5#include "../../../../rapidjson/include/rapidjson/document.h"
6#include "../cards/card.h"
18 std::vector<card*> _cards;
25 card* remove_card(std::vector<card*>::iterator pos);
32 card* remove_card(
int idx);
54 hand(
const std::string&
id,
const std::vector<card*>& cards);
60 explicit hand(
const std::string&
id);
78 [[nodiscard]] std::vector<card*>
get_cards()
const;
107 bool remove_card(std::string card_id, std::string& err);
116 void write_into_json(rapidjson::Value& json, rapidjson::Document::AllocatorType& allocator)
const override;
Represents a card in the game.
Definition card.h:15
Represents a player's hand in the game.
Definition hand.h:15
bool try_get_card(const std::string &card_id, card *&hand_card) const
Tries to get a specific card from the hand.
Definition hand.cpp:33
void write_into_json(rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) const override
Serializes a hand object into a json object.
Definition hand.cpp:83
static hand * from_json(const rapidjson::Value &json)
Deserializes a hand object from a json object.
Definition hand.cpp:88
std::vector< card * > get_cards() const
Gets the cards in the hand.
Definition hand.cpp:27
bool add_card(card *card, std::string &err)
Adds a card to the hand.
Definition hand.cpp:64
unsigned int get_nof_cards() const
Gets the number of cards in the hand.
Definition hand.cpp:23
hand()
Constructs a new hand object.
Definition hand.cpp:7
~hand() override
Destructs a hand object.
Definition hand.cpp:18
Definition unique_serializable.h:12