Project 3 - Currency Type
|
#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) |
Implement a currency type.
Definition in file currency.hpp.
Compare currency values for inequality.
a | The left-hand operand |
b | The right-hand operand |
Definition at line 391 of file currency.hpp.
|
inline |
Compare currency value and an integer for inequality
a | The left-hand operand |
b | The right-hand operand |
Definition at line 399 of file currency.hpp.
|
inline |
Compare currency value and an integer for inequality
a | The left-hand operand |
b | The right-hand operand |
Definition at line 407 of file currency.hpp.
Multiply currency value and an integer
a | The left-hand operand |
b | The right-hand operand |
Definition at line 324 of file currency.hpp.
Multiply currency value and an integer
a | The left-hand operand |
b | The right-hand operand |
Definition at line 334 of file currency.hpp.
Add currency values
a | The left-hand operand |
b | The right-hand operand |
Definition at line 304 of file currency.hpp.
Subtract currency values
a | The left-hand operand |
b | The right-hand operand |
Definition at line 314 of file currency.hpp.
Divide currency value by an integer
a | The left-hand operand |
b | The right-hand operand |
Definition at line 344 of file currency.hpp.
Divide currency values to yield a rational result.
n | the numerator |
d | the denominator |
Definition at line 354 of file currency.hpp.
References fixed< T, N >::value(), and currency< T, N >::value().
Compare currency values for less-than by comparing the underlying values.
a | The left-hand operand |
b | The right-hand operand |
Definition at line 416 of file currency.hpp.
References fixed< T, N >::value(), and currency< T, N >::value().
bool operator< | ( | currency< T, N > | a, |
T | b | ||
) |
Compare a currency value and an integer for less-than.
a | The left-hand operand |
b | The right-hand operand |
Definition at line 424 of file currency.hpp.
bool operator< | ( | T | a, |
currency< T, N > | b | ||
) |
Compare a currency value and an integer for less-than.
a | The left-hand operand |
b | The right-hand operand |
Definition at line 432 of file currency.hpp.
std::basic_ostream<Char, Traits>& operator<< | ( | std::basic_ostream< Char, Traits > & | strm, |
currency< T, N > | c | ||
) |
Write a currency value
strm | The output stream |
c | The value to write |
Definition at line 285 of file currency.hpp.
Compare currency values for less-than-or-equal.
a | The left-hand operand |
b | The right-hand operand |
Definition at line 466 of file currency.hpp.
|
inline |
Compare a currency value and an integer for less-than-or-equal.
a | The left-hand operand |
b | The right-hand operand |
Definition at line 474 of file currency.hpp.
|
inline |
Compare a currency value and an integer for less-than-or-equal.
a | The left-hand operand |
b | The right-hand operand |
Definition at line 482 of file currency.hpp.
Compare currency values for equality by comparing the underlying values.
a | The left-hand operand |
b | The right-hand operand |
Definition at line 366 of file currency.hpp.
References currency< T, N >::value().
bool operator== | ( | currency< T, N > | a, |
T | b | ||
) |
Compare currency value and an integer for equality
a | The left-hand operand |
b | The right-hand operand |
Definition at line 374 of file currency.hpp.
References currency< T, N >::value().
bool operator== | ( | T | a, |
currency< T, N > | b | ||
) |
Compare currency value and an integer for equality
a | The left-hand operand |
b | The right-hand operand |
Definition at line 382 of file currency.hpp.
References currency< T, N >::value().
Compare currency values for greater-than.
a | The left-hand operand |
b | The right-hand operand |
Definition at line 441 of file currency.hpp.
|
inline |
Compare a currency value and an integer for greater-than.
a | The left-hand operand |
b | The right-hand operand |
Definition at line 449 of file currency.hpp.
|
inline |
Compare a currency value and an integer for greater-than.
a | The left-hand operand |
b | The right-hand operand |
Definition at line 457 of file currency.hpp.
Compare currency values for greater-than-or-equal.
a | The left-hand operand |
b | The right-hand operand |
Definition at line 491 of file currency.hpp.
|
inline |
Compare a currency value and an integer for greater-than-or-equal.
a | The left-hand operand |
b | The right-hand operand |
Definition at line 499 of file currency.hpp.
|
inline |
Compare a currency value and an integer for greater-than-or-equal.
a | The left-hand operand |
b | The right-hand operand |
Definition at line 507 of file currency.hpp.
std::basic_istream<Char, Traits>& operator>> | ( | std::basic_istream< Char, Traits > & | strm, |
currency< T, N > & | c | ||
) |
Read a currency value
strm | The input stream | |
[out] | c | Store the value here |
Definition at line 274 of file currency.hpp.
References currency< T, N >::read().