]> git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/unicode/uplrule.h
ICU-461.18.tar.gz
[apple/icu.git] / icuSources / i18n / unicode / uplrule.h
1 /*
2 ******************************************************************************
3 * Copyright (C) 2010 Apple Inc. All Rights Reserved.
4 ******************************************************************************
5 */
6
7 #ifndef UPLRULE_H
8 #define UPLRULE_H
9
10 #include "unicode/utypes.h"
11
12 #if !UCONFIG_NO_FORMATTING
13
14 struct UPluralRules;
15 /**
16 * A UPluralRules object for use in C programs.
17 * @internal
18 */
19 typedef struct UPluralRules UPluralRules;
20
21 /**
22 * Open a new UPluralRules object using the predefined plural rules for a
23 * given locale.
24 * @param locale The locale for which the rules are desired.
25 * @param status A pointer to a UErrorCode to receive any errors.
26 * @return A UPluralRules for the specified locale, or 0 if an error occurred.
27 * @internal
28 */
29 U_INTERNAL UPluralRules* U_EXPORT2
30 uplrule_open(const char *locale,
31 UErrorCode *status);
32
33 /**
34 * Close a UPluralRules object. Once closed it may no longer be used.
35 * @param plrules The UPluralRules object to close.
36 * @internal
37 */
38 U_INTERNAL void U_EXPORT2
39 uplrule_close(UPluralRules *plrules);
40
41 /**
42 * Given an int32_t number, returns the keyword of the first rule that
43 * applies to the number, according to the supplied UPluralRules object.
44 * @param plrules The UPluralRules object specifying the rules.
45 * @param number The number for which the rule has to be determined.
46 * @param keyword The keyword of the rule that applies to number.
47 * @param capacity The capacity of keyword.
48 * @param status A pointer to a UErrorCode to receive any errors.
49 * @return The length of keyword.
50 * @internal
51 */
52 U_INTERNAL int32_t U_EXPORT2
53 uplrule_select(const UPluralRules *plrules,
54 int32_t number,
55 UChar *keyword, int32_t capacity,
56 UErrorCode *status);
57
58 /**
59 * Given a double number, returns the keyword of the first rule that
60 * applies to the number, according to the supplied UPluralRules object.
61 * @param plrules The UPluralRules object specifying the rules.
62 * @param number The number for which the rule has to be determined.
63 * @param keyword The keyword of the rule that applies to number.
64 * @param capacity The capacity of keyword.
65 * @param status A pointer to a UErrorCode to receive any errors.
66 * @return The length of keyword.
67 * @internal
68 */
69 U_INTERNAL int32_t U_EXPORT2
70 uplrule_selectDouble(const UPluralRules *plrules,
71 double number,
72 UChar *keyword, int32_t capacity,
73 UErrorCode *status);
74
75 #endif /* #if !UCONFIG_NO_FORMATTING */
76
77 #endif