ICU 76.1 76.1
Loading...
Searching...
No Matches
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/uenum.h"
18
19#if U_SHOW_CPLUSPLUS_API
21#endif // U_SHOW_CPLUSPLUS_API
22
23#ifndef U_HIDE_INTERNAL_API
24#include "unicode/unum.h"
25#endif /* U_HIDE_INTERNAL_API */
26
27// Forward-declaration
28struct UFormattedNumber;
30
70#ifndef U_HIDE_DEPRECATED_API
76#endif /* U_HIDE_DEPRECATED_API */
77};
82
87struct UPluralRules;
88typedef struct UPluralRules UPluralRules;
99U_CAPI UPluralRules* U_EXPORT2
100uplrules_open(const char *locale, UErrorCode *status);
101
111U_CAPI UPluralRules* U_EXPORT2
112uplrules_openForType(const char *locale, UPluralType type, UErrorCode *status);
113
119U_CAPI void U_EXPORT2
121
122
123#if U_SHOW_CPLUSPLUS_API
124
125U_NAMESPACE_BEGIN
126
137
138U_NAMESPACE_END
139
140#endif
141
142
155U_CAPI int32_t U_EXPORT2
157 double number,
158 UChar *keyword, int32_t capacity,
159 UErrorCode *status);
160
178U_CAPI int32_t U_EXPORT2
180 const struct UFormattedNumber* number,
181 UChar *keyword, int32_t capacity,
182 UErrorCode *status);
183
199U_CAPI int32_t U_EXPORT2
201 const struct UFormattedNumberRange* urange,
202 UChar *keyword, int32_t capacity,
203 UErrorCode *status);
204
205#ifndef U_HIDE_INTERNAL_API
224U_CAPI int32_t U_EXPORT2
226 double number,
227 const UNumberFormat *fmt,
228 UChar *keyword, int32_t capacity,
229 UErrorCode *status);
230
231#endif /* U_HIDE_INTERNAL_API */
232
243U_CAPI UEnumeration* U_EXPORT2
245 UErrorCode *status);
246
247#endif /* #if !UCONFIG_NO_FORMATTING */
248
249#endif
"Smart pointer" class, closes a UPluralRules via uplrules_close().
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
C API: String Enumeration.
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition uenum.h:44
struct UFormattedNumber UFormattedNumber
C-compatible version of icu::number::FormattedNumber.
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition umachine.h:110
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition umachine.h:378
C API: Compatibility APIs for number formatting.
void * UNumberFormat
A number formatter.
Definition unum.h:145
struct UFormattedNumberRange UFormattedNumberRange
C-compatible version of icu::number::FormattedNumberRange.
U_CAPI int32_t uplrules_selectForRange(const UPluralRules *uplrules, const struct UFormattedNumberRange *urange, UChar *keyword, int32_t capacity, UErrorCode *status)
Given a formatted number range, returns the overall plural form of the range.
struct UPluralRules UPluralRules
C typedef for struct UPluralRules.
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 void uplrules_close(UPluralRules *uplrules)
Closes a UPluralRules object.
U_CAPI int32_t uplrules_selectFormatted(const UPluralRules *uplrules, const struct UFormattedNumber *number, UChar *keyword, int32_t capacity, UErrorCode *status)
Given a formatted number, returns the keyword of the first rule that applies to the number,...
U_CAPI int32_t uplrules_select(const UPluralRules *uplrules, double number, UChar *keyword, int32_t capacity, UErrorCode *status)
Given a floating-point number, returns the keyword of the first rule that applies to the number,...
U_CAPI UEnumeration * uplrules_getKeywords(const UPluralRules *uplrules, UErrorCode *status)
Creates a string enumeration of all plural rule keywords used in this UPluralRules object.
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...
U_CAPI 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...
UPluralType
Type of plurals and PluralRules.
@ UPLURAL_TYPE_ORDINAL
Plural rules for ordinal numbers: 1st file, 2nd file, 3rd file, 4th file, etc.
@ UPLURAL_TYPE_CARDINAL
Plural rules for cardinal numbers: 1 file vs.
@ UPLURAL_TYPE_COUNT
One more than the highest normal UPluralType value.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition utypes.h:430