ICU 50.2 50.2
currpinf.h
Go to the documentation of this file.
1/*
2 *******************************************************************************
3 * Copyright (C) 2009-2011, 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
16
17#if !UCONFIG_NO_FORMATTING
18
19#include "unicode/unistr.h"
20
22
23class Locale;
24class PluralRules;
25class Hashtable;
26
45public:
46
53
60 CurrencyPluralInfo(const Locale& locale, UErrorCode& status);
61
68
69
76
77
84
85
92
93
99 UBool operator!=(const CurrencyPluralInfo& info) const;
100
101
108
109
117
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
184
190 static UClassID U_EXPORT2 getStaticClassID();
191
192private:
193 friend class DecimalFormat;
194
195 void initialize(const Locale& loc, UErrorCode& status);
196
197 void setupCurrencyPluralPattern(const Locale& loc, UErrorCode& status);
198
199 /*
200 * delete hash table
201 *
202 * @param hTable hash table to be deleted
203 */
204 void deleteHash(Hashtable* hTable);
205
206
207 /*
208 * initialize hash table
209 *
210 * @param status output param set to success/failure code on exit
211 * @return hash table initialized
212 */
213 Hashtable* initHash(UErrorCode& status);
214
215
216
224 void copyHash(const Hashtable* source, Hashtable* target, UErrorCode& status);
225
226 //-------------------- private data member ---------------------
227 // map from plural count to currency plural pattern, for example
228 // a plural pattern defined in "CurrencyUnitPatterns" is
229 // "one{{0} {1}}", in which "one" is a plural count
230 // and "{0} {1}" is a currency plural pattern".
231 // The currency plural pattern saved in this mapping is the pattern
232 // defined in "CurrencyUnitPattern" by replacing
233 // {0} with the number format pattern,
234 // and {1} with 3 currency sign.
235 Hashtable* fPluralCountToCurrencyUnitPattern;
236
237 /*
238 * The plural rule is used to format currency plural name,
239 * for example: "3.00 US Dollars".
240 * If there are 3 currency signs in the currency patttern,
241 * the 3 currency signs will be replaced by currency plural name.
242 */
243 PluralRules* fPluralRules;
244
245 // locale
246 Locale* fLocale;
247};
248
249
250inline UBool
252
254
255#endif /* #if !UCONFIG_NO_FORMATTING */
256
257#endif // _CURRPINFO
258//eof
CurrencyPluralInfo * clone() const
Clone.
UBool operator==(const CurrencyPluralInfo &info) const
Equal operator.
CurrencyPluralInfo & operator=(const CurrencyPluralInfo &info)
Assignment operator.
CurrencyPluralInfo(UErrorCode &status)
Create a CurrencyPluralInfo object for the default locale.
const Locale & getLocale() const
Get locale.
const PluralRules * getPluralRules() const
Gets plural rules of this locale, used for currency plural format.
UnicodeString & getCurrencyPluralPattern(const UnicodeString &pluralCount, UnicodeString &result) const
Given a plural count, gets currency plural pattern of this locale, used for currency plural format.
void setPluralRules(const UnicodeString &ruleDescription, UErrorCode &status)
Set plural rules.
void setLocale(const Locale &loc, UErrorCode &status)
Set locale.
UBool operator!=(const CurrencyPluralInfo &info) const
Not equal operator.
Definition currpinf.h:251
CurrencyPluralInfo(const CurrencyPluralInfo &info)
Copy constructor.
virtual ~CurrencyPluralInfo()
Destructor.
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
CurrencyPluralInfo(const Locale &locale, UErrorCode &status)
Create a CurrencyPluralInfo object for the given locale.
void setCurrencyPluralPattern(const UnicodeString &pluralCount, const UnicodeString &pattern, UErrorCode &status)
Set currency plural pattern.
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
A Locale object represents a specific geographical, political, or cultural region.
Definition locid.h:182
Defines rules for mapping non-negative numeric values onto a small set of keywords.
Definition plurrule.h:127
UObject is the common ICU "boilerplate" class.
Definition uobject.h:229
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition unistr.h:247
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
int8_t UBool
The ICU boolean type.
Definition umachine.h:200
C++ API: Unicode String.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition uobject.h:96
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