#include <GoKomi.h>
Supported komi values are "unknown" or multiples of 0.5.
Definition at line 16 of file GoKomi.h.
Public Member Functions | |
| GoKomi () | |
| Construct komi with unknown value. | |
| GoKomi (float komi) | |
| Construct komi from float. | |
| GoKomi (const std::string &komi) | |
| Construct komi from string. | |
| GoKomi & | operator= (const GoKomi &komi) |
| bool | operator== (const GoKomi &komi) const |
| bool | operator!= (const GoKomi &komi) const |
| bool | IsUnknown () const |
| Check if komi is unknown. | |
| float | ToFloat () const |
| Convert komi to float. | |
| std::string | ToString () const |
| Convert komi to string. | |
Private Attributes | |
| bool | m_isUnknown |
| int | m_value |
| Komi value stored as integer. | |
Classes | |
| class | InvalidKomi |
| Exception thrown if komi is constructed with invalid value. More... | |
| GoKomi::GoKomi | ( | ) |
| GoKomi::GoKomi | ( | float | komi | ) |
| GoKomi::GoKomi | ( | const std::string & | komi | ) |
Construct komi from string.
| komi | The string, leading and trailing whitespaces will be ignored, empty for unknown komi, float otherwise. The float will be rounded to a multiple of 0.5. |
| InvalidKomi | If string is not empty or contains a float. |
Definition at line 40 of file GoKomi.cpp.
References GoKomi(), m_isUnknown, and m_value.
| bool GoKomi::IsUnknown | ( | ) | const |
Check if komi is unknown.
Definition at line 117 of file GoKomi.h.
References m_isUnknown.
| bool GoKomi::operator== | ( | const GoKomi & | komi | ) | const |
| float GoKomi::ToFloat | ( | ) | const |
Convert komi to float.
Definition at line 122 of file GoKomi.h.
References m_isUnknown, and m_value.
Referenced by GoGtpEngine::CmdFinalScore(), and GoBoardUtil::PassWins().
| string GoKomi::ToString | ( | ) | const |
Convert komi to string.
Definition at line 63 of file GoKomi.cpp.
References m_isUnknown, and m_value.
Referenced by operator<<().
bool GoKomi::m_isUnknown [private] |
Definition at line 73 of file GoKomi.h.
Referenced by GoKomi(), IsUnknown(), operator=(), operator==(), ToFloat(), and ToString().
int GoKomi::m_value [private] |
Komi value stored as integer.
Corresponds to the real komi multiplied by two.
Definition at line 78 of file GoKomi.h.
Referenced by GoKomi(), operator=(), operator==(), ToFloat(), and ToString().