CBG  0.1
Compendium of board games
Square Class Reference

#include <Square.h>

Public Member Functions

 Square ()
 
 Square (int identifier, string start, string end, int amountOfPlayers, Coordinate position)
 
 ~Square ()
 Deconstructor to clear the pieces vector. More...
 
int getIdentifier () const
 Returns the square's identifier. More...
 
bool hasPiece ()
 Returns whether or not the square has a piece on it. More...
 
bool addPiece (int Player, Piece &piece)
 Adds a piece to the square. More...
 
bool removePiece (int player)
 Removes a piece from the square. More...
 
bool hasPieceOwnedBy (int player) const
 Returns whether or not the square has a piece owned by player on it. More...
 
string getStart ()
 Returns the start string of a square. More...
 
string getEnd ()
 Returns the closing string of a square. More...
 
PiecegetPiece (int player)
 Returns the piece on the square owned by player. More...
 
CoordinategetPosition () const
 Returns the position of the square. More...
 

Protected Attributes

int identifier
 Identifier for the square. More...
 
int amountOfPlayers
 The length of the pieces vector. More...
 
int numberOfOccupants
 The number of people currently on the square. More...
 
string start
 The starting string of the square. More...
 
string end
 The closing string of the square. More...
 
vector< Piece * > pieces
 Pointers to all the pieces on the square. More...
 
Coordinate position
 The coordinate of the square. More...
 

Friends

ostream & operator<< (ostream &out, const Square &square)
 Overrides the insert operator for a square. More...
 

Constructor & Destructor Documentation

Square::Square ( )

A square makes up the grid/board for each game.

Author
Ian Duffy
Darren Brogan
Square::Square ( int  identifier,
string  start,
string  end,
int  amountOfPlayers,
Coordinate  position 
)
Square::~Square ( )

Deconstructor to clear the pieces vector.

Member Function Documentation

bool Square::addPiece ( int  Player,
Piece piece 
)

Adds a piece to the square.

string Square::getEnd ( )

Returns the closing string of a square.

int Square::getIdentifier ( ) const

Returns the square's identifier.

Piece & Square::getPiece ( int  player)

Returns the piece on the square owned by player.

Coordinate & Square::getPosition ( ) const

Returns the position of the square.

string Square::getStart ( )

Returns the start string of a square.

bool Square::hasPiece ( )

Returns whether or not the square has a piece on it.

bool Square::hasPieceOwnedBy ( int  player) const

Returns whether or not the square has a piece owned by player on it.

bool Square::removePiece ( int  player)

Removes a piece from the square.

Friends And Related Function Documentation

ostream& operator<< ( ostream &  out,
const Square square 
)
friend

Overrides the insert operator for a square.

Member Data Documentation

int Square::amountOfPlayers
protected

The length of the pieces vector.

string Square::end
protected

The closing string of the square.

int Square::identifier
protected

Identifier for the square.

int Square::numberOfOccupants
protected

The number of people currently on the square.

vector<Piece *> Square::pieces
protected

Pointers to all the pieces on the square.

Coordinate Square::position
protected

The coordinate of the square.

string Square::start
protected

The starting string of the square.


The documentation for this class was generated from the following files: