rp-scrabble
Simple, terminal-based Scrabble game
Public Member Functions | Private Attributes | List of all members
Tile Class Reference

#include <tile.h>

Collaboration diagram for Tile:
Collaboration graph
[legend]

Public Member Functions

 Tile (char l, int p, enum_location p_loc)
 
 Tile (Tile &source)
 
 ~Tile ()
 
char getLetter ()
 
std::string getLetterStr ()
 
int getPoints ()
 
int getLoc ()
 
RackgetRack ()
 
BaggetBag ()
 
SquaregetSquare ()
 
void setLoc (int loc)
 
void setBag (Bag *b)
 
void setRack (Rack *r)
 
void setSquare (Square *s)
 
void show ()
 

Private Attributes

SquaretSquare
 
char letter
 
int points
 
BagtBag
 
RacktRack
 
enum_location presentLoc
 

Detailed Description

Implements a physical scrabble tile

Each Tile has a letter, points, a bag and a rack associated with it

Definition at line 22 of file tile.h.

Constructor & Destructor Documentation

◆ Tile() [1/2]

Tile::Tile ( char  l,
int  p,
enum_location  p_loc 
)

Construct a Tile

Parameters
lLetter on the Tile
pPoint value of the Tile
p_locLocation of the Tile

This function shall not throw exceptions

Definition at line 21 of file tile.cc.

◆ Tile() [2/2]

Tile::Tile ( Tile source)

Copy constructor for Tile

Parameters
sourceSource to copy from

This function shall not throw exceptions

Definition at line 38 of file tile.cc.

◆ ~Tile()

Tile::~Tile ( )
inline

Definition at line 34 of file tile.h.

Member Function Documentation

◆ getBag()

Bag * Tile::getBag ( )

Getter for member tBag

Returns
Pointer to the Bag that the Tile came from

This function shall not throw exceptions.

Definition at line 133 of file tile.cc.

◆ getLetter()

char Tile::getLetter ( )

Getter for member letter

Returns
letter as char

This function shall not throw exceptions.

Definition at line 61 of file tile.cc.

◆ getLetterStr()

string Tile::getLetterStr ( )

Getter for member letter

Returns
letter as std::string

This function shall not throw exceptions.

Definition at line 109 of file tile.cc.

Here is the caller graph for this function:

◆ getLoc()

int Tile::getLoc ( )

Getter for member letter

Returns
Tile location

This function shall not throw exceptions.

Definition at line 85 of file tile.cc.

◆ getPoints()

int Tile::getPoints ( )

Getter for member letter

Returns
points

This function shall not throw exceptions.

Definition at line 73 of file tile.cc.

◆ getRack()

Rack * Tile::getRack ( )

Getter for member tRack

Returns
Pointer to rack that the tile is present in, nullptr if not in a rack

This function shall not throw exceptions.

Definition at line 121 of file tile.cc.

◆ getSquare()

Square * Tile::getSquare ( )

Getter for member tSquare

Returns
A pointer to the Square the Tile is placed in, nullptr if not in a Square

This function shall not throw exceptions.

Definition at line 145 of file tile.cc.

Here is the caller graph for this function:

◆ setBag()

void Tile::setBag ( Bag b)

Setter for member tBag

Parameters
bPointer to a Bag

This function shall not throw exceptions.

Definition at line 157 of file tile.cc.

◆ setLoc()

void Tile::setLoc ( int  loc)

Setter for member tBag

Parameters
loca valid value from enum_location
Exceptions
std::stringcontaining the error message

Definition at line 183 of file tile.cc.

Here is the caller graph for this function:

◆ setRack()

void Tile::setRack ( Rack r)

Setter for member tBag

Parameters
rPointer to a Rack

This function shall not throw exceptions.

Definition at line 170 of file tile.cc.

◆ setSquare()

void Tile::setSquare ( Square s)

Setter for member tBag

Parameters
sPointer to a Square

This function shall not throw exceptions.

Definition at line 207 of file tile.cc.

Here is the caller graph for this function:

◆ show()

void Tile::show ( )

"Pretty print" a tile. Used mostly for debug purposes

Definition at line 49 of file tile.cc.

Member Data Documentation

◆ letter

char Tile::letter
private

Definition at line 25 of file tile.h.

◆ points

int Tile::points
private

Definition at line 26 of file tile.h.

◆ presentLoc

enum_location Tile::presentLoc
private

Definition at line 29 of file tile.h.

◆ tBag

Bag* Tile::tBag
private

Definition at line 27 of file tile.h.

◆ tRack

Rack* Tile::tRack
private

Definition at line 28 of file tile.h.

◆ tSquare

Square* Tile::tSquare
private

Definition at line 24 of file tile.h.


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