Hand.hpp
Go to the documentation of this file.
1 // Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon
2 
3 // We are making my contributions/submissions to this project solely in our
4 // personal capacity and are not conveying any rights to any intellectual
5 // property of any third parties.
6 
7 #ifndef ROSETTASTONE_HAND_HPP
8 #define ROSETTASTONE_HAND_HPP
9 
12 
13 #include <array>
14 
15 namespace RosettaStone
16 {
24 class Hand
25 {
26  public:
28  Hand();
29 
32  Player& GetOwner() const;
33 
36  void SetOwner(Player& owner);
37 
40  bool IsFull() const;
41 
44  bool IsEmpty() const;
45 
48  std::size_t GetNumOfCards() const;
49 
53  Entity* GetCard(std::size_t pos);
54 
57  std::vector<Entity*> GetAllCards();
58 
61  std::optional<std::size_t> FindCardPos(Entity& card);
62 
65  void AddCard(Entity& card);
66 
69  void RemoveCard(Entity& card);
70 
74  void SwapCard(Entity& card1, Entity& card2);
75 
76  private:
77  Player* m_owner = nullptr;
78 
79  std::array<Entity*, HAND_SIZE> m_cards{};
80  std::size_t m_numCard = 0;
81 };
82 } // namespace RosettaStone
83 
84 #endif // ROSETTASTONE_HAND_HPP
Player & GetOwner() const
Entity * GetCard(std::size_t pos)
bool IsFull() const
Hand()
Default constructor.
Hand class.
Definition: Hand.hpp:24
std::optional< std::size_t > FindCardPos(Entity &card)
std::size_t GetNumOfCards() const
void SwapCard(Entity &card1, Entity &card2)
Abstract entity structure that stores card data.
Definition: Entity.hpp:28
std::vector< Entity * > GetAllCards()
void AddCard(Entity &card)
bool IsEmpty() const
void SetOwner(Player &owner)
Player class.
Definition: Player.hpp:33
Definition: AccountInfo.hpp:14
void RemoveCard(Entity &card)