• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 LongNameHandler*
20     forCurrencyLongNames(const Locale &loc, const CurrencyUnit &currency, const PluralRules *rules,
21                          const MicroPropsGenerator *parent, UErrorCode &status);
22 
23     static LongNameHandler*
24     forMeasureUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit,
25                    const UNumberUnitWidth &width, const PluralRules *rules,
26                    const MicroPropsGenerator *parent, UErrorCode &status);
27 
28     void
29     processQuantity(DecimalQuantity &quantity, MicroProps &micros, UErrorCode &status) const U_OVERRIDE;
30 
31     const Modifier* getModifier(int8_t signum, StandardPlural::Form plural) const U_OVERRIDE;
32 
33   private:
34     SimpleModifier fModifiers[StandardPlural::Form::COUNT];
35     const PluralRules *rules;
36     const MicroPropsGenerator *parent;
37 
LongNameHandler(const PluralRules * rules,const MicroPropsGenerator * parent)38     LongNameHandler(const PluralRules *rules, const MicroPropsGenerator *parent)
39             : rules(rules), parent(parent) {}
40 
41     static LongNameHandler*
42     forCompoundUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit,
43                     const UNumberUnitWidth &width, const PluralRules *rules,
44                     const MicroPropsGenerator *parent, UErrorCode &status);
45 
46     void simpleFormatsToModifiers(const UnicodeString *simpleFormats, Field field, UErrorCode &status);
47     void multiSimpleFormatsToModifiers(const UnicodeString *leadFormats, UnicodeString trailFormat,
48                                        Field field, UErrorCode &status);
49 };
50 
51 }  // namespace impl
52 }  // namespace number
53 U_NAMESPACE_END
54 
55 #endif //__NUMBER_LONGNAMES_H__
56 
57 #endif /* #if !UCONFIG_NO_FORMATTING */
58