Main Page   Namespace List   Compound List   File List   Compound Members   File Members  

Currency Class Reference

Operation with currency values don't work fine with float, double type. More...

#include <Currency.h>

List of all members.

Public Methods

 Currency ()
 Currency (const Currency &)
 Currency (int rhs)
 Currency (float rhs)
 Currency (double rhs)
 Currency (int integer, int fraction)
 ~Currency ()
Currency & operator= (const Currency &rhs)
Currency & operator= (const float rhs)
Currency & operator= (const int rhs)
Currency & operator+= (const Currency &rhs)
Currency & operator+= (const float rhs)
Currency & operator+= (const int rhs)
Currency & operator-= (const Currency &rhs)
Currency & operator-= (const float rhs)
Currency & operator-= (const int rhs)
Currency & operator *= (const Currency &rhs)
Currency & operator *= (const float rhs)
Currency & operator *= (const int rhs)
Currency & operator/= (const Currency &rhs)
Currency & operator/= (const float rhs)
Currency & operator/= (const int rhs)
Currency operator+ () const
Currency operator- () const
 operator int () const
 operator float () const
 operator double () const
string toString () const

Public Attributes

int value

Friends

Currency operator- (const Currency &lhs, const Currency &rhs)
Currency operator- (const Currency &lhs, float rhs)
Currency operator- (const Currency &lhs, int rhs)
Currency operator+ (const Currency &lhs, const Currency &rhs)
Currency operator+ (const Currency &lhs, float rhs)
Currency operator+ (const Currency &lhs, int rhs)
Currency operator * (const Currency &lhs, const Currency &rhs)
Currency operator * (const Currency &lhs, float rhs)
Currency operator * (const Currency &lhs, int rhs)
Currency operator/ (const Currency &lhs, const Currency &rhs)
Currency operator/ (const Currency &lhs, float rhs)
Currency operator/ (const Currency &lhs, int rhs)
bool operator< (const Currency &lhs, const Currency &rhs)
bool operator< (const Currency &lhs, float rhs)
bool operator< (const Currency &lhs, int rhs)
bool operator> (const Currency &lhs, const Currency &rhs)
bool operator> (const Currency &lhs, float rhs)
bool operator> (const Currency &lhs, int rhs)
bool operator== (const Currency &lhs, const Currency &rhs)
bool operator== (const Currency &lhs, float rhs)
bool operator== (const Currency &lhs, int rhs)
bool operator!= (const Currency &lhs, const Currency &rhs)
bool operator!= (const Currency &lhs, float rhs)
bool operator!= (const Currency &lhs, int rhs)
bool operator<= (const Currency &lhs, const Currency &rhs)
bool operator<= (const Currency &lhs, float rhs)
bool operator<= (const Currency &lhs, int rhs)
bool operator>= (const Currency &lhs, const Currency &rhs)
bool operator>= (const Currency &lhs, float rhs)
bool operator>= (const Currency &lhs, int rhs)
ostream & operator<< (ostream &os, const Currency &rhs)


Detailed Description

Operation with currency values don't work fine with float, double type.

Existing solutions implements fixed point type as a binary shift. This class implements operators in a decimal fixed point (x100) package. This class use only integer type. Example: Float type => 0.3333333 Currency type =>33 (integer) Operators: +,-,*,/,+=,-=,*=,/=,=,==,<,<=,>,>=,!=,(int),(float),(double), (string),<<

Author:
Paulo Pizarro


Constructor & Destructor Documentation

Currency::Currency  
 

Currency::Currency const Currency &   
 

Currency::Currency int    rhs
 

Currency::Currency float    rhs
 

Currency::Currency double    rhs
 

Currency::Currency int    integer,
int    fraction
 

Currency::~Currency  
 


Member Function Documentation

Currency & Currency::operator *= const int    rhs
 

Currency & Currency::operator *= const float    rhs
 

Currency & Currency::operator *= const Currency &    rhs
 

Currency::operator double  
 

Currency::operator float  
 

Currency::operator int  
 

Currency Currency::operator+  
 

Currency & Currency::operator+= const int    rhs
 

Currency & Currency::operator+= const float    rhs
 

Currency & Currency::operator+= const Currency &    rhs
 

Currency Currency::operator-  
 

Currency & Currency::operator-= const int    rhs
 

Currency & Currency::operator-= const float    rhs
 

Currency & Currency::operator-= const Currency &    rhs
 

Currency & Currency::operator/= const int    rhs
 

Currency & Currency::operator/= const float    rhs
 

Currency & Currency::operator/= const Currency &    rhs
 

Currency & Currency::operator= const int    rhs
 

Currency & Currency::operator= const float    rhs
 

Currency & Currency::operator= const Currency &    rhs
 

string Currency::toString  
 


Friends And Related Function Documentation

Currency operator * const Currency &    lhs,
int    rhs
[friend]
 

Currency operator * const Currency &    lhs,
float    rhs
[friend]
 

Currency operator * const Currency &    lhs,
const Currency &    rhs
[friend]
 

bool operator!= const Currency &    lhs,
int    rhs
[friend]
 

bool operator!= const Currency &    lhs,
float    rhs
[friend]
 

bool operator!= const Currency &    lhs,
const Currency &    rhs
[friend]
 

Currency operator+ const Currency &    lhs,
int    rhs
[friend]
 

Currency operator+ const Currency &    lhs,
float    rhs
[friend]
 

Currency operator+ const Currency &    lhs,
const Currency &    rhs
[friend]
 

Currency operator- const Currency &    lhs,
int    rhs
[friend]
 

Currency operator- const Currency &    lhs,
float    rhs
[friend]
 

Currency operator- const Currency &    lhs,
const Currency &    rhs
[friend]
 

Currency operator/ const Currency &    lhs,
int    rhs
[friend]
 

Currency operator/ const Currency &    lhs,
float    rhs
[friend]
 

Currency operator/ const Currency &    lhs,
const Currency &    rhs
[friend]
 

bool operator< const Currency &    lhs,
int    rhs
[friend]
 

bool operator< const Currency &    lhs,
float    rhs
[friend]
 

bool operator< const Currency &    lhs,
const Currency &    rhs
[friend]
 

ostream& operator<< ostream &    os,
const Currency &    rhs
[friend]
 

bool operator<= const Currency &    lhs,
int    rhs
[friend]
 

bool operator<= const Currency &    lhs,
float    rhs
[friend]
 

bool operator<= const Currency &    lhs,
const Currency &    rhs
[friend]
 

bool operator== const Currency &    lhs,
int    rhs
[friend]
 

bool operator== const Currency &    lhs,
float    rhs
[friend]
 

bool operator== const Currency &    lhs,
const Currency &    rhs
[friend]
 

bool operator> const Currency &    lhs,
int    rhs
[friend]
 

bool operator> const Currency &    lhs,
float    rhs
[friend]
 

bool operator> const Currency &    lhs,
const Currency &    rhs
[friend]
 

bool operator>= const Currency &    lhs,
int    rhs
[friend]
 

bool operator>= const Currency &    lhs,
float    rhs
[friend]
 

bool operator>= const Currency &    lhs,
const Currency &    rhs
[friend]
 


Member Data Documentation

int Currency::value
 


The documentation for this class was generated from the following files:
Generated on Mon Aug 9 09:25:34 2004 by doxygen1.2.18