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