Cute Chess  0.1
Public Types | Public Member Functions | List of all members
Chess::Side Class Reference

The side or color of a chess player. More...

#include <side.h>

Public Types

enum  Type { White, Black, NoSide }
 

Public Member Functions

bool isNull () const
 
 operator Type () const
 
Side opposite () const
 
 Side ()
 
 Side (Type type)
 
 Side (const QString &symbol)
 
QString symbol () const
 
QString toString () const
 

Detailed Description

The side or color of a chess player.

This class is a simple wrapper for the enumerated type Side::Type. Side objects can be used just like one would use an enum type (eg. as an array index).

Member Enumeration Documentation

◆ Type

The enumerated type for the side.

Enumerator
White 

The side with the white pieces.

Black 

The side with the black pieces.

NoSide 

No side.

Constructor & Destructor Documentation

◆ Side() [1/3]

Chess::Side::Side ( )
inline

Constructs a new, null Side object.

◆ Side() [2/3]

Chess::Side::Side ( Type  type)
inline

Constructs a new Side object of type type.

◆ Side() [3/3]

Chess::Side::Side ( const QString symbol)
explicit

Constructs a new Side object from a symbol.

The symbol can be "w" for White, "b" for Black, or anything else for NoSide.

Member Function Documentation

◆ isNull()

bool Chess::Side::isNull ( ) const
inline

Returns true if the side is NoSide.

◆ operator Type()

Chess::Side::operator Type ( ) const
inline

Operator for the Type value of the side.

◆ opposite()

Side Chess::Side::opposite ( ) const
inline

Returns the opposite side.

Note
The side must not be null.

◆ symbol()

QString Chess::Side::symbol ( ) const

Returns the text symbol for the side.

◆ toString()

QString Chess::Side::toString ( ) const

Returns a localized name of the side.


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