xref: /aosp_15_r20/external/icu/libicu/cts_headers/numparse_scientific.h (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
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
18 namespace numparse::impl {
19 
20 class ScientificMatcher : public NumberParseMatcher, public UMemory {
21   public:
22     ScientificMatcher() = default;  // WARNING: Leaves the object in an unusable state
23 
24     ScientificMatcher(const DecimalFormatSymbols& dfs, const Grouper& grouper);
25 
26     bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
27 
28     bool smokeTest(const StringSegment& segment) const override;
29 
30     UnicodeString toString() const override;
31 
32   private:
33     UnicodeString fExponentSeparatorString;
34     DecimalMatcher fExponentMatcher;
35     IgnorablesMatcher fIgnorablesMatcher;
36     UnicodeString fCustomMinusSign;
37     UnicodeString fCustomPlusSign;
38 };
39 
40 } // namespace numparse::impl
41 U_NAMESPACE_END
42 
43 #endif //__NUMPARSE_SCIENTIFIC_H__
44 #endif /* #if !UCONFIG_NO_FORMATTING */
45