| 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 |  | 
|---|
| 10 | #ifndef _UCURR_IMP_H_ | 
|---|
| 11 | #define _UCURR_IMP_H_ | 
|---|
| 12 |  | 
|---|
| 13 | #include "unicode/utypes.h" | 
|---|
| 14 | #include "unicode/unistr.h" | 
|---|
| 15 | #include "unicode/parsepos.h" | 
|---|
| 16 | #include "unicode/uniset.h" | 
|---|
| 17 |  | 
|---|
| 18 | /** | 
|---|
| 19 | * Internal method.  Given a currency ISO code and a locale, return | 
|---|
| 20 | * the "static" currency name.  This is usually the same as the | 
|---|
| 21 | * UCURR_SYMBOL_NAME, but if the latter is a choice format, then the | 
|---|
| 22 | * format is applied to the number 2.0 (to yield the more common | 
|---|
| 23 | * plural) to return a static name. | 
|---|
| 24 | * | 
|---|
| 25 | * This is used for backward compatibility with old currency logic in | 
|---|
| 26 | * DecimalFormat and DecimalFormatSymbols. | 
|---|
| 27 | */ | 
|---|
| 28 | U_CAPI void | 
|---|
| 29 | uprv_getStaticCurrencyName(const UChar* iso, const char* loc, | 
|---|
| 30 | icu::UnicodeString& result, UErrorCode& ec); | 
|---|
| 31 |  | 
|---|
| 32 | /** | 
|---|
| 33 | * Attempt to parse the given string as a currency, either as a | 
|---|
| 34 | * display name in the given locale, or as a 3-letter ISO 4217 | 
|---|
| 35 | * code.  If multiple display names match, then the longest one is | 
|---|
| 36 | * selected.  If both a display name and a 3-letter ISO code | 
|---|
| 37 | * match, then the display name is preferred, unless it's length | 
|---|
| 38 | * is less than 3. | 
|---|
| 39 | * | 
|---|
| 40 | * The parameters must not be NULL. | 
|---|
| 41 | * | 
|---|
| 42 | * @param locale the locale of the display names to match | 
|---|
| 43 | * @param text the text to parse | 
|---|
| 44 | * @param pos input-output position; on input, the position within | 
|---|
| 45 | * text to match; must have 0 <= pos.getIndex() < text.length(); | 
|---|
| 46 | * on output, the position after the last matched character. If | 
|---|
| 47 | * the parse fails, the position in unchanged upon output. | 
|---|
| 48 | * @param type currency type to parse against, LONG_NAME only or not | 
|---|
| 49 | * @param partialMatchLen The length of the longest matching prefix; | 
|---|
| 50 | * this may be nonzero even if no full currency was matched. | 
|---|
| 51 | * @return the ISO 4217 code, as a string, of the best match, or | 
|---|
| 52 | * null if there is no match | 
|---|
| 53 | * | 
|---|
| 54 | * @internal | 
|---|
| 55 | */ | 
|---|
| 56 | U_CAPI void | 
|---|
| 57 | uprv_parseCurrency(const char* locale, | 
|---|
| 58 | const icu::UnicodeString& text, | 
|---|
| 59 | icu::ParsePosition& pos, | 
|---|
| 60 | int8_t type, | 
|---|
| 61 | int32_t* partialMatchLen, | 
|---|
| 62 | UChar* result, | 
|---|
| 63 | UErrorCode& ec); | 
|---|
| 64 |  | 
|---|
| 65 | /** | 
|---|
| 66 | * Puts all possible first-characters of a currency into the | 
|---|
| 67 | * specified UnicodeSet. | 
|---|
| 68 | * | 
|---|
| 69 | * @param locale the locale of the display names of interest | 
|---|
| 70 | * @param result the UnicodeSet to which to add the starting characters | 
|---|
| 71 | */ | 
|---|
| 72 | void uprv_currencyLeads(const char* locale, icu::UnicodeSet& result, UErrorCode& ec); | 
|---|
| 73 |  | 
|---|
| 74 |  | 
|---|
| 75 |  | 
|---|
| 76 | #endif /* #ifndef _UCURR_IMP_H_ */ | 
|---|
| 77 |  | 
|---|
| 78 | //eof | 
|---|
| 79 |  | 
|---|