ICU 63.1 63.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_STABLE 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
108 #ifndef U_HIDE_DRAFT_API
109 ,
118 UCURR_NARROW_SYMBOL_NAME
119 #endif // U_HIDE_DRAFT_API
120 } UCurrNameStyle;
121
122 #if !UCONFIG_NO_SERVICE
123
126 typedef const void* UCurrRegistryKey;
127
139 U_STABLE UCurrRegistryKey U_EXPORT2
140 ucurr_register(const UChar* isoCode,
141 const char* locale,
142 UErrorCode* status);
154 U_STABLE UBool U_EXPORT2
155 ucurr_unregister(UCurrRegistryKey key, UErrorCode* status);
156 #endif /* UCONFIG_NO_SERVICE */
157
175 U_STABLE const UChar* U_EXPORT2
176 ucurr_getName(const UChar* currency,
177 const char* locale,
178 UCurrNameStyle nameStyle,
179 UBool* isChoiceFormat,
180 int32_t* len,
181 UErrorCode* ec);
182
199 U_STABLE const UChar* U_EXPORT2
200 ucurr_getPluralName(const UChar* currency,
201 const char* locale,
202 UBool* isChoiceFormat,
203 const char* pluralCount,
204 int32_t* len,
205 UErrorCode* ec);
206
217 U_STABLE int32_t U_EXPORT2
218 ucurr_getDefaultFractionDigits(const UChar* currency,
219 UErrorCode* ec);
220
231 U_STABLE int32_t U_EXPORT2
232 ucurr_getDefaultFractionDigitsForUsage(const UChar* currency,
233 const UCurrencyUsage usage,
234 UErrorCode* ec);
235
246 U_STABLE double U_EXPORT2
247 ucurr_getRoundingIncrement(const UChar* currency,
248 UErrorCode* ec);
249
260 U_STABLE double U_EXPORT2
261 ucurr_getRoundingIncrementForUsage(const UChar* currency,
262 const UCurrencyUsage usage,
263 UErrorCode* ec);
264
271 typedef enum UCurrCurrencyType {
276 UCURR_ALL = INT32_MAX,
285 UCURR_COMMON = 1,
293 UCURR_UNCOMMON = 2,
299 UCURR_DEPRECATED = 4,
305 UCURR_NON_DEPRECATED = 8
306 } UCurrCurrencyType;
307
317 U_STABLE UEnumeration * U_EXPORT2
318 ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode);
319
346 U_STABLE UBool U_EXPORT2
347 ucurr_isAvailable(const UChar* isoCode,
348 UDate from,
349 UDate to,
350 UErrorCode* errorCode);
351
366 U_STABLE int32_t U_EXPORT2
367 ucurr_countCurrencies(const char* locale,
368 UDate date,
369 UErrorCode* ec);
370
390 U_STABLE int32_t U_EXPORT2
391 ucurr_forLocaleAndDate(const char* locale,
392 UDate date,
393 int32_t index,
394 UChar* buff,
395 int32_t buffCapacity,
396 UErrorCode* ec);
397
414 U_STABLE UEnumeration* U_EXPORT2
415 ucurr_getKeywordValuesForLocale(const char* key,
416 const char* locale,
417 UBool commonlyUsed,
418 UErrorCode* status);
419
429 U_STABLE int32_t U_EXPORT2
430 ucurr_getNumericCode(const UChar* currency);
431
432 #endif /* #if !UCONFIG_NO_FORMATTING */
433
434 #endif
ucurr_register
UCurrRegistryKey ucurr_register(const UChar *isoCode, const char *locale, UErrorCode *status)
Register an (existing) ISO 4217 currency code for the given locale.
ucurr_getRoundingIncrementForUsage
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_ALL
Select all ISO-4217 currency codes.
Definition: ucurr.h:276
UCurrCurrencyType
UCurrCurrencyType
Selector constants for ucurr_openCurrencies().
Definition: ucurr.h:271
ucurr_countCurrencies
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_forLocale
int32_t ucurr_forLocale(const char *locale, UChar *buff, int32_t buffCapacity, UErrorCode *ec)
Finds a currency code for the given locale.
UDate
double UDate
Date and Time data type.
Definition: utypes.h:203
UEnumeration
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:43
ucurr_unregister
UBool ucurr_unregister(UCurrRegistryKey key, UErrorCode *status)
Unregister the previously-registered currency definitions using the URegistryKey returned from ucurr_...
ucurr_getNumericCode
int32_t ucurr_getNumericCode(const UChar *currency)
Returns the ISO 4217 numeric code for the currency.
UCURR_NARROW_SYMBOL_NAME
Selector for getName() indicating the narrow currency symbol.
Definition: ucurr.h:118
ucurr_getRoundingIncrement
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...
ucurr_getDefaultFractionDigitsForUsage
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...
ucurr_forLocaleAndDate
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_COMMON
Select only ISO-4217 commonly used currency codes.
Definition: ucurr.h:285
UCurrencyUsage
UCurrencyUsage
Currency Usage used for Decimal Format.
Definition: ucurr.h:41
UCURR_SYMBOL_NAME
Selector for ucurr_getName indicating a symbolic name for a currency, such as "$" for USD...
Definition: ucurr.h:99
UCURR_USAGE_CASH
a setting to specify currency usage which determines currency digit and rounding for cash usage...
Definition: ucurr.h:54
ucurr_getPluralName
const 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.
UChar
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:342
UCURR_USAGE_COUNT
One higher than the last enum UCurrencyUsage constant.
Definition: ucurr.h:60
INT32_MAX
#define INT32_MAX
The largest value a 32 bit signed integer can hold.
Definition: umachine.h:171
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:401
ucurr_getKeywordValuesForLocale
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...
UCURR_NON_DEPRECATED
Select only non-deprecated ISO-4217 codes.
Definition: ucurr.h:305
UCURR_UNCOMMON
Select ISO-4217 uncommon currency codes.
Definition: ucurr.h:293
ucurr_openISOCurrencies
UEnumeration * ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode)
Provides a UEnumeration object for listing ISO-4217 codes.
uenum.h
C API: String Enumeration.
ucurr_getName
const 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.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UCurrRegistryKey
const void * UCurrRegistryKey
Definition: ucurr.h:126
UCurrNameStyle
UCurrNameStyle
Selector constants for ucurr_getName().
Definition: ucurr.h:93
UCURR_DEPRECATED
Select only deprecated ISO-4217 codes.
Definition: ucurr.h:299
ucurr_isAvailable
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_getDefaultFractionDigits
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...
UCURR_USAGE_STANDARD
a setting to specify currency usage which determines currency digit and rounding for standard usage...
Definition: ucurr.h:48
UCURR_LONG_NAME
Selector for ucurr_getName indicating the long name for a currency, such as "US Dollar" for USD...
Definition: ucurr.h:106
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:111
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:225