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::SgfcGameResult Struct Reference

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

#include <SgfcGameResult.h>

Public Member Functions

bool operator== (const SgfcGameResult &other) const
 Returns true if the properties GameResultType, WinType, Score and IsValid are the same for the current SgfcGameResult object and for other. Returns false if any of these properties are different.
 
bool operator!= (const SgfcGameResult &other) const
 Returns true if any of the properties GameResultType, WinType, Score or IsValid are different for the current SgfcGameResult object and for other. Returns false if all properties are the same.
 

Static Public Member Functions

static SgfcGameResult FromPropertyValue (const SgfcSimpleText &propertyValue)
 Decomposes the content of propertyValue into distinct game result type, win type and score values.
 
static SgfcSimpleText ToPropertyValue (SgfcGameResult gameResult)
 Composes a property value for SgfcPropertyType::RE from the game result type, win type and score values in gameResult.
 

Public Attributes

SgfcGameResultType GameResultType = SgfcGameResultType::UnknownResult
 The result type. The default is SgfcGameResultType::UnknownResult.
 
SgfcWinType WinType = SgfcWinType::WinWithScore
 The win type. The default is SgfcWinType::WinWithScore.
 
SgfcReal Score = 0.0
 The score. The default is 0.0.
 
bool IsValid = false
 True if the SgfcGameResult object holds a valid game result. False if the SgfcGameResult object holds an invalid game result. The default is false.
 

Detailed Description

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

Member Function Documentation

◆ FromPropertyValue()

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

Decomposes the content of propertyValue into distinct game result type, win type and score values.

See the SGF standard specification for the mandatory structure of an SgfcPropertyType::RE property value.

Returns
SgfcGameResult An object with the decomposed game result type, win type and score values. The object's SgfcGameResult::IsValid member is true if decomposition was successful, otherwise it is false.

◆ ToPropertyValue()

SgfcSimpleText LibSgfcPlusPlus::SgfcGameResult::ToPropertyValue ( SgfcGameResult gameResult)
static

Composes a property value for SgfcPropertyType::RE from the game result type, win type and score values in gameResult.

See the SGF standard specification for the mandatory structure of an SgfcPropertyType::RE property value.

Returns
SgfcSimpleText A property value for SgfcPropertyType::RE that conforms to the SGF standard's mandatory formatting, or SgfcConstants::NoneValueString if the SgfcGameResult::IsValid member of gameResult is false.

Member Data Documentation

◆ IsValid

bool LibSgfcPlusPlus::SgfcGameResult::IsValid = false

True if the SgfcGameResult object holds a valid game result. False if the SgfcGameResult object holds an invalid game result. The default is false.

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

◆ Score

SgfcReal LibSgfcPlusPlus::SgfcGameResult::Score = 0.0

The score. The default is 0.0.

The score only has meaning if SgfcGameResult::GameResultType is either SgfcGameResultType::BlackWin or SgfcGameResultType::WhiteWin and if SgfcGameResult::WinType is SgfcWinType::WinWithScore.

◆ WinType

SgfcWinType LibSgfcPlusPlus::SgfcGameResult::WinType = SgfcWinType::WinWithScore

The win type. The default is SgfcWinType::WinWithScore.

The win type only has meaning if SgfcGameResult::GameResultType is either SgfcGameResultType::BlackWin or SgfcGameResultType::WhiteWin.


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