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 bool hasEmptyCurrencySymbol() const; 45 46 protected: 47 // Required fields: 48 CurrencyUnit fCurrency; 49 CharString fLocaleName; 50 51 // Optional fields: 52 UnicodeString fCurrencySymbol; 53 UnicodeString fIntlCurrencySymbol; 54 55 UnicodeString loadSymbol(UCurrNameStyle selector, UErrorCode& status) const; 56 }; 57 58 59 /** 60 * Resolves the effective currency from the property bag. 61 */ 62 CurrencyUnit 63 resolveCurrency(const DecimalFormatProperties& properties, const Locale& locale, UErrorCode& status); 64 65 66 } // namespace impl 67 } // namespace numparse 68 U_NAMESPACE_END 69 70 #endif //__SOURCE_NUMBER_CURRENCYSYMBOLS_H__ 71 #endif /* #if !UCONFIG_NO_FORMATTING */ 72