aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/icu/common/normalizer2.cpp
diff options
context:
space:
mode:
authormcheshkov <mcheshkov@yandex-team.ru>2022-02-10 16:46:16 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:16 +0300
commit1312621288956f199a5bd5342b0133d4395fa725 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs/icu/common/normalizer2.cpp
parente9d19cec64684c9c1e6b0c98297e5b895cf904fe (diff)
downloadydb-1312621288956f199a5bd5342b0133d4395fa725.tar.gz
Restoring authorship annotation for <mcheshkov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/icu/common/normalizer2.cpp')
-rw-r--r--contrib/libs/icu/common/normalizer2.cpp208
1 files changed, 104 insertions, 104 deletions
diff --git a/contrib/libs/icu/common/normalizer2.cpp b/contrib/libs/icu/common/normalizer2.cpp
index e88e0dc8bd..6be7e0b21a 100644
--- a/contrib/libs/icu/common/normalizer2.cpp
+++ b/contrib/libs/icu/common/normalizer2.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: normalizer2.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -20,9 +20,9 @@
#if !UCONFIG_NO_NORMALIZATION
-#include "unicode/edits.h"
+#include "unicode/edits.h"
#include "unicode/normalizer2.h"
-#include "unicode/stringoptions.h"
+#include "unicode/stringoptions.h"
#include "unicode/unistr.h"
#include "unicode/unorm.h"
#include "cstring.h"
@@ -34,11 +34,11 @@
using icu::Normalizer2Impl;
-#if NORM2_HARDCODE_NFC_DATA
+#if NORM2_HARDCODE_NFC_DATA
// NFC/NFD data machine-generated by gennorm2 --csource
#define INCLUDED_FROM_NORMALIZER2_CPP
#include "norm2_nfc_data.h"
-#endif
+#endif
U_NAMESPACE_BEGIN
@@ -46,20 +46,20 @@ U_NAMESPACE_BEGIN
Normalizer2::~Normalizer2() {}
-void
-Normalizer2::normalizeUTF8(uint32_t /*options*/, StringPiece src, ByteSink &sink,
- Edits *edits, UErrorCode &errorCode) const {
- if (U_FAILURE(errorCode)) {
- return;
- }
- if (edits != nullptr) {
- errorCode = U_UNSUPPORTED_ERROR;
- return;
- }
- UnicodeString src16 = UnicodeString::fromUTF8(src);
- normalize(src16, errorCode).toUTF8(sink);
-}
-
+void
+Normalizer2::normalizeUTF8(uint32_t /*options*/, StringPiece src, ByteSink &sink,
+ Edits *edits, UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
+ if (edits != nullptr) {
+ errorCode = U_UNSUPPORTED_ERROR;
+ return;
+ }
+ UnicodeString src16 = UnicodeString::fromUTF8(src);
+ normalize(src16, errorCode).toUTF8(sink);
+}
+
UBool
Normalizer2::getRawDecomposition(UChar32, UnicodeString &) const {
return FALSE;
@@ -75,11 +75,11 @@ Normalizer2::getCombiningClass(UChar32 /*c*/) const {
return 0;
}
-UBool
-Normalizer2::isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const {
- return U_SUCCESS(errorCode) && isNormalized(UnicodeString::fromUTF8(s), errorCode);
-}
-
+UBool
+Normalizer2::isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const {
+ return U_SUCCESS(errorCode) && isNormalized(UnicodeString::fromUTF8(s), errorCode);
+}
+
// Normalizer2 implementation for the old UNORM_NONE.
class NoopNormalizer2 : public Normalizer2 {
virtual ~NoopNormalizer2();
@@ -87,7 +87,7 @@ class NoopNormalizer2 : public Normalizer2 {
virtual UnicodeString &
normalize(const UnicodeString &src,
UnicodeString &dest,
- UErrorCode &errorCode) const U_OVERRIDE {
+ UErrorCode &errorCode) const U_OVERRIDE {
if(U_SUCCESS(errorCode)) {
if(&dest!=&src) {
dest=src;
@@ -97,27 +97,27 @@ class NoopNormalizer2 : public Normalizer2 {
}
return dest;
}
- virtual void
- normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
- Edits *edits, UErrorCode &errorCode) const U_OVERRIDE {
- if(U_SUCCESS(errorCode)) {
- if (edits != nullptr) {
- if ((options & U_EDITS_NO_RESET) == 0) {
- edits->reset();
- }
- edits->addUnchanged(src.length());
- }
- if ((options & U_OMIT_UNCHANGED_TEXT) == 0) {
- sink.Append(src.data(), src.length());
- }
- sink.Flush();
- }
- }
-
+ virtual void
+ normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
+ Edits *edits, UErrorCode &errorCode) const U_OVERRIDE {
+ if(U_SUCCESS(errorCode)) {
+ if (edits != nullptr) {
+ if ((options & U_EDITS_NO_RESET) == 0) {
+ edits->reset();
+ }
+ edits->addUnchanged(src.length());
+ }
+ if ((options & U_OMIT_UNCHANGED_TEXT) == 0) {
+ sink.Append(src.data(), src.length());
+ }
+ sink.Flush();
+ }
+ }
+
virtual UnicodeString &
normalizeSecondAndAppend(UnicodeString &first,
const UnicodeString &second,
- UErrorCode &errorCode) const U_OVERRIDE {
+ UErrorCode &errorCode) const U_OVERRIDE {
if(U_SUCCESS(errorCode)) {
if(&first!=&second) {
first.append(second);
@@ -130,7 +130,7 @@ class NoopNormalizer2 : public Normalizer2 {
virtual UnicodeString &
append(UnicodeString &first,
const UnicodeString &second,
- UErrorCode &errorCode) const U_OVERRIDE {
+ UErrorCode &errorCode) const U_OVERRIDE {
if(U_SUCCESS(errorCode)) {
if(&first!=&second) {
first.append(second);
@@ -141,29 +141,29 @@ class NoopNormalizer2 : public Normalizer2 {
return first;
}
virtual UBool
- getDecomposition(UChar32, UnicodeString &) const U_OVERRIDE {
+ getDecomposition(UChar32, UnicodeString &) const U_OVERRIDE {
return FALSE;
}
- // No need to U_OVERRIDE the default getRawDecomposition().
+ // No need to U_OVERRIDE the default getRawDecomposition().
+ virtual UBool
+ isNormalized(const UnicodeString &, UErrorCode &errorCode) const U_OVERRIDE {
+ return U_SUCCESS(errorCode);
+ }
virtual UBool
- isNormalized(const UnicodeString &, UErrorCode &errorCode) const U_OVERRIDE {
- return U_SUCCESS(errorCode);
+ isNormalizedUTF8(StringPiece, UErrorCode &errorCode) const U_OVERRIDE {
+ return U_SUCCESS(errorCode);
}
- virtual UBool
- isNormalizedUTF8(StringPiece, UErrorCode &errorCode) const U_OVERRIDE {
- return U_SUCCESS(errorCode);
- }
virtual UNormalizationCheckResult
- quickCheck(const UnicodeString &, UErrorCode &) const U_OVERRIDE {
+ quickCheck(const UnicodeString &, UErrorCode &) const U_OVERRIDE {
return UNORM_YES;
}
virtual int32_t
- spanQuickCheckYes(const UnicodeString &s, UErrorCode &) const U_OVERRIDE {
+ spanQuickCheckYes(const UnicodeString &s, UErrorCode &) const U_OVERRIDE {
return s.length();
}
- virtual UBool hasBoundaryBefore(UChar32) const U_OVERRIDE { return TRUE; }
- virtual UBool hasBoundaryAfter(UChar32) const U_OVERRIDE { return TRUE; }
- virtual UBool isInert(UChar32) const U_OVERRIDE { return TRUE; }
+ virtual UBool hasBoundaryBefore(UChar32) const U_OVERRIDE { return TRUE; }
+ virtual UBool hasBoundaryAfter(UChar32) const U_OVERRIDE { return TRUE; }
+ virtual UBool isInert(UChar32) const U_OVERRIDE { return TRUE; }
};
NoopNormalizer2::~NoopNormalizer2() {}
@@ -178,36 +178,36 @@ FCDNormalizer2::~FCDNormalizer2() {}
// instance cache ---------------------------------------------------------- ***
-U_CDECL_BEGIN
-static UBool U_CALLCONV uprv_normalizer2_cleanup();
-U_CDECL_END
-
-static Normalizer2 *noopSingleton;
-static icu::UInitOnce noopInitOnce = U_INITONCE_INITIALIZER;
-
-static void U_CALLCONV initNoopSingleton(UErrorCode &errorCode) {
- if(U_FAILURE(errorCode)) {
- return;
- }
- noopSingleton=new NoopNormalizer2;
- if(noopSingleton==NULL) {
- errorCode=U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- ucln_common_registerCleanup(UCLN_COMMON_NORMALIZER2, uprv_normalizer2_cleanup);
-}
-
-const Normalizer2 *Normalizer2Factory::getNoopInstance(UErrorCode &errorCode) {
- if(U_FAILURE(errorCode)) { return NULL; }
- umtx_initOnce(noopInitOnce, &initNoopSingleton, errorCode);
- return noopSingleton;
-}
-
-const Normalizer2Impl *
-Normalizer2Factory::getImpl(const Normalizer2 *norm2) {
- return &((Normalizer2WithImpl *)norm2)->impl;
-}
-
+U_CDECL_BEGIN
+static UBool U_CALLCONV uprv_normalizer2_cleanup();
+U_CDECL_END
+
+static Normalizer2 *noopSingleton;
+static icu::UInitOnce noopInitOnce = U_INITONCE_INITIALIZER;
+
+static void U_CALLCONV initNoopSingleton(UErrorCode &errorCode) {
+ if(U_FAILURE(errorCode)) {
+ return;
+ }
+ noopSingleton=new NoopNormalizer2;
+ if(noopSingleton==NULL) {
+ errorCode=U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ ucln_common_registerCleanup(UCLN_COMMON_NORMALIZER2, uprv_normalizer2_cleanup);
+}
+
+const Normalizer2 *Normalizer2Factory::getNoopInstance(UErrorCode &errorCode) {
+ if(U_FAILURE(errorCode)) { return NULL; }
+ umtx_initOnce(noopInitOnce, &initNoopSingleton, errorCode);
+ return noopSingleton;
+}
+
+const Normalizer2Impl *
+Normalizer2Factory::getImpl(const Normalizer2 *norm2) {
+ return &((Normalizer2WithImpl *)norm2)->impl;
+}
+
Norm2AllModes::~Norm2AllModes() {
delete impl;
}
@@ -227,7 +227,7 @@ Norm2AllModes::createInstance(Normalizer2Impl *impl, UErrorCode &errorCode) {
return allModes;
}
-#if NORM2_HARDCODE_NFC_DATA
+#if NORM2_HARDCODE_NFC_DATA
Norm2AllModes *
Norm2AllModes::createNFCInstance(UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
@@ -286,24 +286,24 @@ Normalizer2Factory::getNFCImpl(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
return allModes!=NULL ? allModes->impl : NULL;
}
-#endif // NORM2_HARDCODE_NFC_DATA
+#endif // NORM2_HARDCODE_NFC_DATA
-U_CDECL_BEGIN
-
-static UBool U_CALLCONV uprv_normalizer2_cleanup() {
- delete noopSingleton;
- noopSingleton = NULL;
- noopInitOnce.reset();
-#if NORM2_HARDCODE_NFC_DATA
- delete nfcSingleton;
- nfcSingleton = NULL;
- nfcInitOnce.reset();
-#endif
- return TRUE;
+U_CDECL_BEGIN
+
+static UBool U_CALLCONV uprv_normalizer2_cleanup() {
+ delete noopSingleton;
+ noopSingleton = NULL;
+ noopInitOnce.reset();
+#if NORM2_HARDCODE_NFC_DATA
+ delete nfcSingleton;
+ nfcSingleton = NULL;
+ nfcInitOnce.reset();
+#endif
+ return TRUE;
}
-U_CDECL_END
-
+U_CDECL_END
+
U_NAMESPACE_END
// C API ------------------------------------------------------------------- ***