number_currencysymbols.h 1.9 KB

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