|
ICU 73.2
73.2
|
00001 // © 2016 and later: Unicode, Inc. and others. 00002 // License & terms of use: http://www.unicode.org/copyright.html 00003 /* 00004 ******************************************************************************* 00005 * Copyright (C) 2009-2015, International Business Machines Corporation and * 00006 * others. All Rights Reserved. * 00007 ******************************************************************************* 00008 */ 00009 #ifndef CURRPINF_H 00010 #define CURRPINF_H 00011 00012 #include "unicode/utypes.h" 00013 00014 #if U_SHOW_CPLUSPLUS_API 00015 00021 #if !UCONFIG_NO_FORMATTING 00022 00023 #include "unicode/unistr.h" 00024 00025 U_NAMESPACE_BEGIN 00026 00027 class Locale; 00028 class PluralRules; 00029 class Hashtable; 00030 00048 class U_I18N_API CurrencyPluralInfo : public UObject { 00049 public: 00050 00056 CurrencyPluralInfo(UErrorCode& status); 00057 00064 CurrencyPluralInfo(const Locale& locale, UErrorCode& status); 00065 00071 CurrencyPluralInfo(const CurrencyPluralInfo& info); 00072 00073 00079 CurrencyPluralInfo& operator=(const CurrencyPluralInfo& info); 00080 00081 00087 virtual ~CurrencyPluralInfo(); 00088 00089 00095 bool operator==(const CurrencyPluralInfo& info) const; 00096 00097 00103 bool operator!=(const CurrencyPluralInfo& info) const; 00104 00105 00111 CurrencyPluralInfo* clone() const; 00112 00113 00120 const PluralRules* getPluralRules() const; 00121 00131 UnicodeString& getCurrencyPluralPattern(const UnicodeString& pluralCount, 00132 UnicodeString& result) const; 00133 00140 const Locale& getLocale() const; 00141 00153 void setPluralRules(const UnicodeString& ruleDescription, 00154 UErrorCode& status); 00155 00169 void setCurrencyPluralPattern(const UnicodeString& pluralCount, 00170 const UnicodeString& pattern, 00171 UErrorCode& status); 00172 00180 void setLocale(const Locale& loc, UErrorCode& status); 00181 00187 virtual UClassID getDynamicClassID() const override; 00188 00194 static UClassID U_EXPORT2 getStaticClassID(); 00195 00196 private: 00197 friend class DecimalFormat; 00198 friend class DecimalFormatImpl; 00199 00200 void initialize(const Locale& loc, UErrorCode& status); 00201 00202 void setupCurrencyPluralPattern(const Locale& loc, UErrorCode& status); 00203 00204 /* 00205 * delete hash table 00206 * 00207 * @param hTable hash table to be deleted 00208 */ 00209 void deleteHash(Hashtable* hTable); 00210 00211 00212 /* 00213 * initialize hash table 00214 * 00215 * @param status output param set to success/failure code on exit 00216 * @return hash table initialized 00217 */ 00218 Hashtable* initHash(UErrorCode& status); 00219 00220 00221 00229 void copyHash(const Hashtable* source, Hashtable* target, UErrorCode& status); 00230 00231 //-------------------- private data member --------------------- 00232 // map from plural count to currency plural pattern, for example 00233 // a plural pattern defined in "CurrencyUnitPatterns" is 00234 // "one{{0} {1}}", in which "one" is a plural count 00235 // and "{0} {1}" is a currency plural pattern". 00236 // The currency plural pattern saved in this mapping is the pattern 00237 // defined in "CurrencyUnitPattern" by replacing 00238 // {0} with the number format pattern, 00239 // and {1} with 3 currency sign. 00240 Hashtable* fPluralCountToCurrencyUnitPattern; 00241 00242 /* 00243 * The plural rule is used to format currency plural name, 00244 * for example: "3.00 US Dollars". 00245 * If there are 3 currency signs in the currency pattern, 00246 * the 3 currency signs will be replaced by currency plural name. 00247 */ 00248 PluralRules* fPluralRules; 00249 00250 // locale 00251 Locale* fLocale; 00252 00253 private: 00258 UErrorCode fInternalStatus; 00259 }; 00260 00261 00262 inline bool 00263 CurrencyPluralInfo::operator!=(const CurrencyPluralInfo& info) const { 00264 return !operator==(info); 00265 } 00266 00267 U_NAMESPACE_END 00268 00269 #endif /* #if !UCONFIG_NO_FORMATTING */ 00270 00271 #endif /* U_SHOW_CPLUSPLUS_API */ 00272 00273 #endif // _CURRPINFO 00274 //eof
1.7.6.1