1 | // © 2018 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html |
3 | |
4 | #include "unicode/utypes.h" |
5 | |
6 | #if !UCONFIG_NO_FORMATTING |
7 | #ifndef __SOURCE_NUMBER_CURRENCYSYMBOLS_H__ |
8 | #define __SOURCE_NUMBER_CURRENCYSYMBOLS_H__ |
9 | |
10 | #include "numparse_types.h" |
11 | #include "charstr.h" |
12 | #include "number_decimfmtprops.h" |
13 | |
14 | U_NAMESPACE_BEGIN namespace number { |
15 | namespace impl { |
16 | |
17 | |
18 | // Exported as U_I18N_API for tests |
19 | class U_I18N_API CurrencySymbols : public UMemory { |
20 | public: |
21 | CurrencySymbols() = default; // default constructor: leaves class in valid but undefined state |
22 | |
23 | /** Creates an instance in which all symbols are loaded from data. */ |
24 | CurrencySymbols(CurrencyUnit currency, const Locale& locale, UErrorCode& status); |
25 | |
26 | /** Creates an instance in which some symbols might be pre-populated. */ |
27 | CurrencySymbols(CurrencyUnit currency, const Locale& locale, const DecimalFormatSymbols& symbols, |
28 | UErrorCode& status); |
29 | |
30 | const char16_t* getIsoCode() const; |
31 | |
32 | UnicodeString getNarrowCurrencySymbol(UErrorCode& status) const; |
33 | |
34 | UnicodeString getCurrencySymbol(UErrorCode& status) const; |
35 | |
36 | UnicodeString getIntlCurrencySymbol(UErrorCode& status) const; |
37 | |
38 | UnicodeString getPluralName(StandardPlural::Form plural, UErrorCode& status) const; |
39 | |
40 | protected: |
41 | // Required fields: |
42 | CurrencyUnit fCurrency; |
43 | CharString fLocaleName; |
44 | |
45 | // Optional fields: |
46 | UnicodeString fCurrencySymbol; |
47 | UnicodeString fIntlCurrencySymbol; |
48 | |
49 | UnicodeString loadSymbol(UCurrNameStyle selector, UErrorCode& status) const; |
50 | }; |
51 | |
52 | |
53 | /** |
54 | * Resolves the effective currency from the property bag. |
55 | */ |
56 | CurrencyUnit |
57 | resolveCurrency(const DecimalFormatProperties& properties, const Locale& locale, UErrorCode& status); |
58 | |
59 | |
60 | } // namespace impl |
61 | } // namespace numparse |
62 | U_NAMESPACE_END |
63 | |
64 | #endif //__SOURCE_NUMBER_CURRENCYSYMBOLS_H__ |
65 | #endif /* #if !UCONFIG_NO_FORMATTING */ |
66 | |