SourcePro® 2024.1 |
SourcePro® API Reference Guide |
Encapsulates a source currency, a target currency, and a conversion factor, which is, by convention, a multiplicative conversion factor. More...
#include <rw/currency/exchgrate.h>
Public Member Functions | |
RWExchangeRate () | |
RWExchangeRate (const RWCString &sourceMnemonic, const RWCString &targetMnemonic, double rate) | |
RWExchangeRate (const RWExchangeRate &r) | |
double | conversionFactor () const |
RWExchangeRate & | operator= (const RWExchangeRate &r) |
void | restoreFrom (RWFile &) |
void | restoreFrom (RWvistream &) |
void | saveOn (RWFile &) const |
void | saveOn (RWvostream &) const |
void | setConversionFactor (double factor) |
void | setSource (const RWCString &mnemonic) |
void | setTarget (const RWCString &mnemonic) |
RWCString | source () const |
RWCString | target () const |
Related Symbols | |
(Note that these are not member symbols.) | |
RWFile & | operator<< (RWFile &f, const RWExchangeRate &r) |
RWvostream & | operator<< (RWvostream &s, const RWExchangeRate &r) |
bool | operator== (const RWExchangeRate &a, const RWExchangeRate &b) |
RWFile & | operator>> (RWFile &f, RWExchangeRate &r) |
RWvistream & | operator>> (RWvistream &s, RWExchangeRate &r) |
Class RWExchangeRate encapsulates a source currency, a target currency, and a conversion factor, which is, by convention, a multiplicative conversion factor. This means that the source currency amount is multiplied by the conversion factor to obtain the equivalent amount in the target currency. Source and target currencies are stored by their mnemonics and the conversion factor is stored as a double precision floating point number.
|
inline |
Default constructor. The source and target are set to null strings and the rate is set to zero.
RWExchangeRate::RWExchangeRate | ( | const RWExchangeRate & | r | ) |
Copy constructor. Contents of r are copied to self.
RWExchangeRate::RWExchangeRate | ( | const RWCString & | sourceMnemonic, |
const RWCString & | targetMnemonic, | ||
double | rate ) |
Constructs an exchange rate object with the given information. The source currency mnemonic is contained in sourceMnemonic, the target mnemonic is contained in targetMnemonic, and the multiplicative conversion factor is contained in rate.
|
inline |
Returns the multiplicative conversion factor for converting money from source currency to target currency.
RWExchangeRate & RWExchangeRate::operator= | ( | const RWExchangeRate & | r | ) |
Assignment operator. Assigns contents of r to self.
void RWExchangeRate::restoreFrom | ( | RWvistream & | ) |
Restore from a virtual stream.
void RWExchangeRate::saveOn | ( | RWvostream & | ) | const |
Persist to a virtual stream.
|
inline |
Sets the multiplicative conversion factor for converting money from source currency to target currency to factor.
|
inline |
Sets the source mnemonic to mnemonic.
|
inline |
Sets the target mnemonic to mnemonic.
|
inline |
Returns the mnemonic for the source currency.
|
inline |
Returns the mnemonic for the target currency.
|
related |
Saves the object to a RWFile.
|
related |
Saves the object to a virtual stream.
|
friend |
Returns true
if a and b have the same source mnemonic, target mnemonic, and conversion factor. Returns false
if not. The comparison of the source and target mnemonics is case insensitive.
|
related |
Restores a object from a RWFile.
|
related |
Restores a object from a virtual stream.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |