Member Functions | |||
conversionFactor() operator>>() operator<<() |
operator=() operator==() restoreFrom() |
saveOn() setconversionFactor() setSource() |
setTarget() source() target() |
#include <rw/money/exchgrate.h> RWExchangeRate r("USD", "INR",42.254);
com.roguewave.money.currency.v1_0.ExchangeRate
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.
RWExchangeRate();
Default constructor. The source and target are set to null strings and the rate is set to zero.
RWExchangeRate(const RWCString& sourceMnemonic, const RWCString& targetMnemonic, double f);
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 f.
RWExchangeRate(const RWEXchangeRate& r);
Copy constructor. Contents of r are copied to self.
RWExchangeRate& operator=(const RWExchangeRate& r);
Assignment operator. Assigns contents of r to self.
double conversionFactor() const;
Returns the multiplicative conversion factor for converting money from source currency to target currency.
void restoreFrom(RWFile&);
Restore from an RWFile.
void restoreFrom(RWvistream&);
Restore from a virtual stream.
void saveOn(RWFile&) const;
Persist to an RWFile.
void saveOn(RWvostream&) const;
Persist to a virtual stream.
void setconversionFactor(double factor);
Sets the multiplicative conversion factor for converting money from source currency to target currency to factor.
void setSource(const RWCString& mnemonic);
Sets the source mnemonic to mnemonic.
void setTarget(const RWCString& mnemonic);
Sets the target mnemonic to mnemonic.
RWCString source() const;
Returns the mnemonic for the source currency.
RWCString target() const;
Returns the mnemonic for the target currency.
RWBoolean operator==(const RWExchangeRate& lhs, const RWEXchangeRate& rhs);
Returns TRUE if lhs and rhs 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.
RWvostream& operator<<(RWvostream& strm, const RWExchangeRate& r); RWFile& operator<<(RWFile& file, const RWExchangeRate& r);
Saves the object to a virtual stream or RWFile, respectively.
RWvistream& operator>>(RWvistream& strm, const RWExchangeRate& r); RWFile& operator>>(RWFile& strm, const RWExchangeRate& r);
Restores a object from a virtual stream or RWFile, respectively.
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.