ICU 4.8.1.1  4.8.1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
CurrencyAmount Class Reference

A currency together with a numeric amount, such as 200 USD. More...

#include <curramt.h>

Inheritance diagram for CurrencyAmount:
Measure UObject UMemory

Public Member Functions

 CurrencyAmount (const Formattable &amount, const UChar *isoCode, UErrorCode &ec)
 Construct an object with the given numeric amount and the given ISO currency code. More...
 
 CurrencyAmount (double amount, const UChar *isoCode, UErrorCode &ec)
 Construct an object with the given numeric amount and the given ISO currency code. More...
 
 CurrencyAmount (const CurrencyAmount &other)
 Copy constructor. More...
 
CurrencyAmountoperator= (const CurrencyAmount &other)
 Assignment operator. More...
 
virtual UObjectclone () const
 Return a polymorphic clone of this object. More...
 
virtual ~CurrencyAmount ()
 Destructor. More...
 
virtual UClassID getDynamicClassID () const
 Returns a unique class ID for this object POLYMORPHICALLY. More...
 
const CurrencyUnitgetCurrency () const
 Return the currency unit object of this object. More...
 
const UChargetISOCurrency () const
 Return the ISO currency code of this object. More...
 
- Public Member Functions inherited from Measure
 Measure (const Formattable &number, MeasureUnit *adoptedUnit, UErrorCode &ec)
 Construct an object with the given numeric amount and the given unit. More...
 
 Measure (const Measure &other)
 Copy constructor. More...
 
Measureoperator= (const Measure &other)
 Assignment operator. More...
 
virtual ~Measure ()
 Destructor. More...
 
UBool operator== (const UObject &other) const
 Equality operator. More...
 
const FormattablegetNumber () const
 Return a reference to the numeric value of this object. More...
 
const MeasureUnitgetUnit () const
 Return a reference to the unit of this object. More...
 
- Public Member Functions inherited from UObject
virtual ~UObject ()
 Destructor. More...
 

Static Public Member Functions

static UClassID getStaticClassID ()
 Returns the class ID for this class. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Measure
 Measure ()
 Default constructor. More...
 

Detailed Description

A currency together with a numeric amount, such as 200 USD.

Author
Alan Liu
Stable:
ICU 3.0

Definition at line 35 of file curramt.h.

Constructor & Destructor Documentation

CurrencyAmount::CurrencyAmount ( const Formattable amount,
const UChar isoCode,
UErrorCode ec 
)

Construct an object with the given numeric amount and the given ISO currency code.

Parameters
amounta numeric object; amount.isNumeric() must be TRUE
isoCodethe 3-letter ISO 4217 currency code; must not be NULL and must have length 3
ecinput-output error code. If the amount or the isoCode is invalid, then this will be set to a failing value.
Stable:
ICU 3.0
CurrencyAmount::CurrencyAmount ( double  amount,
const UChar isoCode,
UErrorCode ec 
)

Construct an object with the given numeric amount and the given ISO currency code.

Parameters
amountthe amount of the given currency
isoCodethe 3-letter ISO 4217 currency code; must not be NULL and must have length 3
ecinput-output error code. If the isoCode is invalid, then this will be set to a failing value.
Stable:
ICU 3.0
CurrencyAmount::CurrencyAmount ( const CurrencyAmount other)

Copy constructor.

Stable:
ICU 3.0
virtual CurrencyAmount::~CurrencyAmount ( )
virtual

Destructor.

Stable:
ICU 3.0

Member Function Documentation

virtual UObject* CurrencyAmount::clone ( ) const
virtual

Return a polymorphic clone of this object.

The result will have the same class as returned by getDynamicClassID().

Stable:
ICU 3.0

Implements Measure.

const CurrencyUnit & CurrencyAmount::getCurrency ( ) const
inline

Return the currency unit object of this object.

Stable:
ICU 3.0

Definition at line 119 of file curramt.h.

References Measure::getUnit().

Referenced by getISOCurrency().

virtual UClassID CurrencyAmount::getDynamicClassID ( ) const
virtual

Returns a unique class ID for this object POLYMORPHICALLY.

This method implements a simple form of RTTI used by ICU.

Returns
The class ID for this object. All objects of a given class have the same class ID. Objects of other classes have different class IDs.
Stable:
ICU 3.0

Implements UObject.

const UChar * CurrencyAmount::getISOCurrency ( ) const
inline

Return the ISO currency code of this object.

Stable:
ICU 3.0

Definition at line 123 of file curramt.h.

References getCurrency(), and CurrencyUnit::getISOCurrency().

static UClassID CurrencyAmount::getStaticClassID ( )
static

Returns the class ID for this class.

This is used to compare to the return value of getDynamicClassID().

Returns
The class ID for all objects of this class.
Stable:
ICU 3.0
CurrencyAmount& CurrencyAmount::operator= ( const CurrencyAmount other)

Assignment operator.

Stable:
ICU 3.0

The documentation for this class was generated from the following file: