ICU 55.1 55.1

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

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plurrule.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 * Copyright (C) 2008-2015, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 *******************************************************************************
6 *
7 *
8 * File PLURRULE.H
9 *
10 * Modification History:*
11 * Date Name Description
12 *
13 ********************************************************************************
14 */
15
16 #ifndef PLURRULE
17 #define PLURRULE
18
19 #include "unicode/utypes.h"
20
26 #if !UCONFIG_NO_FORMATTING
27
28 #include "unicode/format.h"
29 #include "unicode/upluralrules.h"
30
36 #define UPLRULES_NO_UNIQUE_VALUE ((double)-0.00123456777)
37
38 U_NAMESPACE_BEGIN
39
40 class Hashtable;
41 class FixedDecimal;
42 class RuleChain;
43 class PluralRuleParser;
44 class PluralKeywordEnumeration;
45 class AndConstraint;
46 class SharedPluralRules;
47
191 class U_I18N_API PluralRules : public UObject {
192 public:
193
201 PluralRules(UErrorCode& status);
202
207 PluralRules(const PluralRules& other);
208
213 virtual ~PluralRules();
214
219 PluralRules* clone() const;
220
225 PluralRules& operator=(const PluralRules&);
226
237 static PluralRules* U_EXPORT2 createRules(const UnicodeString& description,
238 UErrorCode& status);
239
248 static PluralRules* U_EXPORT2 createDefaultRules(UErrorCode& status);
249
266 static PluralRules* U_EXPORT2 forLocale(const Locale& locale, UErrorCode& status);
267
284 static PluralRules* U_EXPORT2 forLocale(const Locale& locale, UPluralType type, UErrorCode& status);
285
286 #ifndef U_HIDE_INTERNAL_API
287
292 static StringEnumeration* U_EXPORT2 getAvailableLocales(UErrorCode &status);
293
300 static UBool hasOverride(const Locale &locale);
301
307 static PluralRules* U_EXPORT2 internalForLocale(const Locale& locale, UPluralType type, UErrorCode& status);
308
316 static const SharedPluralRules* U_EXPORT2 createSharedInstance(
317 const Locale& locale, UPluralType type, UErrorCode& status);
318
319
320 #endif /* U_HIDE_INTERNAL_API */
321
331 UnicodeString select(int32_t number) const;
332
342 UnicodeString select(double number) const;
343
344 #ifndef U_HIDE_INTERNAL_API
345
348 UnicodeString select(const FixedDecimal &number) const;
349 #endif /* U_HIDE_INTERNAL_API */
350
361 StringEnumeration* getKeywords(UErrorCode& status) const;
362
363 #ifndef U_HIDE_DEPRECATED_API
364
374 double getUniqueKeywordValue(const UnicodeString& keyword);
375
396 int32_t getAllKeywordValues(const UnicodeString &keyword,
397 double *dest, int32_t destCapacity,
398 UErrorCode& status);
399 #endif /* U_HIDE_DEPRECATED_API */
400
419 int32_t getSamples(const UnicodeString &keyword,
420 double *dest, int32_t destCapacity,
421 UErrorCode& status);
422
432 UBool isKeyword(const UnicodeString& keyword) const;
433
434
441 UnicodeString getKeywordOther() const;
442
443 #ifndef U_HIDE_INTERNAL_API
444
448 UnicodeString getRules() const;
449 #endif /* U_HIDE_INTERNAL_API */
450
459 virtual UBool operator==(const PluralRules& other) const;
460
469 UBool operator!=(const PluralRules& other) const {return !operator==(other);}
470
471
478 static UClassID U_EXPORT2 getStaticClassID(void);
479
485 virtual UClassID getDynamicClassID() const;
486
487
488 private:
489 RuleChain *mRules;
490
491 PluralRules(); // default constructor not implemented
492 void parseDescription(const UnicodeString& ruleData, UErrorCode &status);
493 int32_t getNumberValue(const UnicodeString& token) const;
494 UnicodeString getRuleFromResource(const Locale& locale, UPluralType type, UErrorCode& status);
495 RuleChain *rulesForKeyword(const UnicodeString &keyword) const;
496
497 friend class PluralRuleParser;
498 };
499
500 U_NAMESPACE_END
501
502 #endif /* #if !UCONFIG_NO_FORMATTING */
503
504 #endif // _PLURRULE
505 //eof