OLD | NEW |
1 /* | 1 /* |
2 ********************************************************************** | 2 ********************************************************************** |
3 * Copyright (c) 2002-2013, International Business Machines | 3 * Copyright (c) 2002-2014, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ********************************************************************** | 5 ********************************************************************** |
6 */ | 6 */ |
7 #ifndef _UCURR_H_ | 7 #ifndef _UCURR_H_ |
8 #define _UCURR_H_ | 8 #define _UCURR_H_ |
9 | 9 |
10 #include "unicode/utypes.h" | 10 #include "unicode/utypes.h" |
11 #include "unicode/uenum.h" | 11 #include "unicode/uenum.h" |
12 | 12 |
13 /** | 13 /** |
14 * \file | 14 * \file |
15 * \brief C API: Encapsulates information about a currency. | 15 * \brief C API: Encapsulates information about a currency. |
16 */ | 16 */ |
17 | 17 |
18 #if !UCONFIG_NO_FORMATTING | 18 #if !UCONFIG_NO_FORMATTING |
19 | 19 |
20 /** | 20 /** |
| 21 * Currency Usage used for Decimal Format |
| 22 * @draft ICU 54 |
| 23 */ |
| 24 enum UCurrencyUsage { |
| 25 #ifndef U_HIDE_DRAFT_API |
| 26 /** |
| 27 * a setting to specify currency usage which determines currency digit |
| 28 * and rounding for standard usage, for example: "50.00 NT$" |
| 29 * used as DEFAULT value |
| 30 * @draft ICU 54 |
| 31 */ |
| 32 UCURR_USAGE_STANDARD=0, |
| 33 /** |
| 34 * a setting to specify currency usage which determines currency digit |
| 35 * and rounding for cash usage, for example: "50 NT$" |
| 36 * @draft ICU 54 |
| 37 */ |
| 38 UCURR_USAGE_CASH=1, |
| 39 #endif /* U_HIDE_DRAFT_API */ |
| 40 /** |
| 41 * One higher than the last enum UCurrencyUsage constant. |
| 42 * @draft ICU 54 |
| 43 */ |
| 44 UCURR_USAGE_COUNT=2 |
| 45 }; |
| 46 typedef enum UCurrencyUsage UCurrencyUsage; |
| 47 |
| 48 /** |
21 * The ucurr API encapsulates information about a currency, as defined by | 49 * The ucurr API encapsulates information about a currency, as defined by |
22 * ISO 4217. A currency is represented by a 3-character string | 50 * ISO 4217. A currency is represented by a 3-character string |
23 * containing its ISO 4217 code. This API can return various data | 51 * containing its ISO 4217 code. This API can return various data |
24 * necessary the proper display of a currency: | 52 * necessary the proper display of a currency: |
25 * | 53 * |
26 * <ul><li>A display symbol, for a specific locale | 54 * <ul><li>A display symbol, for a specific locale |
27 * <li>The number of fraction digits to display | 55 * <li>The number of fraction digits to display |
28 * <li>A rounding increment | 56 * <li>A rounding increment |
29 * </ul> | 57 * </ul> |
30 * | 58 * |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 ucurr_getPluralName(const UChar* currency, | 186 ucurr_getPluralName(const UChar* currency, |
159 const char* locale, | 187 const char* locale, |
160 UBool* isChoiceFormat, | 188 UBool* isChoiceFormat, |
161 const char* pluralCount, | 189 const char* pluralCount, |
162 int32_t* len, | 190 int32_t* len, |
163 UErrorCode* ec); | 191 UErrorCode* ec); |
164 | 192 |
165 /** | 193 /** |
166 * Returns the number of the number of fraction digits that should | 194 * Returns the number of the number of fraction digits that should |
167 * be displayed for the given currency. | 195 * be displayed for the given currency. |
| 196 * This is equivalent to ucurr_getDefaultFractionDigitsForUsage(currency,UCURR_U
SAGE_STANDARD,ec); |
168 * @param currency null-terminated 3-letter ISO 4217 code | 197 * @param currency null-terminated 3-letter ISO 4217 code |
169 * @param ec input-output error code | 198 * @param ec input-output error code |
170 * @return a non-negative number of fraction digits to be | 199 * @return a non-negative number of fraction digits to be |
171 * displayed, or 0 if there is an error | 200 * displayed, or 0 if there is an error |
172 * @stable ICU 3.0 | 201 * @stable ICU 3.0 |
173 */ | 202 */ |
174 U_STABLE int32_t U_EXPORT2 | 203 U_STABLE int32_t U_EXPORT2 |
175 ucurr_getDefaultFractionDigits(const UChar* currency, | 204 ucurr_getDefaultFractionDigits(const UChar* currency, |
176 UErrorCode* ec); | 205 UErrorCode* ec); |
177 | 206 |
| 207 #ifndef U_HIDE_DRAFT_API |
| 208 /** |
| 209 * Returns the number of the number of fraction digits that should |
| 210 * be displayed for the given currency with usage. |
| 211 * @param currency null-terminated 3-letter ISO 4217 code |
| 212 * @param usage enum usage for the currency |
| 213 * @param ec input-output error code |
| 214 * @return a non-negative number of fraction digits to be |
| 215 * displayed, or 0 if there is an error |
| 216 * @draft ICU 54 |
| 217 */ |
| 218 U_DRAFT int32_t U_EXPORT2 |
| 219 ucurr_getDefaultFractionDigitsForUsage(const UChar* currency, |
| 220 const UCurrencyUsage usage, |
| 221 UErrorCode* ec); |
| 222 #endif /* U_HIDE_DRAFT_API */ |
| 223 |
178 /** | 224 /** |
179 * Returns the rounding increment for the given currency, or 0.0 if no | 225 * Returns the rounding increment for the given currency, or 0.0 if no |
180 * rounding is done by the currency. | 226 * rounding is done by the currency. |
| 227 * This is equivalent to ucurr_getRoundingIncrementForUsage(currency,UCURR_USAGE
_STANDARD,ec); |
181 * @param currency null-terminated 3-letter ISO 4217 code | 228 * @param currency null-terminated 3-letter ISO 4217 code |
182 * @param ec input-output error code | 229 * @param ec input-output error code |
183 * @return the non-negative rounding increment, or 0.0 if none, | 230 * @return the non-negative rounding increment, or 0.0 if none, |
184 * or 0.0 if there is an error | 231 * or 0.0 if there is an error |
185 * @stable ICU 3.0 | 232 * @stable ICU 3.0 |
186 */ | 233 */ |
187 U_STABLE double U_EXPORT2 | 234 U_STABLE double U_EXPORT2 |
188 ucurr_getRoundingIncrement(const UChar* currency, | 235 ucurr_getRoundingIncrement(const UChar* currency, |
189 UErrorCode* ec); | 236 UErrorCode* ec); |
190 | 237 |
| 238 #ifndef U_HIDE_DRAFT_API |
| 239 /** |
| 240 * Returns the rounding increment for the given currency, or 0.0 if no |
| 241 * rounding is done by the currency given usage. |
| 242 * @param currency null-terminated 3-letter ISO 4217 code |
| 243 * @param usage enum usage for the currency |
| 244 * @param ec input-output error code |
| 245 * @return the non-negative rounding increment, or 0.0 if none, |
| 246 * or 0.0 if there is an error |
| 247 * @draft ICU 54 |
| 248 */ |
| 249 U_DRAFT double U_EXPORT2 |
| 250 ucurr_getRoundingIncrementForUsage(const UChar* currency, |
| 251 const UCurrencyUsage usage, |
| 252 UErrorCode* ec); |
| 253 #endif /* U_HIDE_DRAFT_API */ |
| 254 |
191 /** | 255 /** |
192 * Selector constants for ucurr_openCurrencies(). | 256 * Selector constants for ucurr_openCurrencies(). |
193 * | 257 * |
194 * @see ucurr_openCurrencies | 258 * @see ucurr_openCurrencies |
195 * @stable ICU 3.2 | 259 * @stable ICU 3.2 |
196 */ | 260 */ |
197 typedef enum UCurrCurrencyType { | 261 typedef enum UCurrCurrencyType { |
198 /** | 262 /** |
199 * Select all ISO-4217 currency codes. | 263 * Select all ISO-4217 currency codes. |
200 * @stable ICU 3.2 | 264 * @stable ICU 3.2 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 * @param currency null-terminated 3-letter ISO 4217 code | 415 * @param currency null-terminated 3-letter ISO 4217 code |
352 * @return The ISO 4217 numeric code of the currency | 416 * @return The ISO 4217 numeric code of the currency |
353 * @stable ICU 49 | 417 * @stable ICU 49 |
354 */ | 418 */ |
355 U_STABLE int32_t U_EXPORT2 | 419 U_STABLE int32_t U_EXPORT2 |
356 ucurr_getNumericCode(const UChar* currency); | 420 ucurr_getNumericCode(const UChar* currency); |
357 | 421 |
358 #endif /* #if !UCONFIG_NO_FORMATTING */ | 422 #endif /* #if !UCONFIG_NO_FORMATTING */ |
359 | 423 |
360 #endif | 424 #endif |
OLD | NEW |