numparse_scientific.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // © 2018 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. #include "unicode/utypes.h"
  4. #if !UCONFIG_NO_FORMATTING
  5. #ifndef __NUMPARSE_SCIENTIFIC_H__
  6. #define __NUMPARSE_SCIENTIFIC_H__
  7. #include "numparse_types.h"
  8. #include "numparse_decimal.h"
  9. #include "numparse_symbols.h"
  10. #include "unicode/numberformatter.h"
  11. using icu::number::impl::Grouper;
  12. U_NAMESPACE_BEGIN namespace numparse {
  13. namespace impl {
  14. class ScientificMatcher : public NumberParseMatcher, public UMemory {
  15. public:
  16. ScientificMatcher() = default; // WARNING: Leaves the object in an unusable state
  17. ScientificMatcher(const DecimalFormatSymbols& dfs, const Grouper& grouper);
  18. bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
  19. bool smokeTest(const StringSegment& segment) const override;
  20. UnicodeString toString() const override;
  21. private:
  22. UnicodeString fExponentSeparatorString;
  23. DecimalMatcher fExponentMatcher;
  24. IgnorablesMatcher fIgnorablesMatcher;
  25. UnicodeString fCustomMinusSign;
  26. UnicodeString fCustomPlusSign;
  27. };
  28. } // namespace impl
  29. } // namespace numparse
  30. U_NAMESPACE_END
  31. #endif //__NUMPARSE_SCIENTIFIC_H__
  32. #endif /* #if !UCONFIG_NO_FORMATTING */