libsgfc++ 2.0.1
A C++ library that uses SGFC to read and write SGF (Smart Game Format) data.
|
The SgfcGameInfo class provides an implementation of the ISgfcGameInfo interface. See the interface header file for documentation. More...
#include <SgfcGameInfo.h>
Public Member Functions | |
SgfcGameInfo () | |
Initializes a newly constructed SgfcGameInfo object with default values. | |
SgfcGameInfo (std::shared_ptr< ISgfcNode > rootNode) | |
Initializes a newly constructed SgfcGameInfo object with values taken from the properties in root node rootNode. All values that would normally be taken from the properties in the game info node have default values. | |
SgfcGameInfo (std::shared_ptr< ISgfcNode > rootNode, std::shared_ptr< ISgfcNode > gameInfoNode) | |
Initializes a newly constructed SgfcGameInfo object with values taken from the properties in root node rootNode and from game info node gameInfoNode. | |
virtual | ~SgfcGameInfo () |
Destroys and cleans up the SgfcGameInfo object. | |
virtual SgfcGameType | GetGameType () const override |
Returns the game type. The default value is SgfcConstants::DefaultGameType. | |
virtual SgfcNumber | GetGameTypeAsNumber () override |
Returns the game type as an SgfcNumber value. The default value is the SgfcNumber value that corresponds to SgfcConstants::DefaultGameType. | |
virtual SgfcBoardSize | GetBoardSize () const override |
Returns the size of the board on which the game was played. The default value is the default board size for SgfcConstants::DefaultGameType. | |
virtual SgfcSimpleText | GetRecorderName () const override |
Returns the name of the user (or program) who recorded or entered the game data. The default value is SgfcConstants::NoneValueString. | |
virtual void | SetRecorderName (const SgfcSimpleText &recorderName) override |
Sets the name of the user (or program) who recorded or entered the game data. | |
virtual SgfcSimpleText | GetSourceName () const override |
Returns the name of the source of the game data (e.g. book, journal, etc.). The default value is SgfcConstants::NoneValueString. | |
virtual void | SetSourceName (const SgfcSimpleText &sourceName) override |
Sets the name of the source of the game data (e.g. book, journal, etc.). | |
virtual SgfcSimpleText | GetAnnotationAuthor () const override |
Returns the name of the person who made the annotations to the game. The default value is SgfcConstants::NoneValueString. | |
virtual void | SetAnnotationAuthor (const SgfcSimpleText &annotationAuthor) override |
Sets the name of the person who made the annotations to the game. | |
virtual SgfcSimpleText | GetCopyrightInformation () const override |
Returns the copyright information for the game data (including the annotations). The default value is SgfcConstants::NoneValueString. | |
virtual void | SetCopyrightInformation (const SgfcSimpleText ©rightInformation) override |
Sets the copyright information for the game data (including the annotations). | |
virtual SgfcSimpleText | GetGameName () const override |
Returns the name of the game (e.g. for easily finding the game again within a collection). The default value is SgfcConstants::NoneValueString. | |
virtual void | SetGameName (const SgfcSimpleText &gameName) override |
Sets the name of the game (e.g. for easily finding the game again within a collection). | |
virtual SgfcText | GetGameInformation () const override |
Returns information about the game (e.g. background information, a game summary, etc.). The default value is SgfcConstants::NoneValueString. | |
virtual void | SetGameInformation (const SgfcText &gameInformation) override |
Sets information about the game (e.g. background information, a game summary, etc.). | |
virtual std::vector< SgfcDate > | GetGameDates () const override |
Returns the dates when the game was played, decomposed into years, optional months and optional days. Several non-consecutive dates are possible. The default value is an empty collection of dates. | |
virtual void | SetGameDates (const std::vector< SgfcDate > &gameDates) override |
Sets the dates when the game was played, decomposed into years, optional months and optional days. Several non-consecutive dates are possible. | |
virtual SgfcSimpleText | GetRawGameDates () const override |
Returns the dates when the game was played. Several non-consecutive dates are possible. The default value is SgfcConstants::NoneValueString. | |
virtual SgfcSimpleText | GetRulesName () const override |
Returns the name of the rules used for the game. The default value is SgfcConstants::NoneValueString. | |
virtual void | SetRulesName (const SgfcSimpleText &rulesName) override |
Sets the name of the rules used for the game. | |
virtual SgfcGameResult | GetGameResult () const override |
Returns the result of the game, decomposed into an outcome and an optional score. The default value is an SgfcGameResult object which has the IsValid property set to false. | |
virtual void | SetGameResult (SgfcGameResult gameResult) override |
Sets the result of the game, decomposed into an outcome and an optional score. | |
virtual SgfcSimpleText | GetRawGameResult () const override |
Returns the result of the game. The default value is SgfcConstants::NoneValueString. | |
virtual SgfcReal | GetTimeLimitInSeconds () const override |
Returns the time limit of the game in seconds. The default value is 0.0. | |
virtual void | SetTimeLimitInSeconds (SgfcReal timeLimitInSeconds) override |
Sets the time limit of the game in seconds. | |
virtual SgfcSimpleText | GetOvertimeInformation () const override |
Returns the description of the method used for overtime (byo-yomi). The default value is SgfcConstants::NoneValueString. | |
virtual void | SetOvertimeInformation (const SgfcSimpleText &overtimeInformation) override |
Sets the description of the method used for overtime (byo-yomi). | |
virtual SgfcSimpleText | GetOpeningInformation () const override |
Returns information about the opening played. The default value is SgfcConstants::NoneValueString. | |
virtual void | SetOpeningInformation (const SgfcSimpleText &openingInformation) override |
Sets the information about the opening played. | |
virtual SgfcSimpleText | GetBlackPlayerName () const override |
Returns the name of the black player. The default value is an empty string. | |
virtual void | SetBlackPlayerName (const SgfcSimpleText &blackPlayerName) override |
Sets the name of the black player. | |
virtual SgfcSimpleText | GetBlackPlayerRank () const override |
Returns the rank of the black player. The default value is an empty string. | |
virtual void | SetBlackPlayerRank (const SgfcSimpleText &blackPlayerRank) override |
Sets the rank of the black player. | |
virtual SgfcSimpleText | GetBlackPlayerTeamName () const override |
Returns the name of the black player's team. The default value is SgfcConstants::NoneValueString. | |
virtual void | SetBlackPlayerTeamName (const SgfcSimpleText &blackPlayerTeamName) override |
Sets the name of the black player's team. | |
virtual SgfcSimpleText | GetWhitePlayerName () const override |
Returns the name of the white player. The default value is an empty string. | |
virtual void | SetWhitePlayerName (const SgfcSimpleText &whitePlayerName) override |
Sets the name of the white player. | |
virtual SgfcSimpleText | GetWhitePlayerRank () const override |
Returns the rank of the white player. The default value is an empty string. | |
virtual void | SetWhitePlayerRank (const SgfcSimpleText &whitePlayerRank) override |
Sets the rank of the white player. | |
virtual SgfcSimpleText | GetWhitePlayerTeamName () const override |
Returns the name of the white player's team. The default value is SgfcConstants::NoneValueString. | |
virtual void | SetWhitePlayerTeamName (const SgfcSimpleText &whitePlayerTeamName) override |
Sets the name of the white player's team. | |
virtual SgfcSimpleText | GetGameLocation () const override |
Returns the name or description of the location where the game was played. The default value is SgfcConstants::NoneValueString. | |
virtual void | SetGameLocation (const SgfcSimpleText &gameLocation) override |
Sets the name or description of the location where the game was played. | |
virtual SgfcSimpleText | GetEventName () const override |
Returns the name of the event (e.g. tournament) where the game was played. The default value is SgfcConstants::NoneValueString. | |
virtual void | SetEventName (const SgfcSimpleText &eventName) override |
Sets the name of the event (e.g. tournament) where the game was played. | |
virtual SgfcRoundInformation | GetRoundInformation () const override |
Returns the information that describes the round in which the game was played, decomposed into round number and type of round. The default value is an SgfcRoundInformation object which has the IsValid property set to false. | |
virtual void | SetRoundInformation (const SgfcRoundInformation &roundInformation) override |
Sets the information that describes the round in which the game was played, decomposed into round number and type of round. | |
virtual SgfcSimpleText | GetRawRoundInformation () const override |
Returns the information that describes the round in which the game was played. The default value is SgfcConstants::NoneValueString. | |
virtual const ISgfcGoGameInfo * | ToGoGameInfo () const override |
Returns an ISgfcGoGameInfo object if the ISgfcGameInfo object was created specifically for SgfcGameType::Go. Returns nullptr otherwise. The caller is not the owner of the returned object. | |
virtual void | WriteToRootNode (std::shared_ptr< ISgfcNode > rootNode) |
Writes all root property values in the ISgfcGameInfo object to the corresponding properties in rootNode. | |
virtual void | WriteToGameInfoNode (std::shared_ptr< ISgfcNode > gameInfoNode) |
Writes all game info property values in the ISgfcGameInfo object to the corresponding properties in gameInfoNode. | |
Public Member Functions inherited from LibSgfcPlusPlus::ISgfcGameInfo | |
ISgfcGameInfo () | |
Initializes a newly constructed ISgfcGameInfo object. | |
virtual | ~ISgfcGameInfo () |
Destroys and cleans up the ISgfcGameInfo object. | |
Protected Member Functions | |
SgfcNumber | GetNumberPropertyValue (std::shared_ptr< ISgfcProperty > property) const |
SgfcReal | GetRealPropertyValue (std::shared_ptr< ISgfcProperty > property) const |
SgfcSimpleText | GetSimpleTextPropertyValue (std::shared_ptr< ISgfcProperty > property) const |
SgfcText | GetTextPropertyValue (std::shared_ptr< ISgfcProperty > property) const |
void | RemovePropertyFromNodeIfExists (SgfcPropertyType propertyType, std::shared_ptr< ISgfcNode > node) const |
The SgfcGameInfo class provides an implementation of the ISgfcGameInfo interface. See the interface header file for documentation.
LibSgfcPlusPlus::SgfcGameInfo::SgfcGameInfo | ( | std::shared_ptr< ISgfcNode > | rootNode | ) |
Initializes a newly constructed SgfcGameInfo object with values taken from the properties in root node rootNode. All values that would normally be taken from the properties in the game info node have default values.
std::invalid_argument | Is thrown if rootNode is nullptr. |
LibSgfcPlusPlus::SgfcGameInfo::SgfcGameInfo | ( | std::shared_ptr< ISgfcNode > | rootNode, |
std::shared_ptr< ISgfcNode > | gameInfoNode ) |
Initializes a newly constructed SgfcGameInfo object with values taken from the properties in root node rootNode and from game info node gameInfoNode.
std::invalid_argument | Is thrown if rootNode is nullptr or if gameInfoNode is nullptr. |
|
overridevirtual |
Returns the name of the person who made the annotations to the game. The default value is SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the name of the black player. The default value is an empty string.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the rank of the black player. The default value is an empty string.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the name of the black player's team. The default value is SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the size of the board on which the game was played. The default value is the default board size for SgfcConstants::DefaultGameType.
Returns SgfcConstants::BoardSizeNone or SgfcConstants::BoardSizeInvalid if there is a problem with determining a valid board size from the SZ property. See ISgfcGame::GetBoardSize() for details.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the copyright information for the game data (including the annotations). The default value is SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the name of the event (e.g. tournament) where the game was played. The default value is SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the dates when the game was played, decomposed into years, optional months and optional days. Several non-consecutive dates are possible. The default value is an empty collection of dates.
The returned collection is also empty if there is a problem with decomposing the raw property value. See SgfcDate::FromPropertyValue() for details. An indicator that this happened is if GetRawGameDates() returns a value that is not equal to SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns information about the game (e.g. background information, a game summary, etc.). The default value is SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the name or description of the location where the game was played. The default value is SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the name of the game (e.g. for easily finding the game again within a collection). The default value is SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the result of the game, decomposed into an outcome and an optional score. The default value is an SgfcGameResult object which has the IsValid property set to false.
The returned SgfcGameResult also has the IsValid property set to false if there is a problem with decomposing the raw property value. See SgfcGameResult::FromPropertyValue() for details. An indicator that this happened is if GetRawGameResult() returns a value that is not equal to SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the game type. The default value is SgfcConstants::DefaultGameType.
Returns SgfcGameType::Unknown if the Number value of the GM property is not in the list of valid games defined in the SGF standard.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the game type as an SgfcNumber value. The default value is the SgfcNumber value that corresponds to SgfcConstants::DefaultGameType.
This is useful if GetGameType() returns SgfcGameType::Unknown because the Number value of the GM property is not in the list of valid games defined in the SGF standard.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns information about the opening played. The default value is SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the description of the method used for overtime (byo-yomi). The default value is SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the dates when the game was played. Several non-consecutive dates are possible. The default value is SgfcConstants::NoneValueString.
This is useful if the raw game dates cannot be decomposed into years, optional months and optional days, as is required by the SGF standard for SgfcPropertyType::DT.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the result of the game. The default value is SgfcConstants::NoneValueString.
This is useful if the raw game result cannot be decomposed into an outcome and an optional score as is required by the SGF standard for SgfcPropertyType::RE.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the information that describes the round in which the game was played. The default value is SgfcConstants::NoneValueString.
This is useful if the raw round information cannot be decomposed into round number and type of round as recommended by the SGF standard for SgfcPropertyType::RO.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the name of the user (or program) who recorded or entered the game data. The default value is SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the information that describes the round in which the game was played, decomposed into round number and type of round. The default value is an SgfcRoundInformation object which has the IsValid property set to false.
The returned SgfcRoundInformation also has the IsValid property set to false if there is a problem with decomposing the raw property value. See SgfcRoundInformation::FromPropertyValue() for details. An indicator that this happened is if GetRawRoundInformation() returns a value that is not equal to SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the name of the rules used for the game. The default value is SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the name of the source of the game data (e.g. book, journal, etc.). The default value is SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the time limit of the game in seconds. The default value is 0.0.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the name of the white player. The default value is an empty string.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the rank of the white player. The default value is an empty string.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns the name of the white player's team. The default value is SgfcConstants::NoneValueString.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the name of the person who made the annotations to the game.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the name of the black player.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the rank of the black player.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
Reimplemented in LibSgfcPlusPlus::SgfcGoGameInfo.
|
overridevirtual |
Sets the name of the black player's team.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the copyright information for the game data (including the annotations).
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the name of the event (e.g. tournament) where the game was played.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the dates when the game was played, decomposed into years, optional months and optional days. Several non-consecutive dates are possible.
Invoking this setter also changes the information returned by GetRawGameDates().
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets information about the game (e.g. background information, a game summary, etc.).
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the name or description of the location where the game was played.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the name of the game (e.g. for easily finding the game again within a collection).
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the result of the game, decomposed into an outcome and an optional score.
Invoking this setter also changes the information returned by GetRawGameResult().
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the information about the opening played.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the description of the method used for overtime (byo-yomi).
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the name of the user (or program) who recorded or entered the game data.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the information that describes the round in which the game was played, decomposed into round number and type of round.
Invoking this setter also changes the information returned by GetRawRoundInformation().
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the name of the rules used for the game.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
Reimplemented in LibSgfcPlusPlus::SgfcGoGameInfo.
|
overridevirtual |
Sets the name of the source of the game data (e.g. book, journal, etc.).
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the time limit of the game in seconds.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the name of the white player.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Sets the rank of the white player.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
Reimplemented in LibSgfcPlusPlus::SgfcGoGameInfo.
|
overridevirtual |
Sets the name of the white player's team.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
|
overridevirtual |
Returns an ISgfcGoGameInfo object if the ISgfcGameInfo object was created specifically for SgfcGameType::Go. Returns nullptr otherwise. The caller is not the owner of the returned object.
Implements LibSgfcPlusPlus::ISgfcGameInfo.
Reimplemented in LibSgfcPlusPlus::SgfcGoGameInfo.
|
virtual |
Writes all game info property values in the ISgfcGameInfo object to the corresponding properties in gameInfoNode.
If the property value to be written is equal to the property's default value then the property is removed from gameInfoNode if it exists, or not written if it does not exist.
If the property value to be written is not equal to the property's default value then the property value is written to gameInfoNode, either creating the property if it does not exist or overwriting its value if it does exist.
std::invalid_argument | Is thrown if gameInfoNode is nullptr. |
Reimplemented in LibSgfcPlusPlus::SgfcGoGameInfo.
|
virtual |
Writes all root property values in the ISgfcGameInfo object to the corresponding properties in rootNode.
If rootNode already contains a property, the property's value is overwritten. If rootNode does not contain a property, the property is created.
std::invalid_argument | Is thrown if rootNode is nullptr. |