diff options
author | mcheshkov <mcheshkov@yandex-team.ru> | 2022-02-10 16:46:16 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:16 +0300 |
commit | 1312621288956f199a5bd5342b0133d4395fa725 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs/icu/i18n/numparse_decimal.h | |
parent | e9d19cec64684c9c1e6b0c98297e5b895cf904fe (diff) | |
download | ydb-1312621288956f199a5bd5342b0133d4395fa725.tar.gz |
Restoring authorship annotation for <mcheshkov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/icu/i18n/numparse_decimal.h')
-rw-r--r-- | contrib/libs/icu/i18n/numparse_decimal.h | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/contrib/libs/icu/i18n/numparse_decimal.h b/contrib/libs/icu/i18n/numparse_decimal.h index 6bb6c4be1a..ec6c76487e 100644 --- a/contrib/libs/icu/i18n/numparse_decimal.h +++ b/contrib/libs/icu/i18n/numparse_decimal.h @@ -1,76 +1,76 @@ -// © 2018 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_FORMATTING -#ifndef __NUMPARSE_DECIMAL_H__ -#define __NUMPARSE_DECIMAL_H__ - -#include "unicode/uniset.h" -#include "numparse_types.h" - -U_NAMESPACE_BEGIN namespace numparse { -namespace impl { - -using ::icu::number::impl::Grouper; - -class DecimalMatcher : public NumberParseMatcher, public UMemory { - public: - DecimalMatcher() = default; // WARNING: Leaves the object in an unusable state - - DecimalMatcher(const DecimalFormatSymbols& symbols, const Grouper& grouper, - parse_flags_t parseFlags); - - bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override; - - bool - match(StringSegment& segment, ParsedNumber& result, int8_t exponentSign, UErrorCode& status) const; - - bool smokeTest(const StringSegment& segment) const override; - - UnicodeString toString() const override; - - private: - /** If true, only accept strings whose grouping sizes match the locale */ - bool requireGroupingMatch; - - /** If true, do not accept grouping separators at all */ - bool groupingDisabled; - - // Fraction grouping parsing is disabled for now but could be enabled later. - // See http://bugs.icu-project.org/trac/ticket/10794 - // bool fractionGrouping; - - /** If true, do not accept numbers in the fraction */ - bool integerOnly; - - int16_t grouping1; - int16_t grouping2; - - UnicodeString groupingSeparator; - UnicodeString decimalSeparator; - - // Assumption: these sets all consist of single code points. If this assumption needs to be broken, - // fix getLeadCodePoints() as well as matching logic. Be careful of the performance impact. - const UnicodeSet* groupingUniSet; - const UnicodeSet* decimalUniSet; - const UnicodeSet* separatorSet; - const UnicodeSet* leadSet; - - // Make this class the owner of a few objects that could be allocated. - // The first three LocalPointers are used for assigning ownership only. - LocalPointer<const UnicodeSet> fLocalDecimalUniSet; - LocalPointer<const UnicodeSet> fLocalSeparatorSet; - LocalArray<const UnicodeString> fLocalDigitStrings; - - bool validateGroup(int32_t sepType, int32_t count, bool isPrimary) const; -}; - - -} // namespace impl -} // namespace numparse -U_NAMESPACE_END - -#endif //__NUMPARSE_DECIMAL_H__ -#endif /* #if !UCONFIG_NO_FORMATTING */ +// © 2018 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMPARSE_DECIMAL_H__ +#define __NUMPARSE_DECIMAL_H__ + +#include "unicode/uniset.h" +#include "numparse_types.h" + +U_NAMESPACE_BEGIN namespace numparse { +namespace impl { + +using ::icu::number::impl::Grouper; + +class DecimalMatcher : public NumberParseMatcher, public UMemory { + public: + DecimalMatcher() = default; // WARNING: Leaves the object in an unusable state + + DecimalMatcher(const DecimalFormatSymbols& symbols, const Grouper& grouper, + parse_flags_t parseFlags); + + bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override; + + bool + match(StringSegment& segment, ParsedNumber& result, int8_t exponentSign, UErrorCode& status) const; + + bool smokeTest(const StringSegment& segment) const override; + + UnicodeString toString() const override; + + private: + /** If true, only accept strings whose grouping sizes match the locale */ + bool requireGroupingMatch; + + /** If true, do not accept grouping separators at all */ + bool groupingDisabled; + + // Fraction grouping parsing is disabled for now but could be enabled later. + // See http://bugs.icu-project.org/trac/ticket/10794 + // bool fractionGrouping; + + /** If true, do not accept numbers in the fraction */ + bool integerOnly; + + int16_t grouping1; + int16_t grouping2; + + UnicodeString groupingSeparator; + UnicodeString decimalSeparator; + + // Assumption: these sets all consist of single code points. If this assumption needs to be broken, + // fix getLeadCodePoints() as well as matching logic. Be careful of the performance impact. + const UnicodeSet* groupingUniSet; + const UnicodeSet* decimalUniSet; + const UnicodeSet* separatorSet; + const UnicodeSet* leadSet; + + // Make this class the owner of a few objects that could be allocated. + // The first three LocalPointers are used for assigning ownership only. + LocalPointer<const UnicodeSet> fLocalDecimalUniSet; + LocalPointer<const UnicodeSet> fLocalSeparatorSet; + LocalArray<const UnicodeString> fLocalDigitStrings; + + bool validateGroup(int32_t sepType, int32_t count, bool isPrimary) const; +}; + + +} // namespace impl +} // namespace numparse +U_NAMESPACE_END + +#endif //__NUMPARSE_DECIMAL_H__ +#endif /* #if !UCONFIG_NO_FORMATTING */ |