1b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* 2b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru********************************************************************** 38393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius* Copyright (c) 2002-2013, International Business Machines 4b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Corporation and others. All Rights Reserved. 5b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru********************************************************************** 6b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/ 7b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#ifndef _UCURR_H_ 8b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define _UCURR_H_ 9b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 10b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/utypes.h" 11b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/uenum.h" 12b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 13b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 14b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \file 15b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \brief C API: Encapsulates information about a currency. 16b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 17b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 18b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#if !UCONFIG_NO_FORMATTING 19b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 20b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 21b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The ucurr API encapsulates information about a currency, as defined by 22b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * ISO 4217. A currency is represented by a 3-character string 23b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * containing its ISO 4217 code. This API can return various data 24b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * necessary the proper display of a currency: 25b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 26b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <ul><li>A display symbol, for a specific locale 27b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <li>The number of fraction digits to display 28b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <li>A rounding increment 29b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * </ul> 30b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 31b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The <tt>DecimalFormat</tt> class uses these data to display 32b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * currencies. 33b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @author Alan Liu 34b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @since ICU 2.2 35b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 36b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 37b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 38b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Finds a currency code for the given locale. 39b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale the locale for which to retrieve a currency code. 40b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Currency can be specified by the "currency" keyword 41b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * in which case it overrides the default currency code 42b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param buff fill in buffer. Can be NULL for preflighting. 43b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param buffCapacity capacity of the fill in buffer. Can be 0 for 44b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * preflighting. If it is non-zero, the buff parameter 45b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * must not be NULL. 46b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param ec error code 47b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return length of the currency string. It should always be 3. If 0, 48b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * currency couldn't be found or the input values are 49b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * invalid. 50b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8 51b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 52b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 53b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucurr_forLocale(const char* locale, 54b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar* buff, 55b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t buffCapacity, 56b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* ec); 57b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 58b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 59b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Selector constants for ucurr_getName(). 60b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 61b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucurr_getName 62b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.6 63b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 64b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef enum UCurrNameStyle { 65b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 66b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Selector for ucurr_getName indicating a symbolic name for a 67b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * currency, such as "$" for USD. 68b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.6 69b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 70b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UCURR_SYMBOL_NAME, 71b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 72b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 73b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Selector for ucurr_getName indicating the long name for a 74b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * currency, such as "US Dollar" for USD. 75b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.6 76b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 77b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UCURR_LONG_NAME 78b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} UCurrNameStyle; 79b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 80b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#if !UCONFIG_NO_SERVICE 81b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 82b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.6 83b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 84b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef const void* UCurrRegistryKey; 85b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 86b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 87b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Register an (existing) ISO 4217 currency code for the given locale. 88b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Only the country code and the two variants EURO and PRE_EURO are 89b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * recognized. 90b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param isoCode the three-letter ISO 4217 currency code 91b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale the locale for which to register this currency code 92b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status the in/out status code 93b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a registry key that can be used to unregister this currency code, or NULL 94b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if there was an error. 95b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.6 96b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 97b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UCurrRegistryKey U_EXPORT2 98b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucurr_register(const UChar* isoCode, 99b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char* locale, 100b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 101b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 102b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Unregister the previously-registered currency definitions using the 103b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * URegistryKey returned from ucurr_register. Key becomes invalid after 104b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a successful call and should not be used again. Any currency 105b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * that might have been hidden by the original ucurr_register call is 106b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * restored. 107b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param key the registry key returned by a previous call to ucurr_register 108b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status the in/out status code, no special meanings are assigned 109b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return TRUE if the currency for this key was successfully unregistered 110b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.6 111b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 112b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UBool U_EXPORT2 113b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucurr_unregister(UCurrRegistryKey key, UErrorCode* status); 114b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif /* UCONFIG_NO_SERVICE */ 115b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 116b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the display name for the given currency in the 118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * given locale. For example, the display name for the USD 119b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * currency object in the en_US locale is "$". 120b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param currency null-terminated 3-letter ISO 4217 code 121b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale locale in which to display currency 122b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param nameStyle selector for which kind of name to return 123b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param isChoiceFormat fill-in set to TRUE if the returned value 124b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is a ChoiceFormat pattern; otherwise it is a static string 125b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param len fill-in parameter to receive length of result 126b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param ec error code 127b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return pointer to display string of 'len' UChars. If the resource 128b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * data contains no entry for 'currency', then 'currency' itself is 129b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * returned. If *isChoiceFormat is TRUE, then the result is a 130b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * ChoiceFormat pattern. Otherwise it is a static string. 131b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.6 132b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 133b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE const UChar* U_EXPORT2 134b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucurr_getName(const UChar* currency, 135b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char* locale, 136b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UCurrNameStyle nameStyle, 137b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UBool* isChoiceFormat, 138b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t* len, 139b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* ec); 140b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 141b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 142b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Returns the plural name for the given currency in the 143b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * given locale. For example, the plural name for the USD 144b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * currency object in the en_US locale is "US dollar" or "US dollars". 145b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param currency null-terminated 3-letter ISO 4217 code 146b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param locale locale in which to display currency 147b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param isChoiceFormat fill-in set to TRUE if the returned value 148b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * is a ChoiceFormat pattern; otherwise it is a static string 149b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param pluralCount plural count 150b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param len fill-in parameter to receive length of result 151b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param ec error code 152b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @return pointer to display string of 'len' UChars. If the resource 153b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * data contains no entry for 'currency', then 'currency' itself is 154b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * returned. 15550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @stable ICU 4.2 156b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru */ 157b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste QueruU_STABLE const UChar* U_EXPORT2 158b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queruucurr_getPluralName(const UChar* currency, 159b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru const char* locale, 160b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru UBool* isChoiceFormat, 161b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru const char* pluralCount, 162b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru int32_t* len, 163b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru UErrorCode* ec); 164b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru 165b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru/** 166b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the number of the number of fraction digits that should 167b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * be displayed for the given currency. 168b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param currency null-terminated 3-letter ISO 4217 code 169b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param ec input-output error code 170b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a non-negative number of fraction digits to be 171b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * displayed, or 0 if there is an error 172b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0 173b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 174b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 175b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucurr_getDefaultFractionDigits(const UChar* currency, 176b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* ec); 177b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 178b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 179b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the rounding increment for the given currency, or 0.0 if no 180b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * rounding is done by the currency. 181b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param currency null-terminated 3-letter ISO 4217 code 182b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param ec input-output error code 183b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the non-negative rounding increment, or 0.0 if none, 184b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or 0.0 if there is an error 185b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0 186b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 187b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE double U_EXPORT2 188b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucurr_getRoundingIncrement(const UChar* currency, 189b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* ec); 190b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 191b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 192b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Selector constants for ucurr_openCurrencies(). 193b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 194b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucurr_openCurrencies 195b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.2 196b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 197b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef enum UCurrCurrencyType { 198b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 199b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Select all ISO-4217 currency codes. 200b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.2 201b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 202b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UCURR_ALL = INT32_MAX, 203b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 204b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Select only ISO-4217 commonly used currency codes. 205b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * These currencies can be found in common use, and they usually have 206b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * bank notes or coins associated with the currency code. 207b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This does not include fund codes, precious metals and other 208b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * various ISO-4217 codes limited to special financial products. 209b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.2 210b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 211b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UCURR_COMMON = 1, 212b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 213b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Select ISO-4217 uncommon currency codes. 214b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * These codes respresent fund codes, precious metals and other 215b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * various ISO-4217 codes limited to special financial products. 216b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A fund code is a monetary resource associated with a currency. 217b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.2 218b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 219b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UCURR_UNCOMMON = 2, 220b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 221b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Select only deprecated ISO-4217 codes. 222b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * These codes are no longer in general public use. 223b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.2 224b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 225b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UCURR_DEPRECATED = 4, 226b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 227b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Select only non-deprecated ISO-4217 codes. 228b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * These codes are in general public use. 229b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.2 230b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 231b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UCURR_NON_DEPRECATED = 8 232b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} UCurrCurrencyType; 233b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 234b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 235b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Provides a UEnumeration object for listing ISO-4217 codes. 236b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param currType You can use one of several UCurrCurrencyType values for this 237b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * variable. You can also | (or) them together to get a specific list of 238b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * currencies. Most people will want to use the (UCURR_CURRENCY|UCURR_NON_DEPRECATED) value to 239b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * get a list of current currencies. 240b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode Error code 241b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.2 242b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 243b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UEnumeration * U_EXPORT2 244b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode); 245b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 246103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius/** 247b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Queries if the given ISO 4217 3-letter code is available on the specified date range. 248b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 249b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Note: For checking availability of a currency on a specific date, specify the date on both 'from' and 'to' 250b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 251b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * When 'from' is U_DATE_MIN and 'to' is U_DATE_MAX, this method checks if the specified currency is available any time. 252b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * If 'from' and 'to' are same UDate value, this method checks if the specified currency is available on that date. 253b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 254b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param isoCode 255b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * The ISO 4217 3-letter code. 256b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 257b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param from 258b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * The lower bound of the date range, inclusive. When 'from' is U_DATE_MIN, check the availability 259b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * of the currency any date before 'to' 260b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 261b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param to 262b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * The upper bound of the date range, inclusive. When 'to' is U_DATE_MAX, check the availability of 263b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * the currency any date after 'from' 264b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 265b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param errorCode 266b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * ICU error code 267b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 268b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @return TRUE if the given ISO 4217 3-letter code is supported on the specified date range. 269b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 270103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.8 271b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho */ 27254dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE UBool U_EXPORT2 273b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2clairehoucurr_isAvailable(const UChar* isoCode, 274b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho UDate from, 275b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho UDate to, 276b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho UErrorCode* errorCode); 277b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho 278b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho/** 279c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Finds the number of valid currency codes for the 280c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * given locale and date. 281c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param locale the locale for which to retrieve the 282c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * currency count. 283c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param date the date for which to retrieve the 284c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * currency count for the given locale. 285c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param ec error code 286c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return the number of currency codes for the 287c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * given locale and date. If 0, currency 288c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * codes couldn't be found for the input 289c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * values are invalid. 290b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 291c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 29250294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE int32_t U_EXPORT2 293c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruucurr_countCurrencies(const char* locale, 294c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UDate date, 295c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode* ec); 296c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 297c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 298c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Finds a currency code for the given locale and date 299c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param locale the locale for which to retrieve a currency code. 300c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Currency can be specified by the "currency" keyword 301c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * in which case it overrides the default currency code 302c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param date the date for which to retrieve a currency code for 303c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * the given locale. 304c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param index the index within the available list of currency codes 305c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * for the given locale on the given date. 306c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param buff fill in buffer. Can be NULL for preflighting. 307c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param buffCapacity capacity of the fill in buffer. Can be 0 for 308c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * preflighting. If it is non-zero, the buff parameter 309c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * must not be NULL. 310c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param ec error code 311c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return length of the currency string. It should always be 3. 312c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * If 0, currency couldn't be found or the input values are 313c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * invalid. 314b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 315c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 31650294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE int32_t U_EXPORT2 317c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruucurr_forLocaleAndDate(const char* locale, 318c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UDate date, 319c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru int32_t index, 320c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UChar* buff, 321c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru int32_t buffCapacity, 322c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode* ec); 323b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 324b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru/** 325b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Given a key and a locale, returns an array of string values in a preferred 326b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * order that would make a difference. These are all and only those values where 327b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * the open (creation) of the service with the locale formed from the input locale 328b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * plus input keyword and that value has different behavior than creation with the 329b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * input locale alone. 330b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param key one of the keys supported by this service. For now, only 331b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * "currency" is supported. 332b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param locale the locale 333b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param commonlyUsed if set to true it will return only commonly used values 334b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * with the given locale in preferred order. Otherwise, 335b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * it will return all the available values for the locale. 336b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param status error status 337b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @return a string enumeration over keyword values for the given key and the locale. 33850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @stable ICU 4.2 339b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru */ 34050294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE UEnumeration* U_EXPORT2 341b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queruucurr_getKeywordValuesForLocale(const char* key, 342b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru const char* locale, 343b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru UBool commonlyUsed, 344b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru UErrorCode* status); 345b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru 346103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius/** 347103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * Returns the ISO 4217 numeric code for the currency. 348103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * <p>Note: If the ISO 4217 numeric code is not assigned for the currency or 349103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * the currency is unknown, this function returns 0. 350103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * 351103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @param currency null-terminated 3-letter ISO 4217 code 352103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @return The ISO 4217 numeric code of the currency 3538393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @stable ICU 49 354103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius */ 3558393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig CorneliusU_STABLE int32_t U_EXPORT2 356103e9ffba2cba345d0078eb8b8db33249f81840aCraig Corneliusucurr_getNumericCode(const UChar* currency); 357103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius 358b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_FORMATTING */ 359b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 360b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif 361