libsgfc++ 2.0.1
A C++ library that uses SGFC to read and write SGF (Smart Game Format) data.
|
The ISgfcMessage interface represents a message that is generated when SGF data is loaded and parsed, or when SGF data is saved. Most messages are generated by SGFC, but there are a few error cases where libsgfc++ also generates messages. ISgfcMessage objects are immutable. More...
#include <ISgfcMessage.h>
Public Member Functions | |
ISgfcMessage () | |
Initializes a newly constructed ISgfcMessage object. | |
virtual | ~ISgfcMessage () |
Destroys and cleans up the ISgfcMessage object. | |
virtual SgfcMessageID | GetMessageID () const =0 |
Returns the message's unique identification number. | |
virtual SgfcMessageType | GetMessageType () const =0 |
Returns the type of message. | |
virtual unsigned long | GetLineNumber () const =0 |
Returns the number of the line (1-based) in the parsed SGF data that caused the message. Returns SgfcConstants::InvalidLineNumber if the message does not refer to a specific line in the SGF data (most fatal errors, but also some errors and warnings). | |
virtual unsigned long | GetColumnNumber () const =0 |
Returns the number of the column (1-based) in the parsed SGF data that caused the message. Returns SgfcConstants::InvalidColumnNumber if the message does not refer to a specific column in the SGF data (most fatal errors, but also some errors and warnings). | |
virtual bool | IsCriticalMessage () const =0 |
Returns true if the message describes a critical problem. Only warning and error messages can be critical. Always returns false for fatal errors. | |
virtual int | GetLibraryErrorNumber () const =0 |
Returns an error number that indicates what went wrong when a standard C library function was invoked by SGFC. The value 0 (zero) indicates "no error", a non-zero value indicates an error. | |
virtual std::string | GetMessageText () const =0 |
Returns the message text. | |
virtual std::string | GetFormattedMessageText () const =0 |
Returns the formatted message text as if it had been printed by SGFC on the command-line. If the message was generated by libsgfc++ this returns the same value as GetMessageText(). | |
The ISgfcMessage interface represents a message that is generated when SGF data is loaded and parsed, or when SGF data is saved. Most messages are generated by SGFC, but there are a few error cases where libsgfc++ also generates messages. ISgfcMessage objects are immutable.
|
pure virtual |
Returns the number of the column (1-based) in the parsed SGF data that caused the message. Returns SgfcConstants::InvalidColumnNumber if the message does not refer to a specific column in the SGF data (most fatal errors, but also some errors and warnings).
Implemented in LibSgfcPlusPlus::SgfcMessage.
|
pure virtual |
Returns the formatted message text as if it had been printed by SGFC on the command-line. If the message was generated by libsgfc++ this returns the same value as GetMessageText().
When the command-line version of SGFC prints messages it assembles the individual message parts into a formatted text. libsgfc++ emulates this formatting as closely as possible to generate the value returned by this method. There is no guarantee for an exact match, though.
Implemented in LibSgfcPlusPlus::SgfcMessage.
|
pure virtual |
Returns an error number that indicates what went wrong when a standard C library function was invoked by SGFC. The value 0 (zero) indicates "no error", a non-zero value indicates an error.
As a convenience the library provides the constant SgfcConstants::LibraryErrorNumberNoError in case you prefer to use a constant to implement your program logic.
A non-zero value is a copy of the global errno value, made shortly after the failing function call. In the unlikely case that you need to evaluate this, consult the standard C library documentation of errno.
In case this method returns a non-zero error number, the text returned by GetFormattedMessageText() already includes an error message that results from invoking strerror() with the error number.
Implemented in LibSgfcPlusPlus::SgfcMessage.
|
pure virtual |
Returns the number of the line (1-based) in the parsed SGF data that caused the message. Returns SgfcConstants::InvalidLineNumber if the message does not refer to a specific line in the SGF data (most fatal errors, but also some errors and warnings).
Implemented in LibSgfcPlusPlus::SgfcMessage.
|
pure virtual |
Returns the message's unique identification number.
Every message generated by SGFC has its own unique message ID. Consult the SGFC documentation for a list of message IDs. SGFC calls them "error codes". The exception is when libsgfc++ is unable to determine the message ID when it receives the message data from SGFC - in the very unlikely case that this happens libsgfc++ sets the message ID to SgfcMessageID::UnknownSgfcMessageID.
Every message generated by libsgfc++ also has its own unique message ID that is distinct from all SGFC-generated message IDs.
Implemented in LibSgfcPlusPlus::SgfcMessage.
|
pure virtual |
Returns the message text.
Implemented in LibSgfcPlusPlus::SgfcMessage.
|
pure virtual |
Returns the type of message.
Messages generated by SGFC can be of all types. Messages generated by libsgfc++ are always fatal errors (although this may change in the future).
Implemented in LibSgfcPlusPlus::SgfcMessage.
|
pure virtual |
Returns true if the message describes a critical problem. Only warning and error messages can be critical. Always returns false for fatal errors.
A critical problem indicates that the SGF content parsed by SGFC may be severely damaged and that information may be lost if the parsed SGF data is written.
Implemented in LibSgfcPlusPlus::SgfcMessage.