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 getFormalCurrencySymbol(UErrorCode& status) const; 35 36 UnicodeString getVariantCurrencySymbol(UErrorCode& status) const; 37 38 UnicodeString getCurrencySymbol(UErrorCode& status) const; 39 40 UnicodeString getIntlCurrencySymbol(UErrorCode& status) const; 41 42 UnicodeString getPluralName(StandardPlural::Form plural, UErrorCode& status) const; 43 44 protected: 45 // Required fields: 46 CurrencyUnit fCurrency; 47 CharString fLocaleName; 48 49 // Optional fields: 50 UnicodeString fCurrencySymbol; 51 UnicodeString fIntlCurrencySymbol; 52 53 UnicodeString loadSymbol(UCurrNameStyle selector, UErrorCode& status) const; 54 }; 55 56 57 /** 58 * Resolves the effective currency from the property bag. 59 */ 60 CurrencyUnit 61 resolveCurrency(const DecimalFormatProperties& properties, const Locale& locale, UErrorCode& status); 62 63 64 } // namespace impl 65 } // namespace numparse 66 U_NAMESPACE_END 67 68 #endif //__SOURCE_NUMBER_CURRENCYSYMBOLS_H__ 69 #endif /* #if !UCONFIG_NO_FORMATTING */ 70