libsgfc++ 2.0.1
A C++ library that uses SGFC to read and write SGF (Smart Game Format) data.
|
The ISgfcProperty interface provides access to the data of a single property of an SGF node. One property has 0-n values. More...
#include <ISgfcProperty.h>
Public Member Functions | |
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 ISgfcProperty interface provides access to the data of a single property of an SGF node. One property has 0-n values.
|
pure virtual |
Adds propertyValue as the last value to the property's collection of values. propertyValue may not be nullptr.
This setter makes no attempt to check the validity of the property's collection of values after adding propertyValue.
std::invalid_argument | Is thrown if propertyValue is nullptr or if propertyValue is already in the property's collection of values. |
Implemented in LibSgfcPlusPlus::SgfcProperty.
|
pure virtual |
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.
Implemented in LibSgfcPlusPlus::SgfcProperty.
|
pure virtual |
Returns the name of the property.
The property name cannot be changed after the ISgfcProperty has been constructed.
All properties defined in the SGF standard have a name that consists of two uppercase letters. Application-specific properties not defined in the standard may not adhere to this restriction (although the standard advises against this).
Implemented in LibSgfcPlusPlus::SgfcProperty.
|
pure virtual |
Returns the type of the property. Returns SgfcPropertyType::Unknown if the property is a custom property that is not defined in the SGF standard.
The property type cannot be changed after the ISgfcProperty has been constructed.
Implemented in LibSgfcPlusPlus::SgfcProperty.
|
pure virtual |
Returns the property's first value if the property has any values. Returns nullptr if the property has no values.
This is a convenience method for properties that can have only a single value.
Implemented in LibSgfcPlusPlus::SgfcProperty.
|
pure virtual |
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.
The EBNF in the SGF standard says that at least one value must be present. This can be a value that has the value type "None", which is defined to be an empty string. The meaning for the file content is clear: Something like XY[] is possible. In the library's object model, however, a "None" value is translated to an empty collection.
Implemented in LibSgfcPlusPlus::SgfcProperty.
|
pure virtual |
Returns the property's traits.
Returns SgfcConstants::PropertyTraitsNone if the property has no traits.
Implemented in LibSgfcPlusPlus::SgfcProperty.
|
pure virtual |
Returns true if the property has one or more values. Returns false if the property has no values.
Implemented in LibSgfcPlusPlus::SgfcProperty.
|
pure virtual |
Returns true if the property has the trait trait. Returns false if the property does not have the trait trait.
Implemented in LibSgfcPlusPlus::SgfcProperty.
|
pure virtual |
Removes all values from the property's collection of values.
This setter makes no attempt to check the validity of the property's collection of values after removing all values.
Implemented in LibSgfcPlusPlus::SgfcProperty.
|
pure virtual |
Removes propertyValue from the property's collection of values.
This setter makes no attempt to check the validity of the property's collection of values after removing propertyValue.
std::invalid_argument | Is thrown if propertyValue is not part of the property's collection of values. |
Implemented in LibSgfcPlusPlus::SgfcProperty.
|
pure virtual |
Sets the values of the property to propertyValues. The previous values are discarded. propertyValues may not contain nullptr. propertyValues may not contain duplicates.
This setter makes no attempt to check the validity of the property values. A last-ditch attempt at validation is made by SGFC later when the game tree is written to an SGF file or to an SGF content string, but this is unlikely to catch all mistakes. It is ultimately the responsibility of the library client to take care that the values are valid. The consequence of faulty values is that the library client might be unable to read in the game tree again after it has been written out.
std::invalid_argument | Is thrown if propertyValues contains a nullptr element, or if propertyValues contains duplicate elements. |
Implemented in LibSgfcPlusPlus::SgfcProperty.
|
pure virtual |
Returns an ISgfcBoardSizeProperty object if GetPropertyType() returns SgfcPropertyType::SZ. Returns nullptr otherwise. The caller is not the owner of the returned object.
Implemented in LibSgfcPlusPlus::SgfcProperty, and LibSgfcPlusPlus::SgfcBoardSizeProperty.
|
pure virtual |
Returns an ISgfcGameTypeProperty object if GetPropertyType() returns SgfcPropertyType::GM. Returns nullptr otherwise. The caller is not the owner of the returned object.
Implemented in LibSgfcPlusPlus::SgfcProperty, and LibSgfcPlusPlus::SgfcGameTypeProperty.