CardPile Class Reference

#include <cardpile.h>

Inheritance diagram for CardPile:

Inheritance graph
[legend]
Collaboration diagram for CardPile:

Collaboration graph
[legend]

List of all members.


Detailed Description

This represents a pile of cards. This is usually used as a discard area.

Author:
John Schneiderman

Public Member Functions

void addCard (const Card &card)
void addCardToBottom (const Card &card)
const CardbottomCard () const
 CardPile (const CardSequence &sequence)
 CardPile ()
void clear ()
bool isEmpty () const
bool operator== (const CardPile &rhs)
Card removeCard ()
Card removeCardFromBottom ()
int size () const
const CardtopCard () const

Protected Attributes

CardSequence m_pile

Friends

QTextStream & operator<< (QTextStream &out, const CardPile &pile)
ostream & operator<< (ostream &out, const CardPile &cardPile)
QTextStream & operator>> (QTextStream &in, CardPile &pile)
istream & operator>> (istream &in, CardPile &cardPile)

Constructor & Destructor Documentation

CardPile::CardPile (  ) 

This is the default constructor.

CardPile::CardPile ( const CardSequence sequence  ) 

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.

void CardPile::clear (  ) 

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:
KardsGTError if the card from the top could not be removed.

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:

Generated on Tue Aug 12 23:24:01 2008 for KardsGT by  doxygen 1.5.5