icu::CurrencyUnit Class Reference

A unit of currency, such as USD (U.S. More...

#include <currunit.h>

Inheritance diagram for icu::CurrencyUnit:
icu::MeasureUnit icu::UObject icu::UMemory

Public Member Functions

 CurrencyUnit ()
 Default constructor.
 CurrencyUnit (ConstChar16Ptr isoCode, UErrorCode &ec)
 Construct an object with the given ISO currency code.
 CurrencyUnit (StringPiece isoCode, UErrorCode &ec)
 Construct an object with the given ISO currency code.
 CurrencyUnit (const CurrencyUnit &other)
 Copy constructor.
 CurrencyUnit (const MeasureUnit &measureUnit, UErrorCode &ec)
 Copy constructor from MeasureUnit.
CurrencyUnitoperator= (const CurrencyUnit &other)
 Assignment operator.
virtual UObjectclone () const
 Return a polymorphic clone of this object.
virtual ~CurrencyUnit ()
 Destructor.
virtual UClassID getDynamicClassID () const
 Returns a unique class ID for this object POLYMORPHICALLY.
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 unit of currency, such as USD (U.S.

dollars) or JPY (Japanese yen). This class is a thin wrapper over a char16_t string that subclasses MeasureUnit, for use with Measure and MeasureFormat.

Author:
Alan Liu
Stable:
ICU 3.0

Definition at line 37 of file currunit.h.


Constructor & Destructor Documentation

icu::CurrencyUnit::CurrencyUnit (  ) 

Default constructor.

Initializes currency code to "XXX" (no currency).

Stable:
ICU 60
icu::CurrencyUnit::CurrencyUnit ( ConstChar16Ptr  isoCode,
UErrorCode ec 
)

Construct an object with the given ISO currency code.

Parameters:
isoCode the 3-letter ISO 4217 currency code; must have length 3 and need not be NUL-terminated. If NULL, the currency is initialized to the unknown currency XXX.
ec input-output error code. If the isoCode is invalid, then this will be set to a failing value.
Stable:
ICU 3.0
icu::CurrencyUnit::CurrencyUnit ( StringPiece  isoCode,
UErrorCode ec 
)

Construct an object with the given ISO currency code.

Parameters:
isoCode the 3-letter ISO 4217 currency code; must have length 3. If invalid, the currency is initialized to XXX.
ec input-output error code. If the isoCode is invalid, then this will be set to a failing value.
Draft:
This API may be changed in the future versions and was introduced in ICU 64
icu::CurrencyUnit::CurrencyUnit ( const CurrencyUnit other  ) 

Copy constructor.

Stable:
ICU 3.0
icu::CurrencyUnit::CurrencyUnit ( const MeasureUnit measureUnit,
UErrorCode ec 
)

Copy constructor from MeasureUnit.

This constructor allows you to restore a CurrencyUnit that was sliced to MeasureUnit.

Parameters:
measureUnit The MeasureUnit to copy from.
ec Set to a failing value if the MeasureUnit is not a currency.
Stable:
ICU 60
virtual icu::CurrencyUnit::~CurrencyUnit (  )  [virtual]

Destructor.

Stable:
ICU 3.0

Member Function Documentation

virtual UObject* icu::CurrencyUnit::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

Reimplemented from icu::MeasureUnit.

virtual UClassID icu::CurrencyUnit::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

Reimplemented from icu::MeasureUnit.

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

Return the ISO currency code of this object.

Stable:
ICU 3.0

Definition at line 136 of file currunit.h.

Referenced by icu::CurrencyAmount::getISOCurrency().

static UClassID icu::CurrencyUnit::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

Reimplemented from icu::MeasureUnit.

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

Assignment operator.

Stable:
ICU 3.0

Reimplemented from icu::MeasureUnit.


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

Generated on 1 Jul 2019 for ICU 64.2 by  doxygen 1.6.1