ICU 57.1  57.1
curramt.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (c) 2004-2006, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 * Author: Alan Liu
7 * Created: April 26, 2004
8 * Since: ICU 3.0
9 **********************************************************************
10 */
11 #ifndef __CURRENCYAMOUNT_H__
12 #define __CURRENCYAMOUNT_H__
13 
14 #include "unicode/utypes.h"
15 
16 #if !UCONFIG_NO_FORMATTING
17 
18 #include "unicode/measure.h"
19 #include "unicode/currunit.h"
20 
27 
36  public:
47  CurrencyAmount(const Formattable& amount, const UChar* isoCode,
48  UErrorCode &ec);
49 
60  CurrencyAmount(double amount, const UChar* isoCode,
61  UErrorCode &ec);
62 
68 
74 
80  virtual UObject* clone() const;
81 
86  virtual ~CurrencyAmount();
87 
96  virtual UClassID getDynamicClassID() const;
97 
104  static UClassID U_EXPORT2 getStaticClassID();
105 
110  inline const CurrencyUnit& getCurrency() const;
111 
116  inline const UChar* getISOCurrency() const;
117 };
118 
120  return (const CurrencyUnit&) getUnit();
121 }
122 
123 inline const UChar* CurrencyAmount::getISOCurrency() const {
124  return getCurrency().getISOCurrency();
125 }
126 
128 
129 #endif // !UCONFIG_NO_FORMATTING
130 #endif // __CURRENCYAMOUNT_H__
A currency together with a numeric amount, such as 200 USD.
Definition: curramt.h:35
static UClassID getStaticClassID()
Returns the class ID for this class.
virtual UObject * clone() const
Return a polymorphic clone of this object.
CurrencyAmount & operator=(const CurrencyAmount &other)
Assignment operator.
virtual UClassID getDynamicClassID() const
Returns a unique class ID for this object POLYMORPHICALLY.
CurrencyAmount(double amount, const UChar *isoCode, UErrorCode &ec)
Construct an object with the given numeric amount and the given ISO currency code.
CurrencyAmount(const Formattable &amount, const UChar *isoCode, UErrorCode &ec)
Construct an object with the given numeric amount and the given ISO currency code.
CurrencyAmount(const CurrencyAmount &other)
Copy constructor.
virtual ~CurrencyAmount()
Destructor.
const UChar * getISOCurrency() const
Return the ISO currency code of this object.
Definition: curramt.h:123
const CurrencyUnit & getCurrency() const
Return the currency unit object of this object.
Definition: curramt.h:119
A unit of currency, such as USD (U.S.
Definition: currunit.h:35
const UChar * getISOCurrency() const
Return the ISO currency code of this object.
Definition: currunit.h:103
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:66
An amount of a specified unit, consisting of a number and a Unit.
Definition: measure.h:41
const MeasureUnit & getUnit() const
Return a reference to the unit of this object.
Definition: measure.h:152
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:221
C++ API: Currency Unit Information.
C++ API: MeasureUnit object.
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:312
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:91
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition: utypes.h:476
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition: utypes.h:358
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129