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

The SgfcPlusPlusFactory class is a class that contains only static functions. The functions are used to construct various library objects. More...

#include <SgfcPlusPlusFactory.h>

Static Public Member Functions

static std::shared_ptr< ISgfcArgumentsCreateSgfcArguments ()
 Returns a newly constructed ISgfcArguments object that initially contains no arguments. Use the ISgfcArguments object's add methods to populate it with arguments.
 
static std::shared_ptr< ISgfcCommandLineCreateSgfcCommandLine (std::shared_ptr< ISgfcArguments > arguments)
 Returns a newly constructed ISgfcCommandLine object that passes the specified command line arguments to SGFC.
 
static std::shared_ptr< ISgfcCommandLineCreateSgfcCommandLine ()
 Returns a newly constructed ISgfcCommandLine object that passes no command line arguments to SGFC.
 
static std::shared_ptr< ISgfcDocumentReaderCreateDocumentReader ()
 Returns a newly constructed ISgfcDocumentReader object.
 
static std::shared_ptr< ISgfcDocumentWriterCreateDocumentWriter ()
 Returns a newly constructed ISgfcDocumentWriter object.
 
static std::shared_ptr< ISgfcDocumentCreateDocument ()
 Returns a newly constructed ISgfcDocument object. The ISgfcDocument content consists of a single ISgfcGame object with an empty root node.
 
static std::shared_ptr< ISgfcDocumentCreateDocument (std::shared_ptr< ISgfcGame > game)
 Returns a newly constructed ISgfcDocument object. The ISgfcDocument content consists of the specified game game. The ISgfcDocument object takes ownership of game.
 
static std::shared_ptr< ISgfcGameCreateGame ()
 Returns a newly constructed ISgfcGame object. The game type is SgfcConstants::DefaultGameType. The game is not associated with any document. The game has a game tree that consists of an empty root node.
 
static std::shared_ptr< ISgfcGameCreateGame (std::shared_ptr< ISgfcNode > rootNode)
 Returns a newly constructed ISgfcGame object. The game tree's root node is rootNode. The game type depends on the content of the root node. The game is not associated with any document. The ISgfcGame object takes ownership of rootNode.
 
static std::shared_ptr< ISgfcNodeCreateNode ()
 Returns a newly constructed ISgfcNode object that has no parent, child or sibling and is not associated with any game.
 
static std::shared_ptr< ISgfcGoGameInfoCreateGameInfo ()
 Returns a newly constructed ISgfcGoGameInfo object with default values.
 
static std::shared_ptr< ISgfcGameInfoCreateGameInfo (std::shared_ptr< ISgfcNode > rootNode)
 Initializes a newly constructed ISgfcGameInfo object with values taken from the properties in root node rootNode. All values that would normally be taken from the properties in the game info node have default values.
 
static std::shared_ptr< ISgfcGameInfoCreateGameInfo (std::shared_ptr< ISgfcNode > rootNode, std::shared_ptr< ISgfcNode > gameInfoNode)
 Returns a newly constructed ISgfcGameInfo object with values taken from the content of root node rootNode and from game info node gameInfoNode.
 
static std::shared_ptr< ISgfcPropertyFactoryCreatePropertyFactory ()
 Returns a newly constructed ISgfcPropertyFactory object that can be used to create ISgfcProperty objects, and objects of every known sub-type of ISgfcProperty.
 
static std::shared_ptr< ISgfcPropertyValueFactoryCreatePropertyValueFactory ()
 Returns a newly constructed ISgfcPropertyValueFactory object that can be used to create ISgfcPropertyValue objects, and objects of every known sub-type of ISgfcPropertyValue.
 

Detailed Description

The SgfcPlusPlusFactory class is a class that contains only static functions. The functions are used to construct various library objects.

Member Function Documentation

◆ CreateDocument()

std::shared_ptr< ISgfcDocument > LibSgfcPlusPlus::SgfcPlusPlusFactory::CreateDocument ( std::shared_ptr< ISgfcGame > game)
static

Returns a newly constructed ISgfcDocument object. The ISgfcDocument content consists of the specified game game. The ISgfcDocument object takes ownership of game.

Exceptions
std::invalid_argumentIs thrown if game is nullptr.

◆ CreateGame()

std::shared_ptr< ISgfcGame > LibSgfcPlusPlus::SgfcPlusPlusFactory::CreateGame ( std::shared_ptr< ISgfcNode > rootNode)
static

Returns a newly constructed ISgfcGame object. The game tree's root node is rootNode. The game type depends on the content of the root node. The game is not associated with any document. The ISgfcGame object takes ownership of rootNode.

Exceptions
std::invalid_argumentIs thrown if rootNode is nullptr.

◆ CreateGameInfo() [1/2]

std::shared_ptr< ISgfcGameInfo > LibSgfcPlusPlus::SgfcPlusPlusFactory::CreateGameInfo ( std::shared_ptr< ISgfcNode > rootNode)
static

Initializes a newly constructed ISgfcGameInfo object with values taken from the properties in root node rootNode. All values that would normally be taken from the properties in the game info node have default values.

If the content of rootNode indicates that the game type is SgfcGameType::Go then the returned object is an ISgfcGoGameInfo object. The game type is SgfcGameType::Go in the following cases:

  • If rootNode contains a property of type SgfcPropertyType::GM that either has no value, or that has a single Number value, and that value is 0.
  • Or if rootNode does not contain a property of type SgfcPropertyType::GM.
Exceptions
std::invalid_argumentIs thrown if rootNode is nullptr.

◆ CreateGameInfo() [2/2]

std::shared_ptr< ISgfcGameInfo > LibSgfcPlusPlus::SgfcPlusPlusFactory::CreateGameInfo ( std::shared_ptr< ISgfcNode > rootNode,
std::shared_ptr< ISgfcNode > gameInfoNode )
static

Returns a newly constructed ISgfcGameInfo object with values taken from the content of root node rootNode and from game info node gameInfoNode.

If the content in rootNode indicates that the game type is SgfcGameType::Go then the returned object is an ISgfcGoGameInfo object. The game type is SgfcGameType::Go in the following cases:

  • If rootNode contains a property of type SgfcPropertyType::GM that either has no value, or that has a single Number value, and that value is 0.
  • Or if rootNode does not contain a property of type SgfcPropertyType::GM.
Exceptions
std::invalid_argumentIs thrown if rootNode is nullptr or if gameInfoNode is nullptr.

◆ CreateSgfcCommandLine()

std::shared_ptr< LibSgfcPlusPlus::ISgfcCommandLine > LibSgfcPlusPlus::SgfcPlusPlusFactory::CreateSgfcCommandLine ( std::shared_ptr< ISgfcArguments > arguments)
static

Returns a newly constructed ISgfcCommandLine object that passes the specified command line arguments to SGFC.

Parameters
argumentsThe command line arguments to pass to SGFC. Invoke the ISgfcCommandLine::IsCommandLineValid() method on the resulting object to find out whether the arguments are valid.
Note
The content of arguments is copied, so if you change the content it will not affect the ISgfcCommandLine object returned from this method.

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