|
libsgfc++ 3.0.0
A C++ library that uses SGFC to read and write SGF (Smart Game Format) data.
|
The SgfcGameUtility class is a container for static helper functions related to game logic. More...
#include <SgfcGameUtility.h>
Static Public Member Functions | |
| static SgfcGameType | GetGameType (const std::vector< std::shared_ptr< ISgfcPropertyValue > > &propertyValues) |
| Returns the property value(s) in propertyValues interpreted as an SgfcGameType value. | |
| static SgfcNumber | GetGameTypeAsNumber (const std::vector< std::shared_ptr< ISgfcPropertyValue > > &propertyValues) |
| Returns the property value(s) in propertyValues interpreted as an SgfcNumber value. | |
| static SgfcBoardSize | GetBoardSize (const std::vector< std::shared_ptr< ISgfcPropertyValue > > &propertyValues, SgfcGameType gameType) |
| Returns the property values in propertyValues interpreted as an SgfcBoardSize value. | |
The SgfcGameUtility class is a container for static helper functions related to game logic.
|
static |
Returns the property values in propertyValues interpreted as an SgfcBoardSize value.
| SgfcBoardSize | If propertyValues contains one element that can be converted to a valid SgfcBoardSize value. The value is guaranteed not to be SgfcConstants::BoardSizeNone nor SgfcConstants::BoardSizeInvalid. |
| SgfcConstants::BoardSizeDefaultGo | If propertyValues has no elements, and gameType is SgfcGameType::Go. |
| SgfcConstants::BoardSizeDefaultChess | If propertyValues has no elements, and gameType is SgfcGameType::Chess. |
| SgfcConstants::BoardSizeNone | If propertyValues has no elements, but gameType is neither SgfcGameType::Go nor SgfcGameType::Chess. |
| SgfcConstants::BoardSizeInvalid | If the property value(s) in propertyValues cannot be converted to an SgfcBoardSize value (propertyValues has more than one element, or the element is neither an ISgfcNumberPropertyValue object nor an ISgfcComosedPropertyValue object consisting of two ISgfcNumberPropertyValue objects), or if conversion is possible but the SgfcBoardSize value violates the constraints defined by the SGF standard. See the documentation of SgfcConstants::BoardSizeInvalid for details. |
|
static |
Returns the property value(s) in propertyValues interpreted as an SgfcGameType value.
| SgfcGameType | If propertyValues contains a single element, and that element can be converted to an SgfcNumber value, and that value is defined in the SGF standard, then the SgfcGameType value that corresponds to the SgfcNumber value is returned. The value is guaranteed not to be SgfcGameType::Unknown. |
| SgfcConstants::DefaultGameType | If propertyValues has no elements. The value is guaranteed not to be SgfcGameType::Unknown. |
| SgfcGameType::Unknown | If the property value(s) in propertyValues cannot be converted to an SgfcNumber value (propertyValues has more than one element, or it has a single element that is not an ISgfcNumberPropertyValue object), or if conversion is possible but the SgfcNumber value is not defined in the SGF standard. Invoke GetGameTypeAsNumber() to obtain the game type as SgfcNumber value. |
|
static |
Returns the property value(s) in propertyValues interpreted as an SgfcNumber value.
This is useful if GetGameType() returns SgfcGameType::Unknown because the SgfcNumber value is not defined in the SGF standard and cannot be mapped to a member of the enumeration SgfcGameType.
| SgfcNumber | If propertyValues contains a single element, and that element can be converted to an SgfcNumber value, then that SgfcNumber value is returned. If propertyValues has no elements, then this method returns the SgfcNumber value that corresponds to SgfcConstants::DefaultGameType. |
| SgfcConstants::GameTypeNaN | If the property value(s) in propertyValues cannot be converted to an SgfcNumber value, either because propertyValues has more than one element, or its single element is not an ISgfcNumberPropertyValue object. |