]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html | |
374ca955 A |
3 | /* |
4 | ********************************************************************** | |
57a6839d | 5 | * Copyright (c) 2004-2014, International Business Machines |
374ca955 A |
6 | * Corporation and others. All Rights Reserved. |
7 | ********************************************************************** | |
8 | * Author: Alan Liu | |
9 | * Created: April 26, 2004 | |
10 | * Since: ICU 3.0 | |
11 | ********************************************************************** | |
12 | */ | |
13 | #ifndef __CURRENCYUNIT_H__ | |
14 | #define __CURRENCYUNIT_H__ | |
15 | ||
16 | #include "unicode/utypes.h" | |
17 | ||
18 | #if !UCONFIG_NO_FORMATTING | |
19 | ||
20 | #include "unicode/measunit.h" | |
21 | ||
73c04bcf A |
22 | /** |
23 | * \file | |
24 | * \brief C++ API: Currency Unit Information. | |
25 | */ | |
26 | ||
f3c0d7a5 | 27 | #if U_SHOW_CPLUSPLUS_API |
374ca955 A |
28 | U_NAMESPACE_BEGIN |
29 | ||
30 | /** | |
31 | * A unit of currency, such as USD (U.S. dollars) or JPY (Japanese | |
f3c0d7a5 | 32 | * yen). This class is a thin wrapper over a char16_t string that |
374ca955 A |
33 | * subclasses MeasureUnit, for use with Measure and MeasureFormat. |
34 | * | |
35 | * @author Alan Liu | |
73c04bcf | 36 | * @stable ICU 3.0 |
374ca955 A |
37 | */ |
38 | class U_I18N_API CurrencyUnit: public MeasureUnit { | |
39 | public: | |
40 | /** | |
41 | * Construct an object with the given ISO currency code. | |
42 | * @param isoCode the 3-letter ISO 4217 currency code; must not be | |
43 | * NULL and must have length 3 | |
44 | * @param ec input-output error code. If the isoCode is invalid, | |
45 | * then this will be set to a failing value. | |
73c04bcf | 46 | * @stable ICU 3.0 |
374ca955 | 47 | */ |
f3c0d7a5 | 48 | CurrencyUnit(ConstChar16Ptr isoCode, UErrorCode &ec); |
374ca955 A |
49 | |
50 | /** | |
51 | * Copy constructor | |
73c04bcf | 52 | * @stable ICU 3.0 |
374ca955 A |
53 | */ |
54 | CurrencyUnit(const CurrencyUnit& other); | |
55 | ||
56 | /** | |
57 | * Assignment operator | |
73c04bcf | 58 | * @stable ICU 3.0 |
374ca955 A |
59 | */ |
60 | CurrencyUnit& operator=(const CurrencyUnit& other); | |
61 | ||
62 | /** | |
63 | * Return a polymorphic clone of this object. The result will | |
64 | * have the same class as returned by getDynamicClassID(). | |
73c04bcf | 65 | * @stable ICU 3.0 |
374ca955 A |
66 | */ |
67 | virtual UObject* clone() const; | |
68 | ||
69 | /** | |
70 | * Destructor | |
73c04bcf | 71 | * @stable ICU 3.0 |
374ca955 A |
72 | */ |
73 | virtual ~CurrencyUnit(); | |
74 | ||
374ca955 A |
75 | /** |
76 | * Returns a unique class ID for this object POLYMORPHICALLY. | |
77 | * This method implements a simple form of RTTI used by ICU. | |
78 | * @return The class ID for this object. All objects of a given | |
79 | * class have the same class ID. Objects of other classes have | |
80 | * different class IDs. | |
73c04bcf | 81 | * @stable ICU 3.0 |
374ca955 A |
82 | */ |
83 | virtual UClassID getDynamicClassID() const; | |
84 | ||
85 | /** | |
86 | * Returns the class ID for this class. This is used to compare to | |
87 | * the return value of getDynamicClassID(). | |
88 | * @return The class ID for all objects of this class. | |
73c04bcf | 89 | * @stable ICU 3.0 |
374ca955 A |
90 | */ |
91 | static UClassID U_EXPORT2 getStaticClassID(); | |
92 | ||
93 | /** | |
94 | * Return the ISO currency code of this object. | |
73c04bcf | 95 | * @stable ICU 3.0 |
374ca955 | 96 | */ |
f3c0d7a5 | 97 | inline const char16_t* getISOCurrency() const; |
374ca955 A |
98 | |
99 | private: | |
100 | /** | |
101 | * The ISO 4217 code of this object. | |
102 | */ | |
f3c0d7a5 | 103 | char16_t isoCode[4]; |
374ca955 A |
104 | }; |
105 | ||
f3c0d7a5 | 106 | inline const char16_t* CurrencyUnit::getISOCurrency() const { |
374ca955 A |
107 | return isoCode; |
108 | } | |
109 | ||
110 | U_NAMESPACE_END | |
f3c0d7a5 | 111 | #endif // U_SHOW_CPLUSPLUS_API |
374ca955 A |
112 | |
113 | #endif // !UCONFIG_NO_FORMATTING | |
114 | #endif // __CURRENCYUNIT_H__ |