currpinf.h

Go to the documentation of this file.
00001 /*
00002  *******************************************************************************
00003  * Copyright (C) 2009-2011, International Business Machines Corporation and         *
00004  * others. All Rights Reserved.                                                *
00005  *******************************************************************************
00006  */
00007 #ifndef CURRPINF_H
00008 #define CURRPINF_H
00009 
00010 #include "unicode/utypes.h"
00011 
00017 #if !UCONFIG_NO_FORMATTING
00018 
00019 #include "unicode/unistr.h"
00020 
00021 U_NAMESPACE_BEGIN
00022 
00023 class Locale;
00024 class PluralRules;
00025 class Hashtable;
00026 
00044 class  U_I18N_API CurrencyPluralInfo : public UObject {
00045 public:
00046 
00052     CurrencyPluralInfo(UErrorCode& status);
00053 
00060     CurrencyPluralInfo(const Locale& locale, UErrorCode& status); 
00061 
00067     CurrencyPluralInfo(const CurrencyPluralInfo& info);
00068 
00069 
00075     CurrencyPluralInfo& operator=(const CurrencyPluralInfo& info);
00076 
00077 
00083     virtual ~CurrencyPluralInfo();
00084 
00085 
00091     UBool operator==(const CurrencyPluralInfo& info) const;
00092 
00093 
00099     UBool operator!=(const CurrencyPluralInfo& info) const;
00100 
00101 
00107     CurrencyPluralInfo* clone() const;
00108 
00109 
00116     const PluralRules* getPluralRules() const;
00117 
00127     UnicodeString& getCurrencyPluralPattern(const UnicodeString& pluralCount,
00128                                             UnicodeString& result) const; 
00129 
00136     const Locale& getLocale() const;
00137 
00149     void setPluralRules(const UnicodeString& ruleDescription,
00150                         UErrorCode& status);
00151 
00165     void setCurrencyPluralPattern(const UnicodeString& pluralCount, 
00166                                   const UnicodeString& pattern,
00167                                   UErrorCode& status);
00168 
00176     void setLocale(const Locale& loc, UErrorCode& status);
00177 
00183     virtual UClassID getDynamicClassID() const;
00184 
00190     static UClassID U_EXPORT2 getStaticClassID();
00191 
00192 private:
00193     friend class DecimalFormat;
00194 
00195     void initialize(const Locale& loc, UErrorCode& status);
00196    
00197     void setupCurrencyPluralPattern(const Locale& loc, UErrorCode& status);
00198 
00199     /*
00200      * delete hash table
00201      *
00202      * @param hTable  hash table to be deleted
00203      */
00204     void deleteHash(Hashtable* hTable);
00205 
00206 
00207     /*
00208      * initialize hash table
00209      *
00210      * @param status   output param set to success/failure code on exit
00211      * @return         hash table initialized
00212      */
00213     Hashtable* initHash(UErrorCode& status);
00214 
00215 
00216 
00224     void copyHash(const Hashtable* source, Hashtable* target, UErrorCode& status);
00225 
00226     //-------------------- private data member ---------------------
00227     // map from plural count to currency plural pattern, for example
00228     // a plural pattern defined in "CurrencyUnitPatterns" is
00229     // "one{{0} {1}}", in which "one" is a plural count
00230     // and "{0} {1}" is a currency plural pattern".
00231     // The currency plural pattern saved in this mapping is the pattern
00232     // defined in "CurrencyUnitPattern" by replacing
00233     // {0} with the number format pattern,
00234     // and {1} with 3 currency sign.
00235     Hashtable* fPluralCountToCurrencyUnitPattern;
00236 
00237     /*
00238      * The plural rule is used to format currency plural name,
00239      * for example: "3.00 US Dollars".
00240      * If there are 3 currency signs in the currency patttern,
00241      * the 3 currency signs will be replaced by currency plural name.
00242      */
00243     PluralRules* fPluralRules;
00244 
00245     // locale
00246     Locale* fLocale;
00247 };
00248 
00249 
00250 inline UBool
00251 CurrencyPluralInfo::operator!=(const CurrencyPluralInfo& info) const {              return !operator==(info);                                                   }  
00252 
00253 U_NAMESPACE_END
00254 
00255 #endif /* #if !UCONFIG_NO_FORMATTING */
00256 
00257 #endif // _CURRPINFO
00258 //eof

Generated on 25 Nov 2014 for ICU 50.1.2 by  doxygen 1.4.7