libsgfc++ 2.0.1
A C++ library that uses SGFC to read and write SGF (Smart Game Format) data.
|
The SgfcValueConverter class converts raw string values into value types defined by the SGF standard, and vice versa. More...
#include <SgfcValueConverter.h>
Public Member Functions | |
SgfcValueConverter () | |
Initializes a newly constructed SgfcValueConverter object. | |
virtual | ~SgfcValueConverter () |
Destroys and cleans up the SgfcValueConverter object. | |
bool | TryConvertStringToNumberValue (const std::string &stringValue, SgfcNumber &outNumberValue, std::string &outTypeConversionErrorMessage) const |
Attempts to convert the specified string value stringValue into an SgfcNumber value. The number is formed by the first sequence of digit characters encountered in stringValue. Whitespace at the beginning is ignored. Plus and minus characters indicate the number's sign. The first non-digit, non-sign, non-whitespace character and all characters beyond are ignored. | |
std::string | ConvertNumberValueToString (SgfcNumber numberValue) const |
Converts the specified SgfcNumber numberValue into a string value and returns that string value. | |
bool | TryConvertStringToRealValue (const std::string &stringValue, SgfcReal &outRealValue, std::string &outTypeConversionErrorMessage) const |
Attempts to convert the specified string value stringValue into an SgfcReal value. The number is formed by the first sequence of digit and decimal point (".") characters encountered in stringValue. Whitespace at the beginning is ignored. Plus and minus characters indicate the number's sign. The first non-digit, non-decimal point, non-sign, non-whitespace character and all characters beyond are ignored. The only exception is the scientific notation which is also recognized. | |
std::string | ConvertRealValueToString (SgfcReal realValue) const |
Converts the specified SgfcReal realValue into a string value and returns that string value. | |
bool | TryConvertStringToDoubleValue (const std::string &stringValue, SgfcDouble &outDoubleValue, std::string &outTypeConversionErrorMessage) const |
Attempts to convert the specified string value stringValue into an SgfcDouble value. | |
std::string | ConvertDoubleValueToString (SgfcDouble doubleValue) const |
Converts the specified SgfcDouble doubleValue into a string value and returns that string value. | |
bool | TryConvertStringToColorValue (const std::string &stringValue, SgfcColor &outColorValue, std::string &outTypeConversionErrorMessage) const |
Attempts to convert the specified string value stringValue into an SgfcColor value. | |
std::string | ConvertColorValueToString (SgfcColor colorValue) const |
Converts the specified SgfcColor colorValue into a string value and returns that string value. | |
The SgfcValueConverter class converts raw string values into value types defined by the SGF standard, and vice versa.
bool LibSgfcPlusPlus::SgfcValueConverter::TryConvertStringToColorValue | ( | const std::string & | stringValue, |
SgfcColor & | outColorValue, | ||
std::string & | outTypeConversionErrorMessage ) const |
Attempts to convert the specified string value stringValue into an SgfcColor value.
true | if conversion succeeds. outColorValue in this case holds the converted value. The value of outTypeConversionErrorMessage is undefined. |
false | if conversion fails. outTypeConversionErrorMessage in this case holds an error message with a human readable description why the conversion failed. The value of outColorValue is undefined. |
bool LibSgfcPlusPlus::SgfcValueConverter::TryConvertStringToDoubleValue | ( | const std::string & | stringValue, |
SgfcDouble & | outDoubleValue, | ||
std::string & | outTypeConversionErrorMessage ) const |
Attempts to convert the specified string value stringValue into an SgfcDouble value.
true | if conversion succeeds. outDoubleValue in this case holds the converted value. The value of outTypeConversionErrorMessage is undefined. |
false | if conversion fails. outTypeConversionErrorMessage in this case holds an error message with a human readable description why the conversion failed. The value of outDoubleValue is undefined. |
bool LibSgfcPlusPlus::SgfcValueConverter::TryConvertStringToNumberValue | ( | const std::string & | stringValue, |
SgfcNumber & | outNumberValue, | ||
std::string & | outTypeConversionErrorMessage ) const |
Attempts to convert the specified string value stringValue into an SgfcNumber value. The number is formed by the first sequence of digit characters encountered in stringValue. Whitespace at the beginning is ignored. Plus and minus characters indicate the number's sign. The first non-digit, non-sign, non-whitespace character and all characters beyond are ignored.
Conversion succeeds if at least one usable digit character is found. Conversion fails if no usable digit characters are found.
Example: A floating point number is read up to the decimal point.
true | if conversion succeeds. outNumberValue in this case holds the converted value. The value of outTypeConversionErrorMessage is undefined. |
false | if conversion fails. outTypeConversionErrorMessage in this case holds an error message with a human readable description why the conversion failed. The value of outNumberValue is undefined. |
bool LibSgfcPlusPlus::SgfcValueConverter::TryConvertStringToRealValue | ( | const std::string & | stringValue, |
SgfcReal & | outRealValue, | ||
std::string & | outTypeConversionErrorMessage ) const |
Attempts to convert the specified string value stringValue into an SgfcReal value. The number is formed by the first sequence of digit and decimal point (".") characters encountered in stringValue. Whitespace at the beginning is ignored. Plus and minus characters indicate the number's sign. The first non-digit, non-decimal point, non-sign, non-whitespace character and all characters beyond are ignored. The only exception is the scientific notation which is also recognized.
Conversion succeeds if at least one usable digit character is found. Conversion fails if no usable digit characters are found.
true | if conversion succeeds. outRealValue in this case holds the converted value. The value of outTypeConversionErrorMessage is undefined. |
false | if conversion fails. outTypeConversionErrorMessage in this case holds an error message with a human readable description why the conversion failed. The value of outRealValue is undefined. |