currency.hpp File Reference

#include <iomanip>
#include <istream>
#include <locale>
#include <ostream>
#include <sstream>
#include <string>
#include <stdexcept>
#include "ioflags.hpp"
#include "fixed.hpp"
#include "rational.hpp"

Go to the source code of this file.

Classes

class  currency< T, N >

Functions

template<class T, int N, class Char, class Traits>
std::basic_istream
< Char, Traits > & 
operator>> (std::basic_istream< Char, Traits > &strm, currency< T, N > &c)
template<class T, int N, class Char, class Traits>
std::basic_ostream
< Char, Traits > & 
operator<< (std::basic_ostream< Char, Traits > &strm, currency< T, N > c)
template<class T, int N>
currency< T, N > operator- (currency< T, N > a)
 Negate a currency value.
template<class T, int N>
currency< T, N > operator+ (currency< T, N > a, currency< T, N > b)
template<class T, int N>
currency< T, N > operator- (currency< T, N > a, currency< T, N > b)
template<class T, int N>
currency< T, N > operator * (currency< T, N > a, T b)
template<class T, int N>
currency< T, N > operator * (T a, currency< T, N > b)
template<class T, int N>
currency< T, N > operator/ (currency< T, N > a, T b)
template<class T, int N>
rational< T > operator/ (currency< T, N > n, currency< T, N > d)
template<class T, int N>
bool operator== (currency< T, N > a, currency< T, N > b)
template<class T, int N>
bool operator== (currency< T, N > a, T b)
template<class T, int N>
bool operator== (T a, currency< T, N > b)
template<class T, int N>
bool operator!= (currency< T, N > a, currency< T, N > b)
template<class T, int N>
bool operator!= (currency< T, N > a, T b)
template<class T, int N>
bool operator!= (T a, currency< T, N > b)
template<class T, int N>
bool operator< (currency< T, N > a, currency< T, N > b)
template<class T, int N>
bool operator< (currency< T, N > a, T b)
template<class T, int N>
bool operator< (T a, currency< T, N > b)
template<class T, int N>
bool operator> (currency< T, N > a, currency< T, N > b)
template<class T, int N>
bool operator> (currency< T, N > a, T b)
template<class T, int N>
bool operator> (T a, currency< T, N > b)
template<class T, int N>
bool operator<= (currency< T, N > a, currency< T, N > b)
template<class T, int N>
bool operator<= (currency< T, N > a, T b)
template<class T, int N>
bool operator<= (T a, currency< T, N > b)
template<class T, int N>
bool operator>= (currency< T, N > a, currency< T, N > b)
template<class T, int N>
bool operator>= (currency< T, N > a, T b)
template<class T, int N>
bool operator>= (T a, currency< T, N > b)


Detailed Description

Implement a currency type.

Definition in file currency.hpp.


Function Documentation

template<class T, int N>
currency<T,N> operator * ( a,
currency< T, N >  b 
) [inline]

Multiply currency value and an integer

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 314 of file currency.hpp.

template<class T, int N>
currency<T,N> operator * ( currency< T, N >  a,
b 
) [inline]

Multiply currency value and an integer

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 304 of file currency.hpp.

template<class T, int N>
bool operator!= ( a,
currency< T, N >  b 
) [inline]

Compare currency value and an integer for inequality

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 387 of file currency.hpp.

template<class T, int N>
bool operator!= ( currency< T, N >  a,
b 
) [inline]

Compare currency value and an integer for inequality

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 379 of file currency.hpp.

template<class T, int N>
bool operator!= ( currency< T, N >  a,
currency< T, N >  b 
) [inline]

Compare currency values for inequality.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 371 of file currency.hpp.

template<class T, int N>
currency<T,N> operator+ ( currency< T, N >  a,
currency< T, N >  b 
) [inline]

Add currency values

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 284 of file currency.hpp.

template<class T, int N>
currency<T,N> operator- ( currency< T, N >  a,
currency< T, N >  b 
) [inline]

Subtract currency values

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 294 of file currency.hpp.

template<class T, int N>
rational<T> operator/ ( currency< T, N >  n,
currency< T, N >  d 
) [inline]

Divide currency values to yield a rational result.

Parameters:
n the numerator
d the denominator

Definition at line 334 of file currency.hpp.

References fixed< T, N >::value(), and currency< T, N >::value().

template<class T, int N>
currency<T,N> operator/ ( currency< T, N >  a,
b 
) [inline]

Divide currency value by an integer

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 324 of file currency.hpp.

template<class T, int N>
bool operator< ( a,
currency< T, N >  b 
) [inline]

Compare a currency value and an integer for less-than.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 412 of file currency.hpp.

template<class T, int N>
bool operator< ( currency< T, N >  a,
b 
) [inline]

Compare a currency value and an integer for less-than.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 404 of file currency.hpp.

template<class T, int N>
bool operator< ( currency< T, N >  a,
currency< T, N >  b 
) [inline]

Compare currency values for less-than by comparing the underlying values.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 396 of file currency.hpp.

template<class T, int N, class Char, class Traits>
std::basic_ostream<Char, Traits>& operator<< ( std::basic_ostream< Char, Traits > &  strm,
currency< T, N >  c 
) [inline]

Write a currency value

Parameters:
strm The output stream
c The value to write

Definition at line 265 of file currency.hpp.

template<class T, int N>
bool operator<= ( a,
currency< T, N >  b 
) [inline]

Compare a currency value and an integer for less-than-or-equal.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 462 of file currency.hpp.

template<class T, int N>
bool operator<= ( currency< T, N >  a,
b 
) [inline]

Compare a currency value and an integer for less-than-or-equal.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 454 of file currency.hpp.

template<class T, int N>
bool operator<= ( currency< T, N >  a,
currency< T, N >  b 
) [inline]

Compare currency values for less-than-or-equal.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 446 of file currency.hpp.

template<class T, int N>
bool operator== ( a,
currency< T, N >  b 
) [inline]

Compare currency value and an integer for equality

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 362 of file currency.hpp.

References currency< T, N >::value().

template<class T, int N>
bool operator== ( currency< T, N >  a,
b 
) [inline]

Compare currency value and an integer for equality

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 354 of file currency.hpp.

References currency< T, N >::value().

template<class T, int N>
bool operator== ( currency< T, N >  a,
currency< T, N >  b 
) [inline]

Compare currency values for equality by comparing the underlying values.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 346 of file currency.hpp.

References currency< T, N >::value().

template<class T, int N>
bool operator> ( a,
currency< T, N >  b 
) [inline]

Compare a currency value and an integer for greater-than.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 437 of file currency.hpp.

template<class T, int N>
bool operator> ( currency< T, N >  a,
b 
) [inline]

Compare a currency value and an integer for greater-than.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 429 of file currency.hpp.

template<class T, int N>
bool operator> ( currency< T, N >  a,
currency< T, N >  b 
) [inline]

Compare currency values for greater-than.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 421 of file currency.hpp.

template<class T, int N>
bool operator>= ( a,
currency< T, N >  b 
) [inline]

Compare a currency value and an integer for greater-than-or-equal.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 487 of file currency.hpp.

template<class T, int N>
bool operator>= ( currency< T, N >  a,
b 
) [inline]

Compare a currency value and an integer for greater-than-or-equal.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 479 of file currency.hpp.

template<class T, int N>
bool operator>= ( currency< T, N >  a,
currency< T, N >  b 
) [inline]

Compare currency values for greater-than-or-equal.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 471 of file currency.hpp.

template<class T, int N, class Char, class Traits>
std::basic_istream<Char, Traits>& operator>> ( std::basic_istream< Char, Traits > &  strm,
currency< T, N > &  c 
) [inline]

Read a currency value

Parameters:
strm The input stream
[out] c Store the value here

Definition at line 254 of file currency.hpp.

References currency< T, N >::read().


Generated on Sun Nov 30 10:03:13 2008 for Project 3 - Currency Type by  doxygen 1.5.3