ICU 69.1 69.1

ucurr.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) 2002-2016, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
8 */
9 #ifndef _UCURR_H_
10 #define _UCURR_H_
11
12 #include "unicode/utypes.h"
13 #include "unicode/uenum.h"
14
35 #if !UCONFIG_NO_FORMATTING
36
41 enum UCurrencyUsage {
48 UCURR_USAGE_STANDARD=0,
54 UCURR_USAGE_CASH=1,
55 #ifndef U_HIDE_DEPRECATED_API
56
60 UCURR_USAGE_COUNT=2
61 #endif // U_HIDE_DEPRECATED_API
62 };
64 typedef enum UCurrencyUsage UCurrencyUsage;
65
81 U_CAPI int32_t U_EXPORT2
82 ucurr_forLocale(const char* locale,
83 UChar* buff,
84 int32_t buffCapacity,
85 UErrorCode* ec);
86
93 typedef enum UCurrNameStyle {
99 UCURR_SYMBOL_NAME,
100
106 UCURR_LONG_NAME,
107
116 UCURR_NARROW_SYMBOL_NAME,
117
118 #ifndef U_HIDE_DRAFT_API
119
127 UCURR_FORMAL_SYMBOL_NAME,
128
136 UCURR_VARIANT_SYMBOL_NAME
137 #endif // U_HIDE_DRAFT_API
138
139 } UCurrNameStyle;
140
141 #if !UCONFIG_NO_SERVICE
142
145 typedef const void* UCurrRegistryKey;
146
158 U_CAPI UCurrRegistryKey U_EXPORT2
159 ucurr_register(const UChar* isoCode,
160 const char* locale,
161 UErrorCode* status);
173 U_CAPI UBool U_EXPORT2
174 ucurr_unregister(UCurrRegistryKey key, UErrorCode* status);
175 #endif /* UCONFIG_NO_SERVICE */
176
194 U_CAPI const UChar* U_EXPORT2
195 ucurr_getName(const UChar* currency,
196 const char* locale,
197 UCurrNameStyle nameStyle,
198 UBool* isChoiceFormat,
199 int32_t* len,
200 UErrorCode* ec);
201
219 U_CAPI const UChar* U_EXPORT2
220 ucurr_getPluralName(const UChar* currency,
221 const char* locale,
222 UBool* isChoiceFormat,
223 const char* pluralCount,
224 int32_t* len,
225 UErrorCode* ec);
226
244 U_CAPI int32_t U_EXPORT2
245 ucurr_getDefaultFractionDigits(const UChar* currency,
246 UErrorCode* ec);
247
265 U_CAPI int32_t U_EXPORT2
266 ucurr_getDefaultFractionDigitsForUsage(const UChar* currency,
267 const UCurrencyUsage usage,
268 UErrorCode* ec);
269
280 U_CAPI double U_EXPORT2
281 ucurr_getRoundingIncrement(const UChar* currency,
282 UErrorCode* ec);
283
294 U_CAPI double U_EXPORT2
295 ucurr_getRoundingIncrementForUsage(const UChar* currency,
296 const UCurrencyUsage usage,
297 UErrorCode* ec);
298
305 typedef enum UCurrCurrencyType {
310 UCURR_ALL = INT32_MAX,
319 UCURR_COMMON = 1,
327 UCURR_UNCOMMON = 2,
333 UCURR_DEPRECATED = 4,
339 UCURR_NON_DEPRECATED = 8
340 } UCurrCurrencyType;
341
351 U_CAPI UEnumeration * U_EXPORT2
352 ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode);
353
380 U_CAPI UBool U_EXPORT2
381 ucurr_isAvailable(const UChar* isoCode,
382 UDate from,
383 UDate to,
384 UErrorCode* errorCode);
385
400 U_CAPI int32_t U_EXPORT2
401 ucurr_countCurrencies(const char* locale,
402 UDate date,
403 UErrorCode* ec);
404
424 U_CAPI int32_t U_EXPORT2
425 ucurr_forLocaleAndDate(const char* locale,
426 UDate date,
427 int32_t index,
428 UChar* buff,
429 int32_t buffCapacity,
430 UErrorCode* ec);
431
448 U_CAPI UEnumeration* U_EXPORT2
449 ucurr_getKeywordValuesForLocale(const char* key,
450 const char* locale,
451 UBool commonlyUsed,
452 UErrorCode* status);
453
463 U_CAPI int32_t U_EXPORT2
464 ucurr_getNumericCode(const UChar* currency);
465
466 #endif /* #if !UCONFIG_NO_FORMATTING */
467
468 #endif
UCurrNameStyle
UCurrNameStyle
Selector constants for ucurr_getName().
Definition: ucurr.h:93
ucurr_forLocale
U_CAPI int32_t ucurr_forLocale(const char *locale, UChar *buff, int32_t buffCapacity, UErrorCode *ec)
Finds a currency code for the given locale.
UCURR_NARROW_SYMBOL_NAME
@ UCURR_NARROW_SYMBOL_NAME
Selector for getName() indicating the narrow currency symbol.
Definition: ucurr.h:116
ucurr_getNumericCode
U_CAPI int32_t ucurr_getNumericCode(const UChar *currency)
Returns the ISO 4217 numeric code for the currency.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
UCURR_USAGE_COUNT
@ UCURR_USAGE_COUNT
One higher than the last enum UCurrencyUsage constant.
Definition: ucurr.h:60
ucurr_getName
const U_CAPI UChar * ucurr_getName(const UChar *currency, const char *locale, UCurrNameStyle nameStyle, UBool *isChoiceFormat, int32_t *len, UErrorCode *ec)
Returns the display name for the given currency in the given locale.
UCURR_FORMAL_SYMBOL_NAME
@ UCURR_FORMAL_SYMBOL_NAME
Selector for getName() indicating the formal currency symbol.
Definition: ucurr.h:127
UCurrencyUsage
UCurrencyUsage
Currency Usage used for Decimal Format.
Definition: ucurr.h:41
UCURR_LONG_NAME
@ UCURR_LONG_NAME
Selector for ucurr_getName indicating the long name for a currency, such as "US Dollar" for USD.
Definition: ucurr.h:106
UCURR_DEPRECATED
@ UCURR_DEPRECATED
Select only deprecated ISO-4217 codes.
Definition: ucurr.h:333
ucurr_isAvailable
U_CAPI UBool ucurr_isAvailable(const UChar *isoCode, UDate from, UDate to, UErrorCode *errorCode)
Queries if the given ISO 4217 3-letter code is available on the specified date range.
ucurr_countCurrencies
U_CAPI int32_t ucurr_countCurrencies(const char *locale, UDate date, UErrorCode *ec)
Finds the number of valid currency codes for the given locale and date.
ucurr_forLocaleAndDate
U_CAPI int32_t ucurr_forLocaleAndDate(const char *locale, UDate date, int32_t index, UChar *buff, int32_t buffCapacity, UErrorCode *ec)
Finds a currency code for the given locale and date.
UCURR_UNCOMMON
@ UCURR_UNCOMMON
Select ISO-4217 uncommon currency codes.
Definition: ucurr.h:327
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
UCURR_VARIANT_SYMBOL_NAME
@ UCURR_VARIANT_SYMBOL_NAME
Selector for getName() indicating the variant currency symbol.
Definition: ucurr.h:136
UCurrCurrencyType
UCurrCurrencyType
Selector constants for ucurr_openCurrencies().
Definition: ucurr.h:305
UCURR_USAGE_STANDARD
@ UCURR_USAGE_STANDARD
a setting to specify currency usage which determines currency digit and rounding for standard usage,...
Definition: ucurr.h:48
ucurr_register
U_CAPI UCurrRegistryKey ucurr_register(const UChar *isoCode, const char *locale, UErrorCode *status)
Register an (existing) ISO 4217 currency code for the given locale.
ucurr_getDefaultFractionDigits
U_CAPI int32_t ucurr_getDefaultFractionDigits(const UChar *currency, UErrorCode *ec)
Returns the number of the number of fraction digits that should be displayed for the given currency.
INT32_MAX
#define INT32_MAX
The largest value a 32 bit signed integer can hold.
Definition: umachine.h:208
UCurrRegistryKey
const typedef void * UCurrRegistryKey
Definition: ucurr.h:145
UCURR_USAGE_CASH
@ UCURR_USAGE_CASH
a setting to specify currency usage which determines currency digit and rounding for cash usage,...
Definition: ucurr.h:54
ucurr_openISOCurrencies
U_CAPI UEnumeration * ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode)
Provides a UEnumeration object for listing ISO-4217 codes.
UDate
double UDate
Date and Time data type.
Definition: utypes.h:203
ucurr_getRoundingIncrementForUsage
U_CAPI double ucurr_getRoundingIncrementForUsage(const UChar *currency, const UCurrencyUsage usage, UErrorCode *ec)
Returns the rounding increment for the given currency, or 0.0 if no rounding is done by the currency ...
UCURR_SYMBOL_NAME
@ UCURR_SYMBOL_NAME
Selector for ucurr_getName indicating a symbolic name for a currency, such as "$" for USD.
Definition: ucurr.h:99
ucurr_unregister
U_CAPI UBool ucurr_unregister(UCurrRegistryKey key, UErrorCode *status)
Unregister the previously-registered currency definitions using the URegistryKey returned from ucurr_...
ucurr_getDefaultFractionDigitsForUsage
U_CAPI int32_t ucurr_getDefaultFractionDigitsForUsage(const UChar *currency, const UCurrencyUsage usage, UErrorCode *ec)
Returns the number of the number of fraction digits that should be displayed for the given currency w...
UChar
char16_t UChar
Definition: umachine.h:418
ucurr_getRoundingIncrement
U_CAPI double ucurr_getRoundingIncrement(const UChar *currency, UErrorCode *ec)
Returns the rounding increment for the given currency, or 0.0 if no rounding is done by the currency.
UEnumeration
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:44
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
ucurr_getPluralName
const U_CAPI UChar * ucurr_getPluralName(const UChar *currency, const char *locale, UBool *isChoiceFormat, const char *pluralCount, int32_t *len, UErrorCode *ec)
Returns the plural name for the given currency in the given locale.
UCURR_COMMON
@ UCURR_COMMON
Select only ISO-4217 commonly used currency codes.
Definition: ucurr.h:319
UCURR_ALL
@ UCURR_ALL
Select all ISO-4217 currency codes.
Definition: ucurr.h:310
UCURR_NON_DEPRECATED
@ UCURR_NON_DEPRECATED
Select only non-deprecated ISO-4217 codes.
Definition: ucurr.h:339
uenum.h
C API: String Enumeration.
ucurr_getKeywordValuesForLocale
U_CAPI UEnumeration * ucurr_getKeywordValuesForLocale(const char *key, const char *locale, UBool commonlyUsed, UErrorCode *status)
Given a key and a locale, returns an array of string values in a preferred order that would make a di...