The SgfcGameUtility class is a container for static helper functions related to game logic.
More...
#include <SgfcGameUtility.h>
The SgfcGameUtility class is a container for static helper functions related to game logic.
◆ GetBoardSize()
Returns the property values in propertyValues interpreted as an SgfcBoardSize value.
- Return values
-
◆ GetGameType()
Returns the property value(s) in propertyValues interpreted as an SgfcGameType value.
- Return values
-
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. |
◆ GetGameTypeAsNumber()
SgfcNumber LibSgfcPlusPlus::SgfcGameUtility::GetGameTypeAsNumber |
( |
const std::vector< std::shared_ptr< ISgfcPropertyValue > > & | propertyValues | ) |
|
|
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.
- Return values
-
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. |
The documentation for this class was generated from the following files:
- /Users/patrick/dev/libsgfcplusplus/src/game/SgfcGameUtility.h
- /Users/patrick/dev/libsgfcplusplus/src/game/SgfcGameUtility.cpp