]> git.saurik.com Git - apple/icu.git/blob - icuSources/common/ucurrimp.h
ICU-59180.0.1.tar.gz
[apple/icu.git] / icuSources / common / ucurrimp.h
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
17 /**
18 * Internal method. Given a currency ISO code and a locale, return
19 * the "static" currency name. This is usually the same as the
20 * UCURR_SYMBOL_NAME, but if the latter is a choice format, then the
21 * format is applied to the number 2.0 (to yield the more common
22 * plural) to return a static name.
23 *
24 * This is used for backward compatibility with old currency logic in
25 * DecimalFormat and DecimalFormatSymbols.
26 */
27 U_CAPI void
28 uprv_getStaticCurrencyName(const UChar* iso, const char* loc,
29 icu::UnicodeString& result, UErrorCode& ec);
30
31 /**
32 * Attempt to parse the given string as a currency, either as a
33 * display name in the given locale, or as a 3-letter ISO 4217
34 * code. If multiple display names match, then the longest one is
35 * selected. If both a display name and a 3-letter ISO code
36 * match, then the display name is preferred, unless it's length
37 * is less than 3.
38 *
39 * @param locale the locale of the display names to match
40 * @param text the text to parse
41 * @param pos input-output position; on input, the position within
42 * text to match; must have 0 <= pos.getIndex() < text.length();
43 * on output, the position after the last matched character. If
44 * the parse fails, the position in unchanged upon output.
45 * @param type currency type to parse against, LONG_NAME only or not
46 * @return the ISO 4217 code, as a string, of the best match, or
47 * null if there is no match
48 *
49 * @internal
50 */
51 U_CAPI void
52 uprv_parseCurrency(const char* locale,
53 const icu::UnicodeString& text,
54 icu::ParsePosition& pos,
55 int8_t type,
56 UChar* result,
57 UErrorCode& ec);
58
59 #endif /* #ifndef _UCURR_IMP_H_ */
60
61 //eof