aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/Foundation/src/UTF32Encoding.cpp
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/poco/Foundation/src/UTF32Encoding.cpp
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/poco/Foundation/src/UTF32Encoding.cpp')
-rw-r--r--contrib/libs/poco/Foundation/src/UTF32Encoding.cpp356
1 files changed, 178 insertions, 178 deletions
diff --git a/contrib/libs/poco/Foundation/src/UTF32Encoding.cpp b/contrib/libs/poco/Foundation/src/UTF32Encoding.cpp
index db0cfe21d7..d5d3ef5bb0 100644
--- a/contrib/libs/poco/Foundation/src/UTF32Encoding.cpp
+++ b/contrib/libs/poco/Foundation/src/UTF32Encoding.cpp
@@ -1,178 +1,178 @@
-//
-// UTF32Encoding.cpp
-//
-// Library: Foundation
-// Package: Text
-// Module: UTF32Encoding
-//
-// Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH.
-// and Contributors.
-//
-// SPDX-License-Identifier: BSL-1.0
-//
-
-
-#include "Poco/UTF32Encoding.h"
-#include "Poco/ByteOrder.h"
-#include "Poco/String.h"
-
-
-namespace Poco {
-
-
-const char* UTF32Encoding::_names[] =
-{
- "UTF-32",
- "UTF32",
- NULL
-};
-
-
-const TextEncoding::CharacterMap UTF32Encoding::_charMap =
-{
- /* 00 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- /* 10 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- /* 20 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- /* 30 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- /* 40 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- /* 50 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- /* 60 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- /* 70 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- /* 80 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- /* 90 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- /* a0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- /* b0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- /* c0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- /* d0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- /* e0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- /* f0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-};
-
-
-UTF32Encoding::UTF32Encoding(ByteOrderType byteOrder)
-{
- setByteOrder(byteOrder);
-}
-
-
-UTF32Encoding::UTF32Encoding(int byteOrderMark)
-{
- setByteOrder(byteOrderMark);
-}
-
-
-UTF32Encoding::~UTF32Encoding()
-{
-}
-
-
-UTF32Encoding::ByteOrderType UTF32Encoding::getByteOrder() const
-{
-#if defined(POCO_ARCH_BIG_ENDIAN)
- return _flipBytes ? LITTLE_ENDIAN_BYTE_ORDER : BIG_ENDIAN_BYTE_ORDER;
-#else
- return _flipBytes ? BIG_ENDIAN_BYTE_ORDER : LITTLE_ENDIAN_BYTE_ORDER;
-#endif
-}
-
-
-void UTF32Encoding::setByteOrder(ByteOrderType byteOrder)
-{
-#if defined(POCO_ARCH_BIG_ENDIAN)
- _flipBytes = byteOrder == LITTLE_ENDIAN_BYTE_ORDER;
-#else
- _flipBytes = byteOrder == BIG_ENDIAN_BYTE_ORDER;;
-#endif
-}
-
-
-void UTF32Encoding::setByteOrder(int byteOrderMark)
-{
- _flipBytes = byteOrderMark != 0xFEFF;
-}
-
-
-const char* UTF32Encoding::canonicalName() const
-{
- return _names[0];
-}
-
-
-bool UTF32Encoding::isA(const std::string& encodingName) const
-{
- for (const char** name = _names; *name; ++name)
- {
- if (Poco::icompare(encodingName, *name) == 0)
- return true;
- }
- return false;
-}
-
-
-const TextEncoding::CharacterMap& UTF32Encoding::characterMap() const
-{
- return _charMap;
-}
-
-
-int UTF32Encoding::convert(const unsigned char* bytes) const
-{
- UInt32 uc;
- unsigned char* p = (unsigned char*) &uc;
- *p++ = *bytes++;
- *p++ = *bytes++;
- *p++ = *bytes++;
- *p++ = *bytes++;
-
- if (_flipBytes)
- {
- ByteOrder::flipBytes(uc);
- }
-
- return uc;
-}
-
-
-int UTF32Encoding::convert(int ch, unsigned char* bytes, int length) const
-{
- if (bytes && length >= 4)
- {
- UInt32 ch1 = _flipBytes ? ByteOrder::flipBytes((UInt32) ch) : (UInt32) ch;
- unsigned char* p = (unsigned char*) &ch1;
- *bytes++ = *p++;
- *bytes++ = *p++;
- *bytes++ = *p++;
- *bytes++ = *p++;
- }
- return 4;
-}
-
-
-int UTF32Encoding::queryConvert(const unsigned char* bytes, int length) const
-{
- int ret = -4;
-
- if (length >= 4)
- {
- UInt32 uc;
- unsigned char* p = (unsigned char*) &uc;
- *p++ = *bytes++;
- *p++ = *bytes++;
- *p++ = *bytes++;
- *p++ = *bytes++;
- if (_flipBytes)
- ByteOrder::flipBytes(uc);
- return uc;
- }
-
- return ret;
-}
-
-
-int UTF32Encoding::sequenceLength(const unsigned char* /*bytes*/, int /*length*/) const
-{
- return 4;
-}
-
-
-} // namespace Poco
+//
+// UTF32Encoding.cpp
+//
+// Library: Foundation
+// Package: Text
+// Module: UTF32Encoding
+//
+// Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH.
+// and Contributors.
+//
+// SPDX-License-Identifier: BSL-1.0
+//
+
+
+#include "Poco/UTF32Encoding.h"
+#include "Poco/ByteOrder.h"
+#include "Poco/String.h"
+
+
+namespace Poco {
+
+
+const char* UTF32Encoding::_names[] =
+{
+ "UTF-32",
+ "UTF32",
+ NULL
+};
+
+
+const TextEncoding::CharacterMap UTF32Encoding::_charMap =
+{
+ /* 00 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ /* 10 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ /* 20 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ /* 30 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ /* 40 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ /* 50 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ /* 60 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ /* 70 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ /* 80 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ /* 90 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ /* a0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ /* b0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ /* c0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ /* d0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ /* e0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ /* f0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+};
+
+
+UTF32Encoding::UTF32Encoding(ByteOrderType byteOrder)
+{
+ setByteOrder(byteOrder);
+}
+
+
+UTF32Encoding::UTF32Encoding(int byteOrderMark)
+{
+ setByteOrder(byteOrderMark);
+}
+
+
+UTF32Encoding::~UTF32Encoding()
+{
+}
+
+
+UTF32Encoding::ByteOrderType UTF32Encoding::getByteOrder() const
+{
+#if defined(POCO_ARCH_BIG_ENDIAN)
+ return _flipBytes ? LITTLE_ENDIAN_BYTE_ORDER : BIG_ENDIAN_BYTE_ORDER;
+#else
+ return _flipBytes ? BIG_ENDIAN_BYTE_ORDER : LITTLE_ENDIAN_BYTE_ORDER;
+#endif
+}
+
+
+void UTF32Encoding::setByteOrder(ByteOrderType byteOrder)
+{
+#if defined(POCO_ARCH_BIG_ENDIAN)
+ _flipBytes = byteOrder == LITTLE_ENDIAN_BYTE_ORDER;
+#else
+ _flipBytes = byteOrder == BIG_ENDIAN_BYTE_ORDER;;
+#endif
+}
+
+
+void UTF32Encoding::setByteOrder(int byteOrderMark)
+{
+ _flipBytes = byteOrderMark != 0xFEFF;
+}
+
+
+const char* UTF32Encoding::canonicalName() const
+{
+ return _names[0];
+}
+
+
+bool UTF32Encoding::isA(const std::string& encodingName) const
+{
+ for (const char** name = _names; *name; ++name)
+ {
+ if (Poco::icompare(encodingName, *name) == 0)
+ return true;
+ }
+ return false;
+}
+
+
+const TextEncoding::CharacterMap& UTF32Encoding::characterMap() const
+{
+ return _charMap;
+}
+
+
+int UTF32Encoding::convert(const unsigned char* bytes) const
+{
+ UInt32 uc;
+ unsigned char* p = (unsigned char*) &uc;
+ *p++ = *bytes++;
+ *p++ = *bytes++;
+ *p++ = *bytes++;
+ *p++ = *bytes++;
+
+ if (_flipBytes)
+ {
+ ByteOrder::flipBytes(uc);
+ }
+
+ return uc;
+}
+
+
+int UTF32Encoding::convert(int ch, unsigned char* bytes, int length) const
+{
+ if (bytes && length >= 4)
+ {
+ UInt32 ch1 = _flipBytes ? ByteOrder::flipBytes((UInt32) ch) : (UInt32) ch;
+ unsigned char* p = (unsigned char*) &ch1;
+ *bytes++ = *p++;
+ *bytes++ = *p++;
+ *bytes++ = *p++;
+ *bytes++ = *p++;
+ }
+ return 4;
+}
+
+
+int UTF32Encoding::queryConvert(const unsigned char* bytes, int length) const
+{
+ int ret = -4;
+
+ if (length >= 4)
+ {
+ UInt32 uc;
+ unsigned char* p = (unsigned char*) &uc;
+ *p++ = *bytes++;
+ *p++ = *bytes++;
+ *p++ = *bytes++;
+ *p++ = *bytes++;
+ if (_flipBytes)
+ ByteOrder::flipBytes(uc);
+ return uc;
+ }
+
+ return ret;
+}
+
+
+int UTF32Encoding::sequenceLength(const unsigned char* /*bytes*/, int /*length*/) const
+{
+ return 4;
+}
+
+
+} // namespace Poco