diff options
author | neksard <neksard@yandex-team.ru> | 2022-02-10 16:45:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:23 +0300 |
commit | 8f7cf138264e0caa318144bf8a2c950e0b0a8593 (patch) | |
tree | 83bf5c8c8047c42d8475e6095df90ccdc3d1b57f /contrib/libs/icu/common/unifilt.cpp | |
parent | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (diff) | |
download | ydb-8f7cf138264e0caa318144bf8a2c950e0b0a8593.tar.gz |
Restoring authorship annotation for <neksard@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/icu/common/unifilt.cpp')
-rw-r--r-- | contrib/libs/icu/common/unifilt.cpp | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/contrib/libs/icu/common/unifilt.cpp b/contrib/libs/icu/common/unifilt.cpp index 4ab0d9b5f9..07aa462cd8 100644 --- a/contrib/libs/icu/common/unifilt.cpp +++ b/contrib/libs/icu/common/unifilt.cpp @@ -1,71 +1,71 @@ // © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -********************************************************************** -* Copyright (c) 2001-2012, International Business Machines -* Corporation and others. All Rights Reserved. -********************************************************************** -* Date Name Description -* 07/18/01 aliu Creation. -********************************************************************** -*/ - -#include "unicode/unifilt.h" -#include "unicode/rep.h" -#include "unicode/utf16.h" - -U_NAMESPACE_BEGIN -UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(UnicodeFilter) - - -/* Define this here due to the lack of another file. - It can't be defined in the header */ -UnicodeMatcher::~UnicodeMatcher() {} - -UnicodeFilter::~UnicodeFilter() {} - -/** - * UnicodeFunctor API. - * Note that UnicodeMatcher is a base class of UnicodeFilter. - */ -UnicodeMatcher* UnicodeFilter::toMatcher() const { - return const_cast<UnicodeFilter *>(this); -} - -void UnicodeFilter::setData(const TransliterationRuleData*) {} - -/** - * Default implementation of UnicodeMatcher::matches() for Unicode - * filters. Matches a single code point at offset (either one or - * two 16-bit code units). - */ -UMatchDegree UnicodeFilter::matches(const Replaceable& text, - int32_t& offset, - int32_t limit, - UBool incremental) { - UChar32 c; - if (offset < limit && - contains(c = text.char32At(offset))) { - offset += U16_LENGTH(c); - return U_MATCH; - } - if (offset > limit && - contains(c = text.char32At(offset))) { - // Backup offset by 1, unless the preceding character is a - // surrogate pair -- then backup by 2 (keep offset pointing at - // the lead surrogate). - --offset; - if (offset >= 0) { - offset -= U16_LENGTH(text.char32At(offset)) - 1; - } - return U_MATCH; - } - if (incremental && offset == limit) { - return U_PARTIAL_MATCH; - } - return U_MISMATCH; -} - -U_NAMESPACE_END - -//eof +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2001-2012, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 07/18/01 aliu Creation. +********************************************************************** +*/ + +#include "unicode/unifilt.h" +#include "unicode/rep.h" +#include "unicode/utf16.h" + +U_NAMESPACE_BEGIN +UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(UnicodeFilter) + + +/* Define this here due to the lack of another file. + It can't be defined in the header */ +UnicodeMatcher::~UnicodeMatcher() {} + +UnicodeFilter::~UnicodeFilter() {} + +/** + * UnicodeFunctor API. + * Note that UnicodeMatcher is a base class of UnicodeFilter. + */ +UnicodeMatcher* UnicodeFilter::toMatcher() const { + return const_cast<UnicodeFilter *>(this); +} + +void UnicodeFilter::setData(const TransliterationRuleData*) {} + +/** + * Default implementation of UnicodeMatcher::matches() for Unicode + * filters. Matches a single code point at offset (either one or + * two 16-bit code units). + */ +UMatchDegree UnicodeFilter::matches(const Replaceable& text, + int32_t& offset, + int32_t limit, + UBool incremental) { + UChar32 c; + if (offset < limit && + contains(c = text.char32At(offset))) { + offset += U16_LENGTH(c); + return U_MATCH; + } + if (offset > limit && + contains(c = text.char32At(offset))) { + // Backup offset by 1, unless the preceding character is a + // surrogate pair -- then backup by 2 (keep offset pointing at + // the lead surrogate). + --offset; + if (offset >= 0) { + offset -= U16_LENGTH(text.char32At(offset)) - 1; + } + return U_MATCH; + } + if (incremental && offset == limit) { + return U_PARTIAL_MATCH; + } + return U_MISMATCH; +} + +U_NAMESPACE_END + +//eof |