CardPile Class Reference
#include <cardpile.h>
List of all members.
Detailed Description
This represents a pile of cards. This is usually used as a discard area.
- Author:
- John Schneiderman
Constructor & Destructor Documentation
This is the default constructor.
This is the copy constructor for a CardSequence .
- Parameters:
-
| sequence | is the of cards to put into a pile. |
- Note:
- that the first card in the sequence is the bottom card in the pile.
Member Function Documentation
void CardPile::addCard |
( |
const Card & |
card |
) |
|
Adds a card to the top of the pile.
- Parameters:
-
| card | is the card to place on top of the pile. |
void CardPile::addCardToBottom |
( |
const Card & |
card |
) |
|
Adds a card to the bottom of the pile.
- Parameters:
-
| card | is the card to place at the bottom of the pile. |
const Card & CardPile::bottomCard |
( |
|
) |
const |
An accsessor to the card on the bottom of the pile.
- Returns:
- the card that is on the bottom of the pile.
This will clear the card pile.
bool CardPile::isEmpty |
( |
|
) |
const |
This determines if a pile is empty.
- Returns:
- true if the pile has no cards, false elsewise.
bool CardPile::operator== |
( |
const CardPile & |
rhs |
) |
|
Verifies that two card piles are equal.
- Parameters:
-
| rhs | is the pile you wish to compare to *this. |
- Note:
- piles are considered to be equal if they have the same cards in the same order.
- Returns:
- true if they are considered equal, false elsewise.
Card CardPile::removeCard |
( |
|
) |
|
Removes a card from the top of the pile.
- Returns:
- the card removed from the pile.
- Exceptions:
-
Card CardPile::removeCardFromBottom |
( |
|
) |
|
Removes a card from the bottom of the pile.
- Returns:
- the card removed from the pile.
- Exceptions:
-
| KardsGTError | if the card from the bottom could not be removed. |
int CardPile::size |
( |
|
) |
const |
Gives the number of cards in the pile.
- Returns:
- the number of cards in the pile.
const Card & CardPile::topCard |
( |
|
) |
const |
An accsessor to the card on the top of the pile.
- Returns:
- the card that is on top of the pile.
Friends And Related Function Documentation
QTextStream& operator<< |
( |
QTextStream & |
out, |
|
|
const CardPile & |
pile | |
|
) |
| | [friend] |
Stream insertion operator.
- Parameters:
-
| out | is the stream to write the pile of cards into. |
- Note:
- Each card is separated by white space.
- Parameters:
-
| pile | is the pile to write into the stream. |
- Returns:
- out.
ostream& operator<< |
( |
ostream & |
out, |
|
|
const CardPile & |
cardPile | |
|
) |
| | [friend] |
Stream insertion operator.
- Parameters:
-
| out | is the stream to write the pile of cards into. |
- Note:
- Each card is separated by white space.
- Parameters:
-
| cardPile | is the pile to write into the stream. |
- Returns:
- out.
QTextStream& operator>> |
( |
QTextStream & |
in, |
|
|
CardPile & |
pile | |
|
) |
| | [friend] |
Stream extraction operator.
- Parameters:
-
| in | is the stream to read the pile from. |
- Note:
- Each card is assumed to be separated by white space.
- Parameters:
-
| pile | is the pile to place the read in cards. |
- Returns:
- in.
istream& operator>> |
( |
istream & |
in, |
|
|
CardPile & |
cardPile | |
|
) |
| | [friend] |
Stream extraction operator.
- Parameters:
-
| in | is the stream to read the pile from. |
- Note:
- Each card is assumed to be separated by white space.
- Parameters:
-
| cardPile | is the pile to place the read in cards. |
- Returns:
- in.
Member Data Documentation
- Parameters:
-
| m_pile | is a stack of cards. |
The documentation for this class was generated from the following files:
- gamebase/cardpile.h
- gamebase/cardpile.cpp