|
Eile Mit Weile
|
Represents a figure on the board. More...
#include <Figure.hpp>
Public Member Functions | |
| Figure (unsigned color, int figure_idx) | |
| Color | GetColor () |
| int | GetFigureIdx () const |
| int | GetColorIdx () const |
| void | WriteIntoJson (rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) const override |
Public Member Functions inherited from UniqueSerializable | |
| std::string | GetId () const |
| void | WriteIntoJson (rapidjson::Value &json, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator) const override |
Public Member Functions inherited from Serializable | |
| virtual rapidjson::Document * | ToJson () const |
Static Public Member Functions | |
| static Figure * | FromJson (const rapidjson::Value &json) |
Private Member Functions | |
| Figure (std::string id, unsigned color_idx, int figure_idx) | |
Private Attributes | |
| Color | _color |
| unsigned | _color_idx |
| int | _figure_idx |
Additional Inherited Members | |
Protected Member Functions inherited from UniqueSerializable | |
| UniqueSerializable () | |
| UniqueSerializable (std::string id) | |
Protected Attributes inherited from UniqueSerializable | |
| std::string | id |
Represents a figure on the board.
A figure is identified by its color and its index. The index is used to determine which figure of the current player is to be moved.
Constructor: creates a Figure with a Color and an id (_figure_idx).
Deserialization constructor used by FromJson
|
static |
Deserializes a Figure object from a json object. Used by client.
| int Figure::GetColorIdx | ( | ) | const |
Getter for _color_idx
| int Figure::GetFigureIdx | ( | ) | const |
Getter for _figure_idx
|
overridevirtual |
Serializes a Figure object into a json object. Used by server.
Implements Serializable.
|
private |
|
private |
Value from 0 to 3 makes the Player's 4 figures uniquely identifiable