number_currencysymbols.h (2169B)
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 15 namespace number::impl { 16 17 // Exported as U_I18N_API_CLASS for tests 18 class U_I18N_API_CLASS CurrencySymbols : public UMemory { 19 public: 20 CurrencySymbols() = default; // default constructor: leaves class in valid but undefined state 21 22 /** Creates an instance in which all symbols are loaded from data. */ 23 CurrencySymbols(CurrencyUnit currency, const Locale& locale, UErrorCode& status); 24 25 /** Creates an instance in which some symbols might be pre-populated. */ 26 U_I18N_API CurrencySymbols(CurrencyUnit currency, 27 const Locale& locale, 28 const DecimalFormatSymbols& symbols, 29 UErrorCode& status); 30 31 const char16_t* getIsoCode() const; 32 33 UnicodeString getNarrowCurrencySymbol(UErrorCode& status) const; 34 35 UnicodeString getFormalCurrencySymbol(UErrorCode& status) const; 36 37 UnicodeString getVariantCurrencySymbol(UErrorCode& status) const; 38 39 UnicodeString getCurrencySymbol(UErrorCode& status) const; 40 41 UnicodeString getIntlCurrencySymbol(UErrorCode& status) const; 42 43 UnicodeString getPluralName(StandardPlural::Form plural, UErrorCode& status) const; 44 45 bool hasEmptyCurrencySymbol() const; 46 47 protected: 48 // Required fields: 49 CurrencyUnit fCurrency; 50 CharString fLocaleName; 51 52 // Optional fields: 53 UnicodeString fCurrencySymbol; 54 UnicodeString fIntlCurrencySymbol; 55 56 UnicodeString loadSymbol(UCurrNameStyle selector, UErrorCode& status) const; 57 }; 58 59 60 /** 61 * Resolves the effective currency from the property bag. 62 */ 63 CurrencyUnit 64 resolveCurrency(const DecimalFormatProperties& properties, const Locale& locale, UErrorCode& status); 65 66 } // namespace number::impl 67 U_NAMESPACE_END 68 69 #endif //__SOURCE_NUMBER_CURRENCYSYMBOLS_H__ 70 #endif /* #if !UCONFIG_NO_FORMATTING */