Planeshift
Public Member Functions | Protected Attributes

psMoney Class Reference

#include <psmoney.h>

List of all members.

Public Member Functions

void Adjust (int type, int value)
void AdjustCircles (int c)
void AdjustHexas (int h)
void AdjustOctas (int o)
void AdjustTrias (int t)
bool EnsureCircles (int minValue)
bool EnsureHexas (int minValue)
bool EnsureOctas (int minValue)
bool EnsureTrias (int minValue)
int Get (int type) const
int GetCircles () const
 Get the number of circles.
int GetHexas () const
 Get the number of hexas.
int GetOctas () const
 Get the number of octas.
int GetTotal () const
 Get the total in trias.
int GetTrias () const
 Get the number of trias.
psMoney Normalized () const
 Normalize to have the total match the highest possible number of high value coins.
psMoney operator* (const int mult) const
psMoney operator+ (const psMoney &other) const
psMoney operator+= (const psMoney &other)
psMoney operator- (const psMoney &other) const
psMoney operator- (void) const
bool operator> (const psMoney &other) const
 psMoney (const char *moneyString)
 Construct a psMoney based on a string Format: "C,O,H,T".
 psMoney (int circles, int octas, int hexas, int trias)
 psMoney ()
 psMoney (int trias)
void Set (int circles, int octas, int hexas, int trias)
void Set (const char *moneyString)
void Set (int type, int value)
void SetCircles (int c)
 Set the number of circles.
void SetHexas (int h)
 Set the number of hexas.
void SetOctas (int o)
 Set the number of octas.
void SetTrias (int t)
 Set the number of trias.
csString ToString () const
 Convert psMoney to a string.
csString ToUserString () const
 Convert psMoney to user-friendly string.

Protected Attributes

int circles
int hexas
int octas
int trias

Detailed Description

Definition at line 44 of file psmoney.h.


Constructor & Destructor Documentation

psMoney::psMoney ( )
psMoney::psMoney ( int  trias)
psMoney::psMoney ( int  circles,
int  octas,
int  hexas,
int  trias 
)
psMoney::psMoney ( const char *  moneyString)

Construct a psMoney based on a string Format: "C,O,H,T".


Member Function Documentation

void psMoney::Adjust ( int  type,
int  value 
)
void psMoney::AdjustCircles ( int  c)
void psMoney::AdjustHexas ( int  h)
void psMoney::AdjustOctas ( int  o)
void psMoney::AdjustTrias ( int  t)
bool psMoney::EnsureCircles ( int  minValue)
bool psMoney::EnsureHexas ( int  minValue)
bool psMoney::EnsureOctas ( int  minValue)
bool psMoney::EnsureTrias ( int  minValue)
int psMoney::Get ( int  type) const
int psMoney::GetCircles ( ) const [inline]

Get the number of circles.

Returns:
circles

Definition at line 69 of file psmoney.h.

int psMoney::GetHexas ( ) const [inline]

Get the number of hexas.

Returns:
hexas

Definition at line 87 of file psmoney.h.

int psMoney::GetOctas ( ) const [inline]

Get the number of octas.

Returns:
octas

Definition at line 78 of file psmoney.h.

int psMoney::GetTotal ( ) const

Get the total in trias.

Returns:
Trias
int psMoney::GetTrias ( ) const [inline]

Get the number of trias.

Returns:
trias

Definition at line 97 of file psmoney.h.

psMoney psMoney::Normalized ( ) const

Normalize to have the total match the highest possible number of high value coins.

E.g. 11 trias would normalized be 1 Hexa and 1 Tria.

Returns:
The normalized money without modifying the original object.
psMoney psMoney::operator* ( const int  mult) const
psMoney psMoney::operator+ ( const psMoney other) const
psMoney psMoney::operator+= ( const psMoney other)
psMoney psMoney::operator- ( const psMoney other) const
psMoney psMoney::operator- ( void  ) const
bool psMoney::operator> ( const psMoney other) const
void psMoney::Set ( int  type,
int  value 
)
void psMoney::Set ( const char *  moneyString)
void psMoney::Set ( int  circles,
int  octas,
int  hexas,
int  trias 
)
void psMoney::SetCircles ( int  c) [inline]

Set the number of circles.

Definition at line 63 of file psmoney.h.

void psMoney::SetHexas ( int  h) [inline]

Set the number of hexas.

Definition at line 82 of file psmoney.h.

void psMoney::SetOctas ( int  o) [inline]

Set the number of octas.

Definition at line 73 of file psmoney.h.

void psMoney::SetTrias ( int  t) [inline]

Set the number of trias.

Definition at line 91 of file psmoney.h.

csString psMoney::ToString ( ) const

Convert psMoney to a string.

Returns:
"C,O,H,T"
csString psMoney::ToUserString ( ) const

Convert psMoney to user-friendly string.

Returns:
"12 Circles, 3 Hexas and 14 Trias"

Member Data Documentation

int psMoney::circles [protected]

Definition at line 135 of file psmoney.h.

int psMoney::hexas [protected]

Definition at line 137 of file psmoney.h.

int psMoney::octas [protected]

Definition at line 136 of file psmoney.h.

int psMoney::trias [protected]

Definition at line 138 of file psmoney.h.


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