ICU 73.2  73.2
Public Member Functions | Static Public Member Functions
icu::CurrencyAmount Class Reference

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

#include <curramt.h>

Inheritance diagram for icu::CurrencyAmount:
icu::Measure icu::UObject icu::UMemory

Public Member Functions

 CurrencyAmount (const Formattable &amount, ConstChar16Ptr isoCode, UErrorCode &ec)
 Construct an object with the given numeric amount and the given ISO currency code.
 CurrencyAmount (double amount, ConstChar16Ptr isoCode, UErrorCode &ec)
 Construct an object with the given numeric amount and the given ISO currency code.
 CurrencyAmount (const CurrencyAmount &other)
 Copy constructor.
CurrencyAmountoperator= (const CurrencyAmount &other)
 Assignment operator.
virtual CurrencyAmountclone () const override
 Return a polymorphic clone of this object.
virtual ~CurrencyAmount ()
 Destructor.
virtual UClassID getDynamicClassID () const override
 Returns a unique class ID for this object POLYMORPHICALLY.
const CurrencyUnitgetCurrency () const
 Return the currency unit object of this object.
const char16_t * getISOCurrency () const
 Return the ISO currency code of this object.

Static Public Member Functions

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

Detailed Description

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

Author:
Alan Liu
Stable:
ICU 3.0

Definition at line 39 of file curramt.h.


Constructor & Destructor Documentation

icu::CurrencyAmount::CurrencyAmount ( const Formattable amount,
ConstChar16Ptr  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 nullptr 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
icu::CurrencyAmount::CurrencyAmount ( double  amount,
ConstChar16Ptr  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 nullptr 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

Copy constructor.

Stable:
ICU 3.0
virtual icu::CurrencyAmount::~CurrencyAmount ( ) [virtual]

Destructor.

Stable:
ICU 3.0

Member Function Documentation

virtual CurrencyAmount* icu::CurrencyAmount::clone ( ) const [override, virtual]

Return a polymorphic clone of this object.

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

Stable:
ICU 3.0

Reimplemented from icu::Measure.

Return the currency unit object of this object.

Stable:
ICU 3.0
virtual UClassID icu::CurrencyAmount::getDynamicClassID ( ) const [override, 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

Reimplemented from icu::Measure.

const char16_t * icu::CurrencyAmount::getISOCurrency ( ) const [inline]

Return the ISO currency code of this object.

Stable:
ICU 3.0

Definition at line 123 of file curramt.h.

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

Reimplemented from icu::Measure.

CurrencyAmount& icu::CurrencyAmount::operator= ( const CurrencyAmount other)

Assignment operator.

Stable:
ICU 3.0

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