List of all members
cwchess::Code Class Reference

A chess piece type including color. More...

#include <Code.h>

Inheritance diagram for cwchess::Code:
Inheritance graph
[legend]

Public Member Functions

Constructors
 Code (void)
 Construct a Code object initialized as 'nothing'.
 
 Code (Code const& code)
 Copy-constructor.
 
 Code (CodeData code)
 Construct a Code object from a constant.
 
 Code (Color const& color, Type const& type)
 Construct a Code object with color color and type type.
 
 Code (CwChessboardCode code)
 Explicit conversion from CwChessboardCode to Code.
 
Assigment operators
Code&  operator= (Code const& code)
 Assign from another Code.
 
Code&  operator= (CodeData code)
 Assign from a constant.
 
Code&  operator= (Type const& type)
 Change the type to type. Type may not be nothing (use clear() instead).
 
Code&  operator= (Color const& color)
 Change the color to color.
 
void clear (void)
 Set the type to nothing.
 
Accessors
bool is_a_slider (void) const
 Returns TRUE if the type is a bishop, rook or queen.
 
bool is_a_rookmover (void) const
 Returns TRUE if the type is a rook or queen.
 
bool is_a_bishopmover (void) const
 Returns TRUE if the type is a bishop or queen.
 
bool is_nothing (void) const
 Returns TRUE if the code represents 'nothing'.
 
bool is_a (Type const& type) const
 Returns TRUE if the type is equal.
 
bool is_a (TypeData type) const
 Returns TRUE if the type is equal.
 
bool is (Color const& color) const
 Return TRUE if the color is equal.
 
bool is (ColorData color) const
 Return TRUE if the color is equal.
 
bool has_opposite_color_of (Code const& code)
 Return TRUE if the colors are different.
 
bool moves_along (Direction const& direction)
 Return TRUE if this piece moves along direction.
 
Type type (void) const
 Return the Type of this Code.
 
Color color (void) const
 Return the Color of this Code.
 
uint8_t operator() (void) const
 Return the unlaying integral value.
 
Special functions
void toggle_color (void)
 Toggle the color. May not be used on type 'nothing'.
 
 operator CwChessboardCode (void) const
 Casting operator.
 

Friends

Comparison operators
bool operator== (Code const& c1, Code const& c2)
 
bool operator== (Code const& c1, CodeData c2)
 
bool operator== (CodeData c1, Code const& c2)
 
bool operator!= (Code const& c1, Code const& c2)
 
bool operator!= (Code const& c1, CodeData c2)
 
bool operator!= (CodeData c1, Code const& c2)
 

Additional Inherited Members

- Protected Attributes inherited from cwchess::CodeData
uint8_t M_bits
 0000CTTT, where C is the color and TTT the type.
 

Detailed Description

A chess piece type including color.

This class represents a code for a chess piece that includes it's Type as well as it's Color.

See CodeData for defined constants.

Definition at line 92 of file Code.h.


The documentation for this class was generated from the following files:

Copyright © 2006 - 2010 Carlo Wood.  All rights reserved.