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 | Static Public Member Functions | Public Attributes | List of all members
LibSgfcPlusPlus::SgfcRoundInformation Struct Reference

The SgfcRoundInformation struct is a simple type that can hold the decomposed values of an SgfcPropertyType::RO property value. More...

#include <SgfcRoundInformation.h>

Public Member Functions

bool operator== (const SgfcRoundInformation &other) const
 Returns true if the properties RoundNumber, RoundType and IsVAlid are the same for the current SgfcRoundInformation object and for other. Returns false if any of these properties are different.
 
bool operator!= (const SgfcRoundInformation &other) const
 Returns true if any of the properties RoundNumber, RoundType or IsValid are different for the current SgfcRoundInformation object and for other. Returns false if all properties are the same.
 

Static Public Member Functions

static SgfcRoundInformation FromPropertyValue (const SgfcSimpleText &propertyValue)
 Decomposes the content of propertyValue into distinct round number and round type values.
 
static SgfcSimpleText ToPropertyValue (const SgfcRoundInformation &roundInformation)
 Composes a property value for SgfcPropertyType::RO from the round number and round type values in roundInformation.
 

Public Attributes

SgfcSimpleText RoundNumber
 The round number. The default is an empty string.
 
SgfcSimpleText RoundType
 The round type. The default is an empty string.
 
bool IsValid = false
 True if the SgfcRoundInformation object holds valid round number and round type values. False if the round number and round type values are not valid. The default is false.
 

Detailed Description

The SgfcRoundInformation struct is a simple type that can hold the decomposed values of an SgfcPropertyType::RO property value.

The SGF standard specifies that the SgfcPropertyType::RO property value should be written as "xx (tt)", where "xx" is the number of the round and "(tt)" the type of the round. SgfcRoundInformation::FromPropertyValue() can be used to convert from such a composite property value to an SgfcRoundInformation object, which holds the decomposed values, while SgfcRoundInformation::ToPropertyValue() stitches the decomposed values in an SgfcRoundInformation object back together to a composite property value.

Member Function Documentation

◆ FromPropertyValue()

SgfcRoundInformation LibSgfcPlusPlus::SgfcRoundInformation::FromPropertyValue ( const SgfcSimpleText & propertyValue)
static

Decomposes the content of propertyValue into distinct round number and round type values.

The SGF standard specifies that propertyValue for SgfcPropertyType::RO should be written as "xx (tt)", where "xx" is the number of the round and "(tt)" the type of the round. This method attempts to parse propertyValue according to the SGF standard's suggested formatting.

Returns
SgfcRoundInformation An object with the decomposed round number and round type values. The object's SgfcRoundInformation::IsValid member is true if decomposition was successful, otherwise it is false.

◆ ToPropertyValue()

SgfcSimpleText LibSgfcPlusPlus::SgfcRoundInformation::ToPropertyValue ( const SgfcRoundInformation & roundInformation)
static

Composes a property value for SgfcPropertyType::RO from the round number and round type values in roundInformation.

The SGF standard specifies that a property value for SgfcPropertyType::RO should be written as "xx (tt)", where "xx" is the number of the round and "(tt)" the type of the round. This method composes a return value that conforms to the SGF standard's suggested formatting.

Returns
SgfcSimpleText A property value for SgfcPropertyType::RO that conforms to the SGF standard's suggested formatting, or SgfcConstants::NoneValueString if the SgfcRoundInformation::IsValid member of roundInformation is false.

Member Data Documentation

◆ IsValid

bool LibSgfcPlusPlus::SgfcRoundInformation::IsValid = false

True if the SgfcRoundInformation object holds valid round number and round type values. False if the round number and round type values are not valid. The default is false.

This is mainly used to indicate whether SgfcRoundInformation::FromPropertyValue() was successful in decomposing the SgfcPropertyType::RO property value. A library client that manually creates an SgfcRoundInformation object can simply set this to true to assert valid values.

◆ RoundNumber

SgfcSimpleText LibSgfcPlusPlus::SgfcRoundInformation::RoundNumber

The round number. The default is an empty string.

Although the term "round number" implies a numeric value, the SgfcRoundInformation struct defines this to be a string, because the SGF standard also does not define a specific value type.


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