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::ISgfcDocumentReader Class Referenceabstract

The ISgfcDocumentReader interface provides functions to generate ISgfcDocument objects by reading SGF data from the filesystem or from in-memory data. ISgfcDocumentReader operates the SGFC backend to achieve its task. Use SgfcPlusPlusFactory to construct new ISgfcDocumentReader objects. More...

#include <ISgfcDocumentReader.h>

Inheritance diagram for LibSgfcPlusPlus::ISgfcDocumentReader:
LibSgfcPlusPlus::SgfcDocumentReader

Public Member Functions

 ISgfcDocumentReader ()
 Initializes a newly constructed ISgfcDocumentReader object.
 
virtual ~ISgfcDocumentReader ()
 Destroys and cleans up the ISgfcDocumentReader object.
 
virtual std::shared_ptr< ISgfcArgumentsGetArguments () const =0
 Returns an object with the collection of arguments that ISgfcDocumentReader passes on to SGFC whenever it performs a read operation.
 
virtual std::shared_ptr< ISgfcDocumentReadResultReadSgfFile (const std::string &sgfFilePath) const =0
 Reads SGF data from a single .sgf file located at the specified path and puts the data through the SGFC parser, using the arguments that GetArguments() currently returns.
 
virtual std::shared_ptr< ISgfcDocumentReadResultReadSgfContent (const std::string &sgfContent) const =0
 Reads SGF data from the specified string and puts the data through the SGFC parser, using the arguments that GetArguments() currently returns.
 

Detailed Description

The ISgfcDocumentReader interface provides functions to generate ISgfcDocument objects by reading SGF data from the filesystem or from in-memory data. ISgfcDocumentReader operates the SGFC backend to achieve its task. Use SgfcPlusPlusFactory to construct new ISgfcDocumentReader objects.

ISgfcDocumentReader invokes the SGFC backend's load/parse functions using the arguments that GetArguments() returns. If the library client does not do anything special, this is the default behaviour:

When SgfcArgumentType::EncodingMode 1 or 2 are used the SGFC backend converts the SGF data it reads into memory to UTF-8. However, without further measures the document object tree would still contain whatever CA property values were found in the SGF data. If these values are not UTF-8 then the document object tree would now contain wrong information about the encoding used in-memory. This would be a problem if, for instance, the document object tree were passed to ISgfcDocumentWriter, because the writer would then use the wrong CA property values. To avoid this situation ISgfcDocumentReader performs the following manipulations of the document object tree after the read operation is complete:

Member Function Documentation

◆ GetArguments()

virtual std::shared_ptr< ISgfcArguments > LibSgfcPlusPlus::ISgfcDocumentReader::GetArguments ( ) const
pure virtual

Returns an object with the collection of arguments that ISgfcDocumentReader passes on to SGFC whenever it performs a read operation.

The collection of arguments is initially empty. Add arguments to the collection to change the way how SGFC reads SGF content. The collection retains its state between read operations so that repeated read operations use the same arguments.

Implemented in LibSgfcPlusPlus::SgfcDocumentReader.

◆ ReadSgfContent()

virtual std::shared_ptr< ISgfcDocumentReadResult > LibSgfcPlusPlus::ISgfcDocumentReader::ReadSgfContent ( const std::string & sgfContent) const
pure virtual

Reads SGF data from the specified string and puts the data through the SGFC parser, using the arguments that GetArguments() currently returns.

Read the class documentation for details about encodings.

Returns
An ISgfcDocumentReadResult object that provides the result of the read operation.

Implemented in LibSgfcPlusPlus::SgfcDocumentReader.

◆ ReadSgfFile()

virtual std::shared_ptr< ISgfcDocumentReadResult > LibSgfcPlusPlus::ISgfcDocumentReader::ReadSgfFile ( const std::string & sgfFilePath) const
pure virtual

Reads SGF data from a single .sgf file located at the specified path and puts the data through the SGFC parser, using the arguments that GetArguments() currently returns.

Read the class documentation for details about encodings.

Returns
An ISgfcDocumentReadResult object that provides the result of the read operation.

Implemented in LibSgfcPlusPlus::SgfcDocumentReader.


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