ICU 60.2 60.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Class Hierarchy
- Data Fields

Public Member Functions | Static Public Member Functions
icu::CurrencyUnit Class Reference

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

`#include <currunit.h>`

Inheritance diagram for icu::CurrencyUnit:

## Public Member Functions
| CurrencyUnit ()
| Default constructor. More...
| CurrencyUnit (ConstChar16Ptr isoCode, UErrorCode &ec)
| Construct an object with the given ISO currency code. More...
| CurrencyUnit (const CurrencyUnit &other)
| Copy constructor. More...
| CurrencyUnit (const MeasureUnit &measureUnit, UErrorCode &ec)
| Copy constructor from MeasureUnit. More...
CurrencyUnit & | operator= (const CurrencyUnit &other)
| Assignment operator. More...
virtual UObject * | clone () const
| Return a polymorphic clone of this object. More...
virtual | ~CurrencyUnit ()
| Destructor. More...
virtual UClassID | getDynamicClassID () const
| Returns a unique class ID for this object POLYMORPHICALLY. More...
const char16_t * | getISOCurrency () const
| Return the ISO currency code of this object. More...
Public Member Functions inherited from icu::MeasureUnit
| MeasureUnit ()
| Default constructor. More...
| MeasureUnit (const MeasureUnit &other)
| Copy constructor. More...
MeasureUnit & | operator= (const MeasureUnit &other)
| Assignment operator. More...
virtual | ~MeasureUnit ()
| Destructor. More...
virtual UBool | operator== (const UObject &other) const
| Equality operator. More...
UBool | operator!= (const UObject &other) const
| Inequality operator. More...
const char * | getType () const
| Get the type. More...
const char * | getSubtype () const
| Get the sub type. More...
int32_t | getIndex () const
| ICU use only. More...
Public Member Functions inherited from icu::UObject
virtual | ~UObject ()
| Destructor. More...

## Static Public Member Functions
static UClassID | getStaticClassID ()
| Returns the class ID for this class. More...
Static Public Member Functions inherited from icu::MeasureUnit
static int32_t | getAvailable (MeasureUnit *destArray, int32_t destCapacity, UErrorCode &errorCode)
| getAvailable gets all of the available units. More...
static int32_t | getAvailable (const char *type, MeasureUnit *destArray, int32_t destCapacity, UErrorCode &errorCode)
| getAvailable gets all of the available units for a specific type. More...
static StringEnumeration * | getAvailableTypes (UErrorCode &errorCode)
| getAvailableTypes gets all of the available types. More...
static UClassID | getStaticClassID (void)
| Return the class ID for this class. More...
static int32_t | getIndexCount ()
| ICU use only. More...
static int32_t | internalGetIndexForTypeAndSubtype (const char *type, const char *subtype)
| ICU use only. More...
static MeasureUnit * | resolveUnitPerUnit (const MeasureUnit &unit, const MeasureUnit &perUnit)
| ICU use only. More...
static MeasureUnit * | createGForce (UErrorCode &status)
| Returns unit of acceleration: g-force. More...
static MeasureUnit * | createMeterPerSecondSquared (UErrorCode &status)
| Returns unit of acceleration: meter-per-second-squared. More...
static MeasureUnit * | createArcMinute (UErrorCode &status)
| Returns unit of angle: arc-minute. More...
static MeasureUnit * | createArcSecond (UErrorCode &status)
| Returns unit of angle: arc-second. More...
static MeasureUnit * | createDegree (UErrorCode &status)
| Returns unit of angle: degree. More...
static MeasureUnit * | createRadian (UErrorCode &status)
| Returns unit of angle: radian. More...
static MeasureUnit * | createRevolutionAngle (UErrorCode &status)
| Returns unit of angle: revolution. More...
static MeasureUnit * | createAcre (UErrorCode &status)
| Returns unit of area: acre. More...
static MeasureUnit * | createHectare (UErrorCode &status)
| Returns unit of area: hectare. More...
static MeasureUnit * | createSquareCentimeter (UErrorCode &status)
| Returns unit of area: square-centimeter. More...
static MeasureUnit * | createSquareFoot (UErrorCode &status)
| Returns unit of area: square-foot. More...
static MeasureUnit * | createSquareInch (UErrorCode &status)
| Returns unit of area: square-inch. More...
static MeasureUnit * | createSquareKilometer (UErrorCode &status)
| Returns unit of area: square-kilometer. More...
static MeasureUnit * | createSquareMeter (UErrorCode &status)
| Returns unit of area: square-meter. More...
static MeasureUnit * | createSquareMile (UErrorCode &status)
| Returns unit of area: square-mile. More...
static MeasureUnit * | createSquareYard (UErrorCode &status)
| Returns unit of area: square-yard. More...
static MeasureUnit * | createKarat (UErrorCode &status)
| Returns unit of concentr: karat. More...
static MeasureUnit * | createMilligramPerDeciliter (UErrorCode &status)
| Returns unit of concentr: milligram-per-deciliter. More...
static MeasureUnit * | createMillimolePerLiter (UErrorCode &status)
| Returns unit of concentr: millimole-per-liter. More...
static MeasureUnit * | createPartPerMillion (UErrorCode &status)
| Returns unit of concentr: part-per-million. More...
static MeasureUnit * | createLiterPer100Kilometers (UErrorCode &status)
| Returns unit of consumption: liter-per-100kilometers. More...
static MeasureUnit * | createLiterPerKilometer (UErrorCode &status)
| Returns unit of consumption: liter-per-kilometer. More...
static MeasureUnit * | createMilePerGallon (UErrorCode &status)
| Returns unit of consumption: mile-per-gallon. More...
static MeasureUnit * | createMilePerGallonImperial (UErrorCode &status)
| Returns unit of consumption: mile-per-gallon-imperial. More...
static MeasureUnit * | createBit (UErrorCode &status)
| Returns unit of digital: bit. More...
static MeasureUnit * | createByte (UErrorCode &status)
| Returns unit of digital: byte. More...
static MeasureUnit * | createGigabit (UErrorCode &status)
| Returns unit of digital: gigabit. More...
static MeasureUnit * | createGigabyte (UErrorCode &status)
| Returns unit of digital: gigabyte. More...
static MeasureUnit * | createKilobit (UErrorCode &status)
| Returns unit of digital: kilobit. More...
static MeasureUnit * | createKilobyte (UErrorCode &status)
| Returns unit of digital: kilobyte. More...
static MeasureUnit * | createMegabit (UErrorCode &status)
| Returns unit of digital: megabit. More...
static MeasureUnit * | createMegabyte (UErrorCode &status)
| Returns unit of digital: megabyte. More...
static MeasureUnit * | createTerabit (UErrorCode &status)
| Returns unit of digital: terabit. More...
static MeasureUnit * | createTerabyte (UErrorCode &status)
| Returns unit of digital: terabyte. More...
static MeasureUnit * | createCentury (UErrorCode &status)
| Returns unit of duration: century. More...
static MeasureUnit * | createDay (UErrorCode &status)
| Returns unit of duration: day. More...
static MeasureUnit * | createHour (UErrorCode &status)
| Returns unit of duration: hour. More...
static MeasureUnit * | createMicrosecond (UErrorCode &status)
| Returns unit of duration: microsecond. More...
static MeasureUnit * | createMillisecond (UErrorCode &status)
| Returns unit of duration: millisecond. More...
static MeasureUnit * | createMinute (UErrorCode &status)
| Returns unit of duration: minute. More...
static MeasureUnit * | createMonth (UErrorCode &status)
| Returns unit of duration: month. More...
static MeasureUnit * | createNanosecond (UErrorCode &status)
| Returns unit of duration: nanosecond. More...
static MeasureUnit * | createSecond (UErrorCode &status)
| Returns unit of duration: second. More...
static MeasureUnit * | createWeek (UErrorCode &status)
| Returns unit of duration: week. More...
static MeasureUnit * | createYear (UErrorCode &status)
| Returns unit of duration: year. More...
static MeasureUnit * | createAmpere (UErrorCode &status)
| Returns unit of electric: ampere. More...
static MeasureUnit * | createMilliampere (UErrorCode &status)
| Returns unit of electric: milliampere. More...
static MeasureUnit * | createOhm (UErrorCode &status)
| Returns unit of electric: ohm. More...
static MeasureUnit * | createVolt (UErrorCode &status)
| Returns unit of electric: volt. More...
static MeasureUnit * | createCalorie (UErrorCode &status)
| Returns unit of energy: calorie. More...
static MeasureUnit * | createFoodcalorie (UErrorCode &status)
| Returns unit of energy: foodcalorie. More...
static MeasureUnit * | createJoule (UErrorCode &status)
| Returns unit of energy: joule. More...
static MeasureUnit * | createKilocalorie (UErrorCode &status)
| Returns unit of energy: kilocalorie. More...
static MeasureUnit * | createKilojoule (UErrorCode &status)
| Returns unit of energy: kilojoule. More...
static MeasureUnit * | createKilowattHour (UErrorCode &status)
| Returns unit of energy: kilowatt-hour. More...
static MeasureUnit * | createGigahertz (UErrorCode &status)
| Returns unit of frequency: gigahertz. More...
static MeasureUnit * | createHertz (UErrorCode &status)
| Returns unit of frequency: hertz. More...
static MeasureUnit * | createKilohertz (UErrorCode &status)
| Returns unit of frequency: kilohertz. More...
static MeasureUnit * | createMegahertz (UErrorCode &status)
| Returns unit of frequency: megahertz. More...
static MeasureUnit * | createAstronomicalUnit (UErrorCode &status)
| Returns unit of length: astronomical-unit. More...
static MeasureUnit * | createCentimeter (UErrorCode &status)
| Returns unit of length: centimeter. More...
static MeasureUnit * | createDecimeter (UErrorCode &status)
| Returns unit of length: decimeter. More...
static MeasureUnit * | createFathom (UErrorCode &status)
| Returns unit of length: fathom. More...
static MeasureUnit * | createFoot (UErrorCode &status)
| Returns unit of length: foot. More...
static MeasureUnit * | createFurlong (UErrorCode &status)
| Returns unit of length: furlong. More...
static MeasureUnit * | createInch (UErrorCode &status)
| Returns unit of length: inch. More...
static MeasureUnit * | createKilometer (UErrorCode &status)
| Returns unit of length: kilometer. More...
static MeasureUnit * | createLightYear (UErrorCode &status)
| Returns unit of length: light-year. More...
static MeasureUnit * | createMeter (UErrorCode &status)
| Returns unit of length: meter. More...
static MeasureUnit * | createMicrometer (UErrorCode &status)
| Returns unit of length: micrometer. More...
static MeasureUnit * | createMile (UErrorCode &status)
| Returns unit of length: mile. More...
static MeasureUnit * | createMileScandinavian (UErrorCode &status)
| Returns unit of length: mile-scandinavian. More...
static MeasureUnit * | createMillimeter (UErrorCode &status)
| Returns unit of length: millimeter. More...
static MeasureUnit * | createNanometer (UErrorCode &status)
| Returns unit of length: nanometer. More...
static MeasureUnit * | createNauticalMile (UErrorCode &status)
| Returns unit of length: nautical-mile. More...
static MeasureUnit * | createParsec (UErrorCode &status)
| Returns unit of length: parsec. More...
static MeasureUnit * | createPicometer (UErrorCode &status)
| Returns unit of length: picometer. More...
static MeasureUnit * | createPoint (UErrorCode &status)
| Returns unit of length: point. More...
static MeasureUnit * | createYard (UErrorCode &status)
| Returns unit of length: yard. More...
static MeasureUnit * | createLux (UErrorCode &status)
| Returns unit of light: lux. More...
static MeasureUnit * | createCarat (UErrorCode &status)
| Returns unit of mass: carat. More...
static MeasureUnit * | createGram (UErrorCode &status)
| Returns unit of mass: gram. More...
static MeasureUnit * | createKilogram (UErrorCode &status)
| Returns unit of mass: kilogram. More...
static MeasureUnit * | createMetricTon (UErrorCode &status)
| Returns unit of mass: metric-ton. More...
static MeasureUnit * | createMicrogram (UErrorCode &status)
| Returns unit of mass: microgram. More...
static MeasureUnit * | createMilligram (UErrorCode &status)
| Returns unit of mass: milligram. More...
static MeasureUnit * | createOunce (UErrorCode &status)
| Returns unit of mass: ounce. More...
static MeasureUnit * | createOunceTroy (UErrorCode &status)
| Returns unit of mass: ounce-troy. More...
static MeasureUnit * | createPound (UErrorCode &status)
| Returns unit of mass: pound. More...
static MeasureUnit * | createStone (UErrorCode &status)
| Returns unit of mass: stone. More...
static MeasureUnit * | createTon (UErrorCode &status)
| Returns unit of mass: ton. More...
static MeasureUnit * | createGigawatt (UErrorCode &status)
| Returns unit of power: gigawatt. More...
static MeasureUnit * | createHorsepower (UErrorCode &status)
| Returns unit of power: horsepower. More...
static MeasureUnit * | createKilowatt (UErrorCode &status)
| Returns unit of power: kilowatt. More...
static MeasureUnit * | createMegawatt (UErrorCode &status)
| Returns unit of power: megawatt. More...
static MeasureUnit * | createMilliwatt (UErrorCode &status)
| Returns unit of power: milliwatt. More...
static MeasureUnit * | createWatt (UErrorCode &status)
| Returns unit of power: watt. More...
static MeasureUnit * | createHectopascal (UErrorCode &status)
| Returns unit of pressure: hectopascal. More...
static MeasureUnit * | createInchHg (UErrorCode &status)
| Returns unit of pressure: inch-hg. More...
static MeasureUnit * | createMillibar (UErrorCode &status)
| Returns unit of pressure: millibar. More...
static MeasureUnit * | createMillimeterOfMercury (UErrorCode &status)
| Returns unit of pressure: millimeter-of-mercury. More...
static MeasureUnit * | createPoundPerSquareInch (UErrorCode &status)
| Returns unit of pressure: pound-per-square-inch. More...
static MeasureUnit * | createKilometerPerHour (UErrorCode &status)
| Returns unit of speed: kilometer-per-hour. More...
static MeasureUnit * | createKnot (UErrorCode &status)
| Returns unit of speed: knot. More...
static MeasureUnit * | createMeterPerSecond (UErrorCode &status)
| Returns unit of speed: meter-per-second. More...
static MeasureUnit * | createMilePerHour (UErrorCode &status)
| Returns unit of speed: mile-per-hour. More...
static MeasureUnit * | createCelsius (UErrorCode &status)
| Returns unit of temperature: celsius. More...
static MeasureUnit * | createFahrenheit (UErrorCode &status)
| Returns unit of temperature: fahrenheit. More...
static MeasureUnit * | createGenericTemperature (UErrorCode &status)
| Returns unit of temperature: generic. More...
static MeasureUnit * | createKelvin (UErrorCode &status)
| Returns unit of temperature: kelvin. More...
static MeasureUnit * | createAcreFoot (UErrorCode &status)
| Returns unit of volume: acre-foot. More...
static MeasureUnit * | createBushel (UErrorCode &status)
| Returns unit of volume: bushel. More...
static MeasureUnit * | createCentiliter (UErrorCode &status)
| Returns unit of volume: centiliter. More...
static MeasureUnit * | createCubicCentimeter (UErrorCode &status)
| Returns unit of volume: cubic-centimeter. More...
static MeasureUnit * | createCubicFoot (UErrorCode &status)
| Returns unit of volume: cubic-foot. More...
static MeasureUnit * | createCubicInch (UErrorCode &status)
| Returns unit of volume: cubic-inch. More...
static MeasureUnit * | createCubicKilometer (UErrorCode &status)
| Returns unit of volume: cubic-kilometer. More...
static MeasureUnit * | createCubicMeter (UErrorCode &status)
| Returns unit of volume: cubic-meter. More...
static MeasureUnit * | createCubicMile (UErrorCode &status)
| Returns unit of volume: cubic-mile. More...
static MeasureUnit * | createCubicYard (UErrorCode &status)
| Returns unit of volume: cubic-yard. More...
static MeasureUnit * | createCup (UErrorCode &status)
| Returns unit of volume: cup. More...
static MeasureUnit * | createCupMetric (UErrorCode &status)
| Returns unit of volume: cup-metric. More...
static MeasureUnit * | createDeciliter (UErrorCode &status)
| Returns unit of volume: deciliter. More...
static MeasureUnit * | createFluidOunce (UErrorCode &status)
| Returns unit of volume: fluid-ounce. More...
static MeasureUnit * | createGallon (UErrorCode &status)
| Returns unit of volume: gallon. More...
static MeasureUnit * | createGallonImperial (UErrorCode &status)
| Returns unit of volume: gallon-imperial. More...
static MeasureUnit * | createHectoliter (UErrorCode &status)
| Returns unit of volume: hectoliter. More...
static MeasureUnit * | createLiter (UErrorCode &status)
| Returns unit of volume: liter. More...
static MeasureUnit * | createMegaliter (UErrorCode &status)
| Returns unit of volume: megaliter. More...
static MeasureUnit * | createMilliliter (UErrorCode &status)
| Returns unit of volume: milliliter. More...
static MeasureUnit * | createPint (UErrorCode &status)
| Returns unit of volume: pint. More...
static MeasureUnit * | createPintMetric (UErrorCode &status)
| Returns unit of volume: pint-metric. More...
static MeasureUnit * | createQuart (UErrorCode &status)
| Returns unit of volume: quart. More...
static MeasureUnit * | createTablespoon (UErrorCode &status)
| Returns unit of volume: tablespoon. More...
static MeasureUnit * | createTeaspoon (UErrorCode &status)
| Returns unit of volume: teaspoon. More...

## Additional Inherited Members
Protected Member Functions inherited from icu::MeasureUnit
void | initTime (const char *timeId)
| For ICU use only. More...
void | initCurrency (const char *isoCurrency)
| For ICU use only. More...
void | initNoUnit (const char *subtype)
| For ICU use only. More...

## 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).

Draft:
  This API may be changed in the future versions and was introduced in 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 not be NULL and must have length 3
  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 | ( | 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.

Draft:
  This API may be changed in the future versions and was introduced in 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 123 of file currunit.h.

References U_NAMESPACE_END.

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

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

Assignment operator.

Stable:
  ICU 3.0

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

- currunit.h