|
1 /* |
|
2 ********************************************************************** |
|
3 * Copyright (c) 2002-2011, International Business Machines |
|
4 * Corporation and others. All Rights Reserved. |
|
5 ********************************************************************** |
|
6 */ |
|
7 |
|
8 #ifndef _UCURR_IMP_H_ |
|
9 #define _UCURR_IMP_H_ |
|
10 |
|
11 #include "unicode/utypes.h" |
|
12 #include "unicode/unistr.h" |
|
13 #include "unicode/parsepos.h" |
|
14 |
|
15 /** |
|
16 * Internal method. Given a currency ISO code and a locale, return |
|
17 * the "static" currency name. This is usually the same as the |
|
18 * UCURR_SYMBOL_NAME, but if the latter is a choice format, then the |
|
19 * format is applied to the number 2.0 (to yield the more common |
|
20 * plural) to return a static name. |
|
21 * |
|
22 * This is used for backward compatibility with old currency logic in |
|
23 * DecimalFormat and DecimalFormatSymbols. |
|
24 */ |
|
25 U_CFUNC void |
|
26 uprv_getStaticCurrencyName(const UChar* iso, const char* loc, |
|
27 icu::UnicodeString& result, UErrorCode& ec); |
|
28 |
|
29 /** |
|
30 * Attempt to parse the given string as a currency, either as a |
|
31 * display name in the given locale, or as a 3-letter ISO 4217 |
|
32 * code. If multiple display names match, then the longest one is |
|
33 * selected. If both a display name and a 3-letter ISO code |
|
34 * match, then the display name is preferred, unless it's length |
|
35 * is less than 3. |
|
36 * |
|
37 * @param locale the locale of the display names to match |
|
38 * @param text the text to parse |
|
39 * @param pos input-output position; on input, the position within |
|
40 * text to match; must have 0 <= pos.getIndex() < text.length(); |
|
41 * on output, the position after the last matched character. If |
|
42 * the parse fails, the position in unchanged upon output. |
|
43 * @param type currency type to parse against, LONG_NAME only or not |
|
44 * @return the ISO 4217 code, as a string, of the best match, or |
|
45 * null if there is no match |
|
46 * |
|
47 * @internal |
|
48 */ |
|
49 U_CFUNC void |
|
50 uprv_parseCurrency(const char* locale, |
|
51 const icu::UnicodeString& text, |
|
52 icu::ParsePosition& pos, |
|
53 int8_t type, |
|
54 UChar* result, |
|
55 UErrorCode& ec); |
|
56 |
|
57 #endif /* #ifndef _UCURR_IMP_H_ */ |
|
58 |
|
59 //eof |