|
Eile Mit Weile
|
Holds all relevant information of a player. More...
#include <Player.hpp>
Public Member Functions | |
| Player (std::string name, SerializableValue< int > *color_idx) | |
| Player (std::string name) | |
| Player (std::string id, std::string name) | |
| ~Player () | |
| std::string | GetGameId () |
| void | SetGameId (std::string game_id) |
| unsigned int | GetColorIdx () const |
| void | SetColorIdx (int color_idx) |
| std::string | GetPlayerName () const noexcept |
| 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 Player * | FromJson (const rapidjson::Value &json) |
Private Member Functions | |
| Player (std::string id, SerializableValue< std::string > *name, SerializableValue< int > *color_idx) | |
Private Attributes | |
| SerializableValue< std::string > * | _player_name |
| Color | _color |
| SerializableValue< int > * | _color_idx |
| std::string | _game_id |
Additional Inherited Members | |
Protected Member Functions inherited from UniqueSerializable | |
| UniqueSerializable () | |
| UniqueSerializable (std::string id) | |
Protected Attributes inherited from UniqueSerializable | |
| std::string | id |
Holds all relevant information of a player.
|
explicit |
Constructor for the player used by client.
|
explicit |
Constructor for the player used by client. Color id is set to 0 (red).
| Player::Player | ( | std::string | id, |
| std::string | name | ||
| ) |
Constructor for the player used by server. Color id is set to 0 (red). Unique id of UniqueSerializable is predefined argument.
| Player::~Player | ( | ) |
Destructor for the player. Deletes _player_name
|
private |
|
static |
Reads a player from a json object.
| unsigned Player::GetColorIdx | ( | ) | const |
Getter for _color_idx.
| std::string Player::GetGameId | ( | ) |
Getter for _game_id.
|
noexcept |
Getter for _player_name.
Setter for _color_idx.
|
overridevirtual |
Writes the player into a json object.
Implements Serializable.
|
private |
|
private |
Unique id of the game the player is in.
|
private |
Name of the player.