ICU 59.1  59.1
upluralrules.h
Go to the documentation of this file.
1 // © 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 #include "unicode/uenum.h"
19 #ifndef U_HIDE_INTERNAL_API
20 #include "unicode/unum.h"
21 #endif /* U_HIDE_INTERNAL_API */
22 
61 #ifndef U_HIDE_DEPRECATED_API
62 
67 #endif /* U_HIDE_DEPRECATED_API */
68 };
72 typedef enum UPluralType UPluralType;
73 
78 struct UPluralRules;
79 typedef struct UPluralRules UPluralRules;
90 U_CAPI UPluralRules* U_EXPORT2
91 uplrules_open(const char *locale, UErrorCode *status);
92 
102 U_CAPI UPluralRules* U_EXPORT2
103 uplrules_openForType(const char *locale, UPluralType type, UErrorCode *status);
104 
110 U_CAPI void U_EXPORT2
111 uplrules_close(UPluralRules *uplrules);
112 
113 
114 #if U_SHOW_CPLUSPLUS_API
115 
117 
128 
130 
131 #endif
132 
133 
145 U_CAPI int32_t U_EXPORT2
146 uplrules_select(const UPluralRules *uplrules,
147  double number,
148  UChar *keyword, int32_t capacity,
149  UErrorCode *status);
150 
151 #ifndef U_HIDE_INTERNAL_API
152 
169 U_INTERNAL int32_t U_EXPORT2
171  double number,
172  const UNumberFormat *fmt,
173  UChar *keyword, int32_t capacity,
174  UErrorCode *status);
175 
176 #endif /* U_HIDE_INTERNAL_API */
177 
178 #ifndef U_HIDE_DRAFT_API
179 
189 U_DRAFT UEnumeration* U_EXPORT2
190 uplrules_getKeywords(const UPluralRules *uplrules,
191  UErrorCode *status);
192 #endif /* U_HIDE_DRAFT_API */
193 
194 #endif /* #if !UCONFIG_NO_FORMATTING */
195 
196 #endif
UEnumeration * uplrules_getKeywords(const UPluralRules *uplrules, UErrorCode *status)
Creates a string enumeration of all plural rule keywords used in this UPluralRules object...
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:109
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:43
#define U_INTERNAL
This is used to declare a function as an internal ICU C API.
Definition: umachine.h:119
U_CAPI void uplrules_close(UPluralRules *uplrules)
Closes a UPluralRules object.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:496
void * UNumberFormat
A number formatter.
Definition: unum.h:137
Plural rules for ordinal numbers: 1st file, 2nd file, 3rd file, 4th file, etc.
Definition: upluralrules.h:60
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
Plural rules for cardinal numbers: 1 file vs.
Definition: upluralrules.h:55
U_CAPI 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...
int32_t uplrules_selectWithFormat(const UPluralRules *uplrules, double number, const UNumberFormat *fmt, 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 UP...
U_CAPI UPluralRules * uplrules_open(const char *locale, UErrorCode *status)
Opens a new UPluralRules object using the predefined cardinal-number plural rules for a given locale...
U_CAPI 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...
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:349
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
One more than the highest normal UPluralType value.
Definition: upluralrules.h:66
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
UPluralType
Type of plurals and PluralRules.
Definition: upluralrules.h:50
C API: String Enumeration.
struct UPluralRules UPluralRules
C typedef for struct UPluralRules.
Definition: upluralrules.h:79
Basic definitions for ICU, for both C and C++ APIs.
"Smart pointer" class, closes a UPluralRules via uplrules_close().
#define U_DRAFT
This is used to declare a function as a draft public ICU C API.
Definition: umachine.h:113
C API: NumberFormat.