#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
#include <utility>
#include "unicode/ucurr.h"
#include "unicode/locid.h"
#include "unicode/ures.h"
#include "unicode/ustring.h"
#include "unicode/parsepos.h"
#include "unicode/uniset.h"
#include "unicode/usetiter.h"
#include "unicode/utf16.h"
#include "ustr_imp.h"
#include "bytesinkutil.h"
#include "charstr.h"
#include "cmemory.h"
#include "cstring.h"
#include "static_unicode_sets.h"
#include "uassert.h"
#include "umutex.h"
#include "ucln_cmn.h"
#include "uenumimp.h"
#include "uhash.h"
#include "hash.h"
#include "uinvchar.h"
#include "uresimp.h"
#include "ulist.h"
#include "uresimp.h"
#include "ureslocs.h"
#include "ulocimp.h"
usingnamespaceicu;
#ifdef UCURR_DEBUG_EQUIV
#include "stdio.h"
#endif
#ifdef UCURR_DEBUG
#include "stdio.h"
#endif
IsoCodeEntry;
static const int32_t LAST_RESORT_DATA[] = …;
static const int32_t POW10[] = …;
static const int32_t MAX_POW10 = …;
#define ISO_CURRENCY_CODE_LENGTH …
static const char CURRENCY_DATA[] = …;
static const char CURRENCY_META[] = …;
static const char CURRENCY_MAP[] = …;
static const char DEFAULT_META[] = …;
static const char VAR_DELIM = …;
static const char CURRENCIES[] = …;
static const char CURRENCIES_NARROW[] = …;
static const char CURRENCIES_FORMAL[] = …;
static const char CURRENCIES_VARIANT[] = …;
static const char CURRENCYPLURALS[] = …;
static const UHashtable* gIsoCodes = …;
static icu::UInitOnce gIsoCodesInitOnce { … };
static const icu::Hashtable* gCurrSymbolsEquiv = …;
static icu::UInitOnce gCurrSymbolsEquivInitOnce { … };
U_NAMESPACE_BEGIN
class EquivIterator : public icu::UMemory { … };
const icu::UnicodeString *
EquivIterator::next() { … }
U_NAMESPACE_END
static void makeEquivalent(
const icu::UnicodeString &lhs,
const icu::UnicodeString &rhs,
icu::Hashtable* hash, UErrorCode &status) { … }
static int32_t countEquivalent(const icu::Hashtable &hash, const icu::UnicodeString &s) { … }
static const icu::Hashtable* getCurrSymbolsEquiv();
static UBool U_CALLCONV
isoCodes_cleanup()
{ … }
static UBool U_CALLCONV
currSymbolsEquiv_cleanup()
{ … }
static void U_CALLCONV
deleteIsoCodeEntry(void *obj) { … }
static void U_CALLCONV
deleteUnicode(void *obj) { … }
static inline char*
myUCharsToChars(char* resultOfLen4, const char16_t* currency) { … }
static const int32_t*
_findMetaData(const char16_t* currency, UErrorCode& ec) { … }
static void
idForLocale(const char* locale, char* countryAndVariant, int capacity, UErrorCode* ec)
{ … }
U_CDECL_BEGIN
static UBool U_CALLCONV currency_cleanup();
U_CDECL_END
#if !UCONFIG_NO_SERVICE
struct CReg;
static UMutex gCRegLock;
static CReg* gCRegHead = …;
struct CReg : public icu::UMemory { … };
U_CAPI UCurrRegistryKey U_EXPORT2
ucurr_register(const char16_t* isoCode, const char* locale, UErrorCode *status)
{ … }
U_CAPI UBool U_EXPORT2
ucurr_unregister(UCurrRegistryKey key, UErrorCode* status)
{ … }
#endif
static UBool U_CALLCONV
currency_cache_cleanup();
U_CDECL_BEGIN
static UBool U_CALLCONV currency_cleanup() { … }
U_CDECL_END
U_CAPI int32_t U_EXPORT2
ucurr_forLocale(const char* locale,
char16_t* buff,
int32_t buffCapacity,
UErrorCode* ec) { … }
static UBool fallback(CharString& loc) { … }
U_CAPI const char16_t* U_EXPORT2
ucurr_getName(const char16_t* currency,
const char* locale,
UCurrNameStyle nameStyle,
UBool* isChoiceFormat,
int32_t* len,
UErrorCode* ec) { … }
U_CAPI const char16_t* U_EXPORT2
ucurr_getPluralName(const char16_t* currency,
const char* locale,
UBool* isChoiceFormat,
const char* pluralCount,
int32_t* len,
UErrorCode* ec) { … }
#define NEED_TO_BE_DELETED …
#define MAX_CURRENCY_NAME_LEN …
CurrencyNameStruct;
#ifndef MIN
#define MIN(a,b) …
#endif
#ifndef MAX
#define MAX(a,b) …
#endif
static int U_CALLCONV currencyNameComparator(const void* a, const void* b) { … }
static void
getCurrencyNameCount(const char* loc, int32_t* total_currency_name_count, int32_t* total_currency_symbol_count) { … }
static char16_t*
toUpperCase(const char16_t* source, int32_t len, const char* locale) { … }
static void
collectCurrencyNames(const char* locale,
CurrencyNameStruct** currencyNames,
int32_t* total_currency_name_count,
CurrencyNameStruct** currencySymbols,
int32_t* total_currency_symbol_count,
UErrorCode& ec) { … }
static int32_t
binarySearch(const CurrencyNameStruct* currencyNames,
int32_t indexInCurrencyNames,
const char16_t key,
int32_t* begin, int32_t* end) { … }
static void
linearSearch(const CurrencyNameStruct* currencyNames,
int32_t begin, int32_t end,
const char16_t* text, int32_t textLen,
int32_t *partialMatchLen,
int32_t *maxMatchLen, int32_t* maxMatchIndex) { … }
#define LINEAR_SEARCH_THRESHOLD …
static void
searchCurrencyName(const CurrencyNameStruct* currencyNames,
int32_t total_currency_count,
const char16_t* text, int32_t textLen,
int32_t *partialMatchLen,
int32_t* maxMatchLen, int32_t* maxMatchIndex) { … }
CurrencyNameCacheEntry;
#define CURRENCY_NAME_CACHE_NUM …
static CurrencyNameCacheEntry* currCache[CURRENCY_NAME_CACHE_NUM] = …;
static int8_t currentCacheEntryIndex = …;
static UMutex gCurrencyCacheMutex;
static void
deleteCurrencyNames(CurrencyNameStruct* currencyNames, int32_t count) { … }
static void
deleteCacheEntry(CurrencyNameCacheEntry* entry) { … }
static UBool U_CALLCONV
currency_cache_cleanup() { … }
static CurrencyNameCacheEntry*
getCacheEntry(const char* locale, UErrorCode& ec) { … }
static void releaseCacheEntry(CurrencyNameCacheEntry* cacheEntry) { … }
U_CAPI void
uprv_parseCurrency(const char* locale,
const icu::UnicodeString& text,
icu::ParsePosition& pos,
int8_t type,
int32_t* partialMatchLen,
char16_t* result,
UErrorCode& ec) { … }
void uprv_currencyLeads(const char* locale, icu::UnicodeSet& result, UErrorCode& ec) { … }
U_CAPI void
uprv_getStaticCurrencyName(const char16_t* iso, const char* loc,
icu::UnicodeString& result, UErrorCode& ec)
{ … }
U_CAPI int32_t U_EXPORT2
ucurr_getDefaultFractionDigits(const char16_t* currency, UErrorCode* ec) { … }
U_CAPI int32_t U_EXPORT2
ucurr_getDefaultFractionDigitsForUsage(const char16_t* currency, const UCurrencyUsage usage, UErrorCode* ec) { … }
U_CAPI double U_EXPORT2
ucurr_getRoundingIncrement(const char16_t* currency, UErrorCode* ec) { … }
U_CAPI double U_EXPORT2
ucurr_getRoundingIncrementForUsage(const char16_t* currency, const UCurrencyUsage usage, UErrorCode* ec) { … }
U_CDECL_BEGIN
UCurrencyContext;
static const struct CurrencyList { … } gCurrencyList[] = …;
#define UCURR_MATCHES_BITMASK(variable, typeToMatch) …
static int32_t U_CALLCONV
ucurr_countCurrencyList(UEnumeration *enumerator, UErrorCode * ) { … }
static const char* U_CALLCONV
ucurr_nextCurrencyList(UEnumeration *enumerator,
int32_t* resultLength,
UErrorCode * )
{ … }
static void U_CALLCONV
ucurr_resetCurrencyList(UEnumeration *enumerator, UErrorCode * ) { … }
static void U_CALLCONV
ucurr_closeCurrencyList(UEnumeration *enumerator) { … }
static void U_CALLCONV
ucurr_createCurrencyList(UHashtable *isoCodes, UErrorCode* status){ … }
static const UEnumeration gEnumCurrencyList = …;
U_CDECL_END
static void U_CALLCONV initIsoCodes(UErrorCode &status) { … }
static void populateCurrSymbolsEquiv(icu::Hashtable *hash, UErrorCode &status) { … }
static void U_CALLCONV initCurrSymbolsEquiv() { … }
U_CAPI UBool U_EXPORT2
ucurr_isAvailable(const char16_t* isoCode, UDate from, UDate to, UErrorCode* eErrorCode) { … }
static const icu::Hashtable* getCurrSymbolsEquiv() { … }
U_CAPI UEnumeration * U_EXPORT2
ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode) { … }
U_CAPI int32_t U_EXPORT2
ucurr_countCurrencies(const char* locale,
UDate date,
UErrorCode* ec)
{ … }
U_CAPI int32_t U_EXPORT2
ucurr_forLocaleAndDate(const char* locale,
UDate date,
int32_t index,
char16_t* buff,
int32_t buffCapacity,
UErrorCode* ec)
{ … }
static const UEnumeration defaultKeywordValues = …;
U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key, const char *locale, UBool commonlyUsed, UErrorCode* status) { … }
U_CAPI int32_t U_EXPORT2
ucurr_getNumericCode(const char16_t* currency) { … }
#endif