]> git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/unicode/currunit.h
ICU-59180.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / unicode / currunit.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 **********************************************************************
5 * Copyright (c) 2004-2014, International Business Machines
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
22 /**
23 * \file
24 * \brief C++ API: Currency Unit Information.
25 */
26
27 #if U_SHOW_CPLUSPLUS_API
28 U_NAMESPACE_BEGIN
29
30 /**
31 * A unit of currency, such as USD (U.S. dollars) or JPY (Japanese
32 * yen). This class is a thin wrapper over a char16_t string that
33 * subclasses MeasureUnit, for use with Measure and MeasureFormat.
34 *
35 * @author Alan Liu
36 * @stable ICU 3.0
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.
46 * @stable ICU 3.0
47 */
48 CurrencyUnit(ConstChar16Ptr isoCode, UErrorCode &ec);
49
50 /**
51 * Copy constructor
52 * @stable ICU 3.0
53 */
54 CurrencyUnit(const CurrencyUnit& other);
55
56 /**
57 * Assignment operator
58 * @stable ICU 3.0
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().
65 * @stable ICU 3.0
66 */
67 virtual UObject* clone() const;
68
69 /**
70 * Destructor
71 * @stable ICU 3.0
72 */
73 virtual ~CurrencyUnit();
74
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.
81 * @stable ICU 3.0
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.
89 * @stable ICU 3.0
90 */
91 static UClassID U_EXPORT2 getStaticClassID();
92
93 /**
94 * Return the ISO currency code of this object.
95 * @stable ICU 3.0
96 */
97 inline const char16_t* getISOCurrency() const;
98
99 private:
100 /**
101 * The ISO 4217 code of this object.
102 */
103 char16_t isoCode[4];
104 };
105
106 inline const char16_t* CurrencyUnit::getISOCurrency() const {
107 return isoCode;
108 }
109
110 U_NAMESPACE_END
111 #endif // U_SHOW_CPLUSPLUS_API
112
113 #endif // !UCONFIG_NO_FORMATTING
114 #endif // __CURRENCYUNIT_H__