Represents a card in the game.
More...
#include <card.h>
|
| card (int value, int color) |
| Constructs a new card object (public constructor).
|
|
| ~card () override |
| Destructs a card object.
|
|
int | get_value () const noexcept |
| Gets the card's value.
|
|
int | get_color () const noexcept |
| Gets the card's color.
|
|
void | write_into_json (rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) const override |
| Serializes a card object into a json object.
|
|
std::string | get_id () const |
|
virtual void | write_into_json (rapidjson::Value &json, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator) const override |
|
virtual rapidjson::Document * | to_json () const |
|
|
static card * | from_json (const rapidjson::Value &json) |
| Deserializes a card object from a json object.
|
|
|
| unique_serializable (std::string id) |
|
std::string | _id |
|
Represents a card in the game.
This class encapsulates all information about a card, including its value and color.
◆ card()
card::card |
( |
int | value, |
|
|
int | color ) |
Constructs a new card object (public constructor).
- Parameters
-
value | The card's value. |
color | The card's color. |
◆ from_json()
card * card::from_json |
( |
const rapidjson::Value & | json | ) |
|
|
static |
Deserializes a card object from a json object.
- Parameters
-
json | The json object containing the card information. |
- Returns
- A pointer to a new card object created from the given json object.
◆ get_color()
int card::get_color |
( |
| ) |
const |
|
nodiscardnoexcept |
Gets the card's color.
- Returns
- The card's color.
◆ get_value()
int card::get_value |
( |
| ) |
const |
|
nodiscardnoexcept |
Gets the card's value.
- Returns
- The card's value.
◆ write_into_json()
void card::write_into_json |
( |
rapidjson::Value & | json, |
|
|
rapidjson::Document::AllocatorType & | allocator ) const |
|
overridevirtual |
Serializes a card object into a json object.
- Parameters
-
json | The json object for serializing the card. |
allocator | The json allocator for serializing the card. |
Implements serializable.
The documentation for this class was generated from the following files:
- src/common/game_state/cards/card.h
- src/common/game_state/cards/card.cpp