]> git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/number_scientific.h
ICU-62109.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / number_scientific.h
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_SCIENTIFIC_H__
8 #define __NUMBER_SCIENTIFIC_H__
9
10 #include "number_types.h"
11
12 U_NAMESPACE_BEGIN namespace number {
13 namespace impl {
14
15 // Forward-declare
16 class ScientificHandler;
17
18 class U_I18N_API ScientificModifier : public UMemory, public Modifier {
19 public:
20 ScientificModifier();
21
22 void set(int32_t exponent, const ScientificHandler *handler);
23
24 int32_t apply(NumberStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
25 UErrorCode &status) const U_OVERRIDE;
26
27 int32_t getPrefixLength(UErrorCode &status) const U_OVERRIDE;
28
29 int32_t getCodePointCount(UErrorCode &status) const U_OVERRIDE;
30
31 bool isStrong() const U_OVERRIDE;
32
33 private:
34 int32_t fExponent;
35 const ScientificHandler *fHandler;
36 };
37
38 class ScientificHandler : public UMemory, public MicroPropsGenerator, public MultiplierProducer {
39 public:
40 ScientificHandler(const Notation *notation, const DecimalFormatSymbols *symbols,
41 const MicroPropsGenerator *parent);
42
43 void
44 processQuantity(DecimalQuantity &quantity, MicroProps &micros, UErrorCode &status) const U_OVERRIDE;
45
46 int32_t getMultiplier(int32_t magnitude) const U_OVERRIDE;
47
48 private:
49 const Notation::ScientificSettings& fSettings;
50 const DecimalFormatSymbols *fSymbols;
51 const MicroPropsGenerator *fParent;
52
53 friend class ScientificModifier;
54 };
55
56 } // namespace impl
57 } // namespace number
58 U_NAMESPACE_END
59
60 #endif //__NUMBER_SCIENTIFIC_H__
61
62 #endif /* #if !UCONFIG_NO_FORMATTING */