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

The SgfcPropertyFactory class provides an implementation of the ISgfcPropertyFactory interface. See the interface header file for documentation. More...

#include <SgfcPropertyFactory.h>

Inheritance diagram for LibSgfcPlusPlus::SgfcPropertyFactory:
LibSgfcPlusPlus::ISgfcPropertyFactory

Public Member Functions

ISgfcProperty - Create with property type
virtual std::shared_ptr< ISgfcPropertyCreateProperty (SgfcPropertyType propertyType) const override
 Returns a newly constructed ISgfcProperty object that has the specified property type propertyType. The property has no values. The property is not associated with any node.
 
virtual std::shared_ptr< ISgfcPropertyCreateProperty (SgfcPropertyType propertyType, std::shared_ptr< ISgfcPropertyValue > propertyValue) const override
 Returns a newly constructed ISgfcProperty object that has the specified property type propertyType and the specified property value propertyValue. The property is not associated with any node. The ISgfcProperty object takes ownership of the ISgfcPropertyValue object propertyValue.
 
virtual std::shared_ptr< ISgfcPropertyCreateProperty (SgfcPropertyType propertyType, const std::vector< std::shared_ptr< ISgfcPropertyValue > > &propertyValues) const override
 Returns a newly constructed ISgfcProperty object that has the specified property type propertyType and the specified property values propertyValues. The property is not associated with any node. The ISgfcProperty object takes ownership of the ISgfcPropertyValue objects in propertyValues.
 
ISgfcProperty - Create with property name
virtual std::shared_ptr< ISgfcPropertyCreateProperty (const std::string &propertyName) const override
 Returns a newly constructed ISgfcProperty object that has the specified property name propertyName. The property type is inferred from the property name. The property has no values. The property is not associated with any node.
 
virtual std::shared_ptr< ISgfcPropertyCreateProperty (const std::string &propertyName, std::shared_ptr< ISgfcPropertyValue > propertyValue) const override
 Returns a newly constructed ISgfcProperty object that has the specified property name propertyName and the specified property value propertyValue. The property type is inferred from the property name. The property is not associated with any node. The ISgfcProperty object takes ownership of the ISgfcPropertyValue object propertyValue.
 
virtual std::shared_ptr< ISgfcPropertyCreateProperty (const std::string &propertyName, const std::vector< std::shared_ptr< ISgfcPropertyValue > > &propertyValues) const override
 Returns a newly constructed ISgfcProperty object that has the specified property name propertyName and the specified property values propertyValues. The property type is inferred from the property name. The property is not associated with any node. The ISgfcProperty object takes ownership of the ISgfcPropertyValue objects in propertyValues.
 
Concrete property types - ISgfcBoardSizeProperty
virtual std::shared_ptr< ISgfcBoardSizePropertyCreateBoardSizeProperty () const override
 Returns a newly constructed ISgfcBoardSizeProperty object that has no value. The property is not associated with any node.
 
virtual std::shared_ptr< ISgfcBoardSizePropertyCreateBoardSizeProperty (std::shared_ptr< ISgfcNumberPropertyValue > propertyValue) const override
 Returns a newly constructed ISgfcBoardSizeProperty object that has the specified property value propertyValue. The property is not associated with any node. The ISgfcBoardSizeProperty object takes ownership of the ISgfcNumberPropertyValue object propertyValue.
 
virtual std::shared_ptr< ISgfcBoardSizePropertyCreateBoardSizeProperty (std::shared_ptr< ISgfcComposedPropertyValue > propertyValue) const override
 Returns a newly constructed ISgfcBoardSizeProperty object that has the specified property value propertyValue. The property is not associated with any node. The ISgfcBoardSizeProperty object takes ownership of the ISgfcComposedPropertyValue object propertyValue.
 
- Public Member Functions inherited from LibSgfcPlusPlus::ISgfcPropertyFactory
 ISgfcPropertyFactory ()
 Initializes a newly constructed ISgfcPropertyFactory object.
 
virtual ~ISgfcPropertyFactory ()
 Destroys and cleans up the ISgfcPropertyFactory object.
 

Concrete property types - ISgfcGameTypeProperty

virtual std::shared_ptr< ISgfcGameTypePropertyCreateGameTypeProperty () const override
 Returns a newly constructed ISgfcGameTypeProperty object that has no value. The property is not associated with any node.
 
virtual std::shared_ptr< ISgfcGameTypePropertyCreateGameTypeProperty (std::shared_ptr< ISgfcNumberPropertyValue > propertyValue) const override
 Returns a newly constructed ISgfcGameTypeProperty object that has the specified property value propertyValue. The property is not associated with any node. The ISgfcGameTypeProperty object takes ownership of the ISgfcNumberPropertyValue object propertyValue.
 

Detailed Description

The SgfcPropertyFactory class provides an implementation of the ISgfcPropertyFactory interface. See the interface header file for documentation.

Member Function Documentation

◆ CreateBoardSizeProperty() [1/3]

std::shared_ptr< ISgfcBoardSizeProperty > LibSgfcPlusPlus::SgfcPropertyFactory::CreateBoardSizeProperty ( ) const
overridevirtual

Returns a newly constructed ISgfcBoardSizeProperty object that has no value. The property is not associated with any node.

Implements LibSgfcPlusPlus::ISgfcPropertyFactory.

◆ CreateBoardSizeProperty() [2/3]

std::shared_ptr< ISgfcBoardSizeProperty > LibSgfcPlusPlus::SgfcPropertyFactory::CreateBoardSizeProperty ( std::shared_ptr< ISgfcComposedPropertyValue > propertyValue) const
overridevirtual

Returns a newly constructed ISgfcBoardSizeProperty object that has the specified property value propertyValue. The property is not associated with any node. The ISgfcBoardSizeProperty object takes ownership of the ISgfcComposedPropertyValue object 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.

Implements LibSgfcPlusPlus::ISgfcPropertyFactory.

◆ CreateBoardSizeProperty() [3/3]

std::shared_ptr< ISgfcBoardSizeProperty > LibSgfcPlusPlus::SgfcPropertyFactory::CreateBoardSizeProperty ( std::shared_ptr< ISgfcNumberPropertyValue > propertyValue) const
overridevirtual

Returns a newly constructed ISgfcBoardSizeProperty object that has the specified property value propertyValue. The property is not associated with any node. The ISgfcBoardSizeProperty object takes ownership of the ISgfcNumberPropertyValue object propertyValue.

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

Exceptions
std::invalid_argumentIs thrown if propertyValue is nullptr.

Implements LibSgfcPlusPlus::ISgfcPropertyFactory.

◆ CreateGameTypeProperty() [1/2]

std::shared_ptr< ISgfcGameTypeProperty > LibSgfcPlusPlus::SgfcPropertyFactory::CreateGameTypeProperty ( ) const
overridevirtual

Returns a newly constructed ISgfcGameTypeProperty object that has no value. The property is not associated with any node.

Implements LibSgfcPlusPlus::ISgfcPropertyFactory.

◆ CreateGameTypeProperty() [2/2]

std::shared_ptr< ISgfcGameTypeProperty > LibSgfcPlusPlus::SgfcPropertyFactory::CreateGameTypeProperty ( std::shared_ptr< ISgfcNumberPropertyValue > propertyValue) const
overridevirtual

Returns a newly constructed ISgfcGameTypeProperty object that has the specified property value propertyValue. The property is not associated with any node. The ISgfcGameTypeProperty object takes ownership of the ISgfcNumberPropertyValue object propertyValue.

Exceptions
std::invalid_argumentIs thrown if propertyValue is nullptr.

Implements LibSgfcPlusPlus::ISgfcPropertyFactory.

◆ CreateProperty() [1/6]

std::shared_ptr< ISgfcProperty > LibSgfcPlusPlus::SgfcPropertyFactory::CreateProperty ( const std::string & propertyName) const
overridevirtual

Returns a newly constructed ISgfcProperty object that has the specified property name propertyName. The property type is inferred from the property name. The property has no values. The property is not associated with any node.

Attempts to map propertyName to a value in the enumeration SgfcPropertyType. If the mapping succeeds the result of invoking this method is the same as invoking the overload that takes an SgfcPropertyType value. If the mapping fails then the resulting ISgfcProperty object has SgfcPropertyType::Unknown.

If the mapped SgfcPropertyType value is SgfcPropertyType::SZ or SgfcPropertyType::GM, the returned ISgfcProperty object is an instance of ISgfcBoardSizeProperty or ISgfcGameTypeProperty.

Implements LibSgfcPlusPlus::ISgfcPropertyFactory.

◆ CreateProperty() [2/6]

std::shared_ptr< ISgfcProperty > LibSgfcPlusPlus::SgfcPropertyFactory::CreateProperty ( const std::string & propertyName,
const std::vector< std::shared_ptr< ISgfcPropertyValue > > & propertyValues ) const
overridevirtual

Returns a newly constructed ISgfcProperty object that has the specified property name propertyName and the specified property values propertyValues. The property type is inferred from the property name. The property is not associated with any node. The ISgfcProperty object takes ownership of the ISgfcPropertyValue objects in propertyValues.

Attempts to map propertyName to a value in the enumeration SgfcPropertyType. If the mapping succeeds the result of invoking this method is the same as invoking the overload that takes an SgfcPropertyType value. If the mapping fails then the resulting ISgfcProperty object has SgfcPropertyType::Unknown.

If the mapped SgfcPropertyType value is SgfcPropertyType::SZ or SgfcPropertyType::GM, the returned ISgfcProperty object is an instance of ISgfcBoardSizeProperty or ISgfcGameTypeProperty.

Exceptions
std::invalid_argumentIs thrown if propertyValues contains a nullptr element, or if propertyValues contains duplicate elements. Is also thrown if the mapped SgfcPropertyType value is SgfcPropertyType::SZ or SgfcPropertyType::GM and propertyValues contains more than one value or the value does not meet the requirements of these property types. See the documentation of CreateBoardSizeProperty() or CreateGameTypeProperty() for details.

Implements LibSgfcPlusPlus::ISgfcPropertyFactory.

◆ CreateProperty() [3/6]

std::shared_ptr< ISgfcProperty > LibSgfcPlusPlus::SgfcPropertyFactory::CreateProperty ( const std::string & propertyName,
std::shared_ptr< ISgfcPropertyValue > propertyValue ) const
overridevirtual

Returns a newly constructed ISgfcProperty object that has the specified property name propertyName and the specified property value propertyValue. The property type is inferred from the property name. The property is not associated with any node. The ISgfcProperty object takes ownership of the ISgfcPropertyValue object propertyValue.

Attempts to map propertyName to a value in the enumeration SgfcPropertyType. If the mapping succeeds the result of invoking this method is the same as invoking the overload that takes an SgfcPropertyType value. If the mapping fails then the resulting ISgfcProperty object has SgfcPropertyType::Unknown.

If the mapped SgfcPropertyType value is SgfcPropertyType::SZ or SgfcPropertyType::GM, the returned ISgfcProperty object is an instance of ISgfcBoardSizeProperty or ISgfcGameTypeProperty.

Exceptions
std::invalid_argumentIs thrown if propertyValue is nullptr. Is also thrown if the mapped SgfcPropertyType value is SgfcPropertyType::SZ or SgfcPropertyType::GM and propertyValue does not meet the requirements of these property types. See the documentation of CreateBoardSizeProperty() or CreateGameTypeProperty() for details.

Implements LibSgfcPlusPlus::ISgfcPropertyFactory.

◆ CreateProperty() [4/6]

std::shared_ptr< ISgfcProperty > LibSgfcPlusPlus::SgfcPropertyFactory::CreateProperty ( SgfcPropertyType propertyType) const
overridevirtual

Returns a newly constructed ISgfcProperty object that has the specified property type propertyType. The property has no values. The property is not associated with any node.

If propertyType is SgfcPropertyType::SZ or SgfcPropertyType::GM, the returned ISgfcProperty object is an instance of ISgfcBoardSizeProperty or ISgfcGameTypeProperty.

Exceptions
std::invalid_argumentIs thrown if propertyType is SgfcPropertyType::Unknown.

Implements LibSgfcPlusPlus::ISgfcPropertyFactory.

◆ CreateProperty() [5/6]

std::shared_ptr< ISgfcProperty > LibSgfcPlusPlus::SgfcPropertyFactory::CreateProperty ( SgfcPropertyType propertyType,
const std::vector< std::shared_ptr< ISgfcPropertyValue > > & propertyValues ) const
overridevirtual

Returns a newly constructed ISgfcProperty object that has the specified property type propertyType and the specified property values propertyValues. The property is not associated with any node. The ISgfcProperty object takes ownership of the ISgfcPropertyValue objects in propertyValues.

If propertyType is SgfcPropertyType::SZ or SgfcPropertyType::GM, the returned ISgfcProperty object is an instance of ISgfcBoardSizeProperty or ISgfcGameTypeProperty.

Exceptions
std::invalid_argumentIs thrown if propertyType is SgfcPropertyType::Unknown, or if propertyValues contains a nullptr element, or if propertyValues contains duplicate elements. Is also thrown if propertyType is SgfcPropertyType::SZ or SgfcPropertyType::GM and propertyValues contains more than one value or the value does not meet the requirements of these property types. See the documentation of CreateBoardSizeProperty() or CreateGameTypeProperty() for details.

Implements LibSgfcPlusPlus::ISgfcPropertyFactory.

◆ CreateProperty() [6/6]

std::shared_ptr< ISgfcProperty > LibSgfcPlusPlus::SgfcPropertyFactory::CreateProperty ( SgfcPropertyType propertyType,
std::shared_ptr< ISgfcPropertyValue > propertyValue ) const
overridevirtual

Returns a newly constructed ISgfcProperty object that has the specified property type propertyType and the specified property value propertyValue. The property is not associated with any node. The ISgfcProperty object takes ownership of the ISgfcPropertyValue object propertyValue.

If propertyType is SgfcPropertyType::SZ or SgfcPropertyType::GM, the returned ISgfcProperty object is an instance of ISgfcBoardSizeProperty or ISgfcGameTypeProperty.

Exceptions
std::invalid_argumentIs thrown if propertyType is SgfcPropertyType::Unknown, or if propertyValue is nullptr. Is also thrown if propertyType is SgfcPropertyType::SZ or SgfcPropertyType::GM and propertyValue does not meet the requirements of these property types. See the documentation of CreateBoardSizeProperty() or CreateGameTypeProperty() for details.

Implements LibSgfcPlusPlus::ISgfcPropertyFactory.


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