A repository for currency information. More...
#include <rw/currency/currency.h>
Static Public Attributes | |
static const RWDate | noExpirationDate |
static const RWDate | noIntroductionDate |
Friends | |
bool | operator== (const RWCurrency &a, const RWCurrency &b) |
Related Functions | |
(Note that these are not member functions.) | |
RWvostream & | operator<< (RWvostream &s, const RWCurrency &c) |
RWFile & | operator<< (RWFile &f, const RWCurrency &c) |
RWvistream & | operator>> (RWvistream &s, RWCurrency &c) |
RWFile & | operator>> (RWFile &f, RWCurrency &c) |
The RWCurrency class provides a repository for the following currency information:
If you omit the introduction date and the expiration date when constructing an RWCurrency object, the constructor assigns them values of the public static data members RWCurrency::noIntroductionDate and RWCurrency::noExpirationDate, respectively.
RWCurrency::RWCurrency | ( | ) |
Default constructor.
RWCurrency::RWCurrency | ( | const RWCurrency & | ) |
Copy constructor.
RWCurrency::RWCurrency | ( | const RWCString & | mnemonic, |
int | code, | ||
const RWCString & | name, | ||
const RWCString & | fractionName, | ||
double | wholeToFractRatio | ||
) |
Constructs an RWCurrency with the given information. The introduction and expiration dates are assigned RWCurrency::noIntroductionDate and RWCurrency::noExpirationDate, respectively.
RWCurrency::RWCurrency | ( | const RWCString & | mnemonic, |
int | code, | ||
const RWCString & | name, | ||
const RWCString & | fractionName, | ||
double | wholeToFractRatio, | ||
const RWDate & | introDate, | ||
const RWDate & | expDate | ||
) |
Constructs an RWCurrency with the given information.
|
inline |
Returns the currency's numeric code.
|
inline |
Returns a currency's expiration date. A return value of RWCurrency::noExpirationDate indicates there is no expiration date.
|
inline |
Returns the currency's fraction name.
bool RWCurrency::hasExpired | ( | ) | const |
Returns true
if today's date is beyond the currency's expiration date.
|
inline |
Returns a currency's introduction date. A return value of RWCurrency::noIntroductionDate indicates there is no introduction date.
bool RWCurrency::isActive | ( | ) | const |
Returns true
if today's date lies between the introduction date and the expiration date.
|
inline |
Returns the currency's mnemonic.
|
inline |
Returns the currency's name.
RWCurrency& RWCurrency::operator= | ( | const RWCurrency & | ) |
Assignment operator.
void RWCurrency::restoreFrom | ( | RWvistream & | ) |
Restores the currency from a virtual stream.
void RWCurrency::saveOn | ( | RWvostream & | ) | const |
Persists the currency to a virtual stream.
|
inline |
Sets the currency's numeric code to c.
|
inline |
Sets a currency's expiration date. Note that this can be a date in the past.
|
inline |
Sets the currency's fraction name to fn.
|
inline |
Sets a currency's introduction date. Note that this can be a date in the past.
|
inline |
Sets the currency's mnemonic to m.
|
inline |
Sets the currency's name to n.
|
inline |
Sets the ratio between one unit of the whole part of the currency and the smallest unit of the fractional part of the currency to r.
|
inline |
Returns the ratio between one unit of the whole part of the currency and the smallest unit of the fractional part of the currency
|
related |
Saves the currency object to a virtual stream.
|
related |
Saves the currency object to an RWFile.
|
friend |
Returns true
if and only if all data members are equal.
|
related |
Restores a currency object from a virtual stream.
|
related |
Restores a currency object from an RWFile.
|
static |
These data members provide a way to deal with currencies that do not have introduction or expiration dates. The data member noIntroductionDate represents a date that is "before the beginning of time." Similarly, noExpirationDate represents a date that is "after the end of time." If you omit the introduction date and the expiration date when constructing an RWCurrency object, the constructor assigns these values. You can also use them in applications to determine whether specific introduction or expiration dates occur. The following example shows how they are used:
|
static |
These data members provide a way to deal with currencies that do not have introduction or expiration dates. The data member noIntroductionDate represents a date that is "before the beginning of time." Similarly, noExpirationDate represents a date that is "after the end of time." If you omit the introduction date and the expiration date when constructing an RWCurrency object, the constructor assigns these values. You can also use them in applications to determine whether specific introduction or expiration dates occur. The following example shows how they are used:
Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |