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::SgfcBoardSizeProperty Class Reference

The SgfcBoardSizeProperty class provides an implementation of the ISgfcBoardSizeProperty interface. See the interface header file for documentation. More...

#include <SgfcBoardSizeProperty.h>

Inheritance diagram for LibSgfcPlusPlus::SgfcBoardSizeProperty:
LibSgfcPlusPlus::SgfcProperty LibSgfcPlusPlus::ISgfcBoardSizeProperty LibSgfcPlusPlus::ISgfcProperty LibSgfcPlusPlus::ISgfcProperty

Public Member Functions

 SgfcBoardSizeProperty ()
 Initializes a newly constructed SgfcBoardSizeProperty object. The property has no value.
 
 SgfcBoardSizeProperty (std::shared_ptr< ISgfcNumberPropertyValue > propertyValue)
 Initializes a newly constructed SgfcBoardSizeProperty object. The property has the specified property value propertyValue.
 
 SgfcBoardSizeProperty (std::shared_ptr< ISgfcComposedPropertyValue > propertyValue)
 Initializes a newly constructed SgfcBoardSizeProperty object. The property has the specified property value propertyValue.
 
virtual ~SgfcBoardSizeProperty ()
 Destroys and cleans up the SgfcBoardSizeProperty object.
 
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.
 
virtual SgfcBoardSize GetBoardSize (SgfcGameType gameType) const override
 Returns the property value interpreted as an SgfcBoardSize 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 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.
 
- 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::ISgfcBoardSizeProperty
 ISgfcBoardSizeProperty ()
 Initializes a newly constructed ISgfcBoardSizeProperty object.
 
virtual ~ISgfcBoardSizeProperty ()
 Destroys and cleans up the ISgfcBoardSizeProperty object.
 

Detailed Description

The SgfcBoardSizeProperty class provides an implementation of the ISgfcBoardSizeProperty interface. See the interface header file for documentation.

Constructor & Destructor Documentation

◆ SgfcBoardSizeProperty() [1/2]

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

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

This constructor constructs an ISgfcBoardSizeProperty object that describes a square board.

Exceptions
std::invalid_argumentIs thrown if propertyValue is nullptr.

◆ SgfcBoardSizeProperty() [2/2]

LibSgfcPlusPlus::SgfcBoardSizeProperty::SgfcBoardSizeProperty ( std::shared_ptr< ISgfcComposedPropertyValue > propertyValue)

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

This overload constructs an ISgfcBoardSizeProperty object that describes a rectangular board.

Exceptions
std::invalid_argumentIs thrown if propertyValue is nullptr, or if the propertyValue object is not composed of two ISgfcNumberPropertyValue objects.

Member Function Documentation

◆ GetBoardSize()

SgfcBoardSize LibSgfcPlusPlus::SgfcBoardSizeProperty::GetBoardSize ( SgfcGameType gameType) const
overridevirtual

Returns the property value interpreted as an SgfcBoardSize value.

Return values
SgfcBoardSizeIf the property has a valid value. The value is guaranteed not to be SgfcConstants::BoardSizeNone nor SgfcConstants::BoardSizeInvalid.
SgfcConstants::BoardSizeDefaultGoIf the property has no value, and gameType is SgfcGameType::Go.
SgfcConstants::BoardSizeDefaultChessIf the property has no value, and gameType is SgfcGameType::Chess.
SgfcConstants::BoardSizeNoneIf the property has no value, but gameType is neither SgfcGameType::Go nor SgfcGameType::Chess.
SgfcConstants::BoardSizeInvalidIf the property value(s) cannot be converted to an SgfcBoardSize value (the property has more than one value, or it has a single value that is neither a Number nor a composed value consisting of two Number values), 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.

Implements LibSgfcPlusPlus::ISgfcBoardSizeProperty.

◆ ToBoardSizeProperty()

const ISgfcBoardSizeProperty * LibSgfcPlusPlus::SgfcBoardSizeProperty::ToBoardSizeProperty ( ) const
overridevirtual

Returns an ISgfcBoardSizeProperty object if GetPropertyType() returns SgfcPropertyType::SZ. 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: