| 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 __NUMPARSE_SCIENTIFIC_H__ |
| 8 | #define __NUMPARSE_SCIENTIFIC_H__ |
| 9 | |
| 10 | #include "numparse_types.h" |
| 11 | #include "numparse_decimal.h" |
| 12 | #include "numparse_symbols.h" |
| 13 | #include "unicode/numberformatter.h" |
| 14 | |
| 15 | using icu::number::impl::Grouper; |
| 16 | |
| 17 | U_NAMESPACE_BEGIN namespace numparse { |
| 18 | namespace impl { |
| 19 | |
| 20 | |
| 21 | class ScientificMatcher : public NumberParseMatcher, public UMemory { |
| 22 | public: |
| 23 | ScientificMatcher() = default; // WARNING: Leaves the object in an unusable state |
| 24 | |
| 25 | ScientificMatcher(const DecimalFormatSymbols& dfs, const Grouper& grouper); |
| 26 | |
| 27 | bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override; |
| 28 | |
| 29 | bool smokeTest(const StringSegment& segment) const override; |
| 30 | |
| 31 | UnicodeString toString() const override; |
| 32 | |
| 33 | private: |
| 34 | UnicodeString fExponentSeparatorString; |
| 35 | DecimalMatcher fExponentMatcher; |
| 36 | IgnorablesMatcher fIgnorablesMatcher; |
| 37 | UnicodeString fCustomMinusSign; |
| 38 | UnicodeString fCustomPlusSign; |
| 39 | }; |
| 40 | |
| 41 | |
| 42 | } // namespace impl |
| 43 | } // namespace numparse |
| 44 | U_NAMESPACE_END |
| 45 | |
| 46 | #endif //__NUMPARSE_SCIENTIFIC_H__ |
| 47 | #endif /* #if !UCONFIG_NO_FORMATTING */ |
| 48 |