CardSequence Class Reference
#include <cardsequence.h>
List of all members.
Detailed Description
This is a sequence of cards. This is generally used to hold a player's hand or the sequence of cards played.
- Author:
- John Schneiderman
Member Typedef Documentation
- Parameters:
-
| const_iterator | is an alias to deque<Card>::const_iterator |
- Parameters:
-
| iterator | is an alias to deque<Card>::iterator |
Constructor & Destructor Documentation
CardSequence::CardSequence |
( |
|
) |
|
This is the default constructor.
CardSequence::CardSequence |
( |
const Card & |
card |
) |
|
This is a copy constructor for a single card sequence.
Member Function Documentation
void CardSequence::addCard |
( |
const Card & |
card |
) |
|
This is used to add a card to the end of a players sequence.
- Parameters:
-
| card | is the card to add to a players sequence. |
void CardSequence::addCardToFront |
( |
const Card & |
card |
) |
|
This is used to add a card to the beginning of a players sequence.
- Parameters:
-
| card | is the card to add to a players sequence. |
Card & CardSequence::back |
( |
|
) |
|
Gives the last card in the sequence.
- Returns:
- the last card.
const Card & CardSequence::back |
( |
|
) |
const |
Gives the last card in the sequence.
- Returns:
- the last card.
Gives a constant iterator to the first card in the sequence.
- Returns:
- gives an const_iterator to the first card.
Gives an iterator to the first card in the sequence.
- Returns:
- gives an iterator to the first card.
void CardSequence::clear |
( |
|
) |
|
Removes all of the cards from the sequence.
Gives a constant iterator to the end of the cards in the sequence.
- Returns:
- gives an const_iterator to the end of the cards.
Gives an iterator to the end of the cards in the sequence.
- Returns:
- gives an iterator to the end of the cards.
Card & CardSequence::front |
( |
|
) |
|
Gives the first card in the sequence.
- Returns:
- the first card.
const Card & CardSequence::front |
( |
|
) |
const |
Gives the first card in the sequence.
- Returns:
- the first card.
bool CardSequence::hasCard |
( |
const Card & |
card |
) |
const |
This determines if the sequence has a specific card in it.
- Parameters:
-
| card | is the card to check to see if it's in the sequence. |
- Returns:
- true if card is in the sequence, false elsewise.
bool CardSequence::hasRank |
( |
const Card::Rank & |
rank |
) |
const |
This determines if the sequence has a specific rank in it.
- Parameters:
-
| rank | is the rank to search for. |
- Returns:
- true if the rank is found in the sequence, false elsewise.
bool CardSequence::hasSuit |
( |
const Card::Suit & |
suit |
) |
const |
This determines if the sequence has a specific suit in it.
- Parameters:
-
| suit | is the suit to search for. |
- Returns:
- true if the suit is found in the sequence, false elsewise.
bool CardSequence::isEmpty |
( |
|
) |
const |
This determines if the current sequence has no cards in it.
- Returns:
- true if the sequence is empty or has only invalid cards, false elsewise.
This creates a combined sequence based on *this and a passed in sequence.
- Parameters:
-
| rhs | is the card sequence to combine with *this. |
- Returns:
- *this combined with rhs having rhs at the end.
This appends a card sequence to the end of *this.
- Parameters:
-
| rhs | is the card sequence to add to the end of *this. |
- Returns:
- *this.
This removes a sequence from *this.
- Parameters:
-
| rhs | is the sequence to remove from *this. |
- Returns:
- the result of remove rhs from *this.
This removes and assigns the sequence from *this.
- Parameters:
-
| rhs | is the sequence to remove from *this. |
- Returns:
- *this.
bool CardSequence::operator< |
( |
const CardSequence & |
compare |
) |
const |
Less than operator.
- Note:
- We only compare the sizes of the card sequences.
- Parameters:
-
| compare | is the card sequence to compare. |
- Returns:
- true if the sequence of cards in *this is less than the sequence of cards in compare.
bool CardSequence::operator== |
( |
const CardSequence & |
compare |
) |
const |
Equivalent operator.
- Note:
- The card sequence order does matter in determining equivalence.
- Parameters:
-
| compare | is the card sequence to compare. |
- Returns:
- true if the sequence of cards in *this is the same as the sequence of cards in compare.
Card & CardSequence::operator[] |
( |
int |
index |
) |
|
Random accessor for the sequence.
- Parameters:
-
| index | is the card to get from the sequence. |
- Exceptions:
-
- Returns:
- a reference to the card requested.
const Card & CardSequence::operator[] |
( |
int |
index |
) |
const |
Random accessor for the card sequence.
- Parameters:
-
| index | is the card to get from the sequence. |
- Exceptions:
-
- Returns:
- the card requested.
bool CardSequence::removeCard |
( |
const Card & |
card |
) |
|
This is used to remove the first instance of a card from a players sequence.
- Parameters:
-
| card | is the card to remove from a players sequence. |
- Returns:
- true if the card was successful in its attempt to remove the card, false elsewise.
int CardSequence::size |
( |
|
) |
const |
Gives the current number of cards in the sequence.
- Returns:
- the number of cards.
void CardSequence::sortBySuit |
( |
|
) |
|
Sorts all the cards first by suit then by rank.
Friends And Related Function Documentation
QDebug& operator<< |
( |
QDebug & |
out, |
|
|
const CardSequence & |
sequence | |
|
) |
| | [friend] |
A stream insertion operator that will writes out a card sequence.
- Parameters:
-
| out | this is the buffer to write the card sequence to. |
| sequence | is the card sequence to write out. |
- Returns:
- a reference to out.
- Note:
- Each of the cards are separated by white space, and the last card is followed by an empty card.
QTextStream& operator<< |
( |
QTextStream & |
out, |
|
|
const CardSequence & |
sequence | |
|
) |
| | [friend] |
A stream insertion operator that will writes out a card sequence.
- Parameters:
-
| out | this is the buffer to write the card sequence to. |
| sequence | is the card sequence to write out. |
- Returns:
- a reference to out.
- Note:
- Each of the cards are separated by white space, and the last card is followed by an empty card.
ostream& operator<< |
( |
ostream & |
out, |
|
|
const CardSequence & |
sequence | |
|
) |
| | [friend] |
A stream insertion operator that writes out a card sequence.
- Parameters:
-
| out | this is the buffer to write the card sequence to. |
| sequence | is the card sequence to write out. |
- Returns:
- a reference to out.
- Note:
- Each of the cards are separated by white space.
QTextStream& operator>> |
( |
QTextStream & |
in, |
|
|
CardSequence & |
sequence | |
|
) |
| | [friend] |
A stream extraction operator that will read in a card sequence.
- Parameters:
-
| in | this is the buffer to read the card sequence from. |
| sequence | is the card sequence to read into. |
- Returns:
- a reference to in.
- Note:
- Each card to read in is assumed to be separated by white space, and continues to read until an empty card is read in.
istream& operator>> |
( |
istream & |
in, |
|
|
CardSequence & |
sequence | |
|
) |
| | [friend] |
A stream extraction operator that will read in a card sequence.
- Parameters:
-
| in | this is the buffer to read the card sequence from. |
| sequence | is the card sequence to read into. |
- Returns:
- a reference to in.
- Note:
- Each card to read in is assumed to be separated by white space.
The documentation for this class was generated from the following files:
- gamebase/cardsequence.h
- gamebase/cardsequence.cpp