libsgfc++ 2.0.1
A C++ library that uses SGFC to read and write SGF (Smart Game Format) data.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
LibSgfcPlusPlus::SgfcGameTypeProperty Class Reference

The SgfcGameTypeProperty class provides an implementation of the ISgfcGameTypeProperty interface. See the interface header file for documentation. More...

#include <SgfcGameTypeProperty.h>

Inheritance diagram for LibSgfcPlusPlus::SgfcGameTypeProperty:
LibSgfcPlusPlus::SgfcProperty LibSgfcPlusPlus::ISgfcGameTypeProperty LibSgfcPlusPlus::ISgfcProperty LibSgfcPlusPlus::ISgfcProperty

Public Member Functions

 SgfcGameTypeProperty ()
 Initializes a newly constructed SgfcGameTypeProperty object. The property has no value.
 
 SgfcGameTypeProperty (std::shared_ptr< ISgfcNumberPropertyValue > propertyValue)
 Initializes a newly constructed SgfcGameTypeProperty object. The property has the specified property value propertyValue.
 
virtual ~SgfcGameTypeProperty ()
 Destroys and cleans up the SgfcGameTypeProperty object.
 
virtual const ISgfcGameTypePropertyToGameTypeProperty () const override
 Returns an ISgfcGameTypeProperty object if GetPropertyType() returns SgfcPropertyType::GM. Returns nullptr otherwise. The caller is not the owner of the returned object.
 
virtual SgfcGameType GetGameType () const override
 Returns the property value(s) interpreted as an SgfcGameType value.
 
virtual SgfcNumber GetGameTypeAsNumber () const override
 Returns the property value(s) interpreted as an SgfcNumber value.
 
- Public Member Functions inherited from LibSgfcPlusPlus::SgfcProperty
 SgfcProperty (SgfcPropertyType propertyType, const std::string &propertyName)
 Initializes a newly constructed SgfcProperty object. The property has the specified type propertyType and name propertyName. The property has no values.
 
 SgfcProperty (SgfcPropertyType propertyType, const std::string &propertyName, const std::vector< std::shared_ptr< ISgfcPropertyValue > > &propertyValues)
 Initializes a newly constructed SgfcProperty object. The property has the specified type propertyType, name propertyName and property values propertyValues.
 
virtual ~SgfcProperty ()
 Destroys and cleans up the SgfcProperty object.
 
virtual SgfcPropertyType GetPropertyType () const override
 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 override
 Returns the name of the property.
 
virtual SgfcPropertyCategory GetPropertyCategory () const override
 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 override
 Returns the property's traits.
 
virtual bool HasTrait (SgfcPropertyTrait trait) const override
 Returns true if the property has the trait trait. Returns false if the property does not have the trait trait.
 
virtual bool HasPropertyValues () const override
 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 override
 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) override
 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) override
 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) override
 Removes propertyValue from the property's collection of values.
 
virtual void RemoveAllPropertyValues () override
 Removes all values from the property's collection of values.
 
virtual std::shared_ptr< ISgfcPropertyValueGetPropertyValue () const override
 Returns the property's first value if the property has any values. Returns nullptr if the property has no values.
 
virtual const ISgfcBoardSizePropertyToBoardSizeProperty () const override
 Returns an ISgfcBoardSizeProperty object if GetPropertyType() returns SgfcPropertyType::SZ. Returns nullptr otherwise. The caller is not the owner of the returned object.
 
- Public Member Functions inherited from LibSgfcPlusPlus::ISgfcProperty
 ISgfcProperty ()
 Initializes a newly constructed ISgfcProperty object.
 
virtual ~ISgfcProperty ()
 Destroys and cleans up the ISgfcProperty object.
 
- Public Member Functions inherited from LibSgfcPlusPlus::ISgfcGameTypeProperty
 ISgfcGameTypeProperty ()
 Initializes a newly constructed ISgfcGameTypeProperty object.
 
virtual ~ISgfcGameTypeProperty ()
 Destroys and cleans up the ISgfcGameTypeProperty object.
 

Detailed Description

The SgfcGameTypeProperty class provides an implementation of the ISgfcGameTypeProperty interface. See the interface header file for documentation.

Constructor & Destructor Documentation

◆ SgfcGameTypeProperty()

LibSgfcPlusPlus::SgfcGameTypeProperty::SgfcGameTypeProperty ( std::shared_ptr< ISgfcNumberPropertyValue > propertyValue)

Initializes a newly constructed SgfcGameTypeProperty object. The property has the specified property value propertyValue.

Exceptions
std::invalid_argumentIs thrown if propertyValue is nullptr.

Member Function Documentation

◆ GetGameType()

SgfcGameType LibSgfcPlusPlus::SgfcGameTypeProperty::GetGameType ( ) const
overridevirtual

Returns the property value(s) interpreted as an SgfcGameType value.

Return values
SgfcGameTypeIf 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::DefaultGameTypeIf the property has no value. The value is guaranteed not to be SgfcGameType::Unknown.
SgfcGameType::UnknownIf 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.

Implements LibSgfcPlusPlus::ISgfcGameTypeProperty.

◆ GetGameTypeAsNumber()

SgfcNumber LibSgfcPlusPlus::SgfcGameTypeProperty::GetGameTypeAsNumber ( ) const
overridevirtual

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.

Return values
SgfcNumberIf 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::GameTypeNaNIf 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.

Implements LibSgfcPlusPlus::ISgfcGameTypeProperty.

◆ ToGameTypeProperty()

const ISgfcGameTypeProperty * LibSgfcPlusPlus::SgfcGameTypeProperty::ToGameTypeProperty ( ) const
overridevirtual

Returns an ISgfcGameTypeProperty object if GetPropertyType() returns SgfcPropertyType::GM. Returns nullptr otherwise. The caller is not the owner of the returned object.

Reimplemented from LibSgfcPlusPlus::SgfcProperty.


The documentation for this class was generated from the following files: