ICU 56.1: currpinf.h Source File

ICU 56.1 56.1

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

- File List
- Globals

currpinf.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 * Copyright (C) 2009-2015, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
6 */
7 #ifndef CURRPINF_H
8 #define CURRPINF_H
9
10 #include "unicode/utypes.h"
11
17 #if !UCONFIG_NO_FORMATTING
18
19 #include "unicode/unistr.h"
20
21 U_NAMESPACE_BEGIN
22
23 class Locale;
24 class PluralRules;
25 class Hashtable;
26
44 class U_I18N_API CurrencyPluralInfo : public UObject {
45 public:
46
52 CurrencyPluralInfo(UErrorCode& status);
53
60 CurrencyPluralInfo(const Locale& locale, UErrorCode& status);
61
67 CurrencyPluralInfo(const CurrencyPluralInfo& info);
68
69
75 CurrencyPluralInfo& operator=(const CurrencyPluralInfo& info);
76
77
83 virtual ~CurrencyPluralInfo();
84
85
91 UBool operator==(const CurrencyPluralInfo& info) const;
92
93
99 UBool operator!=(const CurrencyPluralInfo& info) const;
100
101
107 CurrencyPluralInfo* clone() const;
108
109
116 const PluralRules* getPluralRules() const;
117
127 UnicodeString& getCurrencyPluralPattern(const UnicodeString& pluralCount,
128 UnicodeString& result) const;
129
136 const Locale& getLocale() const;
137
149 void setPluralRules(const UnicodeString& ruleDescription,
150 UErrorCode& status);
151
165 void setCurrencyPluralPattern(const UnicodeString& pluralCount,
166 const UnicodeString& pattern,
167 UErrorCode& status);
168
176 void setLocale(const Locale& loc, UErrorCode& status);
177
183 virtual UClassID getDynamicClassID() const;
184
190 static UClassID U_EXPORT2 getStaticClassID();
191
192 private:
193 friend class DecimalFormat;
194 friend class DecimalFormatImpl;
195
196 void initialize(const Locale& loc, UErrorCode& status);
197
198 void setupCurrencyPluralPattern(const Locale& loc, UErrorCode& status);
199
200 /*
201 * delete hash table
202 *
203 * @param hTable hash table to be deleted
204 */
205 void deleteHash(Hashtable* hTable);
206
207
208 /*
209 * initialize hash table
210 *
211 * @param status output param set to success/failure code on exit
212 * @return hash table initialized
213 */
214 Hashtable* initHash(UErrorCode& status);
215
216
217
225 void copyHash(const Hashtable* source, Hashtable* target, UErrorCode& status);
226
227 //-------------------- private data member ---------------------
228 // map from plural count to currency plural pattern, for example
229 // a plural pattern defined in "CurrencyUnitPatterns" is
230 // "one{{0} {1}}", in which "one" is a plural count
231 // and "{0} {1}" is a currency plural pattern".
232 // The currency plural pattern saved in this mapping is the pattern
233 // defined in "CurrencyUnitPattern" by replacing
234 // {0} with the number format pattern,
235 // and {1} with 3 currency sign.
236 Hashtable* fPluralCountToCurrencyUnitPattern;
237
238 /*
239 * The plural rule is used to format currency plural name,
240 * for example: "3.00 US Dollars".
241 * If there are 3 currency signs in the currency patttern,
242 * the 3 currency signs will be replaced by currency plural name.
243 */
244 PluralRules* fPluralRules;
245
246 // locale
247 Locale* fLocale;
248 };
249
250
251 inline UBool
252 CurrencyPluralInfo::operator!=(const CurrencyPluralInfo& info) const { return !operator==(info); }
253
254 U_NAMESPACE_END
255
256 #endif /* #if !UCONFIG_NO_FORMATTING */
257
258 #endif // _CURRPINFO
259 //eof
icu::DecimalFormat
DecimalFormat is a concrete subclass of NumberFormat that formats decimal numbers.
Definition: decimfmt.h:668
icu::UObject::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
unistr.h
C++ API: Unicode String.
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:91
icu::PluralRules
Defines rules for mapping non-negative numeric values onto a small set of keywords.
Definition: plurrule.h:192
U_I18N_API
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:358
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
icu::operator!=
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
Definition: stringpiece.h:218
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:476
icu::CurrencyPluralInfo
This class represents the information needed by DecimalFormat to format currency plural, such as "3.00 US dollars" or "1.00 US dollar".
Definition: currpinf.h:44
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:293
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:221
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:185