ICU 55.1  55.1
ucurr.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (c) 2002-2014, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 */
7 #ifndef _UCURR_H_
8 #define _UCURR_H_
9 
10 #include "unicode/utypes.h"
11 #include "unicode/uenum.h"
12 
18 #if !UCONFIG_NO_FORMATTING
19 
25 #ifndef U_HIDE_DRAFT_API
26 
39 #endif /* U_HIDE_DRAFT_API */
40 
45 };
46 typedef enum UCurrencyUsage UCurrencyUsage;
47 
80 U_STABLE int32_t U_EXPORT2
81 ucurr_forLocale(const char* locale,
82  UChar* buff,
83  int32_t buffCapacity,
84  UErrorCode* ec);
85 
92 typedef enum UCurrNameStyle {
99 
107 
108 #if !UCONFIG_NO_SERVICE
109 
112 typedef const void* UCurrRegistryKey;
113 
125 U_STABLE UCurrRegistryKey U_EXPORT2
126 ucurr_register(const UChar* isoCode,
127  const char* locale,
128  UErrorCode* status);
140 U_STABLE UBool U_EXPORT2
142 #endif /* UCONFIG_NO_SERVICE */
143 
161 U_STABLE const UChar* U_EXPORT2
162 ucurr_getName(const UChar* currency,
163  const char* locale,
164  UCurrNameStyle nameStyle,
165  UBool* isChoiceFormat,
166  int32_t* len,
167  UErrorCode* ec);
168 
185 U_STABLE const UChar* U_EXPORT2
186 ucurr_getPluralName(const UChar* currency,
187  const char* locale,
188  UBool* isChoiceFormat,
189  const char* pluralCount,
190  int32_t* len,
191  UErrorCode* ec);
192 
203 U_STABLE int32_t U_EXPORT2
205  UErrorCode* ec);
206 
207 #ifndef U_HIDE_DRAFT_API
208 
218 U_DRAFT int32_t U_EXPORT2
220  const UCurrencyUsage usage,
221  UErrorCode* ec);
222 #endif /* U_HIDE_DRAFT_API */
223 
234 U_STABLE double U_EXPORT2
236  UErrorCode* ec);
237 
238 #ifndef U_HIDE_DRAFT_API
239 
249 U_DRAFT double U_EXPORT2
251  const UCurrencyUsage usage,
252  UErrorCode* ec);
253 #endif /* U_HIDE_DRAFT_API */
254 
261 typedef enum UCurrCurrencyType {
297 
307 U_STABLE UEnumeration * U_EXPORT2
308 ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode);
309 
336 U_STABLE UBool U_EXPORT2
337 ucurr_isAvailable(const UChar* isoCode,
338  UDate from,
339  UDate to,
340  UErrorCode* errorCode);
341 
356 U_STABLE int32_t U_EXPORT2
357 ucurr_countCurrencies(const char* locale,
358  UDate date,
359  UErrorCode* ec);
360 
380 U_STABLE int32_t U_EXPORT2
381 ucurr_forLocaleAndDate(const char* locale,
382  UDate date,
383  int32_t index,
384  UChar* buff,
385  int32_t buffCapacity,
386  UErrorCode* ec);
387 
404 U_STABLE UEnumeration* U_EXPORT2
406  const char* locale,
407  UBool commonlyUsed,
408  UErrorCode* status);
409 
419 U_STABLE int32_t U_EXPORT2
420 ucurr_getNumericCode(const UChar* currency);
421 
422 #endif /* #if !UCONFIG_NO_FORMATTING */
423 
424 #endif
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.
UCurrNameStyle
UCurrNameStyle
Selector constants for ucurr_getName().
Definition: ucurr.h:92
ucurr_openISOCurrencies
UEnumeration * ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode)
Provides a UEnumeration object for listing ISO-4217 codes.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234
UCURR_USAGE_COUNT
@ UCURR_USAGE_COUNT
One higher than the last enum UCurrencyUsage constant.
Definition: ucurr.h:44
UCurrRegistryKey
const void * UCurrRegistryKey
Definition: ucurr.h:112
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.
UCurrencyUsage
UCurrencyUsage
Currency Usage used for Decimal Format.
Definition: ucurr.h:24
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:105
UCURR_DEPRECATED
@ UCURR_DEPRECATED
Select only deprecated ISO-4217 codes.
Definition: ucurr.h:289
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_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_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_UNCOMMON
@ UCURR_UNCOMMON
Select ISO-4217 uncommon currency codes.
Definition: ucurr.h:283
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition: utypes.h:476
UCurrCurrencyType
UCurrCurrencyType
Selector constants for ucurr_openCurrencies().
Definition: ucurr.h:261
UCURR_USAGE_STANDARD
@ UCURR_USAGE_STANDARD
a setting to specify currency usage which determines currency digit and rounding for standard usage,...
Definition: ucurr.h:32
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_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...
INT32_MAX
#define INT32_MAX
The largest value a 32 bit signed integer can hold.
Definition: umachine.h:180
UCURR_USAGE_CASH
@ UCURR_USAGE_CASH
a setting to specify currency usage which determines currency digit and rounding for cash usage,...
Definition: ucurr.h:38
UDate
double UDate
Date and Time data type.
Definition: utypes.h:201
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.
U_DRAFT
#define U_DRAFT
This is used to declare a function as a draft public ICU C API
Definition: umachine.h:111
ucurr_getNumericCode
int32_t ucurr_getNumericCode(const UChar *currency)
Returns the ISO 4217 numeric code for the currency.
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:109
UCURR_SYMBOL_NAME
@ UCURR_SYMBOL_NAME
Selector for ucurr_getName indicating a symbolic name for a currency, such as "$" for USD.
Definition: ucurr.h:98
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
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:312
ucurr_forLocale
int32_t ucurr_forLocale(const char *locale, UChar *buff, int32_t buffCapacity, UErrorCode *ec)
The ucurr API encapsulates information about a currency, as defined by ISO 4217.
ucurr_unregister
UBool ucurr_unregister(UCurrRegistryKey key, UErrorCode *status)
Unregister the previously-registered currency definitions using the URegistryKey returned from ucurr_...
UEnumeration
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:39
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_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_COMMON
@ UCURR_COMMON
Select only ISO-4217 commonly used currency codes.
Definition: ucurr.h:275
UCURR_ALL
@ UCURR_ALL
Select all ISO-4217 currency codes.
Definition: ucurr.h:266
UCURR_NON_DEPRECATED
@ UCURR_NON_DEPRECATED
Select only non-deprecated ISO-4217 codes.
Definition: ucurr.h:295
uenum.h
C API: String Enumeration.