libsgfc++ 2.0.1
A C++ library that uses SGFC to read and write SGF (Smart Game Format) data.
|
The SgfcDocumentWriter class provides an implementation of the ISgfcDocumentWriter interface. See the interface header file for documentation. More...
#include <SgfcDocumentWriter.h>
Public Member Functions | |
virtual std::shared_ptr< ISgfcArguments > | GetArguments () const override |
Returns an object with the collection of arguments that ISgfcDocumentWriter passes on to SGFC whenever it performs a write operation. | |
virtual std::shared_ptr< ISgfcDocumentWriteResult > | WriteSgfFile (std::shared_ptr< ISgfcDocument > document, const std::string &sgfFilePath) const override |
Writes the content of document to a single .sgf file located at the specified path, using the arguments that GetArguments() currently returns. | |
virtual std::shared_ptr< ISgfcDocumentWriteResult > | WriteSgfContent (std::shared_ptr< ISgfcDocument > document, std::string &sgfContent) const override |
Writes the content of document into the specified string object sgfContent, using the arguments that GetArguments() currently returns. | |
virtual std::shared_ptr< ISgfcDocumentWriteResult > | ValidateDocument (std::shared_ptr< ISgfcDocument > document) const override |
Validates the content of document by simulating a write operation, using the arguments that GetArguments() currently returns. | |
virtual void | DebugPrintToConsole (std::shared_ptr< ISgfcDocument > document) const override |
Encodes the content of document into an SGF content stream and prints that stream to stdout for debugging purposes. | |
Public Member Functions inherited from LibSgfcPlusPlus::ISgfcDocumentWriter | |
ISgfcDocumentWriter () | |
Initializes a newly constructed ISgfcDocumentWriter object. | |
virtual | ~ISgfcDocumentWriter () |
Destroys and cleans up the ISgfcDocumentWriter object. | |
The SgfcDocumentWriter class provides an implementation of the ISgfcDocumentWriter interface. See the interface header file for documentation.
|
overridevirtual |
Encodes the content of document into an SGF content stream and prints that stream to stdout for debugging purposes.
This is useful to see the SGF content that the writer would pass to SGFC for parsing and writing.
Implements LibSgfcPlusPlus::ISgfcDocumentWriter.
|
overridevirtual |
Returns an object with the collection of arguments that ISgfcDocumentWriter passes on to SGFC whenever it performs a write operation.
The collection of arguments initially contains SgfcArgumentType::DefaultEncoding with the parameter "UTF-8". This allows an ISgfcDocument to be passed to ISgfcDocumentWriter for writing whose game trees don't contain an SgfcPropertyType::CA property value. Read the class documentation for details about encodings.
Add arguments to the collection to change the way how SGFC writes SGF content. The collection retains its state between write operations so that repeated write operations use the same arguments.
Implements LibSgfcPlusPlus::ISgfcDocumentWriter.
|
overridevirtual |
Validates the content of document by simulating a write operation, using the arguments that GetArguments() currently returns.
Before ISgfcDocumentWriter can invoke the SGFC backend's write function, it needs to pass the SGF content through the SGFC backend's load/parse functions. The messages in the result object therefore are a combination of a full cycle of SGFC backend load/parse/write operations.
std::logic_error | is thrown if document cannot be encoded into a string due to some fundamental error in the object tree. Currently the only known case is if the document contains one or more games that have no root node. |
Implements LibSgfcPlusPlus::ISgfcDocumentWriter.
|
overridevirtual |
Writes the content of document into the specified string object sgfContent, using the arguments that GetArguments() currently returns.
Before ISgfcDocumentWriter can invoke the SGFC backend's write function, it needs to pass the SGF content through the SGFC backend's load/parse functions. The messages in the result object therefore are a combination of a full cycle of SGFC backend load/parse/write operations.
std::logic_error | is thrown if document cannot be encoded into a string due to some fundamental error in the object tree. Currently the only known case is if the document contains one or more games that have no root node. |
Implements LibSgfcPlusPlus::ISgfcDocumentWriter.
|
overridevirtual |
Writes the content of document to a single .sgf file located at the specified path, using the arguments that GetArguments() currently returns.
Before ISgfcDocumentWriter can invoke the SGFC backend's write function, it needs to pass the SGF content through the SGFC backend's load/parse functions. The messages in the result object therefore are a combination of a full cycle of SGFC backend load/parse/write operations.
std::logic_error | is thrown if document cannot be encoded into a string due to some fundamental error in the object tree. Currently the only known case is if the document contains one or more games that have no root node. |
Implements LibSgfcPlusPlus::ISgfcDocumentWriter.