ICU 58.2 58.2

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

- File List
- Globals

upluralrules.h
Go to the documentation of this file.
1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *****************************************************************************************
5 * Copyright (C) 2010-2013, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 *****************************************************************************************
8 */
9
10 #ifndef UPLURALRULES_H
11 #define UPLURALRULES_H
12
13 #include "unicode/utypes.h"
14
15 #if !UCONFIG_NO_FORMATTING
16
17 #include "unicode/localpointer.h"
18
46 enum UPluralType {
51 UPLURAL_TYPE_CARDINAL,
56 UPLURAL_TYPE_ORDINAL,
57 #ifndef U_HIDE_DEPRECATED_API
58
62 UPLURAL_TYPE_COUNT
63 #endif // U_HIDE_DEPRECATED_API
64 };
68 typedef enum UPluralType UPluralType;
69
74 struct UPluralRules;
75 typedef struct UPluralRules UPluralRules;
86 U_STABLE UPluralRules* U_EXPORT2
87 uplrules_open(const char *locale, UErrorCode *status);
88
98 U_DRAFT UPluralRules* U_EXPORT2
99 uplrules_openForType(const char *locale, UPluralType type, UErrorCode *status);
100
106 U_STABLE void U_EXPORT2
107 uplrules_close(UPluralRules *uplrules);
108
109
110 #if U_SHOW_CPLUSPLUS_API
111
112 U_NAMESPACE_BEGIN
113
123 U_DEFINE_LOCAL_OPEN_POINTER(LocalUPluralRulesPointer, UPluralRules, uplrules_close);
124
125 U_NAMESPACE_END
126
127 #endif
128
129
141 U_STABLE int32_t U_EXPORT2
142 uplrules_select(const UPluralRules *uplrules,
143 double number,
144 UChar *keyword, int32_t capacity,
145 UErrorCode *status);
146
147 #endif /* #if !UCONFIG_NO_FORMATTING */
148
149 #endif
uplrules_openForType
UPluralRules * uplrules_openForType(const char *locale, UPluralType type, UErrorCode *status)
Opens a new UPluralRules object using the predefined plural rules for a given locale and the plural t...
uplrules_open
UPluralRules * uplrules_open(const char *locale, UErrorCode *status)
Opens a new UPluralRules object using the predefined cardinal-number plural rules for a given locale...
uplrules_select
int32_t uplrules_select(const UPluralRules *uplrules, double number, UChar *keyword, int32_t capacity, UErrorCode *status)
Given a number, returns the keyword of the first rule that applies to the number, according to the su...
uplrules_close
void uplrules_close(UPluralRules *uplrules)
Closes a UPluralRules object.
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:530
UPLURAL_TYPE_ORDINAL
Plural rules for ordinal numbers: 1st file, 2nd file, 3rd file, 4th file, etc.
Definition: upluralrules.h:56
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
UPLURAL_TYPE_CARDINAL
Plural rules for cardinal numbers: 1 file vs.
Definition: upluralrules.h:51
UChar
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:337
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
UPLURAL_TYPE_COUNT
One more than the highest normal UPluralType value.
Definition: upluralrules.h:62
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
UPluralType
UPluralType
Type of plurals and PluralRules.
Definition: upluralrules.h:46
UPluralRules
struct UPluralRules UPluralRules
C typedef for struct UPluralRules.
Definition: upluralrules.h:75
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
LocalUPluralRulesPointer
"Smart pointer" class, closes a UPluralRules via uplrules_close().
U_DRAFT
#define U_DRAFT
This is used to declare a function as a draft public ICU C API.
Definition: umachine.h:136
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:134