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

- Search for |

- File List
- Globals

# currpinf.h

Go to the documentation of this file.

    00001 /*
    00002  *******************************************************************************
    00003  * Copyright (C) 2009, 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 union UHashTok;
    00022
    00023 U_NAMESPACE_BEGIN
    00024
    00025 class Locale;
    00026 class PluralRules;
    00027 class Hashtable;
    00028
    00046 class  U_I18N_API CurrencyPluralInfo : public UObject {
    00047 public:
    00048
    00054     CurrencyPluralInfo(UErrorCode& status);
    00055
    00062     CurrencyPluralInfo(const Locale& locale, UErrorCode& status);
    00063
    00069     CurrencyPluralInfo(const CurrencyPluralInfo& info);
    00070
    00071
    00077     CurrencyPluralInfo& operator=(const CurrencyPluralInfo& info);
    00078
    00079
    00085     virtual ~CurrencyPluralInfo();
    00086
    00087
    00093     UBool operator==(const CurrencyPluralInfo& info) const;
    00094
    00095
    00101     UBool operator!=(const CurrencyPluralInfo& info) const;
    00102
    00103
    00109     CurrencyPluralInfo* clone() const;
    00110
    00111
    00118     const PluralRules* getPluralRules() const;
    00119
    00129     UnicodeString& getCurrencyPluralPattern(const UnicodeString& pluralCount,
    00130                                             UnicodeString& result) const;
    00131
    00138     const Locale& getLocale() const;
    00139
    00151     void setPluralRules(const UnicodeString& ruleDescription,
    00152                         UErrorCode& status);
    00153
    00167     void setCurrencyPluralPattern(const UnicodeString& pluralCount,
    00168                                   const UnicodeString& pattern,
    00169                                   UErrorCode& status);
    00170
    00178     void setLocale(const Locale& loc, UErrorCode& status);
    00179
    00185     virtual UClassID getDynamicClassID() const;
    00186
    00192     static UClassID U_EXPORT2 getStaticClassID();
    00193
    00194 private:
    00195     friend class DecimalFormat;
    00196
    00197     void initialize(const Locale& loc, UErrorCode& status);
    00198
    00199     void setupCurrencyPluralPattern(const Locale& loc, UErrorCode& status);
    00200
    00201     /*
    00202      * delete hash table
    00203      *
    00204      * @param hTable  hash table to be deleted
    00205      */
    00206     void deleteHash(Hashtable* hTable);
    00207
    00208
    00209     /*
    00210      * initialize hash table
    00211      *
    00212      * @param status   output param set to success/failure code on exit
    00213      * @return         hash table initialized
    00214      */
    00215     Hashtable* initHash(UErrorCode& status);
    00216
    00217
    00218
    00225     void copyHash(const Hashtable* source, Hashtable* target, UErrorCode& status);
    00226
    00227     //-------------------- private data member ---------------------
    00228     // map from plural count to currency plural pattern, for example
    00229     // a plural pattern defined in "CurrencyUnitPatterns" is
    00230     // "one{{0} {1}}", in which "one" is a plural count
    00231     // and "{0} {1}" is a currency plural pattern".
    00232     // The currency plural pattern saved in this mapping is the pattern
    00233     // defined in "CurrencyUnitPattern" by replacing
    00234     // {0} with the number format pattern,
    00235     // and {1} with 3 currency sign.
    00236     Hashtable* fPluralCountToCurrencyUnitPattern;
    00237
    00238     /*
    00239      * The plural rule is used to format currency plural name,
    00240      * for example: "3.00 US Dollars".
    00241      * If there are 3 currency signs in the currency patttern,
    00242      * the 3 currency signs will be replaced by currency plural name.
    00243      */
    00244     PluralRules* fPluralRules;
    00245
    00246     // locale
    00247     Locale* fLocale;
    00248 };
    00249
    00250
    00251 inline UBool
    00252 CurrencyPluralInfo::operator!=(const CurrencyPluralInfo& info) const {              return !operator==(info);                                                   }
    00253
    00254 U_NAMESPACE_END
    00255
    00256 #endif /* #if !UCONFIG_NO_FORMATTING */
    00257
    00258 #endif // _CURRPINFO
    00259 //eof