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