]> git.saurik.com Git - apple/icu.git/blame - icuSources/common/ucurrimp.h
ICU-64260.0.1.tar.gz
[apple/icu.git] / icuSources / common / ucurrimp.h
CommitLineData
f3c0d7a5
A
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
374ca955
A
3/*
4**********************************************************************
2ca993e8 5* Copyright (c) 2002-2016, International Business Machines
374ca955
A
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"
46f4442e
A
14#include "unicode/unistr.h"
15#include "unicode/parsepos.h"
0f5d89e8 16#include "unicode/uniset.h"
374ca955
A
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 */
2ca993e8 28U_CAPI void
374ca955 29uprv_getStaticCurrencyName(const UChar* iso, const char* loc,
4388f060 30 icu::UnicodeString& result, UErrorCode& ec);
46f4442e
A
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 *
0f5d89e8
A
40 * The parameters must not be NULL.
41 *
46f4442e
A
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.
729e4ab9 48 * @param type currency type to parse against, LONG_NAME only or not
0f5d89e8
A
49 * @param partialMatchLen The length of the longest matching prefix;
50 * this may be nonzero even if no full currency was matched.
46f4442e
A
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 */
2ca993e8 56U_CAPI void
46f4442e 57uprv_parseCurrency(const char* locale,
4388f060
A
58 const icu::UnicodeString& text,
59 icu::ParsePosition& pos,
729e4ab9 60 int8_t type,
0f5d89e8 61 int32_t* partialMatchLen,
46f4442e
A
62 UChar* result,
63 UErrorCode& ec);
374ca955 64
0f5d89e8
A
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 */
72void uprv_currencyLeads(const char* locale, icu::UnicodeSet& result, UErrorCode& ec);
73
74
75
374ca955
A
76#endif /* #ifndef _UCURR_IMP_H_ */
77
78//eof