libsgfc++ 2.0.1
A C++ library that uses SGFC to read and write SGF (Smart Game Format) data.
|
The SgfcDocument class provides an implementation of the ISgfcDocument interface. See the interface header file for documentation. More...
#include <SgfcDocument.h>
Public Member Functions | |
SgfcDocument () | |
Initializes a newly constructed SgfcDocument object. The document has no content. | |
SgfcDocument (SGFInfo *sgfInfo) | |
Initializes a newly constructed SgfcDocument object with the SGF content in sgfInfo. The initialized document contains 0-n ISgfcGame objects that represent the game trees found during parsing of sgfInfo. | |
virtual | ~SgfcDocument () |
Destroys and cleans up the SgfcDocument object. | |
virtual bool | IsEmpty () const override |
Returns true if the document has no content. Returns false if the document has some content. | |
virtual std::vector< std::shared_ptr< ISgfcGame > > | GetGames () const override |
Returns a collection of games that together make up the document. | |
virtual std::shared_ptr< ISgfcGame > | GetGame () const override |
Returns the first game from the collection of games that GetGames() returns. Returns nullptr if GetGames() returns an empty collection. | |
virtual void | SetGames (const std::vector< std::shared_ptr< ISgfcGame > > &games) override |
Sets the collection of games that together make up the document to games, replacing the previous collection. games may not contain nullptr. games may not contain duplicates. | |
virtual void | AppendGame (std::shared_ptr< ISgfcGame > game) override |
Adds game as the last game to the collection of games that together make up the document. game may not be nullptr. | |
virtual void | RemoveGame (std::shared_ptr< ISgfcGame > game) override |
Removes game from the collection of games that together make up the document. | |
virtual void | RemoveAllGames () override |
Removes all games from the collection of games that together make up the document. | |
virtual void | DebugPrintToConsole () const override |
Prints the content of the ISgfcDocument to stdout for debugging purposes. | |
![]() | |
ISgfcDocument () | |
Initializes a newly constructed ISgfcDocument object. | |
virtual | ~ISgfcDocument () |
Destroys and cleans up the ISgfcDocument object. | |
The SgfcDocument class provides an implementation of the ISgfcDocument interface. See the interface header file for documentation.
LibSgfcPlusPlus::SgfcDocument::SgfcDocument | ( | SGFInfo * | sgfInfo | ) |
Initializes a newly constructed SgfcDocument object with the SGF content in sgfInfo. The initialized document contains 0-n ISgfcGame objects that represent the game trees found during parsing of sgfInfo.
std::invalid_argument | Is thrown if sgfInfo is nullptr. Is also thrown if an ISgfcGameTypeProperty or ISgfcBoardSizeProperty object is constructed with invalid property values. |
std::domain_error | Is thrown if parsing of sgfInfo failed due to an interfacing problem with SGFC. Problems can range from simple (but fundamental) things such as an unexpected nullptr in one of the SGFC data structures, to more complex data-related issues such as when SGFC and libsgfc++ disagree about the data type(s) of a property value. |
|
overridevirtual |
Adds game as the last game to the collection of games that together make up the document. game may not be nullptr.
std::invalid_argument | Is thrown if game is nullptr or if game is already in the collection. |
Implements LibSgfcPlusPlus::ISgfcDocument.
|
overridevirtual |
Prints the content of the ISgfcDocument to stdout for debugging purposes.
Implements LibSgfcPlusPlus::ISgfcDocument.
|
overridevirtual |
Returns the first game from the collection of games that GetGames() returns. Returns nullptr if GetGames() returns an empty collection.
This is a convenience method which simplifies the majority of cases where a document only contains a single game.
Implements LibSgfcPlusPlus::ISgfcDocument.
|
overridevirtual |
Returns a collection of games that together make up the document.
Implements LibSgfcPlusPlus::ISgfcDocument.
|
overridevirtual |
Returns true if the document has no content. Returns false if the document has some content.
The document is empty if it contains no games.
Implements LibSgfcPlusPlus::ISgfcDocument.
|
overridevirtual |
Removes all games from the collection of games that together make up the document.
Implements LibSgfcPlusPlus::ISgfcDocument.
|
overridevirtual |
Removes game from the collection of games that together make up the document.
std::invalid_argument | Is thrown if game is not part of the collection of games that together make up the document. |
Implements LibSgfcPlusPlus::ISgfcDocument.
|
overridevirtual |
Sets the collection of games that together make up the document to games, replacing the previous collection. games may not contain nullptr. games may not contain duplicates.
std::invalid_argument | Is thrown if games contains a nullptr element, or if games contains duplicate elements. |
Implements LibSgfcPlusPlus::ISgfcDocument.