libsgfc++ 2.0.1
A C++ library that uses SGFC to read and write SGF (Smart Game Format) data.
|
The SgfcBoardSize struct is a simple type that can hold the value of SgfcPropertyType::SZ. The constant SgfcConstants::BoardSizeNone is used to indicate that SgfcPropertyType::SZ does not exist on a game tree's root node. More...
#include <SgfcBoardSize.h>
Public Member Functions | |
bool | IsSquare () const |
Returns true if the board size represents a square board. Returns false if the board size represents a rectangular board. | |
bool | IsValid (SgfcGameType gameType) const |
Returns true if boardSize is a valid board size for gameType. Returns false if boardSize is not a valid board size for gameType. | |
bool | operator== (const SgfcBoardSize &other) const |
Returns true if the number of columns and rows is the same for the current SgfcBoardSize object and for other. Returns false if either the number of columns or rows or both is different. | |
bool | operator!= (const SgfcBoardSize &other) const |
Returns true if either the number of columns or rows or both is different for the current SgfcBoardSize object and for other. Returns false if the number of columns and rows is the same. | |
Static Public Member Functions | |
static SgfcBoardSize | GetDefaultBoardSize (SgfcGameType gameType) |
Returns the default board size for gameType, as specified by the SGF standard. Returns SgfcConstants::BoardSizeNone if the SGF standard does not specify a default board size for gameType. | |
Public Attributes | |
SgfcNumber | Columns = 1 |
The number of columns of the board. The default is 1, which is the minimum allowed by the SGF standard. | |
SgfcNumber | Rows = 1 |
The number of rows of the board. The default is 1, which is the minimum allowed by the SGF standard. | |
The SgfcBoardSize struct is a simple type that can hold the value of SgfcPropertyType::SZ. The constant SgfcConstants::BoardSizeNone is used to indicate that SgfcPropertyType::SZ does not exist on a game tree's root node.
The SGF standard specifies that for square boards the SGF property must hold only a single SgfcNumber value. SgfcBoardSize is not that flexible, it always stores two values. In case of a square board the two values hold the same numeric value.
bool LibSgfcPlusPlus::SgfcBoardSize::IsValid | ( | SgfcGameType | gameType | ) | const |
Returns true if boardSize is a valid board size for gameType. Returns false if boardSize is not a valid board size for gameType.
A board size is invalid if it violates the constraints defined by the SGF standard. See the documentation of SgfcConstants::BoardSizeInvalid for details.