| 1 | // © 2017 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 __NUMBER_LONGNAMES_H__ |
| 8 | #define __NUMBER_LONGNAMES_H__ |
| 9 | |
| 10 | #include "unicode/uversion.h" |
| 11 | #include "number_utils.h" |
| 12 | #include "number_modifiers.h" |
| 13 | |
| 14 | U_NAMESPACE_BEGIN namespace number { |
| 15 | namespace impl { |
| 16 | |
| 17 | class LongNameHandler : public MicroPropsGenerator, public ModifierStore, public UMemory { |
| 18 | public: |
| 19 | static UnicodeString getUnitDisplayName( |
| 20 | const Locale& loc, |
| 21 | const MeasureUnit& unit, |
| 22 | UNumberUnitWidth width, |
| 23 | UErrorCode& status); |
| 24 | |
| 25 | static UnicodeString getUnitPattern( |
| 26 | const Locale& loc, |
| 27 | const MeasureUnit& unit, |
| 28 | UNumberUnitWidth width, |
| 29 | StandardPlural::Form pluralForm, |
| 30 | UErrorCode& status); |
| 31 | |
| 32 | static LongNameHandler* |
| 33 | forCurrencyLongNames(const Locale &loc, const CurrencyUnit ¤cy, const PluralRules *rules, |
| 34 | const MicroPropsGenerator *parent, UErrorCode &status); |
| 35 | |
| 36 | static LongNameHandler* |
| 37 | forMeasureUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit, |
| 38 | const UNumberUnitWidth &width, const PluralRules *rules, |
| 39 | const MicroPropsGenerator *parent, UErrorCode &status); |
| 40 | |
| 41 | void |
| 42 | processQuantity(DecimalQuantity &quantity, MicroProps µs, UErrorCode &status) const U_OVERRIDE; |
| 43 | |
| 44 | const Modifier* getModifier(Signum signum, StandardPlural::Form plural) const U_OVERRIDE; |
| 45 | |
| 46 | private: |
| 47 | SimpleModifier fModifiers[StandardPlural::Form::COUNT]; |
| 48 | const PluralRules *rules; |
| 49 | const MicroPropsGenerator *parent; |
| 50 | |
| 51 | LongNameHandler(const PluralRules *rules, const MicroPropsGenerator *parent) |
| 52 | : rules(rules), parent(parent) {} |
| 53 | |
| 54 | static LongNameHandler* |
| 55 | forCompoundUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit, |
| 56 | const UNumberUnitWidth &width, const PluralRules *rules, |
| 57 | const MicroPropsGenerator *parent, UErrorCode &status); |
| 58 | |
| 59 | void simpleFormatsToModifiers(const UnicodeString *simpleFormats, Field field, UErrorCode &status); |
| 60 | void multiSimpleFormatsToModifiers(const UnicodeString *leadFormats, UnicodeString trailFormat, |
| 61 | Field field, UErrorCode &status); |
| 62 | }; |
| 63 | |
| 64 | } // namespace impl |
| 65 | } // namespace number |
| 66 | U_NAMESPACE_END |
| 67 | |
| 68 | #endif //__NUMBER_LONGNAMES_H__ |
| 69 | |
| 70 | #endif /* #if !UCONFIG_NO_FORMATTING */ |
| 71 | |