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::SgfcDocumentReadResult Class Reference

The SgfcDocumentReadResult class provides an implementation of the ISgfcDocumentReadResult interface. See the interface header file for documentation. More...

#include <SgfcDocumentReadResult.h>

Inheritance diagram for LibSgfcPlusPlus::SgfcDocumentReadResult:
LibSgfcPlusPlus::ISgfcDocumentReadResult

Public Member Functions

 SgfcDocumentReadResult (std::shared_ptr< ISgfcMessage > invalidCommandLineReason)
 Initializes a newly constructed SgfcDocumentReadResult object that encapsulates a read operation result consisting of a single message invalidCommandLineReason and an empty document.
 
 SgfcDocumentReadResult (std::vector< std::shared_ptr< ISgfcMessage > > parseResult, std::shared_ptr< ISgfcDocument > document)
 Initializes a newly constructed SgfcDocumentReadResult object that encapsulates a read operation result consisting of the collection of messages parseResult and the document document.
 
virtual ~SgfcDocumentReadResult ()
 Destroys and cleans up the SgfcDocumentReadResult object.
 
virtual SgfcExitCode GetExitCode () const override
 Returns an SgfcExitCode value that best fits the result of the read operation. The numeric value of the SgfcExitCode corresponds to one of the exit codes of SGFC.
 
virtual bool IsSgfDataValid () const override
 Returns true if the SGF data that was loaded and parsed by the read operation is valid. Returns false if the SGF data is not valid.
 
virtual std::vector< std::shared_ptr< ISgfcMessage > > GetParseResult () const override
 Returns a collection of ISgfcMessage objects which together form the parse result of the read operation. The messages appear in the order in which they were generated by SGFC. The collection is empty if the read operation did not generate any messages.
 
virtual std::shared_ptr< ISgfcDocumentGetDocument () const override
 Returns the document object that provides access to the SGF data in structured form. If IsSgfDataValid() returns false the document object that is returned contains no data.
 
virtual void DebugPrintToConsole () const override
 Prints the content of the ISgfcDocumentReadResult to stdout for debugging purposes.
 
- Public Member Functions inherited from LibSgfcPlusPlus::ISgfcDocumentReadResult
 ISgfcDocumentReadResult ()
 Initializes a newly constructed ISgfcDocumentReadResult object.
 
virtual ~ISgfcDocumentReadResult ()
 Destroys and cleans up the ISgfcDocumentReadResult object.
 

Detailed Description

The SgfcDocumentReadResult class provides an implementation of the ISgfcDocumentReadResult interface. See the interface header file for documentation.

Constructor & Destructor Documentation

◆ SgfcDocumentReadResult() [1/2]

LibSgfcPlusPlus::SgfcDocumentReadResult::SgfcDocumentReadResult ( std::shared_ptr< ISgfcMessage > invalidCommandLineReason)

Initializes a newly constructed SgfcDocumentReadResult object that encapsulates a read operation result consisting of a single message invalidCommandLineReason and an empty document.

This constructor is intended to be used when the read operation failed due to invalid arguments passed to SGFC.

◆ SgfcDocumentReadResult() [2/2]

LibSgfcPlusPlus::SgfcDocumentReadResult::SgfcDocumentReadResult ( std::vector< std::shared_ptr< ISgfcMessage > > parseResult,
std::shared_ptr< ISgfcDocument > document )

Initializes a newly constructed SgfcDocumentReadResult object that encapsulates a read operation result consisting of the collection of messages parseResult and the document document.

This constructor is intended to be used when the arguments passed to SGFC were valid. The read operation may still have failed due to other reasons.

Member Function Documentation

◆ DebugPrintToConsole()

void LibSgfcPlusPlus::SgfcDocumentReadResult::DebugPrintToConsole ( ) const
overridevirtual

Prints the content of the ISgfcDocumentReadResult to stdout for debugging purposes.

Implements LibSgfcPlusPlus::ISgfcDocumentReadResult.

◆ GetDocument()

std::shared_ptr< ISgfcDocument > LibSgfcPlusPlus::SgfcDocumentReadResult::GetDocument ( ) const
overridevirtual

Returns the document object that provides access to the SGF data in structured form. If IsSgfDataValid() returns false the document object that is returned contains no data.

Implements LibSgfcPlusPlus::ISgfcDocumentReadResult.

◆ GetExitCode()

SgfcExitCode LibSgfcPlusPlus::SgfcDocumentReadResult::GetExitCode ( ) const
overridevirtual

Returns an SgfcExitCode value that best fits the result of the read operation. The numeric value of the SgfcExitCode corresponds to one of the exit codes of SGFC.

Implements LibSgfcPlusPlus::ISgfcDocumentReadResult.

◆ GetParseResult()

std::vector< std::shared_ptr< ISgfcMessage > > LibSgfcPlusPlus::SgfcDocumentReadResult::GetParseResult ( ) const
overridevirtual

Returns a collection of ISgfcMessage objects which together form the parse result of the read operation. The messages appear in the order in which they were generated by SGFC. The collection is empty if the read operation did not generate any messages.

Implements LibSgfcPlusPlus::ISgfcDocumentReadResult.

◆ IsSgfDataValid()

bool LibSgfcPlusPlus::SgfcDocumentReadResult::IsSgfDataValid ( ) const
overridevirtual

Returns true if the SGF data that was loaded and parsed by the read operation is valid. Returns false if the SGF data is not valid.

The SGF data is considered valid if the read operation did not generate a fatal error. A fatal error shows up in the collection of ISgfcMessage objects that GetParseResult() returns, as an ISgfcMessage object with message type SgfcMessageType::FatalError.

Typical fatal errors are invalid arguments, or the SGF data could not be read e.g. because the specified SGF file does not exist.

Implements LibSgfcPlusPlus::ISgfcDocumentReadResult.


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