-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCard.h
87 lines (72 loc) · 2.08 KB
/
Card.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef CARD_H
#define CARD_H
#include <QMetaType>
class Card
{
public:
/**
* @brief The Suit enum holds the different types of suits a playing card can be
*/
enum Suit {
DIAMONDS, CLUBS, HEARTS, SPADES, MAX_SUIT
};
/**
* @brief The Rank enum holds the different types of ranks a playing card can be
*/
enum Rank {
ACE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT,
NINE, TEN, JACK, QUEEN, KING, MAX_RANK
};
/**
* @brief Card constructor should never be used by the programmer. This only exists to allow for
* Qt to use it correctly.
*/
Card() {}
/**
* @brief Card constructs a new Card type with the specified Suit and Rank.
* @param suit the suit of the card
* @param rank the rank of the card
*
* @see Rank
* @see Suit
*/
Card(Suit suit, Rank rank);
/**
* @brief getSuit returns the suit of the playing card
* @return the suit of the playing card
*/
Suit getSuit() const;
/**
* @brief getRank returns the rank of the playing card
* @return the rank of the playing card
*/
Rank getRank() const;
/**
* @brief isFlipped determines whether or not the card is flipped over (face up).
* @return true if the card is face up
* @return false if the card is face down
*/
bool isFlipped() const;
/**
* @brief flip flips the card over. If the card was face down, it's now face up, and vice versa.
*/
void flip();
/**
* @brief isBlack determins whether the card is generally portrayed as being black.
* @return true if the card is generally portrayed as being black (Clubs or Spades).
* @return false if the card is generally portayed as being red (Diamonds or Hearts).
*/
bool isBlack() const;
/**
* @brief isBlack determins whether the card is generally portrayed as being red.
* @return true if the card is generally portayed as being red (Diamonds or Hearts).
* @return false if the card is generally portrayed as being black (Clubs or Spades).
*/
bool isRed() const;
private:
Suit m_suit;
Rank m_rank;
bool m_flipped;
};
Q_DECLARE_METATYPE(Card)
#endif // CARD_H