libsgfc++ 2.0.1
A C++ library that uses SGFC to read and write SGF (Smart Game Format) data.
|
The ISgfcGameTypeProperty interface is a specialization of ISgfcProperty for SgfcPropertyType::GM. It simplifies access to the property value and provides the value in the form of an SgfcGameType value. More...
#include <ISgfcGameTypeProperty.h>
Public Member Functions | |
ISgfcGameTypeProperty () | |
Initializes a newly constructed ISgfcGameTypeProperty object. | |
virtual | ~ISgfcGameTypeProperty () |
Destroys and cleans up the ISgfcGameTypeProperty object. | |
virtual SgfcGameType | GetGameType () const =0 |
Returns the property value(s) interpreted as an SgfcGameType value. | |
virtual SgfcNumber | GetGameTypeAsNumber () const =0 |
Returns the property value(s) interpreted as an SgfcNumber value. | |
Public Member Functions inherited from LibSgfcPlusPlus::ISgfcProperty | |
ISgfcProperty () | |
Initializes a newly constructed ISgfcProperty object. | |
virtual | ~ISgfcProperty () |
Destroys and cleans up the ISgfcProperty object. | |
virtual SgfcPropertyType | GetPropertyType () const =0 |
Returns the type of the property. Returns SgfcPropertyType::Unknown if the property is a custom property that is not defined in the SGF standard. | |
virtual std::string | GetPropertyName () const =0 |
Returns the name of the property. | |
virtual SgfcPropertyCategory | GetPropertyCategory () const =0 |
Returns the category that the property is classified as. Returns SgfcPropertyCategory::Miscellaneous if the property is a custom property that is not defined in the SGF standard. | |
virtual SgfcPropertyTraits | GetTraits () const =0 |
Returns the property's traits. | |
virtual bool | HasTrait (SgfcPropertyTrait trait) const =0 |
Returns true if the property has the trait trait. Returns false if the property does not have the trait trait. | |
virtual bool | HasPropertyValues () const =0 |
Returns true if the property has one or more values. Returns false if the property has no values. | |
virtual std::vector< std::shared_ptr< ISgfcPropertyValue > > | GetPropertyValues () const =0 |
Returns a collection with the values of the property. The collection is empty if the property has no values. The order in which values appear in the collection matches the order in which values were specified when the ISgfcProperty was constructed. | |
virtual void | SetPropertyValues (const std::vector< std::shared_ptr< ISgfcPropertyValue > > &propertyValues)=0 |
Sets the values of the property to propertyValues. The previous values are discarded. propertyValues may not contain nullptr. propertyValues may not contain duplicates. | |
virtual void | AppendPropertyValue (std::shared_ptr< ISgfcPropertyValue > propertyValue)=0 |
Adds propertyValue as the last value to the property's collection of values. propertyValue may not be nullptr. | |
virtual void | RemovePropertyValue (std::shared_ptr< ISgfcPropertyValue > propertyValue)=0 |
Removes propertyValue from the property's collection of values. | |
virtual void | RemoveAllPropertyValues ()=0 |
Removes all values from the property's collection of values. | |
virtual std::shared_ptr< ISgfcPropertyValue > | GetPropertyValue () const =0 |
Returns the property's first value if the property has any values. Returns nullptr if the property has no values. | |
virtual const ISgfcGameTypeProperty * | ToGameTypeProperty () const =0 |
Returns an ISgfcGameTypeProperty object if GetPropertyType() returns SgfcPropertyType::GM. Returns nullptr otherwise. The caller is not the owner of the returned object. | |
virtual const ISgfcBoardSizeProperty * | ToBoardSizeProperty () const =0 |
Returns an ISgfcBoardSizeProperty object if GetPropertyType() returns SgfcPropertyType::SZ. Returns nullptr otherwise. The caller is not the owner of the returned object. | |
The ISgfcGameTypeProperty interface is a specialization of ISgfcProperty for SgfcPropertyType::GM. It simplifies access to the property value and provides the value in the form of an SgfcGameType value.
|
pure virtual |
Returns the property value(s) interpreted as an SgfcGameType value.
SgfcGameType | If the property has a single Number value, and that value is defined in the SGF standard, then the SgfcGameType value that corresponds to the Number value is returned. The value is guaranteed not to be SgfcGameType::Unknown. |
SgfcConstants::DefaultGameType | If the property has no value. The value is guaranteed not to be SgfcGameType::Unknown. |
SgfcGameType::Unknown | If the property's value(s) cannot be converted to a Number value (the property has more than one value, or the single value is not a Number value), or if conversion is possible but the Number value is not defined in the SGF standard. Invoke GetGameTypeAsNumber() to obtain the game type as Number value. |
Implemented in LibSgfcPlusPlus::SgfcGameTypeProperty.
|
pure virtual |
Returns the property value(s) interpreted as an SgfcNumber value.
This is useful if GetGameType() returns SgfcGameType::Unknown because the Number value is not defined in the SGF standard and cannot be mapped to a member of the enumeration SgfcGameType.
SgfcNumber | If the property contains a single Number value, then that Number value is returned. If the property has no value, then this method returns the Number value that corresponds to SgfcConstants::DefaultGameType. |
SgfcConstants::GameTypeNaN | If the property's value(s) cannot be converted to a Number value, either because the property has more than one value, or its single value is not a Number value. |
Implemented in LibSgfcPlusPlus::SgfcGameTypeProperty.