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

- Search for |

- File List
- Globals

# plurrule.h

Go to the documentation of this file.

    00001 /*
    00002 *******************************************************************************
    00003 * Copyright (C) 2008-2009, International Business Machines Corporation and
    00004 * others. All Rights Reserved.
    00005 *******************************************************************************
    00006 *
    00007 *
    00008 * File PLURRULE.H
    00009 *
    00010 * Modification History:*
    00011 *   Date        Name        Description
    00012 *
    00013 ********************************************************************************
    00014 */
    00015
    00016 #ifndef PLURRULE
    00017 #define PLURRULE
    00018
    00019 #include "unicode/utypes.h"
    00020
    00026 #if !UCONFIG_NO_FORMATTING
    00027
    00028 #include "unicode/format.h"
    00029
    00030 U_NAMESPACE_BEGIN
    00031
    00032 class Hashtable;
    00033 class RuleChain;
    00034 class RuleParser;
    00035
    00104 class U_I18N_API PluralRules : public UObject {
    00105 public:
    00106
    00114     PluralRules(UErrorCode& status);
    00115
    00120     PluralRules(const PluralRules& other);
    00121
    00126     virtual ~PluralRules();
    00127
    00132     PluralRules* clone() const;
    00133
    00138     PluralRules& operator=(const PluralRules&);
    00139
    00150     static PluralRules* U_EXPORT2 createRules(const UnicodeString& description,
    00151                                               UErrorCode& status);
    00152
    00161     static PluralRules* U_EXPORT2 createDefaultRules(UErrorCode& status);
    00162
    00178     static PluralRules* U_EXPORT2 forLocale(const Locale& locale, UErrorCode& status);
    00179
    00189     UnicodeString select(int32_t number) const;
    00190
    00200     UnicodeString select(double number) const;
    00201
    00212     StringEnumeration* getKeywords(UErrorCode& status) const;
    00213
    00223     UBool isKeyword(const UnicodeString& keyword) const;
    00224
    00225
    00233     UnicodeString getKeywordOther() const;
    00234
    00243     virtual UBool operator==(const PluralRules& other) const;
    00244
    00253     UBool operator!=(const PluralRules& other) const  {return !operator==(other);}
    00254
    00255
    00262     static UClassID U_EXPORT2 getStaticClassID(void);
    00263
    00269     virtual UClassID getDynamicClassID() const;
    00270
    00271
    00272 private:
    00273     Hashtable       *fLocaleStringsHash;
    00274     UnicodeString   mLocaleName;
    00275     RuleChain       *mRules;
    00276     RuleParser      *mParser;
    00277
    00278     PluralRules();   // default constructor not implemented
    00279     int32_t getRepeatLimit() const;
    00280     void parseDescription(UnicodeString& ruleData, RuleChain& rules, UErrorCode &status);
    00281     void getNextLocale(const UnicodeString& localeData, int32_t* curIndex, UnicodeString& localeName);
    00282     void addRules(RuleChain& rules);
    00283     int32_t getNumberValue(const UnicodeString& token) const;
    00284     UnicodeString getRuleFromResource(const Locale& locale, UErrorCode& status);
    00285
    00286 };
    00287
    00288 U_NAMESPACE_END
    00289
    00290 #endif /* #if !UCONFIG_NO_FORMATTING */
    00291
    00292 #endif // _PLURRULE
    00293 //eof