OLD | NEW |
1 /* | 1 /* |
2 ********************************************************************************
********* | 2 ********************************************************************************
********* |
3 * Copyright (C) 2013, International Business Machines | 3 * Copyright (C) 2013-2014, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ********************************************************************************
********* | 5 ********************************************************************************
********* |
6 */ | 6 */ |
7 | 7 |
8 #ifndef UNUMSYS_H | 8 #ifndef UNUMSYS_H |
9 #define UNUMSYS_H | 9 #define UNUMSYS_H |
10 | 10 |
11 #include "unicode/utypes.h" | 11 #include "unicode/utypes.h" |
12 | 12 |
13 #if !UCONFIG_NO_FORMATTING | 13 #if !UCONFIG_NO_FORMATTING |
(...skipping 13 matching lines...) Expand all Loading... |
27 * More complicated numbering systems are algorithmic in nature, and require use | 27 * More complicated numbering systems are algorithmic in nature, and require use |
28 * of an RBNF formatter (rule based number formatter), in order to calculate | 28 * of an RBNF formatter (rule based number formatter), in order to calculate |
29 * the characters to be displayed for a given number. Examples of algorithmic | 29 * the characters to be displayed for a given number. Examples of algorithmic |
30 * numbering systems include Roman numerals, Chinese numerals, and Hebrew numera
ls. | 30 * numbering systems include Roman numerals, Chinese numerals, and Hebrew numera
ls. |
31 * Formatting rules for many commonly used numbering systems are included in | 31 * Formatting rules for many commonly used numbering systems are included in |
32 * the ICU package, based on the numbering system rules defined in CLDR. | 32 * the ICU package, based on the numbering system rules defined in CLDR. |
33 * Alternate numbering systems can be specified to a locale by using the | 33 * Alternate numbering systems can be specified to a locale by using the |
34 * numbers locale keyword. | 34 * numbers locale keyword. |
35 */ | 35 */ |
36 | 36 |
37 #ifndef U_HIDE_DRAFT_API | |
38 | |
39 /** | 37 /** |
40 * Opaque UNumberingSystem object for use in C programs. | 38 * Opaque UNumberingSystem object for use in C programs. |
41 * @draft ICU 52 | 39 * @stable ICU 52 |
42 */ | 40 */ |
43 struct UNumberingSystem; | 41 struct UNumberingSystem; |
44 typedef struct UNumberingSystem UNumberingSystem; /**< C typedef for struct UNu
mberingSystem. @draft ICU 52 */ | 42 typedef struct UNumberingSystem UNumberingSystem; /**< C typedef for struct UNu
mberingSystem. @stable ICU 52 */ |
45 | 43 |
46 /** | 44 /** |
47 * Opens a UNumberingSystem object using the default numbering system for the sp
ecified | 45 * Opens a UNumberingSystem object using the default numbering system for the sp
ecified |
48 * locale. | 46 * locale. |
49 * @param locale The locale for which the default numbering system should be
opened. | 47 * @param locale The locale for which the default numbering system should be
opened. |
50 * @param status A pointer to a UErrorCode to receive any errors. For example
, this | 48 * @param status A pointer to a UErrorCode to receive any errors. For example
, this |
51 * may be U_UNSUPPORTED_ERROR for a locale such as "en@numbers=
xyz" that | 49 * may be U_UNSUPPORTED_ERROR for a locale such as "en@numbers=
xyz" that |
52 * specifies a numbering system unknown to ICU. | 50 * specifies a numbering system unknown to ICU. |
53 * @return A UNumberingSystem for the specified locale, or NULL if an e
rror | 51 * @return A UNumberingSystem for the specified locale, or NULL if an e
rror |
54 * occurred. | 52 * occurred. |
55 * @draft ICU 52 | 53 * @stable ICU 52 |
56 */ | 54 */ |
57 U_DRAFT UNumberingSystem * U_EXPORT2 | 55 U_STABLE UNumberingSystem * U_EXPORT2 |
58 unumsys_open(const char *locale, UErrorCode *status); | 56 unumsys_open(const char *locale, UErrorCode *status); |
59 | 57 |
60 /** | 58 /** |
61 * Opens a UNumberingSystem object using the name of one of the predefined numbe
ring | 59 * Opens a UNumberingSystem object using the name of one of the predefined numbe
ring |
62 * systems specified by CLDR and known to ICU, such as "latn", "arabext", or "ha
nidec"; | 60 * systems specified by CLDR and known to ICU, such as "latn", "arabext", or "ha
nidec"; |
63 * the full list is returned by unumsys_openAvailableNames. Note that some of th
e names | 61 * the full list is returned by unumsys_openAvailableNames. Note that some of th
e names |
64 * listed at http://unicode.org/repos/cldr/tags/latest/common/bcp47/number.xml -
e.g. | 62 * listed at http://unicode.org/repos/cldr/tags/latest/common/bcp47/number.xml -
e.g. |
65 * default, native, traditional, finance - do not identify specific numbering sy
stems, | 63 * default, native, traditional, finance - do not identify specific numbering sy
stems, |
66 * but rather key values that may only be used as part of a locale, which in tur
n | 64 * but rather key values that may only be used as part of a locale, which in tur
n |
67 * defines how they are mapped to a specific numbering system such as "latn" or
"hant". | 65 * defines how they are mapped to a specific numbering system such as "latn" or
"hant". |
68 * | 66 * |
69 * @param name The name of the numbering system for which a UNumberingSyste
m object | 67 * @param name The name of the numbering system for which a UNumberingSyste
m object |
70 * should be opened. | 68 * should be opened. |
71 * @param status A pointer to a UErrorCode to receive any errors. For example
, this | 69 * @param status A pointer to a UErrorCode to receive any errors. For example
, this |
72 * may be U_UNSUPPORTED_ERROR for a numbering system such as "x
yz" that | 70 * may be U_UNSUPPORTED_ERROR for a numbering system such as "x
yz" that |
73 * is unknown to ICU. | 71 * is unknown to ICU. |
74 * @return A UNumberingSystem for the specified name, or NULL if an err
or | 72 * @return A UNumberingSystem for the specified name, or NULL if an err
or |
75 * occurred. | 73 * occurred. |
76 * @draft ICU 52 | 74 * @stable ICU 52 |
77 */ | 75 */ |
78 U_DRAFT UNumberingSystem * U_EXPORT2 | 76 U_STABLE UNumberingSystem * U_EXPORT2 |
79 unumsys_openByName(const char *name, UErrorCode *status); | 77 unumsys_openByName(const char *name, UErrorCode *status); |
80 | 78 |
81 /** | 79 /** |
82 * Close a UNumberingSystem object. Once closed it may no longer be used. | 80 * Close a UNumberingSystem object. Once closed it may no longer be used. |
83 * @param unumsys The UNumberingSystem object to close. | 81 * @param unumsys The UNumberingSystem object to close. |
84 * @draft ICU 52 | 82 * @stable ICU 52 |
85 */ | 83 */ |
86 U_DRAFT void U_EXPORT2 | 84 U_STABLE void U_EXPORT2 |
87 unumsys_close(UNumberingSystem *unumsys); | 85 unumsys_close(UNumberingSystem *unumsys); |
88 | 86 |
89 #if U_SHOW_CPLUSPLUS_API | 87 #if U_SHOW_CPLUSPLUS_API |
90 U_NAMESPACE_BEGIN | 88 U_NAMESPACE_BEGIN |
91 | 89 |
92 /** | 90 /** |
93 * \class LocalUNumberingSystemPointer | 91 * \class LocalUNumberingSystemPointer |
94 * "Smart pointer" class, closes a UNumberingSystem via unumsys_close(). | 92 * "Smart pointer" class, closes a UNumberingSystem via unumsys_close(). |
95 * For most methods see the LocalPointerBase base class. | 93 * For most methods see the LocalPointerBase base class. |
96 * @see LocalPointerBase | 94 * @see LocalPointerBase |
97 * @see LocalPointer | 95 * @see LocalPointer |
98 * @draft ICU 52 | 96 * @stable ICU 52 |
99 */ | 97 */ |
100 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberingSystemPointer, UNumberingSystem, unum
sys_close); | 98 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberingSystemPointer, UNumberingSystem, unum
sys_close); |
101 | 99 |
102 U_NAMESPACE_END | 100 U_NAMESPACE_END |
103 #endif | 101 #endif |
104 | 102 |
105 /** | 103 /** |
106 * Returns an enumeration over the names of all of the predefined numbering syst
ems known | 104 * Returns an enumeration over the names of all of the predefined numbering syst
ems known |
107 * to ICU. | 105 * to ICU. |
108 * @param status A pointer to a UErrorCode to receive any errors. | 106 * @param status A pointer to a UErrorCode to receive any errors. |
109 * @return A pointer to a UEnumeration that must be closed with uenum_c
lose(), | 107 * @return A pointer to a UEnumeration that must be closed with uenum_c
lose(), |
110 * or NULL if an error occurred. | 108 * or NULL if an error occurred. |
111 * @draft ICU 52 | 109 * @stable ICU 52 |
112 */ | 110 */ |
113 U_DRAFT UEnumeration * U_EXPORT2 | 111 U_STABLE UEnumeration * U_EXPORT2 |
114 unumsys_openAvailableNames(UErrorCode *status); | 112 unumsys_openAvailableNames(UErrorCode *status); |
115 | 113 |
116 /** | 114 /** |
117 * Returns the name of the specified UNumberingSystem object (if it is one of th
e | 115 * Returns the name of the specified UNumberingSystem object (if it is one of th
e |
118 * predefined names known to ICU). | 116 * predefined names known to ICU). |
119 * @param unumsys The UNumberingSystem whose name is desired. | 117 * @param unumsys The UNumberingSystem whose name is desired. |
120 * @return A pointer to the name of the specified UNumberingSystem obje
ct, or | 118 * @return A pointer to the name of the specified UNumberingSystem obje
ct, or |
121 * NULL if the name is not one of the ICU predefined names. The
pointer | 119 * NULL if the name is not one of the ICU predefined names. The
pointer |
122 * is only valid for the lifetime of the UNumberingSystem objec
t. | 120 * is only valid for the lifetime of the UNumberingSystem objec
t. |
123 * @draft ICU 52 | 121 * @stable ICU 52 |
124 */ | 122 */ |
125 U_DRAFT const char * U_EXPORT2 | 123 U_STABLE const char * U_EXPORT2 |
126 unumsys_getName(const UNumberingSystem *unumsys); | 124 unumsys_getName(const UNumberingSystem *unumsys); |
127 | 125 |
128 /** | 126 /** |
129 * Returns whether the given UNumberingSystem object is for an algorithmic (not
purely | 127 * Returns whether the given UNumberingSystem object is for an algorithmic (not
purely |
130 * positional) system. | 128 * positional) system. |
131 * @param unumsys The UNumberingSystem whose algorithmic status is desired. | 129 * @param unumsys The UNumberingSystem whose algorithmic status is desired. |
132 * @return TRUE if the specified UNumberingSystem object is for an algo
rithmic | 130 * @return TRUE if the specified UNumberingSystem object is for an algo
rithmic |
133 * system. | 131 * system. |
134 * @draft ICU 52 | 132 * @stable ICU 52 |
135 */ | 133 */ |
136 U_DRAFT UBool U_EXPORT2 | 134 U_STABLE UBool U_EXPORT2 |
137 unumsys_isAlgorithmic(const UNumberingSystem *unumsys); | 135 unumsys_isAlgorithmic(const UNumberingSystem *unumsys); |
138 | 136 |
139 /** | 137 /** |
140 * Returns the radix of the specified UNumberingSystem object. Simple positional | 138 * Returns the radix of the specified UNumberingSystem object. Simple positional |
141 * numbering systems typically have radix 10, but might have a radix of e.g. 16
for | 139 * numbering systems typically have radix 10, but might have a radix of e.g. 16
for |
142 * hexadecimal. The radix is less well-defined for non-positional algorithmic sy
stems. | 140 * hexadecimal. The radix is less well-defined for non-positional algorithmic sy
stems. |
143 * @param unumsys The UNumberingSystem whose radix is desired. | 141 * @param unumsys The UNumberingSystem whose radix is desired. |
144 * @return The radix of the specified UNumberingSystem object. | 142 * @return The radix of the specified UNumberingSystem object. |
145 * @draft ICU 52 | 143 * @stable ICU 52 |
146 */ | 144 */ |
147 U_DRAFT int32_t U_EXPORT2 | 145 U_STABLE int32_t U_EXPORT2 |
148 unumsys_getRadix(const UNumberingSystem *unumsys); | 146 unumsys_getRadix(const UNumberingSystem *unumsys); |
149 | 147 |
150 /** | 148 /** |
151 * Get the description string of the specified UNumberingSystem object. For simp
le | 149 * Get the description string of the specified UNumberingSystem object. For simp
le |
152 * positional systems this is the ordered string of digits (with length matching | 150 * positional systems this is the ordered string of digits (with length matching |
153 * the radix), e.g. "\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5
D" | 151 * the radix), e.g. "\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5
D" |
154 * for "hanidec"; it would be "0123456789ABCDEF" for hexadecimal. For | 152 * for "hanidec"; it would be "0123456789ABCDEF" for hexadecimal. For |
155 * algorithmic systems this is the name of the RBNF ruleset used for formatting, | 153 * algorithmic systems this is the name of the RBNF ruleset used for formatting, |
156 * e.g. "zh/SpelloutRules/%spellout-cardinal" for "hans" or "%greek-upper" for | 154 * e.g. "zh/SpelloutRules/%spellout-cardinal" for "hans" or "%greek-upper" for |
157 * "grek". | 155 * "grek". |
158 * @param unumsys The UNumberingSystem whose description string is desired. | 156 * @param unumsys The UNumberingSystem whose description string is desired. |
159 * @param result A pointer to a buffer to receive the description string. | 157 * @param result A pointer to a buffer to receive the description string. |
160 * @param resultLength The maximum size of result. | 158 * @param resultLength The maximum size of result. |
161 * @param status A pointer to a UErrorCode to receive any errors. | 159 * @param status A pointer to a UErrorCode to receive any errors. |
162 * @return The total buffer size needed; if greater than resultLength,
the | 160 * @return The total buffer size needed; if greater than resultLength,
the |
163 * output was truncated. | 161 * output was truncated. |
164 * @draft ICU 52 | 162 * @stable ICU 52 |
165 */ | 163 */ |
166 U_DRAFT int32_t U_EXPORT2 | 164 U_STABLE int32_t U_EXPORT2 |
167 unumsys_getDescription(const UNumberingSystem *unumsys, UChar *result, | 165 unumsys_getDescription(const UNumberingSystem *unumsys, UChar *result, |
168 int32_t resultLength, UErrorCode *status); | 166 int32_t resultLength, UErrorCode *status); |
169 | 167 |
170 #endif /* U_HIDE_DRAFT_API */ | |
171 | |
172 #endif /* #if !UCONFIG_NO_FORMATTING */ | 168 #endif /* #if !UCONFIG_NO_FORMATTING */ |
173 | 169 |
174 #endif | 170 #endif |
OLD | NEW |