aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsobols <sobols@yandex-team.ru>2022-02-10 16:47:08 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:08 +0300
commit09961b69c61f471ddd594e0fd877df62a8021562 (patch)
tree54a7b60a9526a7104557a033eb0a8d70d64b604c
parent4ce8835206f981afa4a61915a49a21fb750416ec (diff)
downloadydb-09961b69c61f471ddd594e0fd877df62a8021562.tar.gz
Restoring authorship annotation for <sobols@yandex-team.ru>. Commit 1 of 2.
-rw-r--r--build/plugins/ytest.py4
-rw-r--r--build/rules/maps/maps.policy12
-rw-r--r--build/ymake.core.conf6
-rw-r--r--contrib/libs/crcutil/crc32c_sse4.cc6
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/io/printer.cc8
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/text_format.cc2
-rw-r--r--contrib/libs/ya.make4
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/contrib/anchordict.h14
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h4
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/dll.h12
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/emitter.h6
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/exceptions.h110
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/node/convert.h76
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/impl.h28
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/iterator.h96
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node.h14
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node_data.h8
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h78
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h6
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/node/emit.h16
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/node/impl.h6
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/node/node.h2
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/node/parse.h98
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/node/ptr.h12
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/null.h4
-rw-r--r--contrib/libs/yaml-cpp/include/yaml-cpp/parser.h84
-rw-r--r--contrib/libs/yaml-cpp/src/collectionstack.h2
-rw-r--r--contrib/libs/yaml-cpp/src/emit.cpp2
-rw-r--r--contrib/libs/yaml-cpp/src/emitfromevents.cpp2
-rw-r--r--contrib/libs/yaml-cpp/src/emitterstate.cpp98
-rw-r--r--contrib/libs/yaml-cpp/src/emitterstate.h30
-rw-r--r--contrib/libs/yaml-cpp/src/emitterutils.cpp12
-rw-r--r--contrib/libs/yaml-cpp/src/emitterutils.h4
-rw-r--r--contrib/libs/yaml-cpp/src/exceptions.cpp62
-rw-r--r--contrib/libs/yaml-cpp/src/exp.h26
-rw-r--r--contrib/libs/yaml-cpp/src/node_data.cpp12
-rw-r--r--contrib/libs/yaml-cpp/src/nodebuilder.cpp4
-rw-r--r--contrib/libs/yaml-cpp/src/null.cpp10
-rw-r--r--contrib/libs/yaml-cpp/src/parse.cpp18
-rw-r--r--contrib/libs/yaml-cpp/src/parser.cpp50
-rw-r--r--contrib/libs/yaml-cpp/src/ptr_vector.h14
-rw-r--r--contrib/libs/yaml-cpp/src/regex_yaml.h14
-rw-r--r--contrib/libs/yaml-cpp/src/scanner.cpp170
-rw-r--r--contrib/libs/yaml-cpp/src/scanner.h114
-rw-r--r--contrib/libs/yaml-cpp/src/scanscalar.cpp114
-rw-r--r--contrib/libs/yaml-cpp/src/scanscalar.h8
-rw-r--r--contrib/libs/yaml-cpp/src/scantoken.cpp8
-rw-r--r--contrib/libs/yaml-cpp/src/setting.h20
-rw-r--r--contrib/libs/yaml-cpp/src/singledocparser.cpp4
-rw-r--r--contrib/libs/yaml-cpp/src/singledocparser.h2
-rw-r--r--contrib/libs/yaml-cpp/ya.make2
-rw-r--r--contrib/libs/zlib/deflate.c2
-rw-r--r--contrib/python/protobuf/py2/google/protobuf/pyext/descriptor_pool.cc2
-rw-r--r--contrib/python/protobuf/py2/google/protobuf/pyext/message.cc2
-rw-r--r--contrib/python/protobuf/py2/google/protobuf/pyext/message.h2
-rw-r--r--contrib/python/protobuf/py2/google/protobuf/pyext/message_factory.cc2
-rw-r--r--contrib/python/protobuf/py3/google/protobuf/pyext/descriptor_pool.cc2
-rw-r--r--contrib/python/protobuf/py3/google/protobuf/pyext/message.cc2
-rw-r--r--contrib/python/protobuf/py3/google/protobuf/pyext/message.h2
-rw-r--r--contrib/python/protobuf/py3/google/protobuf/pyext/message_factory.cc2
-rw-r--r--contrib/tools/cython/Cython/Compiler/Nodes.py2
-rw-r--r--contrib/tools/cython/Cython/Utility/CythonFunction.c4
-rwxr-xr-xcontrib/tools/cython/cython.py2
-rw-r--r--library/cpp/blockcodecs/core/common.h6
-rw-r--r--library/cpp/charset/codepage_ut.cpp26
-rw-r--r--library/cpp/containers/comptrie/comptrie_ut.cpp22
-rw-r--r--library/cpp/digest/crc32c/crc32c_ut.cpp18
-rw-r--r--library/cpp/protobuf/json/json2proto.cpp26
-rw-r--r--library/cpp/protobuf/json/json2proto.h4
-rw-r--r--library/cpp/protobuf/json/ut/json2proto_ut.cpp30
-rw-r--r--library/cpp/protobuf/json/ut/util_ut.cpp84
-rw-r--r--library/cpp/protobuf/json/ut/ya.make2
-rw-r--r--library/cpp/protobuf/json/util.cpp50
-rw-r--r--library/cpp/protobuf/json/util.h10
-rw-r--r--library/cpp/unicode/punycode/punycode.cpp20
-rw-r--r--library/cpp/uri/uri-ru_ut.cpp56
-rw-r--r--library/cpp/xml/document/libxml-guards.h2
-rw-r--r--library/cpp/xml/document/ut/ya.make2
-rw-r--r--library/cpp/xml/document/xml-document-decl.h202
-rw-r--r--library/cpp/xml/document/xml-document.cpp120
-rw-r--r--library/cpp/xml/document/xml-document_ut.cpp172
-rw-r--r--library/cpp/xml/document/xml-textreader.cpp572
-rw-r--r--library/cpp/xml/document/xml-textreader.h612
-rw-r--r--library/cpp/xml/document/xml-textreader_ut.cpp422
-rw-r--r--library/cpp/xml/document/ya.make2
-rw-r--r--library/cpp/ya.make2
-rw-r--r--library/python/pytest/plugins/collection.py4
-rw-r--r--library/python/pytest/yatest_tools.py4
-rw-r--r--library/python/testing/recipe/__init__.py6
-rw-r--r--library/python/testing/recipe/ya.make2
-rw-r--r--library/python/testing/yatest_lib/tools.py82
-rw-r--r--util/charset/benchmark/utf8_to_wide/main.cpp2
-rw-r--r--util/datetime/base.h8
-rw-r--r--util/datetime/base_ut.cpp22
-rw-r--r--util/draft/datetime.cpp30
-rw-r--r--util/draft/datetime.h6
-rw-r--r--util/draft/datetime_ut.cpp34
-rw-r--r--util/generic/strbuf_ut.cpp46
-rw-r--r--util/generic/string_ut.cpp36
-rw-r--r--util/network/socket.cpp18
-rw-r--r--util/network/socket.h2
-rw-r--r--util/stream/ios_ut.cpp86
-rw-r--r--util/stream/output.cpp64
-rw-r--r--util/string/cast.cpp4
-rw-r--r--util/string/cast_ut.cpp62
-rw-r--r--util/string/escape.cpp10
-rw-r--r--util/string/escape_ut.cpp6
-rw-r--r--util/string/split_ut.cpp22
-rw-r--r--util/string/strip_ut.cpp4
-rw-r--r--util/string/subst_ut.cpp8
-rw-r--r--util/string/type_ut.cpp24
-rw-r--r--util/string/vector_ut.cpp2
-rw-r--r--util/system/types.h8
-rw-r--r--ydb/core/mind/bscontroller/table_merger.h2
-rw-r--r--ydb/core/mind/table_adapter.h2
-rw-r--r--ydb/library/yql/parser/proto_ast/proto_ast.h2
116 files changed, 2307 insertions, 2307 deletions
diff --git a/build/plugins/ytest.py b/build/plugins/ytest.py
index 8970837f0f..19ae7f3b0f 100644
--- a/build/plugins/ytest.py
+++ b/build/plugins/ytest.py
@@ -10,7 +10,7 @@ import lib._metric_resolvers as mr
import _test_const as consts
import _requirements as reqs
import StringIO
-import subprocess
+import subprocess
import collections
import ymake
@@ -1024,7 +1024,7 @@ def onsetup_pytest_bin(unit, *args):
def onrun(unit, *args):
exectest_cmd = unit.get(["EXECTEST_COMMAND_VALUE"]) or ''
- exectest_cmd += "\n" + subprocess.list2cmdline(args)
+ exectest_cmd += "\n" + subprocess.list2cmdline(args)
unit.set(["EXECTEST_COMMAND_VALUE", exectest_cmd])
diff --git a/build/rules/maps/maps.policy b/build/rules/maps/maps.policy
index 8abf3fbbd7..ce707f72e1 100644
--- a/build/rules/maps/maps.policy
+++ b/build/rules/maps/maps.policy
@@ -29,11 +29,11 @@ ALLOW netsys/tiles-vcdiff/gen-tiles -> maps/libs/deprecated/localeutils
# Use maps/libs/geolib instead
ALLOW maps/streetview/backoffice/lib -> maps/libs/deprecated/coordtrans_pymod
-# Use std::chrono or util/datetime instead
-ALLOW maps/analyzer -> maps/libs/deprecated/boost_time
-ALLOW maps/routing -> maps/libs/deprecated/boost_time
-ALLOW maps/tools/naviguide/lib -> maps/libs/deprecated/boost_time
-
+# Use std::chrono or util/datetime instead
+ALLOW maps/analyzer -> maps/libs/deprecated/boost_time
+ALLOW maps/routing -> maps/libs/deprecated/boost_time
+ALLOW maps/tools/naviguide/lib -> maps/libs/deprecated/boost_time
+
# Stop spreading deprecated stuff
ALLOW maps/libs/deprecated -> maps/libs/deprecated
DENY .* -> maps/libs/deprecated
@@ -50,7 +50,7 @@ ALLOW .* -> maps/libs/http
ALLOW .* -> maps/libs/json
ALLOW .* -> maps/libs/nirvana
ALLOW .* -> maps/libs/local_postgres
-ALLOW .* -> maps/libs/locale
+ALLOW .* -> maps/libs/locale
ALLOW .* -> maps/libs/pgpool
ALLOW .* -> maps/libs/s3mds
ALLOW .* -> maps/libs/sql_chemistry
diff --git a/build/ymake.core.conf b/build/ymake.core.conf
index 081833998b..5f9639b9e7 100644
--- a/build/ymake.core.conf
+++ b/build/ymake.core.conf
@@ -5858,7 +5858,7 @@ macro _SRC("gztproto", SRC, SRCFLAGS...) {
# _PROTO__INCLUDE is before ARCADIA_ROOT in includes because in gazetteer we don't use builtins now and paths'canonization (resolving) depends on order of roots.
# descriptor.proto must be resolved as google/protobuf/descriptor.proto
.CMD=${tool:"dict/gazetteer/converter"} -I$PROTOBUF_PATH ${pre="-I":_PROTO__INCLUDE} -I$ARCADIA_ROOT ${SRCFLAGS} ${input:SRC} ${output;nopath;noext;norel:SRC.proto} ${kv;hide:"p GZ"} ${kv;hide:"pc yellow"}
- .PEERDIR=kernel/gazetteer/proto
+ .PEERDIR=kernel/gazetteer/proto
}
# tag:src-processing
@@ -6089,8 +6089,8 @@ otherwise {
# tag:src-processing
macro _SRC("po", SRC, SRCFLAGS...) {
.CMD=$YMAKE_PYTHON ${input:"contrib/tools/python/src/Tools/i18n/msgfmt.py"} -o $_MO_OUTPUT ${input:SRC}
-}
-
+}
+
# tag:ydl-specific
YDL_FLAGS= --force-color -I ${ARCADIA_ROOT}
YDL_DESC_FLAGS=
diff --git a/contrib/libs/crcutil/crc32c_sse4.cc b/contrib/libs/crcutil/crc32c_sse4.cc
index ed0f64410a..4ab7245dfb 100644
--- a/contrib/libs/crcutil/crc32c_sse4.cc
+++ b/contrib/libs/crcutil/crc32c_sse4.cc
@@ -18,8 +18,8 @@
#include "crc32c_sse4.h"
-#include <util/system/compiler.h>
-
+#include <util/system/compiler.h>
+
#if HAVE_I386 || HAVE_AMD64
namespace crcutil {
@@ -157,7 +157,7 @@ namespace crcutil {
no_more_##block_size##_##num_stripes:; \
} while (0)
-Y_NO_SANITIZE("undefined")
+Y_NO_SANITIZE("undefined")
size_t Crc32cSSE4::Crc32c(const void *data, size_t bytes, Crc crc0) const {
const uint8 *src = static_cast<const uint8 *>(data);
const uint8 *end = src + bytes;
diff --git a/contrib/libs/protobuf/src/google/protobuf/io/printer.cc b/contrib/libs/protobuf/src/google/protobuf/io/printer.cc
index 83ed7d1f69..07f7bbb63d 100644
--- a/contrib/libs/protobuf/src/google/protobuf/io/printer.cc
+++ b/contrib/libs/protobuf/src/google/protobuf/io/printer.cc
@@ -249,10 +249,10 @@ void Printer::CopyToBuffer(const char* data, int size) {
// Data exceeds space in the buffer. Copy what we can and request a
// new buffer.
if (buffer_size_ > 0) {
- memcpy(buffer_, data, buffer_size_);
- offset_ += buffer_size_;
- data += buffer_size_;
- size -= buffer_size_;
+ memcpy(buffer_, data, buffer_size_);
+ offset_ += buffer_size_;
+ data += buffer_size_;
+ size -= buffer_size_;
}
void* void_buffer;
failed_ = !output_->Next(&void_buffer, &buffer_size_);
diff --git a/contrib/libs/protobuf/src/google/protobuf/text_format.cc b/contrib/libs/protobuf/src/google/protobuf/text_format.cc
index 93a2ea8ed3..be6db2a6f9 100644
--- a/contrib/libs/protobuf/src/google/protobuf/text_format.cc
+++ b/contrib/libs/protobuf/src/google/protobuf/text_format.cc
@@ -1316,7 +1316,7 @@ class TextFormat::Printer::TextGenerator
Write(text + pos, size - pos);
} else {
Write(text, size);
- if (size > 0 && text[size - 1] == '\n') {
+ if (size > 0 && text[size - 1] == '\n') {
at_start_of_line_ = true;
}
}
diff --git a/contrib/libs/ya.make b/contrib/libs/ya.make
index 9c4640fdcf..99c9eaf8cf 100644
--- a/contrib/libs/ya.make
+++ b/contrib/libs/ya.make
@@ -171,7 +171,7 @@ RECURSE(
libosmium
libphonenumber
libpng
- libpq
+ libpq
libpqxx
libpsl
libraw
@@ -226,7 +226,7 @@ RECURSE(
minilzo
minizip
mlir11
- mms
+ mms
mongo-c-driver
mongo-cxx-driver
msgpack
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/contrib/anchordict.h b/contrib/libs/yaml-cpp/include/yaml-cpp/contrib/anchordict.h
index 78db9ec928..c84f892fae 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/contrib/anchordict.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/contrib/anchordict.h
@@ -12,13 +12,13 @@
#include "../anchor.h"
namespace YAML {
-/**
- * An object that stores and retrieves values correlating to {@link anchor_t}
- * values.
- *
- * <p>Efficient implementation that can make assumptions about how
- * {@code anchor_t} values are assigned by the {@link Parser} class.
- */
+/**
+ * An object that stores and retrieves values correlating to {@link anchor_t}
+ * values.
+ *
+ * <p>Efficient implementation that can make assumptions about how
+ * {@code anchor_t} values are assigned by the {@link Parser} class.
+ */
template <class T>
class AnchorDict {
public:
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h b/contrib/libs/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h
index f0a38f2887..f4af6448cc 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h
@@ -19,8 +19,8 @@ class Parser;
// functions.
class GraphBuilderInterface {
public:
- virtual ~GraphBuilderInterface() = 0;
-
+ virtual ~GraphBuilderInterface() = 0;
+
// Create and return a new node with a null value.
virtual void *NewNull(const Mark &mark, void *pParentNode) = 0;
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/dll.h b/contrib/libs/yaml-cpp/include/yaml-cpp/dll.h
index a32c06b2e3..41e41ace8e 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/dll.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/dll.h
@@ -8,12 +8,12 @@
#endif
// The following ifdef block is the standard way of creating macros which make
-// exporting from a DLL simpler. All files within this DLL are compiled with the
-// yaml_cpp_EXPORTS symbol defined on the command line. This symbol should not
-// be defined on any project that uses this DLL. This way any other project
-// whose source files include this file see YAML_CPP_API functions as being
-// imported from a DLL, whereas this DLL sees symbols defined with this macro as
-// being exported.
+// exporting from a DLL simpler. All files within this DLL are compiled with the
+// yaml_cpp_EXPORTS symbol defined on the command line. This symbol should not
+// be defined on any project that uses this DLL. This way any other project
+// whose source files include this file see YAML_CPP_API functions as being
+// imported from a DLL, whereas this DLL sees symbols defined with this macro as
+// being exported.
#undef YAML_CPP_API
#ifdef YAML_CPP_DLL // Using or Building YAML-CPP DLL (definition defined
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/emitter.h b/contrib/libs/yaml-cpp/include/yaml-cpp/emitter.h
index ef92cc4035..ca461ca8e9 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/emitter.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/emitter.h
@@ -122,7 +122,7 @@ class YAML_CPP_API Emitter : private noncopyable {
bool CanEmitNewline() const;
private:
- std::unique_ptr<EmitterState> m_pState;
+ std::unique_ptr<EmitterState> m_pState;
ostream_wrapper m_stream;
};
@@ -162,12 +162,12 @@ inline Emitter& Emitter::WriteStreamable(T value) {
template <>
inline void Emitter::SetStreamablePrecision<float>(std::stringstream& stream) {
- stream.precision(static_cast<std::streamsize>(GetFloatPrecision()));
+ stream.precision(static_cast<std::streamsize>(GetFloatPrecision()));
}
template <>
inline void Emitter::SetStreamablePrecision<double>(std::stringstream& stream) {
- stream.precision(static_cast<std::streamsize>(GetDoublePrecision()));
+ stream.precision(static_cast<std::streamsize>(GetDoublePrecision()));
}
// overloads of insertion
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/exceptions.h b/contrib/libs/yaml-cpp/include/yaml-cpp/exceptions.h
index 9c96859b2c..261f7e303d 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/exceptions.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/exceptions.h
@@ -9,18 +9,18 @@
#include "yaml-cpp/mark.h"
#include "yaml-cpp/traits.h"
-#include <sstream>
+#include <sstream>
#include <stdexcept>
#include <string>
-// This is here for compatibility with older versions of Visual Studio
-// which don't support noexcept
-#ifdef _MSC_VER
- #define YAML_CPP_NOEXCEPT _NOEXCEPT
-#else
- #define YAML_CPP_NOEXCEPT noexcept
-#endif
-
+// This is here for compatibility with older versions of Visual Studio
+// which don't support noexcept
+#ifdef _MSC_VER
+ #define YAML_CPP_NOEXCEPT _NOEXCEPT
+#else
+ #define YAML_CPP_NOEXCEPT noexcept
+#endif
+
namespace YAML {
// error messages
namespace ErrorMsg {
@@ -97,7 +97,7 @@ const char* const BAD_FILE = "bad file";
template <typename T>
inline const std::string KEY_NOT_FOUND_WITH_KEY(
- const T&, typename disable_if<is_numeric<T>>::type* = 0) {
+ const T&, typename disable_if<is_numeric<T>>::type* = 0) {
return KEY_NOT_FOUND;
}
@@ -109,21 +109,21 @@ inline const std::string KEY_NOT_FOUND_WITH_KEY(const std::string& key) {
template <typename T>
inline const std::string KEY_NOT_FOUND_WITH_KEY(
- const T& key, typename enable_if<is_numeric<T>>::type* = 0) {
+ const T& key, typename enable_if<is_numeric<T>>::type* = 0) {
std::stringstream stream;
stream << KEY_NOT_FOUND << ": " << key;
return stream.str();
}
}
-class YAML_CPP_API Exception : public std::runtime_error {
+class YAML_CPP_API Exception : public std::runtime_error {
public:
Exception(const Mark& mark_, const std::string& msg_)
: std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {}
- virtual ~Exception() YAML_CPP_NOEXCEPT;
-
- Exception(const Exception&) = default;
+ virtual ~Exception() YAML_CPP_NOEXCEPT;
+ Exception(const Exception&) = default;
+
Mark mark;
std::string msg;
@@ -141,47 +141,47 @@ class YAML_CPP_API Exception : public std::runtime_error {
}
};
-class YAML_CPP_API ParserException : public Exception {
+class YAML_CPP_API ParserException : public Exception {
public:
ParserException(const Mark& mark_, const std::string& msg_)
: Exception(mark_, msg_) {}
- ParserException(const ParserException&) = default;
- virtual ~ParserException() YAML_CPP_NOEXCEPT;
+ ParserException(const ParserException&) = default;
+ virtual ~ParserException() YAML_CPP_NOEXCEPT;
};
-class YAML_CPP_API RepresentationException : public Exception {
+class YAML_CPP_API RepresentationException : public Exception {
public:
RepresentationException(const Mark& mark_, const std::string& msg_)
: Exception(mark_, msg_) {}
- RepresentationException(const RepresentationException&) = default;
- virtual ~RepresentationException() YAML_CPP_NOEXCEPT;
+ RepresentationException(const RepresentationException&) = default;
+ virtual ~RepresentationException() YAML_CPP_NOEXCEPT;
};
// representation exceptions
-class YAML_CPP_API InvalidScalar : public RepresentationException {
+class YAML_CPP_API InvalidScalar : public RepresentationException {
public:
InvalidScalar(const Mark& mark_)
: RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {}
- InvalidScalar(const InvalidScalar&) = default;
- virtual ~InvalidScalar() YAML_CPP_NOEXCEPT;
+ InvalidScalar(const InvalidScalar&) = default;
+ virtual ~InvalidScalar() YAML_CPP_NOEXCEPT;
};
-class YAML_CPP_API KeyNotFound : public RepresentationException {
+class YAML_CPP_API KeyNotFound : public RepresentationException {
public:
template <typename T>
KeyNotFound(const Mark& mark_, const T& key_)
: RepresentationException(mark_, ErrorMsg::KEY_NOT_FOUND_WITH_KEY(key_)) {
}
- KeyNotFound(const KeyNotFound&) = default;
- virtual ~KeyNotFound() YAML_CPP_NOEXCEPT;
+ KeyNotFound(const KeyNotFound&) = default;
+ virtual ~KeyNotFound() YAML_CPP_NOEXCEPT;
};
template <typename T>
-class YAML_CPP_API TypedKeyNotFound : public KeyNotFound {
+class YAML_CPP_API TypedKeyNotFound : public KeyNotFound {
public:
TypedKeyNotFound(const Mark& mark_, const T& key_)
: KeyNotFound(mark_, key_), key(key_) {}
- virtual ~TypedKeyNotFound() YAML_CPP_NOEXCEPT {}
+ virtual ~TypedKeyNotFound() YAML_CPP_NOEXCEPT {}
T key;
};
@@ -192,20 +192,20 @@ inline TypedKeyNotFound<T> MakeTypedKeyNotFound(const Mark& mark,
return TypedKeyNotFound<T>(mark, key);
}
-class YAML_CPP_API InvalidNode : public RepresentationException {
+class YAML_CPP_API InvalidNode : public RepresentationException {
public:
InvalidNode()
: RepresentationException(Mark::null_mark(), ErrorMsg::INVALID_NODE) {}
- InvalidNode(const InvalidNode&) = default;
- virtual ~InvalidNode() YAML_CPP_NOEXCEPT;
+ InvalidNode(const InvalidNode&) = default;
+ virtual ~InvalidNode() YAML_CPP_NOEXCEPT;
};
-class YAML_CPP_API BadConversion : public RepresentationException {
+class YAML_CPP_API BadConversion : public RepresentationException {
public:
explicit BadConversion(const Mark& mark_)
: RepresentationException(mark_, ErrorMsg::BAD_CONVERSION) {}
- BadConversion(const BadConversion&) = default;
- virtual ~BadConversion() YAML_CPP_NOEXCEPT;
+ BadConversion(const BadConversion&) = default;
+ virtual ~BadConversion() YAML_CPP_NOEXCEPT;
};
template <typename T>
@@ -214,54 +214,54 @@ class TypedBadConversion : public BadConversion {
explicit TypedBadConversion(const Mark& mark_) : BadConversion(mark_) {}
};
-class YAML_CPP_API BadDereference : public RepresentationException {
+class YAML_CPP_API BadDereference : public RepresentationException {
public:
BadDereference()
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_DEREFERENCE) {}
- BadDereference(const BadDereference&) = default;
- virtual ~BadDereference() YAML_CPP_NOEXCEPT;
+ BadDereference(const BadDereference&) = default;
+ virtual ~BadDereference() YAML_CPP_NOEXCEPT;
};
-class YAML_CPP_API BadSubscript : public RepresentationException {
+class YAML_CPP_API BadSubscript : public RepresentationException {
public:
BadSubscript()
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_SUBSCRIPT) {}
- BadSubscript(const BadSubscript&) = default;
- virtual ~BadSubscript() YAML_CPP_NOEXCEPT;
+ BadSubscript(const BadSubscript&) = default;
+ virtual ~BadSubscript() YAML_CPP_NOEXCEPT;
};
-class YAML_CPP_API BadPushback : public RepresentationException {
+class YAML_CPP_API BadPushback : public RepresentationException {
public:
BadPushback()
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_PUSHBACK) {}
- BadPushback(const BadPushback&) = default;
- virtual ~BadPushback() YAML_CPP_NOEXCEPT;
+ BadPushback(const BadPushback&) = default;
+ virtual ~BadPushback() YAML_CPP_NOEXCEPT;
};
-class YAML_CPP_API BadInsert : public RepresentationException {
+class YAML_CPP_API BadInsert : public RepresentationException {
public:
BadInsert()
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_INSERT) {}
- BadInsert(const BadInsert&) = default;
- virtual ~BadInsert() YAML_CPP_NOEXCEPT;
+ BadInsert(const BadInsert&) = default;
+ virtual ~BadInsert() YAML_CPP_NOEXCEPT;
};
-class YAML_CPP_API EmitterException : public Exception {
+class YAML_CPP_API EmitterException : public Exception {
public:
EmitterException(const std::string& msg_)
: Exception(Mark::null_mark(), msg_) {}
- EmitterException(const EmitterException&) = default;
- virtual ~EmitterException() YAML_CPP_NOEXCEPT;
+ EmitterException(const EmitterException&) = default;
+ virtual ~EmitterException() YAML_CPP_NOEXCEPT;
};
-class YAML_CPP_API BadFile : public Exception {
+class YAML_CPP_API BadFile : public Exception {
public:
BadFile() : Exception(Mark::null_mark(), ErrorMsg::BAD_FILE) {}
- BadFile(const BadFile&) = default;
- virtual ~BadFile() YAML_CPP_NOEXCEPT;
+ BadFile(const BadFile&) = default;
+ virtual ~BadFile() YAML_CPP_NOEXCEPT;
};
}
-#undef YAML_CPP_NOEXCEPT
-
+#undef YAML_CPP_NOEXCEPT
+
#endif // EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/node/convert.h b/contrib/libs/yaml-cpp/include/yaml-cpp/node/convert.h
index 45a878ab0c..6434968f51 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/node/convert.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/node/convert.h
@@ -7,7 +7,7 @@
#pragma once
#endif
-#include <array>
+#include <array>
#include <limits>
#include <list>
#include <map>
@@ -163,7 +163,7 @@ struct convert<bool> {
// std::map
template <typename K, typename V>
-struct convert<std::map<K, V>> {
+struct convert<std::map<K, V>> {
static Node encode(const std::map<K, V>& rhs) {
Node node(NodeType::Map);
for (typename std::map<K, V>::const_iterator it = rhs.begin();
@@ -190,7 +190,7 @@ struct convert<std::map<K, V>> {
// std::vector
template <typename T>
-struct convert<std::vector<T>> {
+struct convert<std::vector<T>> {
static Node encode(const std::vector<T>& rhs) {
Node node(NodeType::Sequence);
for (typename std::vector<T>::const_iterator it = rhs.begin();
@@ -217,7 +217,7 @@ struct convert<std::vector<T>> {
// std::list
template <typename T>
-struct convert<std::list<T>> {
+struct convert<std::list<T>> {
static Node encode(const std::list<T>& rhs) {
Node node(NodeType::Sequence);
for (typename std::list<T>::const_iterator it = rhs.begin();
@@ -242,42 +242,42 @@ struct convert<std::list<T>> {
}
};
-// std::array
-template <typename T, std::size_t N>
-struct convert<std::array<T, N>> {
- static Node encode(const std::array<T, N>& rhs) {
- Node node(NodeType::Sequence);
- for (const auto& element : rhs) {
- node.push_back(element);
- }
- return node;
- }
-
- static bool decode(const Node& node, std::array<T, N>& rhs) {
- if (!isNodeValid(node)) {
- return false;
- }
-
- for (auto i = 0u; i < node.size(); ++i) {
-#if defined(__GNUC__) && __GNUC__ < 4
- // workaround for GCC 3:
- rhs[i] = node[i].template as<T>();
-#else
- rhs[i] = node[i].as<T>();
-#endif
- }
- return true;
- }
-
- private:
- static bool isNodeValid(const Node& node) {
- return node.IsSequence() && node.size() == N;
- }
-};
-
+// std::array
+template <typename T, std::size_t N>
+struct convert<std::array<T, N>> {
+ static Node encode(const std::array<T, N>& rhs) {
+ Node node(NodeType::Sequence);
+ for (const auto& element : rhs) {
+ node.push_back(element);
+ }
+ return node;
+ }
+
+ static bool decode(const Node& node, std::array<T, N>& rhs) {
+ if (!isNodeValid(node)) {
+ return false;
+ }
+
+ for (auto i = 0u; i < node.size(); ++i) {
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs[i] = node[i].template as<T>();
+#else
+ rhs[i] = node[i].as<T>();
+#endif
+ }
+ return true;
+ }
+
+ private:
+ static bool isNodeValid(const Node& node) {
+ return node.IsSequence() && node.size() == N;
+ }
+};
+
// std::pair
template <typename T, typename U>
-struct convert<std::pair<T, U>> {
+struct convert<std::pair<T, U>> {
static Node encode(const std::pair<T, U>& rhs) {
Node node(NodeType::Sequence);
node.push_back(rhs.first);
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/impl.h b/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/impl.h
index 09e55f838c..c730c5ca83 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/impl.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/impl.h
@@ -9,7 +9,7 @@
#include "yaml-cpp/node/detail/node.h"
#include "yaml-cpp/node/detail/node_data.h"
-#include <type_traits>
+#include <type_traits>
namespace YAML {
namespace detail {
@@ -22,9 +22,9 @@ struct get_idx {
};
template <typename Key>
-struct get_idx<Key,
- typename std::enable_if<std::is_unsigned<Key>::value &&
- !std::is_same<Key, bool>::value>::type> {
+struct get_idx<Key,
+ typename std::enable_if<std::is_unsigned<Key>::value &&
+ !std::is_same<Key, bool>::value>::type> {
static node* get(const std::vector<node*>& sequence, const Key& key,
shared_memory_holder /* pMemory */) {
return key < sequence.size() ? sequence[key] : 0;
@@ -32,7 +32,7 @@ struct get_idx<Key,
static node* get(std::vector<node*>& sequence, const Key& key,
shared_memory_holder pMemory) {
- if (key > sequence.size() || (key > 0 && !sequence[key-1]->is_defined()))
+ if (key > sequence.size() || (key > 0 && !sequence[key-1]->is_defined()))
return 0;
if (key == sequence.size())
sequence.push_back(&pMemory->create_node());
@@ -41,7 +41,7 @@ struct get_idx<Key,
};
template <typename Key>
-struct get_idx<Key, typename std::enable_if<std::is_signed<Key>::value>::type> {
+struct get_idx<Key, typename std::enable_if<std::is_signed<Key>::value>::type> {
static node* get(const std::vector<node*>& sequence, const Key& key,
shared_memory_holder pMemory) {
return key >= 0 ? get_idx<std::size_t>::get(
@@ -132,14 +132,14 @@ inline bool node_data::remove(const Key& key, shared_memory_holder pMemory) {
if (m_type != NodeType::Map)
return false;
- for (kv_pairs::iterator it = m_undefinedPairs.begin();
- it != m_undefinedPairs.end();) {
- kv_pairs::iterator jt = std::next(it);
- if (it->first->equals(key, pMemory))
- m_undefinedPairs.erase(it);
- it = jt;
- }
-
+ for (kv_pairs::iterator it = m_undefinedPairs.begin();
+ it != m_undefinedPairs.end();) {
+ kv_pairs::iterator jt = std::next(it);
+ if (it->first->equals(key, pMemory))
+ m_undefinedPairs.erase(it);
+ it = jt;
+ }
+
for (node_map::iterator it = m_map.begin(); it != m_map.end(); ++it) {
if (it->first->equals(key, pMemory)) {
m_map.erase(it);
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/iterator.h b/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/iterator.h
index deec8fb62c..1df7116cc9 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/iterator.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/iterator.h
@@ -8,71 +8,71 @@
#endif
#include "yaml-cpp/dll.h"
-#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/node.h"
#include "yaml-cpp/node/ptr.h"
#include "yaml-cpp/node/detail/node_iterator.h"
-#include <cstddef>
-#include <iterator>
+#include <cstddef>
+#include <iterator>
namespace YAML {
namespace detail {
struct iterator_value;
template <typename V>
-class iterator_base : public std::iterator<std::forward_iterator_tag, V,
- std::ptrdiff_t, V*, V> {
-
+class iterator_base : public std::iterator<std::forward_iterator_tag, V,
+ std::ptrdiff_t, V*, V> {
+
private:
template <typename>
friend class iterator_base;
struct enabler {};
- typedef node_iterator base_type;
-
- struct proxy {
- explicit proxy(const V& x) : m_ref(x) {}
- V* operator->() { return std::addressof(m_ref); }
- operator V*() { return std::addressof(m_ref); }
-
- V m_ref;
- };
-
+ typedef node_iterator base_type;
+
+ struct proxy {
+ explicit proxy(const V& x) : m_ref(x) {}
+ V* operator->() { return std::addressof(m_ref); }
+ operator V*() { return std::addressof(m_ref); }
+
+ V m_ref;
+ };
+
public:
typedef typename iterator_base::value_type value_type;
public:
- iterator_base() : m_iterator(), m_pMemory() {}
+ iterator_base() : m_iterator(), m_pMemory() {}
explicit iterator_base(base_type rhs, shared_memory_holder pMemory)
- : m_iterator(rhs), m_pMemory(pMemory) {}
+ : m_iterator(rhs), m_pMemory(pMemory) {}
template <class W>
iterator_base(const iterator_base<W>& rhs,
- typename std::enable_if<std::is_convertible<W*, V*>::value,
- enabler>::type = enabler())
- : m_iterator(rhs.m_iterator), m_pMemory(rhs.m_pMemory) {}
-
- iterator_base<V>& operator++() {
- ++m_iterator;
- return *this;
- }
-
- iterator_base<V> operator++(int) {
- iterator_base<V> iterator_pre(*this);
- ++(*this);
- return iterator_pre;
- }
-
- template <typename W>
- bool operator==(const iterator_base<W>& rhs) const {
- return m_iterator == rhs.m_iterator;
- }
-
- template <typename W>
- bool operator!=(const iterator_base<W>& rhs) const {
- return m_iterator != rhs.m_iterator;
- }
-
- value_type operator*() const {
- const typename base_type::value_type& v = *m_iterator;
+ typename std::enable_if<std::is_convertible<W*, V*>::value,
+ enabler>::type = enabler())
+ : m_iterator(rhs.m_iterator), m_pMemory(rhs.m_pMemory) {}
+
+ iterator_base<V>& operator++() {
+ ++m_iterator;
+ return *this;
+ }
+
+ iterator_base<V> operator++(int) {
+ iterator_base<V> iterator_pre(*this);
+ ++(*this);
+ return iterator_pre;
+ }
+
+ template <typename W>
+ bool operator==(const iterator_base<W>& rhs) const {
+ return m_iterator == rhs.m_iterator;
+ }
+
+ template <typename W>
+ bool operator!=(const iterator_base<W>& rhs) const {
+ return m_iterator != rhs.m_iterator;
+ }
+
+ value_type operator*() const {
+ const typename base_type::value_type& v = *m_iterator;
if (v.pNode)
return value_type(Node(*v, m_pMemory));
if (v.first && v.second)
@@ -80,10 +80,10 @@ class iterator_base : public std::iterator<std::forward_iterator_tag, V,
return value_type();
}
- proxy operator->() const { return proxy(**this); }
-
+ proxy operator->() const { return proxy(**this); }
+
private:
- base_type m_iterator;
+ base_type m_iterator;
shared_memory_holder m_pMemory;
};
}
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node.h b/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node.h
index 8a776f62a9..a573991cfa 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node.h
@@ -16,11 +16,11 @@
namespace YAML {
namespace detail {
-class node {
+class node {
public:
node() : m_pRef(new node_ref) {}
- node(const node&) = delete;
- node& operator=(const node&) = delete;
+ node(const node&) = delete;
+ node& operator=(const node&) = delete;
bool is(const node& rhs) const { return m_pRef == rhs.m_pRef; }
const node_ref* ref() const { return m_pRef.get(); }
@@ -66,7 +66,7 @@ class node {
m_pRef->set_data(*rhs.m_pRef);
}
- void set_mark(const Mark& mark) { m_pRef->set_mark(mark); }
+ void set_mark(const Mark& mark) { m_pRef->set_mark(mark); }
void set_type(NodeType::value type) {
if (type != NodeType::Undefined)
@@ -106,9 +106,9 @@ class node {
node_iterator end() { return m_pRef->end(); }
// sequence
- void push_back(node& input, shared_memory_holder pMemory) {
- m_pRef->push_back(input, pMemory);
- input.add_dependency(*this);
+ void push_back(node& input, shared_memory_holder pMemory) {
+ m_pRef->push_back(input, pMemory);
+ input.add_dependency(*this);
}
void insert(node& key, node& value, shared_memory_holder pMemory) {
m_pRef->insert(key, value, pMemory);
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node_data.h b/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node_data.h
index 50bcd74352..bdbd58a7cd 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node_data.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node_data.h
@@ -27,11 +27,11 @@ class node;
namespace YAML {
namespace detail {
-class YAML_CPP_API node_data {
+class YAML_CPP_API node_data {
public:
node_data();
- node_data(const node_data&) = delete;
- node_data& operator=(const node_data&) = delete;
+ node_data(const node_data&) = delete;
+ node_data& operator=(const node_data&) = delete;
void mark_defined();
void set_mark(const Mark& mark);
@@ -114,7 +114,7 @@ class YAML_CPP_API node_data {
mutable std::size_t m_seqSize;
// map
- typedef std::vector<std::pair<node*, node*>> node_map;
+ typedef std::vector<std::pair<node*, node*>> node_map;
node_map m_map;
typedef std::pair<node*, node*> kv_pair;
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h b/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h
index 088090fe74..5b94ae6c7b 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h
@@ -9,9 +9,9 @@
#include "yaml-cpp/dll.h"
#include "yaml-cpp/node/ptr.h"
-#include <cstddef>
-#include <iterator>
-#include <memory>
+#include <cstddef>
+#include <iterator>
+#include <memory>
#include <map>
#include <utility>
#include <vector>
@@ -19,7 +19,7 @@
namespace YAML {
namespace detail {
struct iterator_type {
- enum value { NoneType, Sequence, Map };
+ enum value { NoneType, Sequence, Map };
};
template <typename V>
@@ -37,7 +37,7 @@ struct node_iterator_value : public std::pair<V*, V*> {
};
typedef std::vector<node*> node_seq;
-typedef std::vector<std::pair<node*, node*>> node_map;
+typedef std::vector<std::pair<node*, node*>> node_map;
template <typename V>
struct node_iterator_type {
@@ -53,27 +53,27 @@ struct node_iterator_type<const V> {
template <typename V>
class node_iterator_base
- : public std::iterator<std::forward_iterator_tag, node_iterator_value<V>,
- std::ptrdiff_t, node_iterator_value<V>*,
- node_iterator_value<V>> {
+ : public std::iterator<std::forward_iterator_tag, node_iterator_value<V>,
+ std::ptrdiff_t, node_iterator_value<V>*,
+ node_iterator_value<V>> {
private:
struct enabler {};
- struct proxy {
- explicit proxy(const node_iterator_value<V>& x) : m_ref(x) {}
- node_iterator_value<V>* operator->() { return std::addressof(m_ref); }
- operator node_iterator_value<V>*() { return std::addressof(m_ref); }
-
- node_iterator_value<V> m_ref;
- };
-
+ struct proxy {
+ explicit proxy(const node_iterator_value<V>& x) : m_ref(x) {}
+ node_iterator_value<V>* operator->() { return std::addressof(m_ref); }
+ operator node_iterator_value<V>*() { return std::addressof(m_ref); }
+
+ node_iterator_value<V> m_ref;
+ };
+
public:
typedef typename node_iterator_type<V>::seq SeqIter;
typedef typename node_iterator_type<V>::map MapIter;
typedef node_iterator_value<V> value_type;
node_iterator_base()
- : m_type(iterator_type::NoneType), m_seqIt(), m_mapIt(), m_mapEnd() {}
+ : m_type(iterator_type::NoneType), m_seqIt(), m_mapIt(), m_mapEnd() {}
explicit node_iterator_base(SeqIter seqIt)
: m_type(iterator_type::Sequence),
m_seqIt(seqIt),
@@ -89,8 +89,8 @@ class node_iterator_base
template <typename W>
node_iterator_base(const node_iterator_base<W>& rhs,
- typename std::enable_if<std::is_convertible<W*, V*>::value,
- enabler>::type = enabler())
+ typename std::enable_if<std::is_convertible<W*, V*>::value,
+ enabler>::type = enabler())
: m_type(rhs.m_type),
m_seqIt(rhs.m_seqIt),
m_mapIt(rhs.m_mapIt),
@@ -100,12 +100,12 @@ class node_iterator_base
friend class node_iterator_base;
template <typename W>
- bool operator==(const node_iterator_base<W>& rhs) const {
+ bool operator==(const node_iterator_base<W>& rhs) const {
if (m_type != rhs.m_type)
return false;
switch (m_type) {
- case iterator_type::NoneType:
+ case iterator_type::NoneType:
return true;
case iterator_type::Sequence:
return m_seqIt == rhs.m_seqIt;
@@ -115,14 +115,14 @@ class node_iterator_base
return true;
}
- template <typename W>
- bool operator!=(const node_iterator_base<W>& rhs) const {
- return !(*this == rhs);
- }
-
- node_iterator_base<V>& operator++() {
+ template <typename W>
+ bool operator!=(const node_iterator_base<W>& rhs) const {
+ return !(*this == rhs);
+ }
+
+ node_iterator_base<V>& operator++() {
switch (m_type) {
- case iterator_type::NoneType:
+ case iterator_type::NoneType:
break;
case iterator_type::Sequence:
++m_seqIt;
@@ -132,18 +132,18 @@ class node_iterator_base
m_mapIt = increment_until_defined(m_mapIt);
break;
}
- return *this;
- }
-
- node_iterator_base<V> operator++(int) {
- node_iterator_base<V> iterator_pre(*this);
- ++(*this);
- return iterator_pre;
+ return *this;
}
- value_type operator*() const {
+ node_iterator_base<V> operator++(int) {
+ node_iterator_base<V> iterator_pre(*this);
+ ++(*this);
+ return iterator_pre;
+ }
+
+ value_type operator*() const {
switch (m_type) {
- case iterator_type::NoneType:
+ case iterator_type::NoneType:
return value_type();
case iterator_type::Sequence:
return value_type(**m_seqIt);
@@ -153,8 +153,8 @@ class node_iterator_base
return value_type();
}
- proxy operator->() const { return proxy(**this); }
-
+ proxy operator->() const { return proxy(**this); }
+
MapIter increment_until_defined(MapIter it) {
while (it != m_mapEnd && !is_defined(it))
++it;
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h b/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h
index d8a94f8b80..a54e5e1129 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h
@@ -14,11 +14,11 @@
namespace YAML {
namespace detail {
-class node_ref {
+class node_ref {
public:
node_ref() : m_pData(new node_data) {}
- node_ref(const node_ref&) = delete;
- node_ref& operator=(const node_ref&) = delete;
+ node_ref(const node_ref&) = delete;
+ node_ref& operator=(const node_ref&) = delete;
bool is_defined() const { return m_pData->is_defined(); }
const Mark& mark() const { return m_pData->mark(); }
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/node/emit.h b/contrib/libs/yaml-cpp/include/yaml-cpp/node/emit.h
index 032268c5d0..d344da9759 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/node/emit.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/node/emit.h
@@ -16,17 +16,17 @@ namespace YAML {
class Emitter;
class Node;
-/**
- * Emits the node to the given {@link Emitter}. If there is an error in writing,
- * {@link Emitter#good} will return false.
- */
+/**
+ * Emits the node to the given {@link Emitter}. If there is an error in writing,
+ * {@link Emitter#good} will return false.
+ */
YAML_CPP_API Emitter& operator<<(Emitter& out, const Node& node);
-
-/** Emits the node to the given output stream. */
+
+/** Emits the node to the given output stream. */
YAML_CPP_API std::ostream& operator<<(std::ostream& out, const Node& node);
-/** Converts the node to a YAML string. */
+/** Converts the node to a YAML string. */
YAML_CPP_API std::string Dump(const Node& node);
-} // namespace YAML
+} // namespace YAML
#endif // NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/node/impl.h b/contrib/libs/yaml-cpp/include/yaml-cpp/node/impl.h
index 20c487a687..e73fb44d5f 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/node/impl.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/node/impl.h
@@ -103,7 +103,7 @@ struct as_if<std::string, S> {
explicit as_if(const Node& node_) : node(node_) {}
const Node& node;
- std::string operator()(const S& fallback) const {
+ std::string operator()(const S& fallback) const {
if (node.Type() != NodeType::Scalar)
return fallback;
return node.Scalar();
@@ -115,7 +115,7 @@ struct as_if<T, void> {
explicit as_if(const Node& node_) : node(node_) {}
const Node& node;
- T operator()() const {
+ T operator()() const {
if (!node.m_pNode)
throw TypedBadConversion<T>(node.Mark());
@@ -131,7 +131,7 @@ struct as_if<std::string, void> {
explicit as_if(const Node& node_) : node(node_) {}
const Node& node;
- std::string operator()() const {
+ std::string operator()() const {
if (node.Type() != NodeType::Scalar)
throw TypedBadConversion<std::string>(node.Mark());
return node.Scalar();
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/node/node.h b/contrib/libs/yaml-cpp/include/yaml-cpp/node/node.h
index 1ded7d27b7..0f52f0896b 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/node/node.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/node/node.h
@@ -58,7 +58,7 @@ class YAML_CPP_API Node {
bool IsMap() const { return Type() == NodeType::Map; }
// bool conversions
- YAML_CPP_OPERATOR_BOOL()
+ YAML_CPP_OPERATOR_BOOL()
bool operator!() const { return !IsDefined(); }
// access
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/node/parse.h b/contrib/libs/yaml-cpp/include/yaml-cpp/node/parse.h
index 7745fd7245..6984c0f05d 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/node/parse.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/node/parse.h
@@ -16,63 +16,63 @@
namespace YAML {
class Node;
-/**
- * Loads the input string as a single YAML document.
- *
- * @throws {@link ParserException} if it is malformed.
- */
+/**
+ * Loads the input string as a single YAML document.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
YAML_CPP_API Node Load(const std::string& input);
-
-/**
- * Loads the input string as a single YAML document.
- *
- * @throws {@link ParserException} if it is malformed.
- */
+
+/**
+ * Loads the input string as a single YAML document.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
YAML_CPP_API Node Load(const char* input);
-
-/**
- * Loads the input stream as a single YAML document.
- *
- * @throws {@link ParserException} if it is malformed.
- */
+
+/**
+ * Loads the input stream as a single YAML document.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
YAML_CPP_API Node Load(std::istream& input);
-
-/**
- * Loads the input file as a single YAML document.
- *
- * @throws {@link ParserException} if it is malformed.
- * @throws {@link BadFile} if the file cannot be loaded.
- */
+
+/**
+ * Loads the input file as a single YAML document.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ * @throws {@link BadFile} if the file cannot be loaded.
+ */
YAML_CPP_API Node LoadFile(const std::string& filename);
-/**
- * Loads the input string as a list of YAML documents.
- *
- * @throws {@link ParserException} if it is malformed.
- */
+/**
+ * Loads the input string as a list of YAML documents.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
YAML_CPP_API std::vector<Node> LoadAll(const std::string& input);
-
-/**
- * Loads the input string as a list of YAML documents.
- *
- * @throws {@link ParserException} if it is malformed.
- */
+
+/**
+ * Loads the input string as a list of YAML documents.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
YAML_CPP_API std::vector<Node> LoadAll(const char* input);
-
-/**
- * Loads the input stream as a list of YAML documents.
- *
- * @throws {@link ParserException} if it is malformed.
- */
+
+/**
+ * Loads the input stream as a list of YAML documents.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
YAML_CPP_API std::vector<Node> LoadAll(std::istream& input);
-
-/**
- * Loads the input file as a list of YAML documents.
- *
- * @throws {@link ParserException} if it is malformed.
- * @throws {@link BadFile} if the file cannot be loaded.
- */
+
+/**
+ * Loads the input file as a list of YAML documents.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ * @throws {@link BadFile} if the file cannot be loaded.
+ */
YAML_CPP_API std::vector<Node> LoadAllFromFile(const std::string& filename);
-} // namespace YAML
+} // namespace YAML
#endif // VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/node/ptr.h b/contrib/libs/yaml-cpp/include/yaml-cpp/node/ptr.h
index ce085dd5cd..5fbed4be9d 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/node/ptr.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/node/ptr.h
@@ -8,7 +8,7 @@
#endif
#include "yaml-cpp/dll.h"
-#include <memory>
+#include <memory>
namespace YAML {
namespace detail {
@@ -18,11 +18,11 @@ class node_data;
class memory;
class memory_holder;
-typedef std::shared_ptr<node> shared_node;
-typedef std::shared_ptr<node_ref> shared_node_ref;
-typedef std::shared_ptr<node_data> shared_node_data;
-typedef std::shared_ptr<memory_holder> shared_memory_holder;
-typedef std::shared_ptr<memory> shared_memory;
+typedef std::shared_ptr<node> shared_node;
+typedef std::shared_ptr<node_ref> shared_node_ref;
+typedef std::shared_ptr<node_data> shared_node_data;
+typedef std::shared_ptr<memory_holder> shared_memory_holder;
+typedef std::shared_ptr<memory> shared_memory;
}
}
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/null.h b/contrib/libs/yaml-cpp/include/yaml-cpp/null.h
index b9521d488a..ecfe1524bd 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/null.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/null.h
@@ -8,7 +8,7 @@
#endif
#include "yaml-cpp/dll.h"
-#include <string>
+#include <string>
namespace YAML {
class Node;
@@ -18,7 +18,7 @@ inline bool operator==(const _Null&, const _Null&) { return true; }
inline bool operator!=(const _Null&, const _Null&) { return false; }
YAML_CPP_API bool IsNull(const Node& node); // old API only
-YAML_CPP_API bool IsNullString(const std::string& str);
+YAML_CPP_API bool IsNullString(const std::string& str);
extern YAML_CPP_API _Null Null;
}
diff --git a/contrib/libs/yaml-cpp/include/yaml-cpp/parser.h b/contrib/libs/yaml-cpp/include/yaml-cpp/parser.h
index ceac22d026..2f71a03b1f 100644
--- a/contrib/libs/yaml-cpp/include/yaml-cpp/parser.h
+++ b/contrib/libs/yaml-cpp/include/yaml-cpp/parser.h
@@ -20,66 +20,66 @@ class Scanner;
struct Directives;
struct Token;
-/**
- * A parser turns a stream of bytes into one stream of "events" per YAML
- * document in the input stream.
- */
+/**
+ * A parser turns a stream of bytes into one stream of "events" per YAML
+ * document in the input stream.
+ */
class YAML_CPP_API Parser : private noncopyable {
public:
- /** Constructs an empty parser (with no input. */
+ /** Constructs an empty parser (with no input. */
Parser();
-
- /**
- * Constructs a parser from the given input stream. The input stream must
- * live as long as the parser.
- */
- explicit Parser(std::istream& in);
-
+
+ /**
+ * Constructs a parser from the given input stream. The input stream must
+ * live as long as the parser.
+ */
+ explicit Parser(std::istream& in);
+
~Parser();
- /** Evaluates to true if the parser has some valid input to be read. */
- explicit operator bool() const;
+ /** Evaluates to true if the parser has some valid input to be read. */
+ explicit operator bool() const;
- /**
- * Resets the parser with the given input stream. Any existing state is
- * erased.
- */
+ /**
+ * Resets the parser with the given input stream. Any existing state is
+ * erased.
+ */
void Load(std::istream& in);
-
- /**
- * Handles the next document by calling events on the {@code eventHandler}.
- *
- * @throw a ParserException on error.
- * @return false if there are no more documents
- */
+
+ /**
+ * Handles the next document by calling events on the {@code eventHandler}.
+ *
+ * @throw a ParserException on error.
+ * @return false if there are no more documents
+ */
bool HandleNextDocument(EventHandler& eventHandler);
void PrintTokens(std::ostream& out);
private:
- /**
- * Reads any directives that are next in the queue, setting the internal
- * {@code m_pDirectives} state.
- */
+ /**
+ * Reads any directives that are next in the queue, setting the internal
+ * {@code m_pDirectives} state.
+ */
void ParseDirectives();
-
+
void HandleDirective(const Token& token);
-
- /**
- * Handles a "YAML" directive, which should be of the form 'major.minor' (like
- * a version number).
- */
+
+ /**
+ * Handles a "YAML" directive, which should be of the form 'major.minor' (like
+ * a version number).
+ */
void HandleYamlDirective(const Token& token);
-
- /**
- * Handles a "TAG" directive, which should be of the form 'handle prefix',
- * where 'handle' is converted to 'prefix' in the file.
- */
+
+ /**
+ * Handles a "TAG" directive, which should be of the form 'handle prefix',
+ * where 'handle' is converted to 'prefix' in the file.
+ */
void HandleTagDirective(const Token& token);
private:
- std::unique_ptr<Scanner> m_pScanner;
- std::unique_ptr<Directives> m_pDirectives;
+ std::unique_ptr<Scanner> m_pScanner;
+ std::unique_ptr<Directives> m_pDirectives;
};
}
diff --git a/contrib/libs/yaml-cpp/src/collectionstack.h b/contrib/libs/yaml-cpp/src/collectionstack.h
index 46c463ebce..23e1bd397a 100644
--- a/contrib/libs/yaml-cpp/src/collectionstack.h
+++ b/contrib/libs/yaml-cpp/src/collectionstack.h
@@ -27,7 +27,7 @@ class CollectionStack {
collectionStack.push(type);
}
void PopCollectionType(CollectionType::value type) {
- (void)type;
+ (void)type;
assert(type == GetCurCollectionType());
collectionStack.pop();
}
diff --git a/contrib/libs/yaml-cpp/src/emit.cpp b/contrib/libs/yaml-cpp/src/emit.cpp
index 51bc791533..4eac410986 100644
--- a/contrib/libs/yaml-cpp/src/emit.cpp
+++ b/contrib/libs/yaml-cpp/src/emit.cpp
@@ -22,4 +22,4 @@ std::string Dump(const Node& node) {
emitter << node;
return emitter.c_str();
}
-} // namespace YAML
+} // namespace YAML
diff --git a/contrib/libs/yaml-cpp/src/emitfromevents.cpp b/contrib/libs/yaml-cpp/src/emitfromevents.cpp
index 4832649f3c..3d72822bd5 100644
--- a/contrib/libs/yaml-cpp/src/emitfromevents.cpp
+++ b/contrib/libs/yaml-cpp/src/emitfromevents.cpp
@@ -111,7 +111,7 @@ void EmitFromEvents::BeginNode() {
}
void EmitFromEvents::EmitProps(const std::string& tag, anchor_t anchor) {
- if (!tag.empty() && tag != "?" && tag != "!")
+ if (!tag.empty() && tag != "?" && tag != "!")
m_emitter << VerbatimTag(tag);
if (anchor)
m_emitter << Anchor(ToString(anchor));
diff --git a/contrib/libs/yaml-cpp/src/emitterstate.cpp b/contrib/libs/yaml-cpp/src/emitterstate.cpp
index 3542aaf507..8b785e852b 100644
--- a/contrib/libs/yaml-cpp/src/emitterstate.cpp
+++ b/contrib/libs/yaml-cpp/src/emitterstate.cpp
@@ -53,31 +53,31 @@ void EmitterState::SetNonContent() { m_hasNonContent = true; }
void EmitterState::SetLongKey() {
assert(!m_groups.empty());
- if (m_groups.empty()) {
+ if (m_groups.empty()) {
return;
- }
+ }
- assert(m_groups.back()->type == GroupType::Map);
- m_groups.back()->longKey = true;
+ assert(m_groups.back()->type == GroupType::Map);
+ m_groups.back()->longKey = true;
}
void EmitterState::ForceFlow() {
assert(!m_groups.empty());
- if (m_groups.empty()) {
+ if (m_groups.empty()) {
return;
- }
+ }
- m_groups.back()->flowType = FlowType::Flow;
+ m_groups.back()->flowType = FlowType::Flow;
}
void EmitterState::StartedNode() {
if (m_groups.empty()) {
m_docCount++;
} else {
- m_groups.back()->childCount++;
- if (m_groups.back()->childCount % 2 == 0) {
- m_groups.back()->longKey = false;
- }
+ m_groups.back()->childCount++;
+ if (m_groups.back()->childCount % 2 == 0) {
+ m_groups.back()->longKey = false;
+ }
}
m_hasAnchor = false;
@@ -124,50 +124,50 @@ void EmitterState::StartedScalar() {
void EmitterState::StartedGroup(GroupType::value type) {
StartedNode();
- const std::size_t lastGroupIndent =
- (m_groups.empty() ? 0 : m_groups.back()->indent);
+ const std::size_t lastGroupIndent =
+ (m_groups.empty() ? 0 : m_groups.back()->indent);
m_curIndent += lastGroupIndent;
- // TODO: Create move constructors for settings types to simplify transfer
- std::unique_ptr<Group> pGroup(new Group(type));
+ // TODO: Create move constructors for settings types to simplify transfer
+ std::unique_ptr<Group> pGroup(new Group(type));
// transfer settings (which last until this group is done)
- //
- // NB: if pGroup->modifiedSettings == m_modifiedSettings,
- // m_modifiedSettings is not changed!
- pGroup->modifiedSettings = std::move(m_modifiedSettings);
+ //
+ // NB: if pGroup->modifiedSettings == m_modifiedSettings,
+ // m_modifiedSettings is not changed!
+ pGroup->modifiedSettings = std::move(m_modifiedSettings);
// set up group
- if (GetFlowType(type) == Block) {
+ if (GetFlowType(type) == Block) {
pGroup->flowType = FlowType::Block;
- } else {
+ } else {
pGroup->flowType = FlowType::Flow;
- }
+ }
pGroup->indent = GetIndent();
- m_groups.push_back(std::move(pGroup));
+ m_groups.push_back(std::move(pGroup));
}
void EmitterState::EndedGroup(GroupType::value type) {
if (m_groups.empty()) {
- if (type == GroupType::Seq) {
+ if (type == GroupType::Seq) {
return SetError(ErrorMsg::UNEXPECTED_END_SEQ);
- } else {
+ } else {
return SetError(ErrorMsg::UNEXPECTED_END_MAP);
- }
+ }
}
// get rid of the current group
{
- std::unique_ptr<Group> pFinishedGroup = std::move(m_groups.back());
- m_groups.pop_back();
- if (pFinishedGroup->type != type) {
+ std::unique_ptr<Group> pFinishedGroup = std::move(m_groups.back());
+ m_groups.pop_back();
+ if (pFinishedGroup->type != type) {
return SetError(ErrorMsg::UNMATCHED_GROUP_TAG);
- }
+ }
}
// reset old settings
- std::size_t lastIndent = (m_groups.empty() ? 0 : m_groups.back()->indent);
+ std::size_t lastIndent = (m_groups.empty() ? 0 : m_groups.back()->indent);
assert(m_curIndent >= lastIndent);
m_curIndent -= lastIndent;
@@ -179,39 +179,39 @@ void EmitterState::EndedGroup(GroupType::value type) {
}
EmitterNodeType::value EmitterState::CurGroupNodeType() const {
- if (m_groups.empty()) {
+ if (m_groups.empty()) {
return EmitterNodeType::NoType;
- }
+ }
- return m_groups.back()->NodeType();
+ return m_groups.back()->NodeType();
}
GroupType::value EmitterState::CurGroupType() const {
- return m_groups.empty() ? GroupType::NoType : m_groups.back()->type;
+ return m_groups.empty() ? GroupType::NoType : m_groups.back()->type;
}
FlowType::value EmitterState::CurGroupFlowType() const {
- return m_groups.empty() ? FlowType::NoType : m_groups.back()->flowType;
+ return m_groups.empty() ? FlowType::NoType : m_groups.back()->flowType;
}
-std::size_t EmitterState::CurGroupIndent() const {
- return m_groups.empty() ? 0 : m_groups.back()->indent;
+std::size_t EmitterState::CurGroupIndent() const {
+ return m_groups.empty() ? 0 : m_groups.back()->indent;
}
std::size_t EmitterState::CurGroupChildCount() const {
- return m_groups.empty() ? m_docCount : m_groups.back()->childCount;
+ return m_groups.empty() ? m_docCount : m_groups.back()->childCount;
}
bool EmitterState::CurGroupLongKey() const {
- return m_groups.empty() ? false : m_groups.back()->longKey;
+ return m_groups.empty() ? false : m_groups.back()->longKey;
}
-std::size_t EmitterState::LastIndent() const {
- if (m_groups.size() <= 1) {
+std::size_t EmitterState::LastIndent() const {
+ if (m_groups.size() <= 1) {
return 0;
- }
+ }
- return m_curIndent - m_groups[m_groups.size() - 2]->indent;
+ return m_curIndent - m_groups[m_groups.size() - 2]->indent;
}
void EmitterState::ClearModifiedSettings() { m_modifiedSettings.clear(); }
@@ -348,16 +348,16 @@ bool EmitterState::SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope) {
}
}
-bool EmitterState::SetFloatPrecision(std::size_t value, FmtScope::value scope) {
- if (value > std::numeric_limits<float>::digits10 + 1)
+bool EmitterState::SetFloatPrecision(std::size_t value, FmtScope::value scope) {
+ if (value > std::numeric_limits<float>::digits10 + 1)
return false;
_Set(m_floatPrecision, value, scope);
return true;
}
-bool EmitterState::SetDoublePrecision(std::size_t value,
- FmtScope::value scope) {
- if (value > std::numeric_limits<double>::digits10 + 1)
+bool EmitterState::SetDoublePrecision(std::size_t value,
+ FmtScope::value scope) {
+ if (value > std::numeric_limits<double>::digits10 + 1)
return false;
_Set(m_doublePrecision, value, scope);
return true;
diff --git a/contrib/libs/yaml-cpp/src/emitterstate.h b/contrib/libs/yaml-cpp/src/emitterstate.h
index 0937f000d9..a6f4ba7b8e 100644
--- a/contrib/libs/yaml-cpp/src/emitterstate.h
+++ b/contrib/libs/yaml-cpp/src/emitterstate.h
@@ -10,12 +10,12 @@
#include "setting.h"
#include "yaml-cpp/emitterdef.h"
#include "yaml-cpp/emittermanip.h"
-
+
#include <cassert>
-#include <memory>
+#include <memory>
#include <stack>
#include <stdexcept>
-#include <vector>
+#include <vector>
namespace YAML {
struct FmtScope {
@@ -58,12 +58,12 @@ class EmitterState {
GroupType::value CurGroupType() const;
FlowType::value CurGroupFlowType() const;
- std::size_t CurGroupIndent() const;
+ std::size_t CurGroupIndent() const;
std::size_t CurGroupChildCount() const;
bool CurGroupLongKey() const;
- std::size_t LastIndent() const;
- std::size_t CurIndent() const { return m_curIndent; }
+ std::size_t LastIndent() const;
+ std::size_t CurIndent() const { return m_curIndent; }
bool HasAnchor() const { return m_hasAnchor; }
bool HasTag() const { return m_hasTag; }
bool HasBegunNode() const {
@@ -95,12 +95,12 @@ class EmitterState {
EMITTER_MANIP GetIntFormat() const { return m_intFmt.get(); }
bool SetIndent(std::size_t value, FmtScope::value scope);
- std::size_t GetIndent() const { return m_indent.get(); }
+ std::size_t GetIndent() const { return m_indent.get(); }
bool SetPreCommentIndent(std::size_t value, FmtScope::value scope);
- std::size_t GetPreCommentIndent() const { return m_preCommentIndent.get(); }
+ std::size_t GetPreCommentIndent() const { return m_preCommentIndent.get(); }
bool SetPostCommentIndent(std::size_t value, FmtScope::value scope);
- std::size_t GetPostCommentIndent() const { return m_postCommentIndent.get(); }
+ std::size_t GetPostCommentIndent() const { return m_postCommentIndent.get(); }
bool SetFlowType(GroupType::value groupType, EMITTER_MANIP value,
FmtScope::value scope);
@@ -109,9 +109,9 @@ class EmitterState {
bool SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope);
EMITTER_MANIP GetMapKeyFormat() const { return m_mapKeyFmt.get(); }
- bool SetFloatPrecision(std::size_t value, FmtScope::value scope);
+ bool SetFloatPrecision(std::size_t value, FmtScope::value scope);
std::size_t GetFloatPrecision() const { return m_floatPrecision.get(); }
- bool SetDoublePrecision(std::size_t value, FmtScope::value scope);
+ bool SetDoublePrecision(std::size_t value, FmtScope::value scope);
std::size_t GetDoublePrecision() const { return m_doublePrecision.get(); }
private:
@@ -137,8 +137,8 @@ class EmitterState {
Setting<EMITTER_MANIP> m_seqFmt;
Setting<EMITTER_MANIP> m_mapFmt;
Setting<EMITTER_MANIP> m_mapKeyFmt;
- Setting<std::size_t> m_floatPrecision;
- Setting<std::size_t> m_doublePrecision;
+ Setting<std::size_t> m_floatPrecision;
+ Setting<std::size_t> m_doublePrecision;
SettingChanges m_modifiedSettings;
SettingChanges m_globalModifiedSettings;
@@ -149,7 +149,7 @@ class EmitterState {
GroupType::value type;
FlowType::value flowType;
- std::size_t indent;
+ std::size_t indent;
std::size_t childCount;
bool longKey;
@@ -174,7 +174,7 @@ class EmitterState {
}
};
- std::vector<std::unique_ptr<Group>> m_groups;
+ std::vector<std::unique_ptr<Group>> m_groups;
std::size_t m_curIndent;
bool m_hasAnchor;
bool m_hasTag;
diff --git a/contrib/libs/yaml-cpp/src/emitterutils.cpp b/contrib/libs/yaml-cpp/src/emitterutils.cpp
index 147738ad8a..cbb68e50fc 100644
--- a/contrib/libs/yaml-cpp/src/emitterutils.cpp
+++ b/contrib/libs/yaml-cpp/src/emitterutils.cpp
@@ -9,7 +9,7 @@
#include "stringsource.h"
#include "yaml-cpp/binary.h" // IWYU pragma: keep
#include "yaml-cpp/ostream_wrapper.h"
-#include "yaml-cpp/null.h"
+#include "yaml-cpp/null.h"
namespace YAML {
namespace Utils {
@@ -154,7 +154,7 @@ void WriteCodePoint(ostream_wrapper& out, int codePoint) {
bool IsValidPlainScalar(const std::string& str, FlowType::value flowType,
bool allowOnlyAscii) {
// check against null
- if (IsNullString(str)) {
+ if (IsNullString(str)) {
return false;
}
@@ -354,7 +354,7 @@ bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
}
bool WriteLiteralString(ostream_wrapper& out, const std::string& str,
- std::size_t indent) {
+ std::size_t indent) {
out << "|\n";
out << IndentTo(indent);
int codePoint;
@@ -380,8 +380,8 @@ bool WriteChar(ostream_wrapper& out, char ch) {
out << "\"\\n\"";
} else if (ch == '\b') {
out << "\"\\b\"";
- } else if (ch == '\\') {
- out << "\"\\\\\"";
+ } else if (ch == '\\') {
+ out << "\"\\\\\"";
} else if ((0x20 <= ch && ch <= 0x7e) || ch == ' ') {
out << "\"" << ch << "\"";
} else {
@@ -393,7 +393,7 @@ bool WriteChar(ostream_wrapper& out, char ch) {
}
bool WriteComment(ostream_wrapper& out, const std::string& str,
- std::size_t postCommentIndent) {
+ std::size_t postCommentIndent) {
const std::size_t curIndent = out.col();
out << "#" << Indentation(postCommentIndent);
out.set_comment();
diff --git a/contrib/libs/yaml-cpp/src/emitterutils.h b/contrib/libs/yaml-cpp/src/emitterutils.h
index 6cc7319147..04777e9299 100644
--- a/contrib/libs/yaml-cpp/src/emitterutils.h
+++ b/contrib/libs/yaml-cpp/src/emitterutils.h
@@ -34,10 +34,10 @@ bool WriteSingleQuotedString(ostream_wrapper& out, const std::string& str);
bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
bool escapeNonAscii);
bool WriteLiteralString(ostream_wrapper& out, const std::string& str,
- std::size_t indent);
+ std::size_t indent);
bool WriteChar(ostream_wrapper& out, char ch);
bool WriteComment(ostream_wrapper& out, const std::string& str,
- std::size_t postCommentIndent);
+ std::size_t postCommentIndent);
bool WriteAlias(ostream_wrapper& out, const std::string& str);
bool WriteAnchor(ostream_wrapper& out, const std::string& str);
bool WriteTag(ostream_wrapper& out, const std::string& str, bool verbatim);
diff --git a/contrib/libs/yaml-cpp/src/exceptions.cpp b/contrib/libs/yaml-cpp/src/exceptions.cpp
index 9b6d8912c1..50387db489 100644
--- a/contrib/libs/yaml-cpp/src/exceptions.cpp
+++ b/contrib/libs/yaml-cpp/src/exceptions.cpp
@@ -1,31 +1,31 @@
-#include "yaml-cpp/exceptions.h"
-
-// This is here for compatibility with older versions of Visual Studio
-// which don't support noexcept
-#ifdef _MSC_VER
- #define YAML_CPP_NOEXCEPT _NOEXCEPT
-#else
- #define YAML_CPP_NOEXCEPT noexcept
-#endif
-
-namespace YAML {
-
-// These destructors are defined out-of-line so the vtable is only emitted once.
-Exception::~Exception() YAML_CPP_NOEXCEPT {}
-ParserException::~ParserException() YAML_CPP_NOEXCEPT {}
-RepresentationException::~RepresentationException() YAML_CPP_NOEXCEPT {}
-InvalidScalar::~InvalidScalar() YAML_CPP_NOEXCEPT {}
-KeyNotFound::~KeyNotFound() YAML_CPP_NOEXCEPT {}
-InvalidNode::~InvalidNode() YAML_CPP_NOEXCEPT {}
-BadConversion::~BadConversion() YAML_CPP_NOEXCEPT {}
-BadDereference::~BadDereference() YAML_CPP_NOEXCEPT {}
-BadSubscript::~BadSubscript() YAML_CPP_NOEXCEPT {}
-BadPushback::~BadPushback() YAML_CPP_NOEXCEPT {}
-BadInsert::~BadInsert() YAML_CPP_NOEXCEPT {}
-EmitterException::~EmitterException() YAML_CPP_NOEXCEPT {}
-BadFile::~BadFile() YAML_CPP_NOEXCEPT {}
-}
-
-#undef YAML_CPP_NOEXCEPT
-
-
+#include "yaml-cpp/exceptions.h"
+
+// This is here for compatibility with older versions of Visual Studio
+// which don't support noexcept
+#ifdef _MSC_VER
+ #define YAML_CPP_NOEXCEPT _NOEXCEPT
+#else
+ #define YAML_CPP_NOEXCEPT noexcept
+#endif
+
+namespace YAML {
+
+// These destructors are defined out-of-line so the vtable is only emitted once.
+Exception::~Exception() YAML_CPP_NOEXCEPT {}
+ParserException::~ParserException() YAML_CPP_NOEXCEPT {}
+RepresentationException::~RepresentationException() YAML_CPP_NOEXCEPT {}
+InvalidScalar::~InvalidScalar() YAML_CPP_NOEXCEPT {}
+KeyNotFound::~KeyNotFound() YAML_CPP_NOEXCEPT {}
+InvalidNode::~InvalidNode() YAML_CPP_NOEXCEPT {}
+BadConversion::~BadConversion() YAML_CPP_NOEXCEPT {}
+BadDereference::~BadDereference() YAML_CPP_NOEXCEPT {}
+BadSubscript::~BadSubscript() YAML_CPP_NOEXCEPT {}
+BadPushback::~BadPushback() YAML_CPP_NOEXCEPT {}
+BadInsert::~BadInsert() YAML_CPP_NOEXCEPT {}
+EmitterException::~EmitterException() YAML_CPP_NOEXCEPT {}
+BadFile::~BadFile() YAML_CPP_NOEXCEPT {}
+}
+
+#undef YAML_CPP_NOEXCEPT
+
+
diff --git a/contrib/libs/yaml-cpp/src/exp.h b/contrib/libs/yaml-cpp/src/exp.h
index 50b0220b81..a17a21750a 100644
--- a/contrib/libs/yaml-cpp/src/exp.h
+++ b/contrib/libs/yaml-cpp/src/exp.h
@@ -20,10 +20,10 @@ namespace YAML {
namespace Exp {
// misc
-inline const RegEx& Empty() {
- static const RegEx e;
- return e;
-}
+inline const RegEx& Empty() {
+ static const RegEx e;
+ return e;
+}
inline const RegEx& Space() {
static const RegEx e = RegEx(' ');
return e;
@@ -169,15 +169,15 @@ inline const RegEx& EndScalarInFlow() {
return e;
}
-inline const RegEx& ScanScalarEndInFlow() {
- static const RegEx e = (EndScalarInFlow() || (BlankOrBreak() + Comment()));
- return e;
-}
-
-inline const RegEx& ScanScalarEnd() {
- static const RegEx e = EndScalar() || (BlankOrBreak() + Comment());
- return e;
-}
+inline const RegEx& ScanScalarEndInFlow() {
+ static const RegEx e = (EndScalarInFlow() || (BlankOrBreak() + Comment()));
+ return e;
+}
+
+inline const RegEx& ScanScalarEnd() {
+ static const RegEx e = EndScalar() || (BlankOrBreak() + Comment());
+ return e;
+}
inline const RegEx& EscSingleQuote() {
static const RegEx e = RegEx("\'\'");
return e;
diff --git a/contrib/libs/yaml-cpp/src/node_data.cpp b/contrib/libs/yaml-cpp/src/node_data.cpp
index 77cd465780..0e613a4113 100644
--- a/contrib/libs/yaml-cpp/src/node_data.cpp
+++ b/contrib/libs/yaml-cpp/src/node_data.cpp
@@ -1,5 +1,5 @@
#include <assert.h>
-#include <iterator>
+#include <iterator>
#include <sstream>
#include "yaml-cpp/exceptions.h"
@@ -28,7 +28,7 @@ void node_data::mark_defined() {
m_isDefined = true;
}
-void node_data::set_mark(const Mark& mark) { m_mark = mark; }
+void node_data::set_mark(const Mark& mark) { m_mark = mark; }
void node_data::set_type(NodeType::value type) {
if (type == NodeType::Undefined) {
@@ -102,7 +102,7 @@ void node_data::compute_seq_size() const {
void node_data::compute_map_size() const {
kv_pairs::iterator it = m_undefinedPairs.begin();
while (it != m_undefinedPairs.end()) {
- kv_pairs::iterator jt = std::next(it);
+ kv_pairs::iterator jt = std::next(it);
if (it->first->is_defined() && it->second->is_defined())
m_undefinedPairs.erase(it);
it = jt;
@@ -256,10 +256,10 @@ void node_data::reset_map() {
}
void node_data::insert_map_pair(node& key, node& value) {
- m_map.emplace_back(&key, &value);
-
+ m_map.emplace_back(&key, &value);
+
if (!key.is_defined() || !value.is_defined())
- m_undefinedPairs.emplace_back(&key, &value);
+ m_undefinedPairs.emplace_back(&key, &value);
}
void node_data::convert_to_map(shared_memory_holder pMemory) {
diff --git a/contrib/libs/yaml-cpp/src/nodebuilder.cpp b/contrib/libs/yaml-cpp/src/nodebuilder.cpp
index 093d2efeb7..3b9417ea7f 100644
--- a/contrib/libs/yaml-cpp/src/nodebuilder.cpp
+++ b/contrib/libs/yaml-cpp/src/nodebuilder.cpp
@@ -48,8 +48,8 @@ void NodeBuilder::OnScalar(const Mark& mark, const std::string& tag,
Pop();
}
-void NodeBuilder::OnSequenceStart(const Mark& mark, const std::string& tag,
- anchor_t anchor, EmitterStyle::value style) {
+void NodeBuilder::OnSequenceStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style) {
detail::node& node = Push(mark, anchor);
node.set_tag(tag);
node.set_type(NodeType::Sequence);
diff --git a/contrib/libs/yaml-cpp/src/null.cpp b/contrib/libs/yaml-cpp/src/null.cpp
index d12dd08ce4..443e4f98da 100644
--- a/contrib/libs/yaml-cpp/src/null.cpp
+++ b/contrib/libs/yaml-cpp/src/null.cpp
@@ -2,9 +2,9 @@
namespace YAML {
_Null Null;
-
-bool IsNullString(const std::string& str) {
- return str.empty() || str == "~" || str == "null" || str == "Null" ||
- str == "NULL";
-}
+
+bool IsNullString(const std::string& str) {
+ return str.empty() || str == "~" || str == "null" || str == "Null" ||
+ str == "NULL";
}
+}
diff --git a/contrib/libs/yaml-cpp/src/parse.cpp b/contrib/libs/yaml-cpp/src/parse.cpp
index 0b2ae4a4f6..9e0efdc8c2 100644
--- a/contrib/libs/yaml-cpp/src/parse.cpp
+++ b/contrib/libs/yaml-cpp/src/parse.cpp
@@ -22,18 +22,18 @@ Node Load(const char* input) {
Node Load(std::istream& input) {
Parser parser(input);
NodeBuilder builder;
- if (!parser.HandleNextDocument(builder)) {
+ if (!parser.HandleNextDocument(builder)) {
return Node();
- }
+ }
return builder.Root();
}
Node LoadFile(const std::string& filename) {
std::ifstream fin(filename.c_str());
- if (!fin) {
+ if (!fin) {
throw BadFile();
- }
+ }
return Load(fin);
}
@@ -53,9 +53,9 @@ std::vector<Node> LoadAll(std::istream& input) {
Parser parser(input);
while (1) {
NodeBuilder builder;
- if (!parser.HandleNextDocument(builder)) {
+ if (!parser.HandleNextDocument(builder)) {
break;
- }
+ }
docs.push_back(builder.Root());
}
@@ -64,9 +64,9 @@ std::vector<Node> LoadAll(std::istream& input) {
std::vector<Node> LoadAllFromFile(const std::string& filename) {
std::ifstream fin(filename.c_str());
- if (!fin) {
+ if (!fin) {
throw BadFile();
- }
+ }
return LoadAll(fin);
}
-} // namespace YAML
+} // namespace YAML
diff --git a/contrib/libs/yaml-cpp/src/parser.cpp b/contrib/libs/yaml-cpp/src/parser.cpp
index cd69f39fce..d5d9e20a4e 100644
--- a/contrib/libs/yaml-cpp/src/parser.cpp
+++ b/contrib/libs/yaml-cpp/src/parser.cpp
@@ -31,9 +31,9 @@ bool Parser::HandleNextDocument(EventHandler& eventHandler) {
return false;
ParseDirectives();
- if (m_pScanner->empty()) {
+ if (m_pScanner->empty()) {
return false;
- }
+ }
SingleDocParser sdp(*m_pScanner, *m_pDirectives);
sdp.HandleDocument(eventHandler);
@@ -44,20 +44,20 @@ void Parser::ParseDirectives() {
bool readDirective = false;
while (1) {
- if (m_pScanner->empty()) {
+ if (m_pScanner->empty()) {
break;
- }
+ }
Token& token = m_pScanner->peek();
- if (token.type != Token::DIRECTIVE) {
+ if (token.type != Token::DIRECTIVE) {
break;
- }
+ }
// we keep the directives from the last document if none are specified;
// but if any directives are specific, then we reset them
- if (!readDirective) {
+ if (!readDirective) {
m_pDirectives.reset(new Directives);
- }
+ }
readDirective = true;
HandleDirective(token);
@@ -66,34 +66,34 @@ void Parser::ParseDirectives() {
}
void Parser::HandleDirective(const Token& token) {
- if (token.value == "YAML") {
+ if (token.value == "YAML") {
HandleYamlDirective(token);
- } else if (token.value == "TAG") {
+ } else if (token.value == "TAG") {
HandleTagDirective(token);
- }
+ }
}
void Parser::HandleYamlDirective(const Token& token) {
- if (token.params.size() != 1) {
+ if (token.params.size() != 1) {
throw ParserException(token.mark, ErrorMsg::YAML_DIRECTIVE_ARGS);
- }
+ }
- if (!m_pDirectives->version.isDefault) {
+ if (!m_pDirectives->version.isDefault) {
throw ParserException(token.mark, ErrorMsg::REPEATED_YAML_DIRECTIVE);
- }
+ }
std::stringstream str(token.params[0]);
str >> m_pDirectives->version.major;
str.get();
str >> m_pDirectives->version.minor;
- if (!str || str.peek() != EOF) {
+ if (!str || str.peek() != EOF) {
throw ParserException(
token.mark, std::string(ErrorMsg::YAML_VERSION) + token.params[0]);
- }
+ }
- if (m_pDirectives->version.major > 1) {
+ if (m_pDirectives->version.major > 1) {
throw ParserException(token.mark, ErrorMsg::YAML_MAJOR_VERSION);
- }
+ }
m_pDirectives->version.isDefault = false;
// TODO: warning on major == 1, minor > 2?
@@ -105,22 +105,22 @@ void Parser::HandleTagDirective(const Token& token) {
const std::string& handle = token.params[0];
const std::string& prefix = token.params[1];
- if (m_pDirectives->tags.find(handle) != m_pDirectives->tags.end()) {
+ if (m_pDirectives->tags.find(handle) != m_pDirectives->tags.end()) {
throw ParserException(token.mark, ErrorMsg::REPEATED_TAG_DIRECTIVE);
- }
+ }
m_pDirectives->tags[handle] = prefix;
}
void Parser::PrintTokens(std::ostream& out) {
- if (!m_pScanner.get()) {
+ if (!m_pScanner.get()) {
return;
- }
+ }
while (1) {
- if (m_pScanner->empty()) {
+ if (m_pScanner->empty()) {
break;
- }
+ }
out << m_pScanner->peek() << "\n";
m_pScanner->pop();
diff --git a/contrib/libs/yaml-cpp/src/ptr_vector.h b/contrib/libs/yaml-cpp/src/ptr_vector.h
index 955aebd8d5..b4f899035b 100644
--- a/contrib/libs/yaml-cpp/src/ptr_vector.h
+++ b/contrib/libs/yaml-cpp/src/ptr_vector.h
@@ -16,27 +16,27 @@
namespace YAML {
-// TODO: This class is no longer needed
+// TODO: This class is no longer needed
template <typename T>
class ptr_vector : private YAML::noncopyable {
public:
ptr_vector() {}
- void clear() { m_data.clear(); }
+ void clear() { m_data.clear(); }
std::size_t size() const { return m_data.size(); }
bool empty() const { return m_data.empty(); }
- void push_back(std::unique_ptr<T>&& t) { m_data.push_back(std::move(t)); }
+ void push_back(std::unique_ptr<T>&& t) { m_data.push_back(std::move(t)); }
T& operator[](std::size_t i) { return *m_data[i]; }
const T& operator[](std::size_t i) const { return *m_data[i]; }
- T& back() { return *(m_data.back().get()); }
-
- const T& back() const { return *(m_data.back().get()); }
+ T& back() { return *(m_data.back().get()); }
+ const T& back() const { return *(m_data.back().get()); }
+
private:
- std::vector<std::unique_ptr<T>> m_data;
+ std::vector<std::unique_ptr<T>> m_data;
};
}
diff --git a/contrib/libs/yaml-cpp/src/regex_yaml.h b/contrib/libs/yaml-cpp/src/regex_yaml.h
index 8f28b852a2..3e7c5042b1 100644
--- a/contrib/libs/yaml-cpp/src/regex_yaml.h
+++ b/contrib/libs/yaml-cpp/src/regex_yaml.h
@@ -10,8 +10,8 @@
#include <string>
#include <vector>
-#include "yaml-cpp/dll.h"
-
+#include "yaml-cpp/dll.h"
+
namespace YAML {
class Stream;
@@ -28,7 +28,7 @@ enum REGEX_OP {
// simplified regular expressions
// . Only straightforward matches (no repeated characters)
// . Only matches from start of string
-class YAML_CPP_API RegEx {
+class YAML_CPP_API RegEx {
public:
RegEx();
RegEx(char ch);
@@ -36,10 +36,10 @@ class YAML_CPP_API RegEx {
RegEx(const std::string& str, REGEX_OP op = REGEX_SEQ);
~RegEx() {}
- friend YAML_CPP_API RegEx operator!(const RegEx& ex);
- friend YAML_CPP_API RegEx operator||(const RegEx& ex1, const RegEx& ex2);
- friend YAML_CPP_API RegEx operator&&(const RegEx& ex1, const RegEx& ex2);
- friend YAML_CPP_API RegEx operator+(const RegEx& ex1, const RegEx& ex2);
+ friend YAML_CPP_API RegEx operator!(const RegEx& ex);
+ friend YAML_CPP_API RegEx operator||(const RegEx& ex1, const RegEx& ex2);
+ friend YAML_CPP_API RegEx operator&&(const RegEx& ex1, const RegEx& ex2);
+ friend YAML_CPP_API RegEx operator+(const RegEx& ex1, const RegEx& ex2);
bool Matches(char ch) const;
bool Matches(const std::string& str) const;
diff --git a/contrib/libs/yaml-cpp/src/scanner.cpp b/contrib/libs/yaml-cpp/src/scanner.cpp
index b5cfcc12b2..7176d6d6d0 100644
--- a/contrib/libs/yaml-cpp/src/scanner.cpp
+++ b/contrib/libs/yaml-cpp/src/scanner.cpp
@@ -51,9 +51,9 @@ void Scanner::EnsureTokensInQueue() {
Token& token = m_tokens.front();
// if this guy's valid, then we're done
- if (token.status == Token::VALID) {
+ if (token.status == Token::VALID) {
return;
- }
+ }
// here's where we clean up the impossible tokens
if (token.status == Token::INVALID) {
@@ -65,9 +65,9 @@ void Scanner::EnsureTokensInQueue() {
}
// no token? maybe we've actually finished
- if (m_endedStream) {
+ if (m_endedStream) {
return;
- }
+ }
// no? then scan...
ScanNextToken();
@@ -75,13 +75,13 @@ void Scanner::EnsureTokensInQueue() {
}
void Scanner::ScanNextToken() {
- if (m_endedStream) {
+ if (m_endedStream) {
return;
- }
+ }
- if (!m_startedStream) {
+ if (!m_startedStream) {
return StartStream();
- }
+ }
// get rid of whitespace, etc. (in between tokens it should be irrelevent)
ScanToNextToken();
@@ -94,75 +94,75 @@ void Scanner::ScanNextToken() {
// *****
// end of stream
- if (!INPUT) {
+ if (!INPUT) {
return EndStream();
- }
+ }
- if (INPUT.column() == 0 && INPUT.peek() == Keys::Directive) {
+ if (INPUT.column() == 0 && INPUT.peek() == Keys::Directive) {
return ScanDirective();
- }
+ }
// document token
- if (INPUT.column() == 0 && Exp::DocStart().Matches(INPUT)) {
+ if (INPUT.column() == 0 && Exp::DocStart().Matches(INPUT)) {
return ScanDocStart();
- }
+ }
- if (INPUT.column() == 0 && Exp::DocEnd().Matches(INPUT)) {
+ if (INPUT.column() == 0 && Exp::DocEnd().Matches(INPUT)) {
return ScanDocEnd();
- }
+ }
// flow start/end/entry
- if (INPUT.peek() == Keys::FlowSeqStart ||
- INPUT.peek() == Keys::FlowMapStart) {
+ if (INPUT.peek() == Keys::FlowSeqStart ||
+ INPUT.peek() == Keys::FlowMapStart) {
return ScanFlowStart();
- }
+ }
- if (INPUT.peek() == Keys::FlowSeqEnd || INPUT.peek() == Keys::FlowMapEnd) {
+ if (INPUT.peek() == Keys::FlowSeqEnd || INPUT.peek() == Keys::FlowMapEnd) {
return ScanFlowEnd();
- }
+ }
- if (INPUT.peek() == Keys::FlowEntry) {
+ if (INPUT.peek() == Keys::FlowEntry) {
return ScanFlowEntry();
- }
+ }
// block/map stuff
- if (Exp::BlockEntry().Matches(INPUT)) {
+ if (Exp::BlockEntry().Matches(INPUT)) {
return ScanBlockEntry();
- }
+ }
- if ((InBlockContext() ? Exp::Key() : Exp::KeyInFlow()).Matches(INPUT)) {
+ if ((InBlockContext() ? Exp::Key() : Exp::KeyInFlow()).Matches(INPUT)) {
return ScanKey();
- }
+ }
- if (GetValueRegex().Matches(INPUT)) {
+ if (GetValueRegex().Matches(INPUT)) {
return ScanValue();
- }
+ }
// alias/anchor
- if (INPUT.peek() == Keys::Alias || INPUT.peek() == Keys::Anchor) {
+ if (INPUT.peek() == Keys::Alias || INPUT.peek() == Keys::Anchor) {
return ScanAnchorOrAlias();
- }
+ }
// tag
- if (INPUT.peek() == Keys::Tag) {
+ if (INPUT.peek() == Keys::Tag) {
return ScanTag();
- }
+ }
// special scalars
if (InBlockContext() && (INPUT.peek() == Keys::LiteralScalar ||
- INPUT.peek() == Keys::FoldedScalar)) {
+ INPUT.peek() == Keys::FoldedScalar)) {
return ScanBlockScalar();
- }
+ }
- if (INPUT.peek() == '\'' || INPUT.peek() == '\"') {
+ if (INPUT.peek() == '\'' || INPUT.peek() == '\"') {
return ScanQuotedScalar();
- }
+ }
// plain scalars
if ((InBlockContext() ? Exp::PlainScalar() : Exp::PlainScalarInFlow())
- .Matches(INPUT)) {
+ .Matches(INPUT)) {
return ScanPlainScalar();
- }
+ }
// don't know what it is!
throw ParserException(INPUT.mark(), ErrorMsg::UNKNOWN_TOKEN);
@@ -172,24 +172,24 @@ void Scanner::ScanToNextToken() {
while (1) {
// first eat whitespace
while (INPUT && IsWhitespaceToBeEaten(INPUT.peek())) {
- if (InBlockContext() && Exp::Tab().Matches(INPUT)) {
+ if (InBlockContext() && Exp::Tab().Matches(INPUT)) {
m_simpleKeyAllowed = false;
- }
+ }
INPUT.eat(1);
}
// then eat a comment
if (Exp::Comment().Matches(INPUT)) {
// eat until line break
- while (INPUT && !Exp::Break().Matches(INPUT)) {
+ while (INPUT && !Exp::Break().Matches(INPUT)) {
INPUT.eat(1);
- }
+ }
}
// if it's NOT a line break, then we're done!
- if (!Exp::Break().Matches(INPUT)) {
+ if (!Exp::Break().Matches(INPUT)) {
break;
- }
+ }
// otherwise, let's eat the line break and keep going
int n = Exp::Break().Match(INPUT);
@@ -199,9 +199,9 @@ void Scanner::ScanToNextToken() {
InvalidateSimpleKey();
// new line - we may be able to accept a simple key now
- if (InBlockContext()) {
+ if (InBlockContext()) {
m_simpleKeyAllowed = true;
- }
+ }
}
}
@@ -218,21 +218,21 @@ void Scanner::ScanToNextToken() {
// that they can't contribute to indentation, so once you've seen a tab in a
// line, you can't start a simple key
bool Scanner::IsWhitespaceToBeEaten(char ch) {
- if (ch == ' ') {
+ if (ch == ' ') {
return true;
- }
+ }
- if (ch == '\t') {
+ if (ch == '\t') {
return true;
- }
+ }
return false;
}
const RegEx& Scanner::GetValueRegex() const {
- if (InBlockContext()) {
+ if (InBlockContext()) {
return Exp::Value();
- }
+ }
return m_canBeJSONFlow ? Exp::ValueInJSONFlow() : Exp::ValueInFlow();
}
@@ -240,17 +240,17 @@ const RegEx& Scanner::GetValueRegex() const {
void Scanner::StartStream() {
m_startedStream = true;
m_simpleKeyAllowed = true;
- std::unique_ptr<IndentMarker> pIndent(
- new IndentMarker(-1, IndentMarker::NONE));
- m_indentRefs.push_back(std::move(pIndent));
+ std::unique_ptr<IndentMarker> pIndent(
+ new IndentMarker(-1, IndentMarker::NONE));
+ m_indentRefs.push_back(std::move(pIndent));
m_indents.push(&m_indentRefs.back());
}
void Scanner::EndStream() {
// force newline
- if (INPUT.column() > 0) {
+ if (INPUT.column() > 0) {
INPUT.ResetColumn();
- }
+ }
PopAllIndents();
PopAllSimpleKeys();
@@ -281,72 +281,72 @@ Token::TYPE Scanner::GetStartTokenFor(IndentMarker::INDENT_TYPE type) const {
Scanner::IndentMarker* Scanner::PushIndentTo(int column,
IndentMarker::INDENT_TYPE type) {
// are we in flow?
- if (InFlowContext()) {
+ if (InFlowContext()) {
return 0;
- }
+ }
- std::unique_ptr<IndentMarker> pIndent(new IndentMarker(column, type));
+ std::unique_ptr<IndentMarker> pIndent(new IndentMarker(column, type));
IndentMarker& indent = *pIndent;
const IndentMarker& lastIndent = *m_indents.top();
// is this actually an indentation?
- if (indent.column < lastIndent.column) {
+ if (indent.column < lastIndent.column) {
return 0;
- }
+ }
if (indent.column == lastIndent.column &&
!(indent.type == IndentMarker::SEQ &&
- lastIndent.type == IndentMarker::MAP)) {
+ lastIndent.type == IndentMarker::MAP)) {
return 0;
- }
+ }
// push a start token
indent.pStartToken = PushToken(GetStartTokenFor(type));
// and then the indent
m_indents.push(&indent);
- m_indentRefs.push_back(std::move(pIndent));
+ m_indentRefs.push_back(std::move(pIndent));
return &m_indentRefs.back();
}
void Scanner::PopIndentToHere() {
// are we in flow?
- if (InFlowContext()) {
+ if (InFlowContext()) {
return;
- }
+ }
// now pop away
while (!m_indents.empty()) {
const IndentMarker& indent = *m_indents.top();
- if (indent.column < INPUT.column()) {
+ if (indent.column < INPUT.column()) {
break;
- }
+ }
if (indent.column == INPUT.column() &&
!(indent.type == IndentMarker::SEQ &&
- !Exp::BlockEntry().Matches(INPUT))) {
+ !Exp::BlockEntry().Matches(INPUT))) {
break;
- }
+ }
PopIndent();
}
- while (!m_indents.empty() &&
- m_indents.top()->status == IndentMarker::INVALID) {
+ while (!m_indents.empty() &&
+ m_indents.top()->status == IndentMarker::INVALID) {
PopIndent();
- }
+ }
}
void Scanner::PopAllIndents() {
// are we in flow?
- if (InFlowContext()) {
+ if (InFlowContext()) {
return;
- }
+ }
// now pop away
while (!m_indents.empty()) {
const IndentMarker& indent = *m_indents.top();
- if (indent.type == IndentMarker::NONE) {
+ if (indent.type == IndentMarker::NONE) {
break;
- }
+ }
PopIndent();
}
@@ -361,17 +361,17 @@ void Scanner::PopIndent() {
return;
}
- if (indent.type == IndentMarker::SEQ) {
+ if (indent.type == IndentMarker::SEQ) {
m_tokens.push(Token(Token::BLOCK_SEQ_END, INPUT.mark()));
- } else if (indent.type == IndentMarker::MAP) {
+ } else if (indent.type == IndentMarker::MAP) {
m_tokens.push(Token(Token::BLOCK_MAP_END, INPUT.mark()));
- }
+ }
}
int Scanner::GetTopIndent() const {
- if (m_indents.empty()) {
+ if (m_indents.empty()) {
return 0;
- }
+ }
return m_indents.top()->column;
}
@@ -383,4 +383,4 @@ void Scanner::ThrowParserException(const std::string& msg) const {
}
throw ParserException(mark, msg);
}
-} // namespace YAML
+} // namespace YAML
diff --git a/contrib/libs/yaml-cpp/src/scanner.h b/contrib/libs/yaml-cpp/src/scanner.h
index 7bb2ccc71a..6c1ebcecfe 100644
--- a/contrib/libs/yaml-cpp/src/scanner.h
+++ b/contrib/libs/yaml-cpp/src/scanner.h
@@ -24,24 +24,24 @@ namespace YAML {
class Node;
class RegEx;
-/**
- * A scanner transforms a stream of characters into a stream of tokens.
- */
+/**
+ * A scanner transforms a stream of characters into a stream of tokens.
+ */
class Scanner {
public:
- explicit Scanner(std::istream &in);
+ explicit Scanner(std::istream &in);
~Scanner();
- /** Returns true if there are no more tokens to be read. */
+ /** Returns true if there are no more tokens to be read. */
bool empty();
-
- /** Removes the next token in the queue. */
+
+ /** Removes the next token in the queue. */
void pop();
-
- /** Returns, but does not remove, the next token in the queue. */
+
+ /** Returns, but does not remove, the next token in the queue. */
Token &peek();
-
- /** Returns the current mark in the input stream. */
+
+ /** Returns the current mark in the input stream. */
Mark mark() const;
private:
@@ -61,29 +61,29 @@ class Scanner {
private:
// scanning
-
- /**
- * Scans until there's a valid token at the front of the queue, or the queue
- * is empty. The state can be checked by {@link #empty}, and the next token
- * retrieved by {@link #peek}.
- */
+
+ /**
+ * Scans until there's a valid token at the front of the queue, or the queue
+ * is empty. The state can be checked by {@link #empty}, and the next token
+ * retrieved by {@link #peek}.
+ */
void EnsureTokensInQueue();
-
- /**
- * The main scanning function; this method branches out to scan whatever the
- * next token should be.
- */
+
+ /**
+ * The main scanning function; this method branches out to scan whatever the
+ * next token should be.
+ */
void ScanNextToken();
-
- /** Eats the input stream until it reaches the next token-like thing. */
+
+ /** Eats the input stream until it reaches the next token-like thing. */
void ScanToNextToken();
-
- /** Sets the initial conditions for starting a stream. */
+
+ /** Sets the initial conditions for starting a stream. */
void StartStream();
-
- /** Closes out the stream, finish up, etc. */
+
+ /** Closes out the stream, finish up, etc. */
void EndStream();
-
+
Token *PushToken(Token::TYPE type);
bool InFlowContext() const { return !m_flows.empty(); }
@@ -91,29 +91,29 @@ class Scanner {
std::size_t GetFlowLevel() const { return m_flows.size(); }
Token::TYPE GetStartTokenFor(IndentMarker::INDENT_TYPE type) const;
-
- /**
- * Pushes an indentation onto the stack, and enqueues the proper token
- * (sequence start or mapping start).
- *
- * @return the indent marker it generates (if any).
- */
+
+ /**
+ * Pushes an indentation onto the stack, and enqueues the proper token
+ * (sequence start or mapping start).
+ *
+ * @return the indent marker it generates (if any).
+ */
IndentMarker *PushIndentTo(int column, IndentMarker::INDENT_TYPE type);
-
- /**
- * Pops indentations off the stack until it reaches the current indentation
- * level, and enqueues the proper token each time. Then pops all invalid
- * indentations off.
- */
+
+ /**
+ * Pops indentations off the stack until it reaches the current indentation
+ * level, and enqueues the proper token each time. Then pops all invalid
+ * indentations off.
+ */
void PopIndentToHere();
-
- /**
- * Pops all indentations (except for the base empty one) off the stack, and
- * enqueues the proper token each time.
- */
+
+ /**
+ * Pops all indentations (except for the base empty one) off the stack, and
+ * enqueues the proper token each time.
+ */
void PopAllIndents();
-
- /** Pops a single indent, pushing the proper token. */
+
+ /** Pops a single indent, pushing the proper token. */
void PopIndent();
int GetTopIndent() const;
@@ -125,17 +125,17 @@ class Scanner {
bool VerifySimpleKey();
void PopAllSimpleKeys();
- /**
- * Throws a ParserException with the current token location (if available),
- * and does not parse any more tokens.
- */
+ /**
+ * Throws a ParserException with the current token location (if available),
+ * and does not parse any more tokens.
+ */
void ThrowParserException(const std::string &msg) const;
bool IsWhitespaceToBeEaten(char ch);
-
- /**
- * Returns the appropriate regex to check if the next token is a value token.
- */
+
+ /**
+ * Returns the appropriate regex to check if the next token is a value token.
+ */
const RegEx &GetValueRegex() const;
struct SimpleKey {
diff --git a/contrib/libs/yaml-cpp/src/scanscalar.cpp b/contrib/libs/yaml-cpp/src/scanscalar.cpp
index 10e359d446..28fcf10eed 100644
--- a/contrib/libs/yaml-cpp/src/scanscalar.cpp
+++ b/contrib/libs/yaml-cpp/src/scanscalar.cpp
@@ -28,28 +28,28 @@ std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) {
std::string scalar;
params.leadingSpaces = false;
- if (!params.end) {
- params.end = &Exp::Empty();
- }
-
+ if (!params.end) {
+ params.end = &Exp::Empty();
+ }
+
while (INPUT) {
// ********************************
// Phase #1: scan until line ending
std::size_t lastNonWhitespaceChar = scalar.size();
bool escapedNewline = false;
- while (!params.end->Matches(INPUT) && !Exp::Break().Matches(INPUT)) {
- if (!INPUT) {
+ while (!params.end->Matches(INPUT) && !Exp::Break().Matches(INPUT)) {
+ if (!INPUT) {
break;
- }
+ }
// document indicator?
if (INPUT.column() == 0 && Exp::DocIndicator().Matches(INPUT)) {
- if (params.onDocIndicator == BREAK) {
+ if (params.onDocIndicator == BREAK) {
break;
- } else if (params.onDocIndicator == THROW) {
+ } else if (params.onDocIndicator == THROW) {
throw ParserException(INPUT.mark(), ErrorMsg::DOC_IN_SCALAR);
- }
+ }
}
foundNonEmptyLine = true;
@@ -76,31 +76,31 @@ std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) {
// otherwise, just add the damn character
char ch = INPUT.get();
scalar += ch;
- if (ch != ' ' && ch != '\t') {
+ if (ch != ' ' && ch != '\t') {
lastNonWhitespaceChar = scalar.size();
- }
+ }
}
// eof? if we're looking to eat something, then we throw
if (!INPUT) {
- if (params.eatEnd) {
+ if (params.eatEnd) {
throw ParserException(INPUT.mark(), ErrorMsg::EOF_IN_SCALAR);
- }
+ }
break;
}
// doc indicator?
if (params.onDocIndicator == BREAK && INPUT.column() == 0 &&
- Exp::DocIndicator().Matches(INPUT)) {
+ Exp::DocIndicator().Matches(INPUT)) {
break;
- }
+ }
// are we done via character match?
- int n = params.end->Match(INPUT);
+ int n = params.end->Match(INPUT);
if (n >= 0) {
- if (params.eatEnd) {
+ if (params.eatEnd) {
INPUT.eat(n);
- }
+ }
break;
}
@@ -117,34 +117,34 @@ std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) {
// Phase #3: scan initial spaces
// first the required indentation
- while (INPUT.peek() == ' ' &&
- (INPUT.column() < params.indent ||
- (params.detectIndent && !foundNonEmptyLine)) &&
- !params.end->Matches(INPUT)) {
+ while (INPUT.peek() == ' ' &&
+ (INPUT.column() < params.indent ||
+ (params.detectIndent && !foundNonEmptyLine)) &&
+ !params.end->Matches(INPUT)) {
INPUT.eat(1);
- }
+ }
// update indent if we're auto-detecting
- if (params.detectIndent && !foundNonEmptyLine) {
+ if (params.detectIndent && !foundNonEmptyLine) {
params.indent = std::max(params.indent, INPUT.column());
- }
+ }
// and then the rest of the whitespace
while (Exp::Blank().Matches(INPUT)) {
// we check for tabs that masquerade as indentation
if (INPUT.peek() == '\t' && INPUT.column() < params.indent &&
- params.onTabInIndentation == THROW) {
+ params.onTabInIndentation == THROW) {
throw ParserException(INPUT.mark(), ErrorMsg::TAB_IN_INDENTATION);
- }
+ }
- if (!params.eatLeadingWhitespace) {
+ if (!params.eatLeadingWhitespace) {
break;
- }
-
- if (params.end->Matches(INPUT)) {
- break;
- }
+ }
+ if (params.end->Matches(INPUT)) {
+ break;
+ }
+
INPUT.eat(1);
}
@@ -163,29 +163,29 @@ std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) {
break;
case FOLD_BLOCK:
if (!emptyLine && !nextEmptyLine && !moreIndented &&
- !nextMoreIndented && INPUT.column() >= params.indent) {
+ !nextMoreIndented && INPUT.column() >= params.indent) {
scalar += " ";
- } else if (nextEmptyLine) {
+ } else if (nextEmptyLine) {
foldedNewlineCount++;
- } else {
+ } else {
scalar += "\n";
- }
+ }
if (!nextEmptyLine && foldedNewlineCount > 0) {
scalar += std::string(foldedNewlineCount - 1, '\n');
if (foldedNewlineStartedMoreIndented ||
- nextMoreIndented | !foundNonEmptyLine) {
+ nextMoreIndented | !foundNonEmptyLine) {
scalar += "\n";
- }
+ }
foldedNewlineCount = 0;
}
break;
case FOLD_FLOW:
- if (nextEmptyLine) {
+ if (nextEmptyLine) {
scalar += "\n";
- } else if (!emptyLine && !nextEmptyLine && !escapedNewline) {
+ } else if (!emptyLine && !nextEmptyLine && !escapedNewline) {
scalar += " ";
- }
+ }
break;
}
}
@@ -205,41 +205,41 @@ std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) {
if (params.trimTrailingSpaces) {
std::size_t pos = scalar.find_last_not_of(' ');
if (lastEscapedChar != std::string::npos) {
- if (pos < lastEscapedChar || pos == std::string::npos) {
+ if (pos < lastEscapedChar || pos == std::string::npos) {
pos = lastEscapedChar;
- }
+ }
}
- if (pos < scalar.size()) {
+ if (pos < scalar.size()) {
scalar.erase(pos + 1);
- }
+ }
}
switch (params.chomp) {
case CLIP: {
std::size_t pos = scalar.find_last_not_of('\n');
if (lastEscapedChar != std::string::npos) {
- if (pos < lastEscapedChar || pos == std::string::npos) {
+ if (pos < lastEscapedChar || pos == std::string::npos) {
pos = lastEscapedChar;
- }
+ }
}
- if (pos == std::string::npos) {
+ if (pos == std::string::npos) {
scalar.erase();
- } else if (pos + 1 < scalar.size()) {
+ } else if (pos + 1 < scalar.size()) {
scalar.erase(pos + 2);
- }
+ }
} break;
case STRIP: {
std::size_t pos = scalar.find_last_not_of('\n');
if (lastEscapedChar != std::string::npos) {
- if (pos < lastEscapedChar || pos == std::string::npos) {
+ if (pos < lastEscapedChar || pos == std::string::npos) {
pos = lastEscapedChar;
- }
+ }
}
- if (pos == std::string::npos) {
+ if (pos == std::string::npos) {
scalar.erase();
- } else if (pos < scalar.size()) {
+ } else if (pos < scalar.size()) {
scalar.erase(pos + 1);
- }
+ }
} break;
default:
break;
diff --git a/contrib/libs/yaml-cpp/src/scanscalar.h b/contrib/libs/yaml-cpp/src/scanscalar.h
index c3a574ad9b..a8282f61f7 100644
--- a/contrib/libs/yaml-cpp/src/scanscalar.h
+++ b/contrib/libs/yaml-cpp/src/scanscalar.h
@@ -19,8 +19,8 @@ enum FOLD { DONT_FOLD, FOLD_BLOCK, FOLD_FLOW };
struct ScanScalarParams {
ScanScalarParams()
- : end(nullptr),
- eatEnd(false),
+ : end(nullptr),
+ eatEnd(false),
indent(0),
detectIndent(false),
eatLeadingWhitespace(0),
@@ -33,8 +33,8 @@ struct ScanScalarParams {
leadingSpaces(false) {}
// input:
- const RegEx* end; // what condition ends this scalar?
- // unowned.
+ const RegEx* end; // what condition ends this scalar?
+ // unowned.
bool eatEnd; // should we eat that condition when we see it?
int indent; // what level of indentation should be eaten and ignored?
bool detectIndent; // should we try to autodetect the indent?
diff --git a/contrib/libs/yaml-cpp/src/scantoken.cpp b/contrib/libs/yaml-cpp/src/scantoken.cpp
index fd8758d781..9a722b15b6 100644
--- a/contrib/libs/yaml-cpp/src/scantoken.cpp
+++ b/contrib/libs/yaml-cpp/src/scantoken.cpp
@@ -297,8 +297,8 @@ void Scanner::ScanPlainScalar() {
// set up the scanning parameters
ScanScalarParams params;
- params.end =
- (InFlowContext() ? &Exp::ScanScalarEndInFlow() : &Exp::ScanScalarEnd());
+ params.end =
+ (InFlowContext() ? &Exp::ScanScalarEndInFlow() : &Exp::ScanScalarEnd());
params.eatEnd = false;
params.indent = (InFlowContext() ? 0 : GetTopIndent() + 1);
params.fold = FOLD_FLOW;
@@ -338,8 +338,8 @@ void Scanner::ScanQuotedScalar() {
// setup the scanning parameters
ScanScalarParams params;
- RegEx end = (single ? RegEx(quote) && !Exp::EscSingleQuote() : RegEx(quote));
- params.end = &end;
+ RegEx end = (single ? RegEx(quote) && !Exp::EscSingleQuote() : RegEx(quote));
+ params.end = &end;
params.eatEnd = true;
params.escape = (single ? '\'' : '\\');
params.indent = 0;
diff --git a/contrib/libs/yaml-cpp/src/setting.h b/contrib/libs/yaml-cpp/src/setting.h
index b78d40e2e8..0f8e19fbc6 100644
--- a/contrib/libs/yaml-cpp/src/setting.h
+++ b/contrib/libs/yaml-cpp/src/setting.h
@@ -20,7 +20,7 @@ class Setting {
Setting() : m_value() {}
const T get() const { return m_value; }
- std::unique_ptr<SettingChangeBase> set(const T& value);
+ std::unique_ptr<SettingChangeBase> set(const T& value);
void restore(const Setting<T>& oldSetting) { m_value = oldSetting.get(); }
private:
@@ -49,8 +49,8 @@ class SettingChange : public SettingChangeBase {
};
template <typename T>
-inline std::unique_ptr<SettingChangeBase> Setting<T>::set(const T& value) {
- std::unique_ptr<SettingChangeBase> pChange(new SettingChange<T>(this));
+inline std::unique_ptr<SettingChangeBase> Setting<T>::set(const T& value) {
+ std::unique_ptr<SettingChangeBase> pChange(new SettingChange<T>(this));
m_value = value;
return pChange;
}
@@ -71,23 +71,23 @@ class SettingChanges : private noncopyable {
(*it)->pop();
}
- void push(std::unique_ptr<SettingChangeBase> pSettingChange) {
- m_settingChanges.push_back(std::move(pSettingChange));
+ void push(std::unique_ptr<SettingChangeBase> pSettingChange) {
+ m_settingChanges.push_back(std::move(pSettingChange));
}
- // like std::unique_ptr - assignment is transfer of ownership
- SettingChanges& operator=(SettingChanges&& rhs) {
+ // like std::unique_ptr - assignment is transfer of ownership
+ SettingChanges& operator=(SettingChanges&& rhs) {
if (this == &rhs)
return *this;
clear();
- std::swap(m_settingChanges, rhs.m_settingChanges);
-
+ std::swap(m_settingChanges, rhs.m_settingChanges);
+
return *this;
}
private:
- typedef std::vector<std::unique_ptr<SettingChangeBase>> setting_changes;
+ typedef std::vector<std::unique_ptr<SettingChangeBase>> setting_changes;
setting_changes m_settingChanges;
};
}
diff --git a/contrib/libs/yaml-cpp/src/singledocparser.cpp b/contrib/libs/yaml-cpp/src/singledocparser.cpp
index a27c1c3b04..b2d9bbfad4 100644
--- a/contrib/libs/yaml-cpp/src/singledocparser.cpp
+++ b/contrib/libs/yaml-cpp/src/singledocparser.cpp
@@ -11,7 +11,7 @@
#include "yaml-cpp/eventhandler.h"
#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
#include "yaml-cpp/mark.h"
-#include "yaml-cpp/null.h"
+#include "yaml-cpp/null.h"
namespace YAML {
SingleDocParser::SingleDocParser(Scanner& scanner, const Directives& directives)
@@ -76,7 +76,7 @@ void SingleDocParser::HandleNode(EventHandler& eventHandler) {
const Token& token = m_scanner.peek();
- if (token.type == Token::PLAIN_SCALAR && IsNullString(token.value)) {
+ if (token.type == Token::PLAIN_SCALAR && IsNullString(token.value)) {
eventHandler.OnNull(mark, anchor);
m_scanner.pop();
return;
diff --git a/contrib/libs/yaml-cpp/src/singledocparser.h b/contrib/libs/yaml-cpp/src/singledocparser.h
index 2b92067cdd..4c005b1ad0 100644
--- a/contrib/libs/yaml-cpp/src/singledocparser.h
+++ b/contrib/libs/yaml-cpp/src/singledocparser.h
@@ -53,7 +53,7 @@ class SingleDocParser : private noncopyable {
private:
Scanner& m_scanner;
const Directives& m_directives;
- std::unique_ptr<CollectionStack> m_pCollectionStack;
+ std::unique_ptr<CollectionStack> m_pCollectionStack;
typedef std::map<std::string, anchor_t> Anchors;
Anchors m_anchors;
diff --git a/contrib/libs/yaml-cpp/ya.make b/contrib/libs/yaml-cpp/ya.make
index 058caf92fa..293ae35ea1 100644
--- a/contrib/libs/yaml-cpp/ya.make
+++ b/contrib/libs/yaml-cpp/ya.make
@@ -27,7 +27,7 @@ SRCS(
src/emitter.cpp
src/emitterstate.cpp
src/emitterutils.cpp
- src/exceptions.cpp
+ src/exceptions.cpp
src/exp.cpp
src/memory.cpp
src/nodebuilder.cpp
diff --git a/contrib/libs/zlib/deflate.c b/contrib/libs/zlib/deflate.c
index 7318b1e2fb..7f7df55c51 100644
--- a/contrib/libs/zlib/deflate.c
+++ b/contrib/libs/zlib/deflate.c
@@ -153,7 +153,7 @@ local const config configuration_table[10] = {
*/
/* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */
-#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
+#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
/* ===========================================================================
* Update a hash value with the given input byte
diff --git a/contrib/python/protobuf/py2/google/protobuf/pyext/descriptor_pool.cc b/contrib/python/protobuf/py2/google/protobuf/pyext/descriptor_pool.cc
index a53411e797..201d7b94ea 100644
--- a/contrib/python/protobuf/py2/google/protobuf/pyext/descriptor_pool.cc
+++ b/contrib/python/protobuf/py2/google/protobuf/pyext/descriptor_pool.cc
@@ -176,7 +176,7 @@ static PyDescriptorPool* PyDescriptorPool_NewWithDatabase(
// The public DescriptorPool constructor.
static PyObject* New(PyTypeObject* type,
PyObject* args, PyObject* kwargs) {
- static const char* kwlist[] = {"descriptor_db", 0};
+ static const char* kwlist[] = {"descriptor_db", 0};
PyObject* py_database = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O",
const_cast<char**>(kwlist), &py_database)) {
diff --git a/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc b/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc
index 8b41ca47dd..029ae2c7cd 100644
--- a/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc
+++ b/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc
@@ -551,7 +551,7 @@ PyObject* PickleError_class;
// Format an error message for unexpected types.
// Always return with an exception set.
-void FormatTypeError(PyObject* arg, const char* expected_types) {
+void FormatTypeError(PyObject* arg, const char* expected_types) {
// This function is often called with an exception set.
// Clear it to call PyObject_Repr() in good conditions.
PyErr_Clear();
diff --git a/contrib/python/protobuf/py2/google/protobuf/pyext/message.h b/contrib/python/protobuf/py2/google/protobuf/pyext/message.h
index ca81a87521..1a8a0cf57e 100644
--- a/contrib/python/protobuf/py2/google/protobuf/pyext/message.h
+++ b/contrib/python/protobuf/py2/google/protobuf/pyext/message.h
@@ -330,7 +330,7 @@ PyObject* SetAllowOversizeProtos(PyObject* m, PyObject* arg);
#define FULL_MODULE_NAME "google.protobuf.pyext._message"
-void FormatTypeError(PyObject* arg, const char* expected_types);
+void FormatTypeError(PyObject* arg, const char* expected_types);
template<class T>
bool CheckAndGetInteger(PyObject* arg, T* value);
bool CheckAndGetDouble(PyObject* arg, double* value);
diff --git a/contrib/python/protobuf/py2/google/protobuf/pyext/message_factory.cc b/contrib/python/protobuf/py2/google/protobuf/pyext/message_factory.cc
index 7905be0214..abd7675821 100644
--- a/contrib/python/protobuf/py2/google/protobuf/pyext/message_factory.cc
+++ b/contrib/python/protobuf/py2/google/protobuf/pyext/message_factory.cc
@@ -77,7 +77,7 @@ PyMessageFactory* NewMessageFactory(PyTypeObject* type, PyDescriptorPool* pool)
}
PyObject* New(PyTypeObject* type, PyObject* args, PyObject* kwargs) {
- static const char* kwlist[] = {"pool", 0};
+ static const char* kwlist[] = {"pool", 0};
PyObject* pool = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O",
const_cast<char**>(kwlist), &pool)) {
diff --git a/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor_pool.cc b/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor_pool.cc
index a53411e797..201d7b94ea 100644
--- a/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor_pool.cc
+++ b/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor_pool.cc
@@ -176,7 +176,7 @@ static PyDescriptorPool* PyDescriptorPool_NewWithDatabase(
// The public DescriptorPool constructor.
static PyObject* New(PyTypeObject* type,
PyObject* args, PyObject* kwargs) {
- static const char* kwlist[] = {"descriptor_db", 0};
+ static const char* kwlist[] = {"descriptor_db", 0};
PyObject* py_database = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O",
const_cast<char**>(kwlist), &py_database)) {
diff --git a/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc b/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc
index 8b41ca47dd..029ae2c7cd 100644
--- a/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc
+++ b/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc
@@ -551,7 +551,7 @@ PyObject* PickleError_class;
// Format an error message for unexpected types.
// Always return with an exception set.
-void FormatTypeError(PyObject* arg, const char* expected_types) {
+void FormatTypeError(PyObject* arg, const char* expected_types) {
// This function is often called with an exception set.
// Clear it to call PyObject_Repr() in good conditions.
PyErr_Clear();
diff --git a/contrib/python/protobuf/py3/google/protobuf/pyext/message.h b/contrib/python/protobuf/py3/google/protobuf/pyext/message.h
index ca81a87521..1a8a0cf57e 100644
--- a/contrib/python/protobuf/py3/google/protobuf/pyext/message.h
+++ b/contrib/python/protobuf/py3/google/protobuf/pyext/message.h
@@ -330,7 +330,7 @@ PyObject* SetAllowOversizeProtos(PyObject* m, PyObject* arg);
#define FULL_MODULE_NAME "google.protobuf.pyext._message"
-void FormatTypeError(PyObject* arg, const char* expected_types);
+void FormatTypeError(PyObject* arg, const char* expected_types);
template<class T>
bool CheckAndGetInteger(PyObject* arg, T* value);
bool CheckAndGetDouble(PyObject* arg, double* value);
diff --git a/contrib/python/protobuf/py3/google/protobuf/pyext/message_factory.cc b/contrib/python/protobuf/py3/google/protobuf/pyext/message_factory.cc
index 7905be0214..abd7675821 100644
--- a/contrib/python/protobuf/py3/google/protobuf/pyext/message_factory.cc
+++ b/contrib/python/protobuf/py3/google/protobuf/pyext/message_factory.cc
@@ -77,7 +77,7 @@ PyMessageFactory* NewMessageFactory(PyTypeObject* type, PyDescriptorPool* pool)
}
PyObject* New(PyTypeObject* type, PyObject* args, PyObject* kwargs) {
- static const char* kwlist[] = {"pool", 0};
+ static const char* kwlist[] = {"pool", 0};
PyObject* pool = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O",
const_cast<char**>(kwlist), &pool)) {
diff --git a/contrib/tools/cython/Cython/Compiler/Nodes.py b/contrib/tools/cython/Cython/Compiler/Nodes.py
index 6436c5002d..c733d21294 100644
--- a/contrib/tools/cython/Cython/Compiler/Nodes.py
+++ b/contrib/tools/cython/Cython/Compiler/Nodes.py
@@ -4193,7 +4193,7 @@ class GeneratorBodyDefNode(DefNode):
# ----- Function header
code.putln("")
self.generate_function_header(code)
- code.putln("__pyx_CoroutineObject *%s = (__pyx_CoroutineObject *)%s_obj;" % (Naming.generator_cname, Naming.generator_cname))
+ code.putln("__pyx_CoroutineObject *%s = (__pyx_CoroutineObject *)%s_obj;" % (Naming.generator_cname, Naming.generator_cname))
closure_init_code = code.insertion_point()
# ----- Local variables
code.putln("PyObject *%s = NULL;" % Naming.retval_cname)
diff --git a/contrib/tools/cython/Cython/Utility/CythonFunction.c b/contrib/tools/cython/Cython/Utility/CythonFunction.c
index d51b308a8d..3226f88286 100644
--- a/contrib/tools/cython/Cython/Utility/CythonFunction.c
+++ b/contrib/tools/cython/Cython/Utility/CythonFunction.c
@@ -516,9 +516,9 @@ static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
PyObject_GC_Del(m);
}
-static void __Pyx_CyFunction_dealloc(PyObject *obj)
+static void __Pyx_CyFunction_dealloc(PyObject *obj)
{
- __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) obj;
+ __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) obj;
PyObject_GC_UnTrack(m);
__Pyx__CyFunction_dealloc(m);
}
diff --git a/contrib/tools/cython/cython.py b/contrib/tools/cython/cython.py
index f4f1486ecf..a001a4525b 100755
--- a/contrib/tools/cython/cython.py
+++ b/contrib/tools/cython/cython.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# Change content of this file to change uids for cython programs - cython 0.29.27 r0
-
+
#
# Cython -- Main Program, generic
#
diff --git a/library/cpp/blockcodecs/core/common.h b/library/cpp/blockcodecs/core/common.h
index f05df4d334..5944a08890 100644
--- a/library/cpp/blockcodecs/core/common.h
+++ b/library/cpp/blockcodecs/core/common.h
@@ -91,11 +91,11 @@ namespace NBlockCodecs {
const auto len = ReadUnaligned<ui64>(in.data());
- if (!len)
+ if (!len)
return 0;
- Base()->DoDecompress(TData(in).Skip(sizeof(len)), out, len);
- return len;
+ Base()->DoDecompress(TData(in).Skip(sizeof(len)), out, len);
+ return len;
}
inline const T* Base() const noexcept {
diff --git a/library/cpp/charset/codepage_ut.cpp b/library/cpp/charset/codepage_ut.cpp
index c3ac3ac478..350f886335 100644
--- a/library/cpp/charset/codepage_ut.cpp
+++ b/library/cpp/charset/codepage_ut.cpp
@@ -365,58 +365,58 @@ static void TestCanEncodeEach(const TWtringBuf& text, ECharset encoding, bool ex
void TCodepageTest::TestCanEncode() {
TestCanEncodeEmpty();
- const TUtf16String lat = u"AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz";
+ const TUtf16String lat = u"AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz";
TestCanEncodeEach(lat, CODES_WIN, true);
TestCanEncodeEach(lat, CODES_YANDEX, true);
TestCanEncodeEach(lat, CODES_UTF8, true);
- const TUtf16String rus = u"АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя";
+ const TUtf16String rus = u"АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя";
TestCanEncodeEach(rus, CODES_WIN, true);
TestCanEncodeEach(rus, CODES_YANDEX, true);
TestCanEncodeEach(rus, CODES_UTF8, true);
- const TUtf16String ukr = u"ҐґЄєІіЇї";
+ const TUtf16String ukr = u"ҐґЄєІіЇї";
TestCanEncodeEach(ukr, CODES_WIN, true);
TestCanEncodeEach(ukr, CODES_YANDEX, true);
TestCanEncodeEach(ukr, CODES_UTF8, true);
- const TUtf16String pol = u"ĄĆĘŁŃÓŚŹŻąćęłńóśźż";
+ const TUtf16String pol = u"ĄĆĘŁŃÓŚŹŻąćęłńóśźż";
TestCanEncodeEach(pol, CODES_WIN, false);
TestCanEncodeEach(pol, CODES_YANDEX, true);
TestCanEncodeEach(pol, CODES_UTF_16BE, true);
- const TUtf16String ger = u"ÄäÖöÜüß";
+ const TUtf16String ger = u"ÄäÖöÜüß";
TestCanEncodeEach(ger, CODES_WIN, false);
TestCanEncodeEach(ger, CODES_YANDEX, true);
TestCanEncodeEach(ger, CODES_UTF_16LE, true);
- const TUtf16String fra1 = u"éàèùâêîôûëïç"; // supported in yandex cp
- const TUtf16String fra2 = u"ÉÀÈÙÂÊÎÔÛËÏŸÿÇ";
- const TUtf16String fra3 = u"Æ挜";
+ const TUtf16String fra1 = u"éàèùâêîôûëïç"; // supported in yandex cp
+ const TUtf16String fra2 = u"ÉÀÈÙÂÊÎÔÛËÏŸÿÇ";
+ const TUtf16String fra3 = u"Æ挜";
TestCanEncodeEach(fra1 + fra2 + fra3, CODES_WIN, false);
TestCanEncodeEach(fra1, CODES_YANDEX, true);
TestCanEncodeEach(fra2 + fra3, CODES_YANDEX, false);
TestCanEncodeEach(fra1 + fra2 + fra3, CODES_UTF8, true);
- const TUtf16String kaz = u"ӘәҒғҚқҢңӨөҰұҮүҺһ";
+ const TUtf16String kaz = u"ӘәҒғҚқҢңӨөҰұҮүҺһ";
TestCanEncodeEach(kaz, CODES_WIN, false);
TestCanEncodeEach(kaz, CODES_YANDEX, false);
TestCanEncodeEach(kaz, CODES_UTF8, true);
TestCanEncodeEach(kaz, CODES_KAZWIN, true);
- const TUtf16String tur1 = u"ĞİŞğş";
- const TUtf16String tur = tur1 + u"ı";
+ const TUtf16String tur1 = u"ĞİŞğş";
+ const TUtf16String tur = tur1 + u"ı";
TestCanEncodeEach(tur, CODES_WIN, false);
TestCanEncodeEach(tur, CODES_YANDEX, false);
TestCanEncodeEach(tur, CODES_UTF8, true);
- const TUtf16String chi = u"新隶体新隸體";
+ const TUtf16String chi = u"新隶体新隸體";
TestCanEncodeEach(chi, CODES_WIN, false);
TestCanEncodeEach(chi, CODES_YANDEX, false);
TestCanEncodeEach(chi, CODES_UTF8, true);
TestCanEncodeEach(chi, CODES_UTF_16LE, true);
- const TUtf16String jap = u"漢字仮字交じり文";
+ const TUtf16String jap = u"漢字仮字交じり文";
TestCanEncodeEach(jap, CODES_WIN, false);
TestCanEncodeEach(jap, CODES_YANDEX, false);
TestCanEncodeEach(jap, CODES_UTF8, true);
diff --git a/library/cpp/containers/comptrie/comptrie_ut.cpp b/library/cpp/containers/comptrie/comptrie_ut.cpp
index 74bee09b5d..efd9154b76 100644
--- a/library/cpp/containers/comptrie/comptrie_ut.cpp
+++ b/library/cpp/containers/comptrie/comptrie_ut.cpp
@@ -1249,7 +1249,7 @@ void TCompactTrieTest::TestTrieForPairWtrokaVectorInt64() {
TVector<TVector<i64>> values = GetSampleVectorData<TVector<i64>>(10);
TVector<std::pair<TUtf16String, TVector<i64>>> data;
for (size_t i = 0; i < 10; i++)
- data.push_back(std::pair<TUtf16String, TVector<i64>>(keys[i] + u"_v", values[i]));
+ data.push_back(std::pair<TUtf16String, TVector<i64>>(keys[i] + u"_v", values[i]));
TestTrieWithContainers<std::pair<TUtf16String, TVector<i64>>>(keys, data, "pair-str-v-i64");
}
@@ -1273,9 +1273,9 @@ void TCompactTrieTest::TestFindLongestPrefixWithEmptyValue() {
TBufferOutput buffer;
{
TCompactTrieBuilder<wchar16, ui32> builder;
- builder.Add(u"", 42);
- builder.Add(u"yandex", 271828);
- builder.Add(u"ya", 31415);
+ builder.Add(u"", 42);
+ builder.Add(u"yandex", 271828);
+ builder.Add(u"ya", 31415);
builder.Save(buffer);
}
{
@@ -1283,11 +1283,11 @@ void TCompactTrieTest::TestFindLongestPrefixWithEmptyValue() {
size_t prefixLen = 123;
ui32 value = 0;
- UNIT_ASSERT(trie.FindLongestPrefix(u"google", &prefixLen, &value));
+ UNIT_ASSERT(trie.FindLongestPrefix(u"google", &prefixLen, &value));
UNIT_ASSERT(prefixLen == 0);
UNIT_ASSERT(value == 42);
- UNIT_ASSERT(trie.FindLongestPrefix(u"yahoo", &prefixLen, &value));
+ UNIT_ASSERT(trie.FindLongestPrefix(u"yahoo", &prefixLen, &value));
UNIT_ASSERT(prefixLen == 2);
UNIT_ASSERT(value == 31415);
}
@@ -1562,18 +1562,18 @@ void TCompactTrieTest::TestBuilderFindLongestPrefix(size_t keysCount, double bra
void TCompactTrieTest::TestBuilderFindLongestPrefixWithEmptyValue() {
TCompactTrieBuilder<wchar16, ui32> builder;
- builder.Add(u"", 42);
- builder.Add(u"yandex", 271828);
- builder.Add(u"ya", 31415);
+ builder.Add(u"", 42);
+ builder.Add(u"yandex", 271828);
+ builder.Add(u"ya", 31415);
size_t prefixLen = 123;
ui32 value = 0;
- UNIT_ASSERT(builder.FindLongestPrefix(u"google", &prefixLen, &value));
+ UNIT_ASSERT(builder.FindLongestPrefix(u"google", &prefixLen, &value));
UNIT_ASSERT_VALUES_EQUAL(prefixLen, 0);
UNIT_ASSERT_VALUES_EQUAL(value, 42);
- UNIT_ASSERT(builder.FindLongestPrefix(u"yahoo", &prefixLen, &value));
+ UNIT_ASSERT(builder.FindLongestPrefix(u"yahoo", &prefixLen, &value));
UNIT_ASSERT_VALUES_EQUAL(prefixLen, 2);
UNIT_ASSERT_VALUES_EQUAL(value, 31415);
diff --git a/library/cpp/digest/crc32c/crc32c_ut.cpp b/library/cpp/digest/crc32c/crc32c_ut.cpp
index aa31b83422..02d4c12fec 100644
--- a/library/cpp/digest/crc32c/crc32c_ut.cpp
+++ b/library/cpp/digest/crc32c/crc32c_ut.cpp
@@ -8,15 +8,15 @@ Y_UNIT_TEST_SUITE(TestCrc32c) {
}
Y_UNIT_TEST(TestUnaligned) {
- const TString str(1000, 'a');
- for (size_t substrLen = 0; substrLen <= str.length(); ++substrLen) {
- const ui32 crc = Crc32c(str.data(), substrLen);
- for (size_t offset = 1; offset + substrLen <= str.length(); ++offset) {
- UNIT_ASSERT_VALUES_EQUAL(Crc32c(str.data() + offset, substrLen), crc);
- }
- }
- }
-
+ const TString str(1000, 'a');
+ for (size_t substrLen = 0; substrLen <= str.length(); ++substrLen) {
+ const ui32 crc = Crc32c(str.data(), substrLen);
+ for (size_t offset = 1; offset + substrLen <= str.length(); ++offset) {
+ UNIT_ASSERT_VALUES_EQUAL(Crc32c(str.data() + offset, substrLen), crc);
+ }
+ }
+ }
+
Y_UNIT_TEST(TestExtend) {
UNIT_ASSERT_VALUES_EQUAL(Crc32cExtend(1, "abc", 3), ui32(2466950601));
}
diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp
index 640c10f5a5..ba6f2859f3 100644
--- a/library/cpp/protobuf/json/json2proto.cpp
+++ b/library/cpp/protobuf/json/json2proto.cpp
@@ -110,18 +110,18 @@ JsonString2Field(const NJson::TJsonValue& json,
reflection->SetString(&proto, &field, value);
}
-static const NProtoBuf::EnumValueDescriptor*
-FindEnumValue(const NProtoBuf::EnumDescriptor* enumField,
- TStringBuf target, bool (*equals)(TStringBuf, TStringBuf)) {
- for (int i = 0; i < enumField->value_count(); i++) {
- auto* valueDescriptor = enumField->value(i);
- if (equals(valueDescriptor->name(), target)) {
- return valueDescriptor;
- }
- }
- return nullptr;
-}
-
+static const NProtoBuf::EnumValueDescriptor*
+FindEnumValue(const NProtoBuf::EnumDescriptor* enumField,
+ TStringBuf target, bool (*equals)(TStringBuf, TStringBuf)) {
+ for (int i = 0; i < enumField->value_count(); i++) {
+ auto* valueDescriptor = enumField->value(i);
+ if (equals(valueDescriptor->name(), target)) {
+ return valueDescriptor;
+ }
+ }
+ return nullptr;
+}
+
static void
JsonEnum2Field(const NJson::TJsonValue& json,
google::protobuf::Message& proto,
@@ -148,7 +148,7 @@ JsonEnum2Field(const NJson::TJsonValue& json,
const auto& value = json.GetString();
if (config.EnumValueMode == NProtobufJson::TJson2ProtoConfig::EnumCaseInsensetive) {
enumFieldValue = FindEnumValue(enumField, value, AsciiEqualsIgnoreCase);
- } else if (config.EnumValueMode == NProtobufJson::TJson2ProtoConfig::EnumSnakeCaseInsensitive) {
+ } else if (config.EnumValueMode == NProtobufJson::TJson2ProtoConfig::EnumSnakeCaseInsensitive) {
enumFieldValue = FindEnumValue(enumField, value, NProtobufJson::EqualsIgnoringCaseAndUnderscores);
} else {
enumFieldValue = enumField->FindValueByName(value);
diff --git a/library/cpp/protobuf/json/json2proto.h b/library/cpp/protobuf/json/json2proto.h
index 4c33498dfa..5e7cff44b4 100644
--- a/library/cpp/protobuf/json/json2proto.h
+++ b/library/cpp/protobuf/json/json2proto.h
@@ -32,8 +32,8 @@ namespace NProtobufJson {
enum EnumValueMode {
EnumCaseSensetive = 0, // default
- EnumCaseInsensetive,
- EnumSnakeCaseInsensitive
+ EnumCaseInsensetive,
+ EnumSnakeCaseInsensitive
};
TSelf& SetFieldNameMode(FldNameMode mode) {
diff --git a/library/cpp/protobuf/json/ut/json2proto_ut.cpp b/library/cpp/protobuf/json/ut/json2proto_ut.cpp
index 0dfe57bc7a..377b1d7836 100644
--- a/library/cpp/protobuf/json/ut/json2proto_ut.cpp
+++ b/library/cpp/protobuf/json/ut/json2proto_ut.cpp
@@ -928,21 +928,21 @@ Y_UNIT_TEST(TestComplexMapAsObject_EnumStringCaseInsensetive) {
);
} // TestComplexMapAsObject_EnumStringCaseInsensetive
-Y_UNIT_TEST(TestComplexMapAsObject_EnumStringSnakeCaseInsensitive) {
- TestComplexMapAsObject(
- [](TComplexMapType& proto) {
- auto& items = *proto.MutableEnum();
- items["key1"] = EEnum::E_1;
- items["key2"] = EEnum::E_2;
- items["key3"] = EEnum::E_3;
- },
- R"_({"Enum":{"key1":"e1","key2":"_E_2_","key3":"e_3"}})_",
- TJson2ProtoConfig()
- .SetMapAsObject(true)
- .SetEnumValueMode(NProtobufJson::TJson2ProtoConfig::EnumSnakeCaseInsensitive)
- );
-} // TestComplexMapAsObject_EnumStringCaseInsensetive
-
+Y_UNIT_TEST(TestComplexMapAsObject_EnumStringSnakeCaseInsensitive) {
+ TestComplexMapAsObject(
+ [](TComplexMapType& proto) {
+ auto& items = *proto.MutableEnum();
+ items["key1"] = EEnum::E_1;
+ items["key2"] = EEnum::E_2;
+ items["key3"] = EEnum::E_3;
+ },
+ R"_({"Enum":{"key1":"e1","key2":"_E_2_","key3":"e_3"}})_",
+ TJson2ProtoConfig()
+ .SetMapAsObject(true)
+ .SetEnumValueMode(NProtobufJson::TJson2ProtoConfig::EnumSnakeCaseInsensitive)
+ );
+} // TestComplexMapAsObject_EnumStringCaseInsensetive
+
Y_UNIT_TEST(TestComplexMapAsObject_Float) {
TestComplexMapAsObject(
[](TComplexMapType& proto) {
diff --git a/library/cpp/protobuf/json/ut/util_ut.cpp b/library/cpp/protobuf/json/ut/util_ut.cpp
index 05101dca28..0d22ce86d4 100644
--- a/library/cpp/protobuf/json/ut/util_ut.cpp
+++ b/library/cpp/protobuf/json/ut/util_ut.cpp
@@ -1,42 +1,42 @@
-#include <library/cpp/protobuf/json/util.h>
-
-#include <library/cpp/testing/unittest/registar.h>
-
-using namespace NProtobufJson;
-
-Y_UNIT_TEST_SUITE(TEqualsTest) {
- Y_UNIT_TEST(TestEmpty) {
- UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("", ""));
- UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("", "_"));
- UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("f", ""));
- }
-
- Y_UNIT_TEST(TestTrivial) {
- UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("f", "f"));
- UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("f", "o"));
- UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("fo", "f"));
- UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("f", "fo"));
- UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("bar", "baz"));
- }
-
- Y_UNIT_TEST(TestUnderscores) {
- UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo_bar", "foobar"));
- UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo_bar_", "foobar"));
- UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("foo_bar_z", "foobar"));
- UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo__bar__", "foobar"));
- UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("foo__bar__z", "foobar"));
- UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("_foo_bar", "foobar"));
- UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("_foo_bar_", "foobar"));
- UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("_foo_bar_", "foo___bar"));
- }
-
- Y_UNIT_TEST(TestCase) {
- UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo_bar", "FOO_BAR"));
- UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foobar", "fooBar"));
- }
-
- Y_UNIT_TEST(TestCaseAndUnderscores) {
- UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("fooBar", "FOO_BAR"));
- UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("FOO_BAR_BAZ", "fooBar_BAZ"));
- }
-}
+#include <library/cpp/protobuf/json/util.h>
+
+#include <library/cpp/testing/unittest/registar.h>
+
+using namespace NProtobufJson;
+
+Y_UNIT_TEST_SUITE(TEqualsTest) {
+ Y_UNIT_TEST(TestEmpty) {
+ UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("", ""));
+ UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("", "_"));
+ UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("f", ""));
+ }
+
+ Y_UNIT_TEST(TestTrivial) {
+ UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("f", "f"));
+ UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("f", "o"));
+ UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("fo", "f"));
+ UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("f", "fo"));
+ UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("bar", "baz"));
+ }
+
+ Y_UNIT_TEST(TestUnderscores) {
+ UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo_bar", "foobar"));
+ UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo_bar_", "foobar"));
+ UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("foo_bar_z", "foobar"));
+ UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo__bar__", "foobar"));
+ UNIT_ASSERT(!EqualsIgnoringCaseAndUnderscores("foo__bar__z", "foobar"));
+ UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("_foo_bar", "foobar"));
+ UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("_foo_bar_", "foobar"));
+ UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("_foo_bar_", "foo___bar"));
+ }
+
+ Y_UNIT_TEST(TestCase) {
+ UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foo_bar", "FOO_BAR"));
+ UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("foobar", "fooBar"));
+ }
+
+ Y_UNIT_TEST(TestCaseAndUnderscores) {
+ UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("fooBar", "FOO_BAR"));
+ UNIT_ASSERT(EqualsIgnoringCaseAndUnderscores("FOO_BAR_BAZ", "fooBar_BAZ"));
+ }
+}
diff --git a/library/cpp/protobuf/json/ut/ya.make b/library/cpp/protobuf/json/ut/ya.make
index b60a6d3c17..966d481639 100644
--- a/library/cpp/protobuf/json/ut/ya.make
+++ b/library/cpp/protobuf/json/ut/ya.make
@@ -11,7 +11,7 @@ SRCS(
string_transform_ut.cpp
filter_ut.proto
test.proto
- util_ut.cpp
+ util_ut.cpp
)
GENERATE_ENUM_SERIALIZATION(test.pb.h)
diff --git a/library/cpp/protobuf/json/util.cpp b/library/cpp/protobuf/json/util.cpp
index 53a065eee2..c0c90c0e5c 100644
--- a/library/cpp/protobuf/json/util.cpp
+++ b/library/cpp/protobuf/json/util.cpp
@@ -39,7 +39,7 @@ namespace {
}
}
}
-
+
namespace NProtobufJson {
void ToSnakeCase(TString* const name) {
ToSnakeCaseImpl(name, [](const char prev) { return prev != '_'; });
@@ -49,28 +49,28 @@ namespace NProtobufJson {
ToSnakeCaseImpl(name, [](const char prev) { return prev != '_' && !IsAsciiUpper(prev); });
}
- bool EqualsIgnoringCaseAndUnderscores(TStringBuf s1, TStringBuf s2) {
- size_t i1 = 0, i2 = 0;
-
- while (i1 < s1.size() && i2 < s2.size()) {
- if (s1[i1] == '_') {
- ++i1;
- } else if (s2[i2] == '_') {
- ++i2;
- } else if (AsciiToUpper(s1[i1]) != AsciiToUpper(s2[i2])) {
- return false;
- } else {
- ++i1, ++i2;
- }
- }
-
- while (i1 < s1.size() && s1[i1] == '_') {
- ++i1;
- }
- while (i2 < s2.size() && s2[i2] == '_') {
- ++i2;
- }
-
- return (i1 == s1.size() && i2 == s2.size());
- }
+ bool EqualsIgnoringCaseAndUnderscores(TStringBuf s1, TStringBuf s2) {
+ size_t i1 = 0, i2 = 0;
+
+ while (i1 < s1.size() && i2 < s2.size()) {
+ if (s1[i1] == '_') {
+ ++i1;
+ } else if (s2[i2] == '_') {
+ ++i2;
+ } else if (AsciiToUpper(s1[i1]) != AsciiToUpper(s2[i2])) {
+ return false;
+ } else {
+ ++i1, ++i2;
+ }
+ }
+
+ while (i1 < s1.size() && s1[i1] == '_') {
+ ++i1;
+ }
+ while (i2 < s2.size() && s2[i2] == '_') {
+ ++i2;
+ }
+
+ return (i1 == s1.size() && i2 == s2.size());
+ }
}
diff --git a/library/cpp/protobuf/json/util.h b/library/cpp/protobuf/json/util.h
index d93342d3f8..7ee2405afd 100644
--- a/library/cpp/protobuf/json/util.h
+++ b/library/cpp/protobuf/json/util.h
@@ -4,11 +4,11 @@
namespace NProtobufJson {
void ToSnakeCase(TString* const name);
-
+
void ToSnakeCaseDense(TString* const name);
- /**
- * "FOO_BAR" ~ "foo_bar" ~ "fooBar"
- */
- bool EqualsIgnoringCaseAndUnderscores(TStringBuf s1, TStringBuf s2);
+ /**
+ * "FOO_BAR" ~ "foo_bar" ~ "fooBar"
+ */
+ bool EqualsIgnoringCaseAndUnderscores(TStringBuf s1, TStringBuf s2);
}
diff --git a/library/cpp/unicode/punycode/punycode.cpp b/library/cpp/unicode/punycode/punycode.cpp
index 800d1f19fe..adbb80ad53 100644
--- a/library/cpp/unicode/punycode/punycode.cpp
+++ b/library/cpp/unicode/punycode/punycode.cpp
@@ -19,7 +19,7 @@ static inline void CheckIdnaResult(int rc) {
// UTF-32 helpers
-static inline void AppendWideToUtf32(const TWtringBuf& in, TVector<ui32>& out) {
+static inline void AppendWideToUtf32(const TWtringBuf& in, TVector<ui32>& out) {
out.reserve(out.size() + in.size() + 1);
const wchar16* b = in.begin();
@@ -29,18 +29,18 @@ static inline void AppendWideToUtf32(const TWtringBuf& in, TVector<ui32>& out) {
}
}
-static inline void AppendUtf32ToWide(const ui32* in, size_t len, TUtf16String& out) {
+static inline void AppendUtf32ToWide(const ui32* in, size_t len, TUtf16String& out) {
out.reserve(out.size() + len);
- const ui32* b = in;
- const ui32* e = in + len;
+ const ui32* b = in;
+ const ui32* e = in + len;
for (; b != e; ++b) {
- WriteSymbol(wchar32(*b), out);
+ WriteSymbol(wchar32(*b), out);
}
}
TStringBuf WideToPunycode(const TWtringBuf& in16, TString& out) {
- TVector<ui32> in32;
+ TVector<ui32> in32;
AppendWideToUtf32(in16, in32);
size_t outlen = in32.size();
@@ -59,7 +59,7 @@ TStringBuf WideToPunycode(const TWtringBuf& in16, TString& out) {
TWtringBuf PunycodeToWide(const TStringBuf& in, TUtf16String& out16) {
size_t outlen = in.size();
- TVector<ui32> out32(outlen);
+ TVector<ui32> out32(outlen);
int rc = punycode_decode(in.size(), in.data(), &outlen, out32.begin(), nullptr);
CheckPunycodeResult(rc);
@@ -80,7 +80,7 @@ namespace {
}
TString HostNameToPunycode(const TWtringBuf& unicodeHost) {
- TVector<ui32> in32;
+ TVector<ui32> in32;
AppendWideToUtf32(unicodeHost, in32);
in32.push_back(0);
@@ -96,12 +96,12 @@ TUtf16String PunycodeToHostName(const TStringBuf& punycodeHost) {
ythrow TPunycodeError() << "Non-ASCII punycode input";
size_t len = punycodeHost.size();
- TVector<ui32> in32(len + 1, 0);
+ TVector<ui32> in32(len + 1, 0);
for (size_t i = 0; i < len; ++i)
in32[i] = static_cast<ui8>(punycodeHost[i]);
in32[len] = 0;
- TIdnaResult<ui32> out;
+ TIdnaResult<ui32> out;
int rc = idna_to_unicode_4z4z(in32.begin(), &out.Data, 0);
CheckIdnaResult(rc);
diff --git a/library/cpp/uri/uri-ru_ut.cpp b/library/cpp/uri/uri-ru_ut.cpp
index ec35a164d2..3fca250dcf 100644
--- a/library/cpp/uri/uri-ru_ut.cpp
+++ b/library/cpp/uri/uri-ru_ut.cpp
@@ -4,15 +4,15 @@
#include <util/system/maxlen.h>
namespace NUri {
- namespace {
- TString AsWin1251(const TString& s) {
- return Recode(CODES_UTF8, CODES_WIN, s);
- }
- TString AsKoi8(const TString& s) {
- return Recode(CODES_UTF8, CODES_KOI8, s);
- }
- }
-
+ namespace {
+ TString AsWin1251(const TString& s) {
+ return Recode(CODES_UTF8, CODES_WIN, s);
+ }
+ TString AsKoi8(const TString& s) {
+ return Recode(CODES_UTF8, CODES_KOI8, s);
+ }
+ }
+
Y_UNIT_TEST_SUITE(URLTestRU) {
Y_UNIT_TEST(test_httpURL2) {
TUri url;
@@ -37,19 +37,19 @@ namespace NUri {
UNIT_ASSERT(!url.IsNull(TField::FlagPath));
UNIT_ASSERT_VALUES_EQUAL(url.PrintS(TField::FlagPath), "www.ya.ru/index.html");
- UNIT_ASSERT_VALUES_EQUAL(url.Parse(AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10")), TState::ParsedOK);
- UNIT_ASSERT_VALUES_EQUAL(url.PrintS(), AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10"));
+ UNIT_ASSERT_VALUES_EQUAL(url.Parse(AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10")), TState::ParsedOK);
+ UNIT_ASSERT_VALUES_EQUAL(url.PrintS(), AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10"));
- UNIT_ASSERT_VALUES_EQUAL(url.Parse(AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10"),
+ UNIT_ASSERT_VALUES_EQUAL(url.Parse(AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10"),
TFeature::FeaturesDefault | TFeature::FeatureEncodeExtendedASCII),
TState::ParsedOK);
UNIT_ASSERT_VALUES_EQUAL(url.PrintS(),
- AsWin1251("www.TEST.Ru/%D4%C5%D3%D4\\'\".html?%D4%C5%D3%D4\\'\"=%D4%C5%D3%D4+\\'\"%10"));
+ AsWin1251("www.TEST.Ru/%D4%C5%D3%D4\\'\".html?%D4%C5%D3%D4\\'\"=%D4%C5%D3%D4+\\'\"%10"));
- UNIT_ASSERT_VALUES_EQUAL(url.Parse(AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10"),
+ UNIT_ASSERT_VALUES_EQUAL(url.Parse(AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10"),
TFeature::FeaturesDefault | TFeature::FeatureEncodeForSQL),
TState::ParsedOK);
- UNIT_ASSERT_VALUES_EQUAL(url.PrintS(), AsWin1251("www.TEST.Ru/ФЕУФ%5C%27%22.html?ФЕУФ%5C%27%22=ФЕУФ+%5C%27%22%10"));
+ UNIT_ASSERT_VALUES_EQUAL(url.PrintS(), AsWin1251("www.TEST.Ru/ФЕУФ%5C%27%22.html?ФЕУФ%5C%27%22=ФЕУФ+%5C%27%22%10"));
UNIT_ASSERT_VALUES_EQUAL(url.Parse("q/%33%26%13%2f%2b%30%20",
TFeature::FeaturesDefault | TFeature::FeatureDecodeStandard),
@@ -62,7 +62,7 @@ namespace NUri {
UNIT_ASSERT_VALUES_EQUAL(url.Parse("//server/path", TFeature::FeaturesRobot), TState::ParsedOK);
}
- const TString links[] = {
+ const TString links[] = {
"viewforum.php?f=1&amp;sid=b4568481b67b1d7683bea78634b2e240", "viewforum.php?f=1&sid=b4568481b67b1d7683bea78634b2e240",
"./viewtopic.php?p=74&amp;sid=6#p74", "./viewtopic.php?p=74&sid=6#p74",
"viewtopic.php?p=9313&amp;sid=8#9313", "viewtopic.php?p=9313&sid=8#9313",
@@ -71,12 +71,12 @@ namespace NUri {
"images\nil.jpg", "images%0Ail.jpg",
"http://caedebaturque.termez.su\r\n/?article=218", "http://caedebaturque.termez.su%0D%0A/?article=218",
- AsKoi8("javascript:window.external.AddFavorite(\'http://www.humor.look.ru/\',\'Злобные Деды Морозы!!!\')"), "javascript:window.external.AddFavorite(\'http://www.humor.look.ru/\',\'%FA%CC%CF%C2%CE%D9%C5%20%E4%C5%C4%D9%20%ED%CF%D2%CF%DA%D9!!!\')",
+ AsKoi8("javascript:window.external.AddFavorite(\'http://www.humor.look.ru/\',\'Злобные Деды Морозы!!!\')"), "javascript:window.external.AddFavorite(\'http://www.humor.look.ru/\',\'%FA%CC%CF%C2%CE%D9%C5%20%E4%C5%C4%D9%20%ED%CF%D2%CF%DA%D9!!!\')",
"search.php?search_author=%CB%FE%E4%EC%E8%EB%E0+%C3%F3%F1%E5%E2%E0&amp;showresults=posts&amp;sid=8", "search.php?search_author=%CB%FE%E4%EC%E8%EB%E0+%C3%F3%F1%E5%E2%E0&showresults=posts&sid=8",
- AsWin1251("/Search/author/?q=Штрибель Х.В."), "/Search/author/?q=%D8%F2%F0%E8%E1%E5%EB%FC%20%D5.%C2.",
- AsWin1251("javascript:ins(\'ГОРШОК\')"), "javascript:ins(\'%C3%CE%D0%D8%CE%CA\')",
- AsWin1251("?l=я"), "?l=%FF",
- AsWin1251("content.php?id=3392&theme=Цена"), "content.php?id=3392&theme=%D6%E5%ED%E0",
+ AsWin1251("/Search/author/?q=Штрибель Х.В."), "/Search/author/?q=%D8%F2%F0%E8%E1%E5%EB%FC%20%D5.%C2.",
+ AsWin1251("javascript:ins(\'ГОРШОК\')"), "javascript:ins(\'%C3%CE%D0%D8%CE%CA\')",
+ AsWin1251("?l=я"), "?l=%FF",
+ AsWin1251("content.php?id=3392&theme=Цена"), "content.php?id=3392&theme=%D6%E5%ED%E0",
"/a-mp3/stype-1/?search=А", "/a-mp3/stype-1/?search=%D0%90",
"/a-mp3/stype-1/?search=Б", "/a-mp3/stype-1/?search=%D0%91",
"/a-mp3/stype-1/?search=В", "/a-mp3/stype-1/?search=%D0%92",
@@ -86,7 +86,7 @@ namespace NUri {
"/a-mp3/stype-1/?search=Ж", "/a-mp3/stype-1/?search=%D0%96",
"/a-mp3/stype-1/?search=З", "/a-mp3/stype-1/?search=%D0%97",
// %98 is not defined in CP1251 so don't put it here explicitly
- "/a-mp3/stype-1/?search=\xD0\x98", "/a-mp3/stype-1/?search=%D0%98",
+ "/a-mp3/stype-1/?search=\xD0\x98", "/a-mp3/stype-1/?search=%D0%98",
"/a-mp3/stype-1/?search=Й", "/a-mp3/stype-1/?search=%D0%99",
"/a-mp3/stype-1/?search=К", "/a-mp3/stype-1/?search=%D0%9A",
"/a-mp3/stype-1/?search=Л", "/a-mp3/stype-1/?search=%D0%9B",
@@ -94,7 +94,7 @@ namespace NUri {
"/a-mp3/stype-1/?search=Н", "/a-mp3/stype-1/?search=%D0%9D",
"/a-mp3/stype-1/?search=О", "/a-mp3/stype-1/?search=%D0%9E",
"/a-mp3/stype-1/?search=П", "/a-mp3/stype-1/?search=%D0%9F",
- "/a-mp3/stype-1/?search=\xD0", "/a-mp3/stype-1/?search=%D0",
+ "/a-mp3/stype-1/?search=\xD0", "/a-mp3/stype-1/?search=%D0",
"/a-mp3/stype-1/?search=С", "/a-mp3/stype-1/?search=%D0%A1",
"/a-mp3/stype-1/?search=Т", "/a-mp3/stype-1/?search=%D0%A2",
"/a-mp3/stype-1/?search=У", "/a-mp3/stype-1/?search=%D0%A3",
@@ -117,20 +117,20 @@ namespace NUri {
"http&#58;//www.is-ufa.ru/price2/price_IS.rar", "http://www.is-ufa.ru/price2/price_IS.rar",
"&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#105;&#110;&#102;&#111;&#64;&#101;&#116;&#101;&#109;&#46;&#100;&#101;", "mailto:info@etem.de",
"&quot;http://www.fubix.ru&quot;", "\"http://www.fubix.ru\"",
- AsWin1251("mailto:&#107;&#97;&#109;&#112;&#97;&#64;&#117;&#107;&#114;&#46;&#110;&#101;&#116;?subject=Арабский язык"), "mailto:kampa@ukr.net?subject=%C0%F0%E0%E1%F1%EA%E8%E9%20%FF%E7%FB%EA",
- {}};
+ AsWin1251("mailto:&#107;&#97;&#109;&#112;&#97;&#64;&#117;&#107;&#114;&#46;&#110;&#101;&#116;?subject=Арабский язык"), "mailto:kampa@ukr.net?subject=%C0%F0%E0%E1%F1%EA%E8%E9%20%FF%E7%FB%EA",
+ {}};
Y_UNIT_TEST(testHtLinkDecode) {
char decodedlink[URL_MAXLEN + 10];
for (int i = 0; links[i]; i += 2) {
- UNIT_ASSERT(HtLinkDecode(links[i].c_str(), decodedlink, sizeof(decodedlink)));
- UNIT_ASSERT_VALUES_EQUAL(decodedlink, links[i + 1]);
+ UNIT_ASSERT(HtLinkDecode(links[i].c_str(), decodedlink, sizeof(decodedlink)));
+ UNIT_ASSERT_VALUES_EQUAL(decodedlink, links[i + 1]);
}
}
Y_UNIT_TEST(testRuIDNA) {
{
-#define DEC "\xD7\xE5\xF0\xE5\xEf\xEE\xE2\xE5\xF6.\xF0\xF4" /* "Череповец.рф" in Windows-1251 */
+#define DEC "\xD7\xE5\xF0\xE5\xEf\xEE\xE2\xE5\xF6.\xF0\xF4" /* "Череповец.рф" in Windows-1251 */
#define ENC "%D7%E5%F0%E5%EF%EE%E2%E5%F6.%F0%F4"
// punycode corresponds to lowercase
#define PNC "xn--b1afab7bff7cb.xn--p1ai"
diff --git a/library/cpp/xml/document/libxml-guards.h b/library/cpp/xml/document/libxml-guards.h
index 4188cecff1..479ce285e5 100644
--- a/library/cpp/xml/document/libxml-guards.h
+++ b/library/cpp/xml/document/libxml-guards.h
@@ -40,7 +40,7 @@ namespace NXml {
typedef TxmlXPathObjectPtr TXPathObjectPtr;
typedef TAutoPtr<char, NDetail::TSignedCharPtrTraits> TSignedCharPtr;
typedef TAutoPtr<xmlChar, NDetail::TCharPtrTraits> TCharPtr;
- typedef TxmlDocHolder TDocHolder;
+ typedef TxmlDocHolder TDocHolder;
typedef TxmlURIPtr TURIPtr;
typedef TxmlNodePtr TNodePtr;
typedef TAutoPtr<xmlOutputBuffer, NDetail::TOutputBufferPtrTraits> TOutputBufferPtr;
diff --git a/library/cpp/xml/document/ut/ya.make b/library/cpp/xml/document/ut/ya.make
index e955448c66..9a7213baa0 100644
--- a/library/cpp/xml/document/ut/ya.make
+++ b/library/cpp/xml/document/ut/ya.make
@@ -4,7 +4,7 @@ OWNER(finder)
SRCS(
xml-document_ut.cpp
- xml-textreader_ut.cpp
+ xml-textreader_ut.cpp
xml-options_ut.cpp
)
diff --git a/library/cpp/xml/document/xml-document-decl.h b/library/cpp/xml/document/xml-document-decl.h
index bfda1fb7e6..cde87a311b 100644
--- a/library/cpp/xml/document/xml-document-decl.h
+++ b/library/cpp/xml/document/xml-document-decl.h
@@ -15,8 +15,8 @@ namespace NXml {
class TConstNodes;
class TConstNode;
- using TXPathContext = xmlXPathContext;
-
+ using TXPathContext = xmlXPathContext;
+
class TDocument {
public:
enum Source {
@@ -35,11 +35,11 @@ namespace NXml {
TDocument(const TString& source, Source type = File);
public:
- TDocument(const TDocument& that) = delete;
- TDocument& operator=(const TDocument& that) = delete;
+ TDocument(const TDocument& that) = delete;
+ TDocument& operator=(const TDocument& that) = delete;
- TDocument(TDocument&& that);
- TDocument& operator=(TDocument&& that);
+ TDocument(TDocument&& that);
+ TDocument& operator=(TDocument&& that);
/**
* get root element
@@ -74,12 +74,12 @@ namespace NXml {
void ParseFile(const TString& file);
void ParseString(TZtStringBuf xml);
- TDocument(TDocHolder doc)
- : Doc(std::move(doc))
+ TDocument(TDocHolder doc)
+ : Doc(std::move(doc))
{
}
- TDocHolder Doc;
+ TDocHolder Doc;
};
struct TNamespaceForXPath {
@@ -150,7 +150,7 @@ namespace NXml {
friend class TConstNode;
friend class TNode;
- TConstNodes(xmlDoc* doc, TXPathObjectPtr obj);
+ TConstNodes(xmlDoc* doc, TXPathObjectPtr obj);
size_t SizeValue;
xmlDoc* Doc;
@@ -161,7 +161,7 @@ namespace NXml {
public:
friend class TDocument;
friend class TConstNode;
- friend class TTextReader;
+ friend class TTextReader;
/**
* check if node is null
@@ -174,18 +174,18 @@ namespace NXml {
bool IsElementNode() const;
/**
- * Create xpath context to be used later for fast xpath evaluation.
- * @param nss: explicitly specify XML namespaces to use and their prefixes
- *
- * For better performance, when you need to evaluate several xpath expressions,
- * it makes sense to create a context, load namespace prefixes once
- * and use the context several times in Node(), Nodes(), XPath() function calls for several nodes.
- * The context may be used with any node of the current document, but
- * cannot be shared between different XML documents.
- */
- TXPathContextPtr CreateXPathContext(const TNamespacesForXPath& nss = TNamespacesForXPath()) const;
-
- /**
+ * Create xpath context to be used later for fast xpath evaluation.
+ * @param nss: explicitly specify XML namespaces to use and their prefixes
+ *
+ * For better performance, when you need to evaluate several xpath expressions,
+ * it makes sense to create a context, load namespace prefixes once
+ * and use the context several times in Node(), Nodes(), XPath() function calls for several nodes.
+ * The context may be used with any node of the current document, but
+ * cannot be shared between different XML documents.
+ */
+ TXPathContextPtr CreateXPathContext(const TNamespacesForXPath& nss = TNamespacesForXPath()) const;
+
+ /**
* get all element nodes matching given xpath expression
* @param xpath: xpath expression
* @param quiet: don't throw exception if zero nodes found
@@ -197,17 +197,17 @@ namespace NXml {
TConstNodes Nodes(TZtStringBuf xpath, bool quiet = false, const TNamespacesForXPath& ns = TNamespacesForXPath()) const;
/**
- * get all element nodes matching given xpath expression
- * @param xpath: xpath expression
- * @param quiet: don't throw exception if zero nodes found
- * @param ctxt: reusable xpath context
- *
- * For historical reasons, this only works for *element* nodes.
- * Use the XPath function if you need other kinds of nodes.
- */
+ * get all element nodes matching given xpath expression
+ * @param xpath: xpath expression
+ * @param quiet: don't throw exception if zero nodes found
+ * @param ctxt: reusable xpath context
+ *
+ * For historical reasons, this only works for *element* nodes.
+ * Use the XPath function if you need other kinds of nodes.
+ */
TConstNodes Nodes(TZtStringBuf xpath, bool quiet, TXPathContext& ctxt) const;
-
- /**
+
+ /**
* get all nodes matching given xpath expression
* @param xpath: xpath expression
* @param quiet: don't throw exception if zero nodes found
@@ -216,18 +216,18 @@ namespace NXml {
TConstNodes XPath(TZtStringBuf xpath, bool quiet = false, const TNamespacesForXPath& ns = TNamespacesForXPath()) const;
/**
- * get all nodes matching given xpath expression
- * @param xpath: xpath expression
- * @param quiet: don't throw exception if zero nodes found
- * @param ctxt: reusable xpath context
- */
+ * get all nodes matching given xpath expression
+ * @param xpath: xpath expression
+ * @param quiet: don't throw exception if zero nodes found
+ * @param ctxt: reusable xpath context
+ */
TConstNodes XPath(TZtStringBuf xpath, bool quiet, TXPathContext& ctxt) const;
-
- /**
+
+ /**
* get the first element node matching given xpath expression
* @param xpath: path to node (from current node)
* @param quiet: don't throw exception if node not found,
- * return null node (@see IsNull())
+ * return null node (@see IsNull())
* @param ns: explicitly specify XML namespaces to use and their prefixes
*
* For historical reasons, this only works for *element* nodes.
@@ -238,23 +238,23 @@ namespace NXml {
TConstNode Node(TZtStringBuf xpath, bool quiet = false, const TNamespacesForXPath& ns = TNamespacesForXPath()) const;
/**
- * get the first element node matching given xpath expression
- * @param xpath: path to node (from current node)
- * @param quiet: don't throw exception if node not found,
- * return null node (@see IsNull())
- * @param ctxt: reusable xpath context
- *
- * For historical reasons, this only works for *element* nodes.
- * Use the XPath function if you need other kinds of nodes.
- */
+ * get the first element node matching given xpath expression
+ * @param xpath: path to node (from current node)
+ * @param quiet: don't throw exception if node not found,
+ * return null node (@see IsNull())
+ * @param ctxt: reusable xpath context
+ *
+ * For historical reasons, this only works for *element* nodes.
+ * Use the XPath function if you need other kinds of nodes.
+ */
TNode Node(TZtStringBuf xpath, bool quiet, TXPathContext& ctxt);
TConstNode Node(TZtStringBuf xpath, bool quiet, TXPathContext& ctxt) const;
-
- /**
+
+ /**
* get node first child
* @param name: child name
- * @note if name is empty, returns the first child node of type "element"
- * @note returns null node if no child found
+ * @note if name is empty, returns the first child node of type "element"
+ * @note returns null node if no child found
*/
TNode FirstChild(TZtStringBuf name);
TConstNode FirstChild(TZtStringBuf name) const;
@@ -272,8 +272,8 @@ namespace NXml {
/**
* get node neighbour
* @param name: neighbour name
- * @note if name is empty, returns the next sibling node of type "element"
- * @node returns null node if no neighbour found
+ * @note if name is empty, returns the next sibling node of type "element"
+ * @node returns null node if no neighbour found
*/
TNode NextSibling(TZtStringBuf name);
TConstNode NextSibling(TZtStringBuf name) const;
@@ -495,18 +495,18 @@ namespace NXml {
}
/**
- * Create xpath context to be used later for fast xpath evaluation.
- * @param nss: explicitly specify XML namespaces to use and their prefixes
- */
+ * Create xpath context to be used later for fast xpath evaluation.
+ * @param nss: explicitly specify XML namespaces to use and their prefixes
+ */
TXPathContextPtr CreateXPathContext(const TNamespacesForXPath& nss = TNamespacesForXPath()) const {
- return ActualNode.CreateXPathContext(nss);
- }
-
- /**
+ return ActualNode.CreateXPathContext(nss);
+ }
+
+ /**
* get all element nodes matching given xpath expression
* @param xpath: xpath expression
* @param quiet: don't throw exception if zero nodes found
- * @param ns: explicitly specify XML namespaces to use and their prefixes
+ * @param ns: explicitly specify XML namespaces to use and their prefixes
*
* For historical reasons, this only works for *element* nodes.
* Use the XPath function if you need other kinds of nodes.
@@ -516,44 +516,44 @@ namespace NXml {
}
/**
- * get all element nodes matching given xpath expression
- * @param xpath: xpath expression
- * @param quiet: don't throw exception if zero nodes found
- * @param ctxt: reusable xpath context
- *
- * For historical reasons, this only works for *element* nodes.
- * Use the XPath function if you need other kinds of nodes.
- */
+ * get all element nodes matching given xpath expression
+ * @param xpath: xpath expression
+ * @param quiet: don't throw exception if zero nodes found
+ * @param ctxt: reusable xpath context
+ *
+ * For historical reasons, this only works for *element* nodes.
+ * Use the XPath function if you need other kinds of nodes.
+ */
TConstNodes Nodes(TZtStringBuf xpath, bool quiet, TXPathContext& ctxt) const {
- return ActualNode.Nodes(xpath, quiet, ctxt);
- }
-
- /**
+ return ActualNode.Nodes(xpath, quiet, ctxt);
+ }
+
+ /**
* get all nodes matching given xpath expression
* @param xpath: xpath expression
* @param quiet: don't throw exception if zero nodes found
- * @param ns: explicitly specify XML namespaces to use and their prefixes
+ * @param ns: explicitly specify XML namespaces to use and their prefixes
*/
TConstNodes XPath(TZtStringBuf xpath, bool quiet = false, const TNamespacesForXPath& ns = TNamespacesForXPath()) const {
return ActualNode.XPath(xpath, quiet, ns);
}
/**
- * get all nodes matching given xpath expression
- * @param xpath: xpath expression
- * @param quiet: don't throw exception if zero nodes found
- * @param ctxt: reusable xpath context
- */
+ * get all nodes matching given xpath expression
+ * @param xpath: xpath expression
+ * @param quiet: don't throw exception if zero nodes found
+ * @param ctxt: reusable xpath context
+ */
TConstNodes XPath(TZtStringBuf xpath, bool quiet, TXPathContext& ctxt) const {
- return ActualNode.XPath(xpath, quiet, ctxt);
- }
-
- /**
+ return ActualNode.XPath(xpath, quiet, ctxt);
+ }
+
+ /**
* get the first element node matching given xpath expression
* @param xpath: path to node (from current node)
* @param quiet: don't throw exception if node not found,
- * return null node (@see IsNull())
- * @param ns: explicitly specify XML namespaces to use and their prefixes
+ * return null node (@see IsNull())
+ * @param ns: explicitly specify XML namespaces to use and their prefixes
*
* For historical reasons, this only works for *element* nodes.
* Use the XPath function if you need other kinds of nodes.
@@ -562,20 +562,20 @@ namespace NXml {
return ActualNode.Node(xpath, quiet, ns);
}
- /**
- * get the first element node matching given xpath expression
- * @param xpath: path to node (from current node)
- * @param quiet: don't throw exception if node not found,
- * return null node (@see IsNull())
- * @param ctxt: reusable xpath context
- *
- * For historical reasons, this only works for *element* nodes.
- * Use the XPath function if you need other kinds of nodes.
- */
+ /**
+ * get the first element node matching given xpath expression
+ * @param xpath: path to node (from current node)
+ * @param quiet: don't throw exception if node not found,
+ * return null node (@see IsNull())
+ * @param ctxt: reusable xpath context
+ *
+ * For historical reasons, this only works for *element* nodes.
+ * Use the XPath function if you need other kinds of nodes.
+ */
TConstNode Node(TZtStringBuf xpath, bool quiet, TXPathContext& ctxt) const {
- return ActualNode.Node(xpath, quiet, ctxt);
- }
-
+ return ActualNode.Node(xpath, quiet, ctxt);
+ }
+
TConstNode FirstChild(TZtStringBuf name) const {
return ActualNode.FirstChild(name);
}
diff --git a/library/cpp/xml/document/xml-document.cpp b/library/cpp/xml/document/xml-document.cpp
index 18a554d732..6907217a14 100644
--- a/library/cpp/xml/document/xml-document.cpp
+++ b/library/cpp/xml/document/xml-document.cpp
@@ -26,7 +26,7 @@ namespace NXml {
ParseString(xml);
break;
case RootName: {
- TDocHolder doc(xmlNewDoc(XMLCHAR("1.0")));
+ TDocHolder doc(xmlNewDoc(XMLCHAR("1.0")));
if (!doc)
THROW(XmlException, "Can't create xml document.");
doc->encoding = xmlStrdup(XMLCHAR("utf-8"));
@@ -36,21 +36,21 @@ namespace NXml {
THROW(XmlException, "Can't create root node.");
xmlDocSetRootElement(doc.Get(), node.Get());
Y_UNUSED(node.Release());
- Doc = std::move(doc);
+ Doc = std::move(doc);
} break;
default:
THROW(InvalidArgument, "Wrong source type");
}
}
- TDocument::TDocument(TDocument&& doc)
- : Doc(std::move(doc.Doc))
+ TDocument::TDocument(TDocument&& doc)
+ : Doc(std::move(doc.Doc))
{
}
- TDocument& TDocument::operator=(TDocument&& doc) {
+ TDocument& TDocument::operator=(TDocument&& doc) {
if (this != &doc)
- doc.Swap(*this);
+ doc.Swap(*this);
return *this;
}
@@ -63,7 +63,7 @@ namespace NXml {
if (!pctx)
THROW(XmlException, "Can't create parser context");
- TDocHolder doc(xmlCtxtReadFile(pctx.Get(), file.c_str(), nullptr, XML_PARSE_NOCDATA));
+ TDocHolder doc(xmlCtxtReadFile(pctx.Get(), file.c_str(), nullptr, XML_PARSE_NOCDATA));
if (!doc)
THROW(XmlException, "Can't parse file " << file);
@@ -72,7 +72,7 @@ namespace NXml {
if (res == -1)
THROW(XmlException, "XIncludes processing failed");
- Doc = std::move(doc);
+ Doc = std::move(doc);
}
void TDocument::ParseString(TZtStringBuf xml) {
@@ -80,12 +80,12 @@ namespace NXml {
if (pctx.Get() == nullptr)
THROW(XmlException, "Can't create parser context");
- TDocHolder doc(xmlCtxtReadMemory(pctx.Get(), xml.c_str(), (int)xml.size(), nullptr, nullptr, XML_PARSE_NOCDATA));
+ TDocHolder doc(xmlCtxtReadMemory(pctx.Get(), xml.c_str(), (int)xml.size(), nullptr, nullptr, XML_PARSE_NOCDATA));
if (!doc)
THROW(XmlException, "Can't parse string");
- Doc = std::move(doc);
+ Doc = std::move(doc);
}
TNode TDocument::Root() {
@@ -113,34 +113,34 @@ namespace NXml {
}
TXPathContextPtr TNode::CreateXPathContext(const TNamespacesForXPath& nss) const {
- TXPathContextPtr ctx = xmlXPathNewContext(DocPointer);
- if (!ctx)
- THROW(XmlException, "Can't create empty xpath context");
-
- for (const auto& ns : nss) {
- const int r = xmlXPathRegisterNs(ctx.Get(), XMLCHAR(ns.Prefix.c_str()), XMLCHAR(ns.Url.c_str()));
- if (r != 0)
- THROW(XmlException, "Can't register namespace " << ns.Url << " with prefix " << ns.Prefix);
- }
-
- return ctx;
- }
-
+ TXPathContextPtr ctx = xmlXPathNewContext(DocPointer);
+ if (!ctx)
+ THROW(XmlException, "Can't create empty xpath context");
+
+ for (const auto& ns : nss) {
+ const int r = xmlXPathRegisterNs(ctx.Get(), XMLCHAR(ns.Prefix.c_str()), XMLCHAR(ns.Url.c_str()));
+ if (r != 0)
+ THROW(XmlException, "Can't register namespace " << ns.Url << " with prefix " << ns.Prefix);
+ }
+
+ return ctx;
+ }
+
TConstNodes TNode::XPath(TZtStringBuf xpath, bool quiet, const TNamespacesForXPath& ns) const {
- TXPathContextPtr ctxt = CreateXPathContext(ns);
- return XPath(xpath, quiet, *ctxt);
- }
+ TXPathContextPtr ctxt = CreateXPathContext(ns);
+ return XPath(xpath, quiet, *ctxt);
+ }
TConstNodes TNode::XPath(TZtStringBuf xpath, bool quiet, TXPathContext& ctxt) const {
- if (xmlXPathSetContextNode(NodePointer, &ctxt) != 0)
- THROW(XmlException, "Can't set xpath context node, probably the context is associated with another document");
-
- TXPathObjectPtr obj = xmlXPathEvalExpression(XMLCHAR(xpath.c_str()), &ctxt);
- if (!obj)
- THROW(XmlException, "Can't evaluate xpath expression " << xpath);
-
- TConstNodes nodes(DocPointer, obj);
-
+ if (xmlXPathSetContextNode(NodePointer, &ctxt) != 0)
+ THROW(XmlException, "Can't set xpath context node, probably the context is associated with another document");
+
+ TXPathObjectPtr obj = xmlXPathEvalExpression(XMLCHAR(xpath.c_str()), &ctxt);
+ if (!obj)
+ THROW(XmlException, "Can't evaluate xpath expression " << xpath);
+
+ TConstNodes nodes(DocPointer, obj);
+
if (nodes.Size() == 0 && !quiet)
THROW(NodeNotFound, xpath);
@@ -148,30 +148,30 @@ namespace NXml {
}
TConstNodes TNode::Nodes(TZtStringBuf xpath, bool quiet, const TNamespacesForXPath& ns) const {
- TXPathContextPtr ctxt = CreateXPathContext(ns);
- return Nodes(xpath, quiet, *ctxt);
- }
-
+ TXPathContextPtr ctxt = CreateXPathContext(ns);
+ return Nodes(xpath, quiet, *ctxt);
+ }
+
TConstNodes TNode::Nodes(TZtStringBuf xpath, bool quiet, TXPathContext& ctxt) const {
- TConstNodes nodes = XPath(xpath, quiet, ctxt);
+ TConstNodes nodes = XPath(xpath, quiet, ctxt);
if (nodes.Size() != 0 && !nodes[0].IsElementNode())
THROW(XmlException, "xpath points to non-element nodes: " << xpath);
return nodes;
}
TNode TNode::Node(TZtStringBuf xpath, bool quiet, const TNamespacesForXPath& ns) {
- TXPathContextPtr ctxt = CreateXPathContext(ns);
- return Node(xpath, quiet, *ctxt);
- }
+ TXPathContextPtr ctxt = CreateXPathContext(ns);
+ return Node(xpath, quiet, *ctxt);
+ }
TConstNode TNode::Node(TZtStringBuf xpath, bool quiet, const TNamespacesForXPath& ns) const {
- TXPathContextPtr ctxt = CreateXPathContext(ns);
- return Node(xpath, quiet, *ctxt);
- }
-
+ TXPathContextPtr ctxt = CreateXPathContext(ns);
+ return Node(xpath, quiet, *ctxt);
+ }
+
TNode TNode::Node(TZtStringBuf xpath, bool quiet, TXPathContext& ctxt) {
- TConstNodes n = Nodes(xpath, quiet, ctxt);
-
+ TConstNodes n = Nodes(xpath, quiet, ctxt);
+
if (n.Size() == 0 && !quiet)
THROW(NodeNotFound, xpath);
@@ -182,7 +182,7 @@ namespace NXml {
}
TConstNode TNode::Node(TZtStringBuf xpath, bool quiet, TXPathContext& ctxt) const {
- return const_cast<TNode*>(this)->Node(xpath, quiet, ctxt);
+ return const_cast<TNode*>(this)->Node(xpath, quiet, ctxt);
}
TNode TNode::FirstChild(TZtStringBuf name) {
@@ -271,9 +271,9 @@ namespace NXml {
}
TString TNode::Name() const {
- if (IsNull())
- THROW(XmlException, "Node is null");
-
+ if (IsNull())
+ THROW(XmlException, "Node is null");
+
return CAST2CHAR(NodePointer->name);
}
@@ -294,9 +294,9 @@ namespace NXml {
}
bool TNode::IsText() const {
- if (IsNull())
- THROW(XmlException, "Node is null");
-
+ if (IsNull())
+ THROW(XmlException, "Node is null");
+
return NodePointer->type == XML_TEXT_NODE;
}
@@ -368,10 +368,10 @@ namespace NXml {
return TConstNodesRef(*this);
}
- TConstNodes::TConstNodes(xmlDoc* doc, TXPathObjectPtr obj)
- : SizeValue(obj && obj->nodesetval ? obj->nodesetval->nodeNr : 0)
- , Doc(doc)
- , Obj(obj)
+ TConstNodes::TConstNodes(xmlDoc* doc, TXPathObjectPtr obj)
+ : SizeValue(obj && obj->nodesetval ? obj->nodesetval->nodeNr : 0)
+ , Doc(doc)
+ , Obj(obj)
{
}
diff --git a/library/cpp/xml/document/xml-document_ut.cpp b/library/cpp/xml/document/xml-document_ut.cpp
index 9f537b75c4..8361e3c503 100644
--- a/library/cpp/xml/document/xml-document_ut.cpp
+++ b/library/cpp/xml/document/xml-document_ut.cpp
@@ -84,11 +84,11 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) {
TConstNode text = root.Node("h:text", false, nss);
UNIT_ASSERT_EQUAL(text.Value<TString>(), "Некоторый текст");
-
- // For performance you can create xpath context once using nss and pass it.
- TXPathContextPtr ctxt = root.CreateXPathContext(nss);
- UNIT_ASSERT(root.Node("text", true, *ctxt).IsNull());
- UNIT_ASSERT_EXCEPTION(root.Node("text", false, *ctxt), yexception);
+
+ // For performance you can create xpath context once using nss and pass it.
+ TXPathContextPtr ctxt = root.CreateXPathContext(nss);
+ UNIT_ASSERT(root.Node("text", true, *ctxt).IsNull());
+ UNIT_ASSERT_EXCEPTION(root.Node("text", false, *ctxt), yexception);
UNIT_ASSERT_EQUAL(root.Node("h:text", false, *ctxt).Value<TString>(), "Некоторый текст");
}
Y_UNIT_TEST(XmlNodes) {
@@ -119,37 +119,37 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) {
iterLog << node2.Name() << ';';
}
UNIT_ASSERT_STRINGS_EQUAL(iterLog.Str(), "a;c;");
-
- // get only element nodes, ignore text nodes with empty "name" param
+
+ // get only element nodes, ignore text nodes with empty "name" param
node = root.FirstChild(TString());
- UNIT_ASSERT_EQUAL(node.IsText(), false);
- UNIT_ASSERT_EQUAL(node.Name(), "a");
+ UNIT_ASSERT_EQUAL(node.IsText(), false);
+ UNIT_ASSERT_EQUAL(node.Name(), "a");
node = node.NextSibling(TString());
- UNIT_ASSERT_EQUAL(node.IsText(), false);
- UNIT_ASSERT_EQUAL(node.Name(), "c");
-
- // use exact "name" to retrieve children and siblings
- node = root.FirstChild("a");
- UNIT_ASSERT_EQUAL(node.IsNull(), false);
- UNIT_ASSERT_EQUAL(node.Name(), "a");
- node = node.NextSibling("c");
- UNIT_ASSERT_EQUAL(node.IsNull(), false);
- UNIT_ASSERT_EQUAL(node.Name(), "c");
- node = root.FirstChild("c"); // skip "a"
- UNIT_ASSERT_EQUAL(node.IsNull(), false);
- UNIT_ASSERT_EQUAL(node.Name(), "c");
-
- // node not found: no exceptions, null nodes are returned
- node = root.FirstChild("b"); // b is not direct child of root
- UNIT_ASSERT_EQUAL(node.IsNull(), true);
- node = root.FirstChild("nosuchnode");
- UNIT_ASSERT_EQUAL(node.IsNull(), true);
- node = root.FirstChild();
- node = root.NextSibling("unknownnode");
- UNIT_ASSERT_EQUAL(node.IsNull(), true);
- UNIT_ASSERT_EXCEPTION(node.Name(), yexception);
+ UNIT_ASSERT_EQUAL(node.IsText(), false);
+ UNIT_ASSERT_EQUAL(node.Name(), "c");
+
+ // use exact "name" to retrieve children and siblings
+ node = root.FirstChild("a");
+ UNIT_ASSERT_EQUAL(node.IsNull(), false);
+ UNIT_ASSERT_EQUAL(node.Name(), "a");
+ node = node.NextSibling("c");
+ UNIT_ASSERT_EQUAL(node.IsNull(), false);
+ UNIT_ASSERT_EQUAL(node.Name(), "c");
+ node = root.FirstChild("c"); // skip "a"
+ UNIT_ASSERT_EQUAL(node.IsNull(), false);
+ UNIT_ASSERT_EQUAL(node.Name(), "c");
+
+ // node not found: no exceptions, null nodes are returned
+ node = root.FirstChild("b"); // b is not direct child of root
+ UNIT_ASSERT_EQUAL(node.IsNull(), true);
+ node = root.FirstChild("nosuchnode");
+ UNIT_ASSERT_EQUAL(node.IsNull(), true);
+ node = root.FirstChild();
+ node = root.NextSibling("unknownnode");
+ UNIT_ASSERT_EQUAL(node.IsNull(), true);
+ UNIT_ASSERT_EXCEPTION(node.Name(), yexception);
UNIT_ASSERT_EXCEPTION(node.Value<TString>(), yexception);
- UNIT_ASSERT_EXCEPTION(node.IsText(), yexception);
+ UNIT_ASSERT_EXCEPTION(node.IsText(), yexception);
}
Y_UNIT_TEST(DefVal) {
using namespace NXml;
@@ -235,49 +235,49 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) {
UNIT_ASSERT_VALUES_EQUAL(n.ToString(), "<a><b len=\"15\" correct=\"1\">hello world</b></a>");
}
}
-
+
Y_UNIT_TEST(ReuseXPathContext) {
- using namespace NXml;
-
- TDocument xml(
- "<?xml version=\"1.0\"?>\n"
- "<root>\n"
- "<a><b><c>Hello, world!</c></b></a>\n"
- "<text x=\"10\">First</text>\n"
- "<text y=\"20\">Second</text>\n"
- "</root>",
- TDocument::String);
-
- TXPathContextPtr rootCtxt = xml.Root().CreateXPathContext();
-
- // Check Node()
- TConstNode b = xml.Root().Node("a/b", false, *rootCtxt);
-
- // We can use root node context for xpath evaluation in any node
- TConstNode c1 = b.Node("c", false, *rootCtxt);
+ using namespace NXml;
+
+ TDocument xml(
+ "<?xml version=\"1.0\"?>\n"
+ "<root>\n"
+ "<a><b><c>Hello, world!</c></b></a>\n"
+ "<text x=\"10\">First</text>\n"
+ "<text y=\"20\">Second</text>\n"
+ "</root>",
+ TDocument::String);
+
+ TXPathContextPtr rootCtxt = xml.Root().CreateXPathContext();
+
+ // Check Node()
+ TConstNode b = xml.Root().Node("a/b", false, *rootCtxt);
+
+ // We can use root node context for xpath evaluation in any node
+ TConstNode c1 = b.Node("c", false, *rootCtxt);
UNIT_ASSERT_EQUAL(c1.Value<TString>(), "Hello, world!");
-
- TXPathContextPtr bCtxt = b.CreateXPathContext();
- TConstNode c2 = b.Node("c", false, *bCtxt);
+
+ TXPathContextPtr bCtxt = b.CreateXPathContext();
+ TConstNode c2 = b.Node("c", false, *bCtxt);
UNIT_ASSERT_EQUAL(c2.Value<TString>(), "Hello, world!");
-
- // Mixing contexts from different documents is forbidden
- TDocument otherXml("<root></root>", TDocument::String);
- TXPathContextPtr otherCtxt = otherXml.Root().CreateXPathContext();
- UNIT_ASSERT_EXCEPTION(b.Node("c", false, *otherCtxt), yexception);
-
- // Check Nodes()
- TConstNodes texts = xml.Root().Nodes("text", true, *rootCtxt);
- UNIT_ASSERT_EQUAL(texts.Size(), 2);
-
- // Nodes() does't work for non-element nodes
- UNIT_ASSERT_EXCEPTION(xml.Root().Nodes("text/@x", true, *rootCtxt), yexception);
-
- // Check XPath()
- TConstNodes ys = xml.Root().XPath("text/@y", true, *rootCtxt);
- UNIT_ASSERT_EQUAL(ys.Size(), 1);
- UNIT_ASSERT_EQUAL(ys[0].Value<int>(), 20);
- }
+
+ // Mixing contexts from different documents is forbidden
+ TDocument otherXml("<root></root>", TDocument::String);
+ TXPathContextPtr otherCtxt = otherXml.Root().CreateXPathContext();
+ UNIT_ASSERT_EXCEPTION(b.Node("c", false, *otherCtxt), yexception);
+
+ // Check Nodes()
+ TConstNodes texts = xml.Root().Nodes("text", true, *rootCtxt);
+ UNIT_ASSERT_EQUAL(texts.Size(), 2);
+
+ // Nodes() does't work for non-element nodes
+ UNIT_ASSERT_EXCEPTION(xml.Root().Nodes("text/@x", true, *rootCtxt), yexception);
+
+ // Check XPath()
+ TConstNodes ys = xml.Root().XPath("text/@y", true, *rootCtxt);
+ UNIT_ASSERT_EQUAL(ys.Size(), 1);
+ UNIT_ASSERT_EQUAL(ys[0].Value<int>(), 20);
+ }
Y_UNIT_TEST(Html) {
using namespace NXml;
@@ -291,19 +291,19 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) {
videoNode.SaveAsHtml(ss);
UNIT_ASSERT_EQUAL(ss.Str(), "<video controls></video>");
}
-
- Y_UNIT_TEST(Move) {
- using namespace NXml;
-
- TDocument xml1("foo", TDocument::RootName);
- xml1.Root().AddChild("bar");
-
- UNIT_ASSERT_VALUES_EQUAL(xml1.Root().ToString(), "<foo><bar/></foo>");
-
- TDocument xml2 = std::move(xml1);
- UNIT_ASSERT_EXCEPTION(xml1.Root(), yexception);
- UNIT_ASSERT_VALUES_EQUAL(xml2.Root().ToString(), "<foo><bar/></foo>");
- }
+
+ Y_UNIT_TEST(Move) {
+ using namespace NXml;
+
+ TDocument xml1("foo", TDocument::RootName);
+ xml1.Root().AddChild("bar");
+
+ UNIT_ASSERT_VALUES_EQUAL(xml1.Root().ToString(), "<foo><bar/></foo>");
+
+ TDocument xml2 = std::move(xml1);
+ UNIT_ASSERT_EXCEPTION(xml1.Root(), yexception);
+ UNIT_ASSERT_VALUES_EQUAL(xml2.Root().ToString(), "<foo><bar/></foo>");
+ }
Y_UNIT_TEST(StringConversion) {
using namespace NXml;
diff --git a/library/cpp/xml/document/xml-textreader.cpp b/library/cpp/xml/document/xml-textreader.cpp
index b946f1fbf2..291c1a0f55 100644
--- a/library/cpp/xml/document/xml-textreader.cpp
+++ b/library/cpp/xml/document/xml-textreader.cpp
@@ -1,318 +1,318 @@
-#include "xml-textreader.h"
-
-#include <contrib/libs/libxml/include/libxml/xmlreader.h>
-
-#include <util/generic/yexception.h>
-#include <util/string/strip.h>
-#include <util/system/compiler.h>
-
-namespace NXml {
+#include "xml-textreader.h"
+
+#include <contrib/libs/libxml/include/libxml/xmlreader.h>
+
+#include <util/generic/yexception.h>
+#include <util/string/strip.h>
+#include <util/system/compiler.h>
+
+namespace NXml {
TTextReader::TTextReader(IInputStream& stream, const TOptions& options)
- : Stream(stream)
- , IsError(false)
- {
+ : Stream(stream)
+ , IsError(false)
+ {
Impl.Reset(xmlReaderForIO(ReadFromInputStreamCallback, nullptr, this, nullptr, nullptr, options.GetMask()));
-
- if (!Impl) {
- ythrow yexception() << "cannot instantiate underlying xmlTextReader structure";
- }
- SetupErrorHandler();
- CheckForExceptions();
- }
-
- TTextReader::~TTextReader() {
- }
-
- bool TTextReader::Read() {
- return BoolResult(xmlTextReaderRead(Impl.Get()));
- }
-
+
+ if (!Impl) {
+ ythrow yexception() << "cannot instantiate underlying xmlTextReader structure";
+ }
+ SetupErrorHandler();
+ CheckForExceptions();
+ }
+
+ TTextReader::~TTextReader() {
+ }
+
+ bool TTextReader::Read() {
+ return BoolResult(xmlTextReaderRead(Impl.Get()));
+ }
+
TString TTextReader::ReadInnerXml() const {
- return TempStringOrEmptyResult(xmlTextReaderReadInnerXml(Impl.Get()));
- }
-
+ return TempStringOrEmptyResult(xmlTextReaderReadInnerXml(Impl.Get()));
+ }
+
TString TTextReader::ReadOuterXml() const {
- return TempStringOrEmptyResult(xmlTextReaderReadOuterXml(Impl.Get()));
- }
-
+ return TempStringOrEmptyResult(xmlTextReaderReadOuterXml(Impl.Get()));
+ }
+
TString TTextReader::ReadString() const {
- return TempStringOrEmptyResult(xmlTextReaderReadString(Impl.Get()));
- }
-
- bool TTextReader::ReadAttributeValue() const {
- return BoolResult(xmlTextReaderReadAttributeValue(Impl.Get()));
- }
-
- int TTextReader::GetAttributeCount() const {
- return IntResult(xmlTextReaderAttributeCount(Impl.Get()));
- }
-
- TStringBuf TTextReader::GetBaseUri() const {
- return ConstStringOrEmptyResult(xmlTextReaderConstBaseUri(Impl.Get()));
- }
-
- int TTextReader::GetDepth() const {
- return IntResult(xmlTextReaderDepth(Impl.Get()));
- }
-
- bool TTextReader::HasAttributes() const {
- return BoolResult(xmlTextReaderHasAttributes(Impl.Get()));
- }
-
- bool TTextReader::HasValue() const {
- return BoolResult(xmlTextReaderHasValue(Impl.Get()));
- }
-
- bool TTextReader::IsDefault() const {
- return BoolResult(xmlTextReaderIsDefault(Impl.Get()));
- }
-
- bool TTextReader::IsEmptyElement() const {
- return BoolResult(xmlTextReaderIsEmptyElement(Impl.Get()));
- }
-
- TStringBuf TTextReader::GetLocalName() const {
- return ConstStringOrEmptyResult(xmlTextReaderConstLocalName(Impl.Get()));
- }
-
- TStringBuf TTextReader::GetName() const {
- return ConstStringOrEmptyResult(xmlTextReaderConstName(Impl.Get()));
- }
-
- TStringBuf TTextReader::GetNamespaceUri() const {
- return ConstStringOrEmptyResult(xmlTextReaderConstNamespaceUri(Impl.Get()));
- }
-
- TTextReader::ENodeType TTextReader::GetNodeType() const {
- return static_cast<ENodeType>(IntResult(xmlTextReaderNodeType(Impl.Get())));
- }
-
- TStringBuf TTextReader::GetPrefix() const {
- return ConstStringOrEmptyResult(xmlTextReaderConstPrefix(Impl.Get()));
- }
-
- char TTextReader::GetQuoteChar() const {
- return CharResult(xmlTextReaderQuoteChar(Impl.Get()));
- }
-
- TStringBuf TTextReader::GetValue() const {
- return ConstStringOrEmptyResult(xmlTextReaderConstValue(Impl.Get()));
- }
-
- TTextReader::EReadState TTextReader::GetReadState() const {
- return static_cast<EReadState>(IntResult(xmlTextReaderReadState(Impl.Get())));
- }
-
- void TTextReader::Close() {
- if (xmlTextReaderClose(Impl.Get()) == -1) {
- ThrowException();
- }
- }
-
+ return TempStringOrEmptyResult(xmlTextReaderReadString(Impl.Get()));
+ }
+
+ bool TTextReader::ReadAttributeValue() const {
+ return BoolResult(xmlTextReaderReadAttributeValue(Impl.Get()));
+ }
+
+ int TTextReader::GetAttributeCount() const {
+ return IntResult(xmlTextReaderAttributeCount(Impl.Get()));
+ }
+
+ TStringBuf TTextReader::GetBaseUri() const {
+ return ConstStringOrEmptyResult(xmlTextReaderConstBaseUri(Impl.Get()));
+ }
+
+ int TTextReader::GetDepth() const {
+ return IntResult(xmlTextReaderDepth(Impl.Get()));
+ }
+
+ bool TTextReader::HasAttributes() const {
+ return BoolResult(xmlTextReaderHasAttributes(Impl.Get()));
+ }
+
+ bool TTextReader::HasValue() const {
+ return BoolResult(xmlTextReaderHasValue(Impl.Get()));
+ }
+
+ bool TTextReader::IsDefault() const {
+ return BoolResult(xmlTextReaderIsDefault(Impl.Get()));
+ }
+
+ bool TTextReader::IsEmptyElement() const {
+ return BoolResult(xmlTextReaderIsEmptyElement(Impl.Get()));
+ }
+
+ TStringBuf TTextReader::GetLocalName() const {
+ return ConstStringOrEmptyResult(xmlTextReaderConstLocalName(Impl.Get()));
+ }
+
+ TStringBuf TTextReader::GetName() const {
+ return ConstStringOrEmptyResult(xmlTextReaderConstName(Impl.Get()));
+ }
+
+ TStringBuf TTextReader::GetNamespaceUri() const {
+ return ConstStringOrEmptyResult(xmlTextReaderConstNamespaceUri(Impl.Get()));
+ }
+
+ TTextReader::ENodeType TTextReader::GetNodeType() const {
+ return static_cast<ENodeType>(IntResult(xmlTextReaderNodeType(Impl.Get())));
+ }
+
+ TStringBuf TTextReader::GetPrefix() const {
+ return ConstStringOrEmptyResult(xmlTextReaderConstPrefix(Impl.Get()));
+ }
+
+ char TTextReader::GetQuoteChar() const {
+ return CharResult(xmlTextReaderQuoteChar(Impl.Get()));
+ }
+
+ TStringBuf TTextReader::GetValue() const {
+ return ConstStringOrEmptyResult(xmlTextReaderConstValue(Impl.Get()));
+ }
+
+ TTextReader::EReadState TTextReader::GetReadState() const {
+ return static_cast<EReadState>(IntResult(xmlTextReaderReadState(Impl.Get())));
+ }
+
+ void TTextReader::Close() {
+ if (xmlTextReaderClose(Impl.Get()) == -1) {
+ ThrowException();
+ }
+ }
+
TString TTextReader::GetAttribute(int number) const {
- return TempStringResult(xmlTextReaderGetAttributeNo(Impl.Get(), number));
- }
-
+ return TempStringResult(xmlTextReaderGetAttributeNo(Impl.Get(), number));
+ }
+
TString TTextReader::GetAttribute(TZtStringBuf name) const {
return TempStringResult(xmlTextReaderGetAttribute(Impl.Get(), XMLCHAR(name.data())));
- }
-
+ }
+
TString TTextReader::GetAttribute(TZtStringBuf localName, TZtStringBuf nsUri) const {
return TempStringResult(xmlTextReaderGetAttributeNs(Impl.Get(), XMLCHAR(localName.data()), XMLCHAR(nsUri.data())));
- }
-
+ }
+
TString TTextReader::LookupNamespace(TZtStringBuf prefix) const {
return TempStringResult(xmlTextReaderLookupNamespace(Impl.Get(), XMLCHAR(prefix.data())));
- }
-
- bool TTextReader::MoveToAttribute(int number) {
- return BoolResult(xmlTextReaderMoveToAttributeNo(Impl.Get(), number));
- }
-
+ }
+
+ bool TTextReader::MoveToAttribute(int number) {
+ return BoolResult(xmlTextReaderMoveToAttributeNo(Impl.Get(), number));
+ }
+
bool TTextReader::MoveToAttribute(TZtStringBuf name) {
return BoolResult(xmlTextReaderMoveToAttribute(Impl.Get(), XMLCHAR(name.data())));
- }
-
+ }
+
bool TTextReader::MoveToAttribute(TZtStringBuf localName, TZtStringBuf nsUri) {
return BoolResult(xmlTextReaderMoveToAttributeNs(Impl.Get(), XMLCHAR(localName.data()), XMLCHAR(nsUri.data())));
- }
-
- bool TTextReader::MoveToFirstAttribute() {
- return BoolResult(xmlTextReaderMoveToFirstAttribute(Impl.Get()));
- }
-
- bool TTextReader::MoveToNextAttribute() {
- return BoolResult(xmlTextReaderMoveToNextAttribute(Impl.Get()));
- }
-
- bool TTextReader::MoveToElement() {
- return BoolResult(xmlTextReaderMoveToElement(Impl.Get()));
- }
-
- TConstNode TTextReader::Expand() const {
- const xmlNodePtr node = xmlTextReaderExpand(Impl.Get());
- if (node == nullptr) {
- ThrowException();
- }
- return TConstNode(TNode(node->doc, node));
- }
-
- bool TTextReader::Next() {
- return BoolResult(xmlTextReaderNext(Impl.Get()));
- }
-
- bool TTextReader::IsValid() const {
- return BoolResult(xmlTextReaderIsValid(Impl.Get()));
- }
-
- // Callback for xmlReaderForIO() to read more data.
+ }
+
+ bool TTextReader::MoveToFirstAttribute() {
+ return BoolResult(xmlTextReaderMoveToFirstAttribute(Impl.Get()));
+ }
+
+ bool TTextReader::MoveToNextAttribute() {
+ return BoolResult(xmlTextReaderMoveToNextAttribute(Impl.Get()));
+ }
+
+ bool TTextReader::MoveToElement() {
+ return BoolResult(xmlTextReaderMoveToElement(Impl.Get()));
+ }
+
+ TConstNode TTextReader::Expand() const {
+ const xmlNodePtr node = xmlTextReaderExpand(Impl.Get());
+ if (node == nullptr) {
+ ThrowException();
+ }
+ return TConstNode(TNode(node->doc, node));
+ }
+
+ bool TTextReader::Next() {
+ return BoolResult(xmlTextReaderNext(Impl.Get()));
+ }
+
+ bool TTextReader::IsValid() const {
+ return BoolResult(xmlTextReaderIsValid(Impl.Get()));
+ }
+
+ // Callback for xmlReaderForIO() to read more data.
// It is almost "noexcept" (std::bad_alloc may happen when saving exception message to new TString).
- // Waiting for std::exception_ptr and std::rethrow_exception from C++11 in Arcadia to make it really "noexcept".
- int TTextReader::ReadFromInputStreamCallback(void* context, char* buffer, int len) {
+ // Waiting for std::exception_ptr and std::rethrow_exception from C++11 in Arcadia to make it really "noexcept".
+ int TTextReader::ReadFromInputStreamCallback(void* context, char* buffer, int len) {
Y_ASSERT(len >= 0);
- TTextReader* reader = static_cast<TTextReader*>(context);
-
- int result = -1;
-
+ TTextReader* reader = static_cast<TTextReader*>(context);
+
+ int result = -1;
+
// Exception may be thrown by IInputStream::Read().
- // It is caught unconditionally because exceptions cannot safely pass through libxml2 plain C code
- // (no destructors, no RAII, raw pointers, so in case of stack unwinding some memory gets leaked).
-
- try {
- result = reader->Stream.Read(buffer, len);
- } catch (const yexception& ex) {
- reader->LogError() << "read from input stream failed: " << ex;
- } catch (...) {
- reader->LogError() << "read from input stream failed";
- }
-
- return result;
- }
-
- void TTextReader::OnLibxmlError(void* arg, const char* msg, xmlParserSeverities severity, xmlTextReaderLocatorPtr locator) {
- TTextReader* reader = static_cast<TTextReader*>(arg);
+ // It is caught unconditionally because exceptions cannot safely pass through libxml2 plain C code
+ // (no destructors, no RAII, raw pointers, so in case of stack unwinding some memory gets leaked).
+
+ try {
+ result = reader->Stream.Read(buffer, len);
+ } catch (const yexception& ex) {
+ reader->LogError() << "read from input stream failed: " << ex;
+ } catch (...) {
+ reader->LogError() << "read from input stream failed";
+ }
+
+ return result;
+ }
+
+ void TTextReader::OnLibxmlError(void* arg, const char* msg, xmlParserSeverities severity, xmlTextReaderLocatorPtr locator) {
+ TTextReader* reader = static_cast<TTextReader*>(arg);
Y_ASSERT(reader != nullptr);
-
- TStringStream& out = reader->LogError();
-
- if (severity == XML_PARSER_SEVERITY_ERROR) {
- out << "libxml parse error";
- } else if (severity == XML_PARSER_SEVERITY_VALIDITY_ERROR) {
- out << "libxml validity error";
- } else {
- out << "libxml error";
- }
-
- if (locator != nullptr) {
- const int line = xmlTextReaderLocatorLineNumber(locator);
- const TCharPtr baseUri = xmlTextReaderLocatorBaseURI(locator);
- out << " (";
- if (line != -1) {
- out << "at line " << line;
- if (baseUri) {
- out << ", ";
- }
- }
- if (baseUri) {
- out << "base URI " << CAST2CHAR(baseUri.Get());
- }
- out << ")";
- }
-
- TStringBuf message = (msg != nullptr) ? msg : "unknown";
- message = StripStringRight(message); // remove trailing \n that is added by libxml
- if (!message.empty()) {
- out << ": " << message;
- }
- }
-
- void TTextReader::SetupErrorHandler() {
- xmlTextReaderErrorFunc func = nullptr;
- void* arg = nullptr;
-
- // We respect any other error handlers already set up:
- xmlTextReaderGetErrorHandler(Impl.Get(), &func, &arg);
- if (!func) {
- func = TTextReader::OnLibxmlError;
- xmlTextReaderSetErrorHandler(Impl.Get(), func, this);
- }
- }
-
- TStringStream& TTextReader::LogError() const {
- if (IsError) { // maybe there are previous errors
- ErrorBuffer << Endl;
- }
- IsError = true;
- return ErrorBuffer;
- }
-
- void TTextReader::CheckForExceptions() const {
+
+ TStringStream& out = reader->LogError();
+
+ if (severity == XML_PARSER_SEVERITY_ERROR) {
+ out << "libxml parse error";
+ } else if (severity == XML_PARSER_SEVERITY_VALIDITY_ERROR) {
+ out << "libxml validity error";
+ } else {
+ out << "libxml error";
+ }
+
+ if (locator != nullptr) {
+ const int line = xmlTextReaderLocatorLineNumber(locator);
+ const TCharPtr baseUri = xmlTextReaderLocatorBaseURI(locator);
+ out << " (";
+ if (line != -1) {
+ out << "at line " << line;
+ if (baseUri) {
+ out << ", ";
+ }
+ }
+ if (baseUri) {
+ out << "base URI " << CAST2CHAR(baseUri.Get());
+ }
+ out << ")";
+ }
+
+ TStringBuf message = (msg != nullptr) ? msg : "unknown";
+ message = StripStringRight(message); // remove trailing \n that is added by libxml
+ if (!message.empty()) {
+ out << ": " << message;
+ }
+ }
+
+ void TTextReader::SetupErrorHandler() {
+ xmlTextReaderErrorFunc func = nullptr;
+ void* arg = nullptr;
+
+ // We respect any other error handlers already set up:
+ xmlTextReaderGetErrorHandler(Impl.Get(), &func, &arg);
+ if (!func) {
+ func = TTextReader::OnLibxmlError;
+ xmlTextReaderSetErrorHandler(Impl.Get(), func, this);
+ }
+ }
+
+ TStringStream& TTextReader::LogError() const {
+ if (IsError) { // maybe there are previous errors
+ ErrorBuffer << Endl;
+ }
+ IsError = true;
+ return ErrorBuffer;
+ }
+
+ void TTextReader::CheckForExceptions() const {
if (Y_LIKELY(!IsError)) {
- return;
- }
-
+ return;
+ }
+
const TString message = ErrorBuffer.Str();
- ErrorBuffer.clear();
- IsError = false;
-
- ythrow yexception() << message;
- }
-
- void TTextReader::ThrowException() const {
- CheckForExceptions();
- // Probably CheckForExceptions() would throw an exception with more verbose message. As the last resort
- // (we do not even know the name of the failed libxml function, but it's possible to deduce it from stacktrace):
- ythrow yexception() << "libxml function returned error exit code";
- }
-
- bool TTextReader::BoolResult(int value) const {
+ ErrorBuffer.clear();
+ IsError = false;
+
+ ythrow yexception() << message;
+ }
+
+ void TTextReader::ThrowException() const {
+ CheckForExceptions();
+ // Probably CheckForExceptions() would throw an exception with more verbose message. As the last resort
+ // (we do not even know the name of the failed libxml function, but it's possible to deduce it from stacktrace):
+ ythrow yexception() << "libxml function returned error exit code";
+ }
+
+ bool TTextReader::BoolResult(int value) const {
if (Y_UNLIKELY(value == -1)) {
- ThrowException();
- }
- return (value != 0);
- }
-
- int TTextReader::IntResult(int value) const {
+ ThrowException();
+ }
+ return (value != 0);
+ }
+
+ int TTextReader::IntResult(int value) const {
if (Y_UNLIKELY(value == -1)) {
- ThrowException();
- }
- return value;
- }
-
- char TTextReader::CharResult(int value) const {
+ ThrowException();
+ }
+ return value;
+ }
+
+ char TTextReader::CharResult(int value) const {
if (Y_UNLIKELY(value == -1)) {
- ThrowException();
- }
- return static_cast<char>(value);
- }
-
- TStringBuf TTextReader::ConstStringResult(const xmlChar* value) const {
+ ThrowException();
+ }
+ return static_cast<char>(value);
+ }
+
+ TStringBuf TTextReader::ConstStringResult(const xmlChar* value) const {
if (Y_UNLIKELY(value == nullptr)) {
- ThrowException();
- }
- return CAST2CHAR(value);
- }
-
- TStringBuf TTextReader::ConstStringOrEmptyResult(const xmlChar* value) const {
- CheckForExceptions();
- return (value != nullptr) ? TStringBuf(CAST2CHAR(value)) : TStringBuf();
- }
-
+ ThrowException();
+ }
+ return CAST2CHAR(value);
+ }
+
+ TStringBuf TTextReader::ConstStringOrEmptyResult(const xmlChar* value) const {
+ CheckForExceptions();
+ return (value != nullptr) ? TStringBuf(CAST2CHAR(value)) : TStringBuf();
+ }
+
TString TTextReader::TempStringResult(TCharPtr value) const {
if (Y_UNLIKELY(value == nullptr)) {
- ThrowException();
- }
+ ThrowException();
+ }
return TString(CAST2CHAR(value.Get()));
- }
-
+ }
+
TString TTextReader::TempStringOrEmptyResult(TCharPtr value) const {
- CheckForExceptions();
+ CheckForExceptions();
return (value != nullptr) ? TString(CAST2CHAR(value.Get())) : TString();
- }
-
- struct TTextReader::TDeleter {
- static inline void Destroy(xmlTextReaderPtr handle) {
- xmlFreeTextReader(handle);
- }
- };
+ }
+
+ struct TTextReader::TDeleter {
+ static inline void Destroy(xmlTextReaderPtr handle) {
+ xmlFreeTextReader(handle);
+ }
+ };
}
diff --git a/library/cpp/xml/document/xml-textreader.h b/library/cpp/xml/document/xml-textreader.h
index ab4c329d26..9e0b8be6ea 100644
--- a/library/cpp/xml/document/xml-textreader.h
+++ b/library/cpp/xml/document/xml-textreader.h
@@ -1,325 +1,325 @@
-#pragma once
-
-#include "xml-document.h"
+#pragma once
+
+#include "xml-document.h"
#include "xml-options.h"
-
-#include <contrib/libs/libxml/include/libxml/xmlreader.h>
-
+
+#include <contrib/libs/libxml/include/libxml/xmlreader.h>
+
#include <library/cpp/string_utils/ztstrbuf/ztstrbuf.h>
-#include <util/generic/noncopyable.h>
-#include <util/generic/ptr.h>
-#include <util/generic/strbuf.h>
+#include <util/generic/noncopyable.h>
+#include <util/generic/ptr.h>
+#include <util/generic/strbuf.h>
#include <util/generic/string.h>
#include <functional>
-#include <util/stream/input.h>
-#include <util/stream/str.h>
-
-namespace NXml {
- /**
- * TextReader Parser
- *
- * API of the XML streaming API based on C# interfaces.
- * Provides fast, non-cached, forward-only access to XML data.
- *
- * Like the SAX parser, the TextReader parser is suitable for sequential
- * parsing, but instead of implementing handlers for specific parts of the
- * document, it allows you to detect the current node type, process the node
- * accordingly, and skip forward in the document as much as necessary.
- *
- * Unlike the DOM parser, you may not move backwards in the XML document.
- * And unlike the SAX parser, you must not waste time processing nodes that do not
- * interest you.
- *
- * All methods are on the single parser instance, but their result depends on the current context.
- * For instance, use Read() to move to the next node, and MoveToElement() to navigate to child nodes.
- * These methods will return false when no more nodes are available. Then use
- * methods such as GetName() and GetValue() to examine the elements and their attributes.
- *
- * This wrapper is inspired by TextReader from libxml++.
- */
-
- class TTextReader: private TNonCopyable {
- public:
- // strongly-typed alias for enum from xmlreader.h
- enum class ENodeType : int {
- // clang-format off
- Attribute = XML_READER_TYPE_ATTRIBUTE,
- CDATA = XML_READER_TYPE_CDATA,
- Comment = XML_READER_TYPE_COMMENT,
- Document = XML_READER_TYPE_DOCUMENT,
- DocumentFragment = XML_READER_TYPE_DOCUMENT_FRAGMENT,
- DocumentType = XML_READER_TYPE_DOCUMENT_TYPE,
- Element = XML_READER_TYPE_ELEMENT,
- EndElement = XML_READER_TYPE_END_ELEMENT,
- EndEntity = XML_READER_TYPE_END_ENTITY,
- Entity = XML_READER_TYPE_ENTITY,
- EntityReference = XML_READER_TYPE_ENTITY_REFERENCE,
- None = XML_READER_TYPE_NONE,
- Notation = XML_READER_TYPE_NOTATION,
- ProcessingInstruction = XML_READER_TYPE_PROCESSING_INSTRUCTION,
- SignificantWhitespace = XML_READER_TYPE_SIGNIFICANT_WHITESPACE,
- Text = XML_READER_TYPE_TEXT,
- Whitespace = XML_READER_TYPE_WHITESPACE,
- XmlDeclaration = XML_READER_TYPE_XML_DECLARATION,
- // clang-format on
- };
-
- enum class EReadState : int {
- // clang-format off
- Closed = XML_TEXTREADER_MODE_CLOSED,
- EndOfFile = XML_TEXTREADER_MODE_EOF,
- Error = XML_TEXTREADER_MODE_ERROR,
- Initial = XML_TEXTREADER_MODE_INITIAL,
- Interactive = XML_TEXTREADER_MODE_INTERACTIVE,
- Reading = XML_TEXTREADER_MODE_READING,
- // clang-format on
- };
-
- public:
+#include <util/stream/input.h>
+#include <util/stream/str.h>
+
+namespace NXml {
+ /**
+ * TextReader Parser
+ *
+ * API of the XML streaming API based on C# interfaces.
+ * Provides fast, non-cached, forward-only access to XML data.
+ *
+ * Like the SAX parser, the TextReader parser is suitable for sequential
+ * parsing, but instead of implementing handlers for specific parts of the
+ * document, it allows you to detect the current node type, process the node
+ * accordingly, and skip forward in the document as much as necessary.
+ *
+ * Unlike the DOM parser, you may not move backwards in the XML document.
+ * And unlike the SAX parser, you must not waste time processing nodes that do not
+ * interest you.
+ *
+ * All methods are on the single parser instance, but their result depends on the current context.
+ * For instance, use Read() to move to the next node, and MoveToElement() to navigate to child nodes.
+ * These methods will return false when no more nodes are available. Then use
+ * methods such as GetName() and GetValue() to examine the elements and their attributes.
+ *
+ * This wrapper is inspired by TextReader from libxml++.
+ */
+
+ class TTextReader: private TNonCopyable {
+ public:
+ // strongly-typed alias for enum from xmlreader.h
+ enum class ENodeType : int {
+ // clang-format off
+ Attribute = XML_READER_TYPE_ATTRIBUTE,
+ CDATA = XML_READER_TYPE_CDATA,
+ Comment = XML_READER_TYPE_COMMENT,
+ Document = XML_READER_TYPE_DOCUMENT,
+ DocumentFragment = XML_READER_TYPE_DOCUMENT_FRAGMENT,
+ DocumentType = XML_READER_TYPE_DOCUMENT_TYPE,
+ Element = XML_READER_TYPE_ELEMENT,
+ EndElement = XML_READER_TYPE_END_ELEMENT,
+ EndEntity = XML_READER_TYPE_END_ENTITY,
+ Entity = XML_READER_TYPE_ENTITY,
+ EntityReference = XML_READER_TYPE_ENTITY_REFERENCE,
+ None = XML_READER_TYPE_NONE,
+ Notation = XML_READER_TYPE_NOTATION,
+ ProcessingInstruction = XML_READER_TYPE_PROCESSING_INSTRUCTION,
+ SignificantWhitespace = XML_READER_TYPE_SIGNIFICANT_WHITESPACE,
+ Text = XML_READER_TYPE_TEXT,
+ Whitespace = XML_READER_TYPE_WHITESPACE,
+ XmlDeclaration = XML_READER_TYPE_XML_DECLARATION,
+ // clang-format on
+ };
+
+ enum class EReadState : int {
+ // clang-format off
+ Closed = XML_TEXTREADER_MODE_CLOSED,
+ EndOfFile = XML_TEXTREADER_MODE_EOF,
+ Error = XML_TEXTREADER_MODE_ERROR,
+ Initial = XML_TEXTREADER_MODE_INITIAL,
+ Interactive = XML_TEXTREADER_MODE_INTERACTIVE,
+ Reading = XML_TEXTREADER_MODE_READING,
+ // clang-format on
+ };
+
+ public:
TTextReader(IInputStream& stream, const TOptions& options = TOptions());
- ~TTextReader();
-
- /**
- * Moves the position of the current instance to the next node in the stream, exposing its properties.
- * @return true if the node was read successfully, false if there are no more nodes to read
- */
- bool Read();
-
- /**
- * Reads the contents of the current node, including child nodes and markup.
- * @return A string containing the XML content, or an empty string
- * if the current node is neither an element nor attribute, or has no child nodes
- */
+ ~TTextReader();
+
+ /**
+ * Moves the position of the current instance to the next node in the stream, exposing its properties.
+ * @return true if the node was read successfully, false if there are no more nodes to read
+ */
+ bool Read();
+
+ /**
+ * Reads the contents of the current node, including child nodes and markup.
+ * @return A string containing the XML content, or an empty string
+ * if the current node is neither an element nor attribute, or has no child nodes
+ */
TString ReadInnerXml() const;
-
- /**
- * Reads the current node and its contents, including child nodes and markup.
- * @return A string containing the XML content, or an empty string
- * if the current node is neither an element nor attribute
- */
+
+ /**
+ * Reads the current node and its contents, including child nodes and markup.
+ * @return A string containing the XML content, or an empty string
+ * if the current node is neither an element nor attribute
+ */
TString ReadOuterXml() const;
-
- /**
- * Reads the contents of an element or a text node as a string.
- * @return A string containing the contents of the Element or Text node,
- * or an empty string if the reader is positioned on any other type of node
- */
+
+ /**
+ * Reads the contents of an element or a text node as a string.
+ * @return A string containing the contents of the Element or Text node,
+ * or an empty string if the reader is positioned on any other type of node
+ */
TString ReadString() const;
-
- /**
- * Parses an attribute value into one or more Text and EntityReference nodes.
- * @return A bool where true indicates the attribute value was parsed,
- * and false indicates the reader was not positioned on an attribute node
- * or all the attribute values have been read
- */
- bool ReadAttributeValue() const;
-
- /**
- * Gets the number of attributes on the current node.
- * @return The number of attributes on the current node, or zero if the current node
- * does not support attributes
- */
- int GetAttributeCount() const;
-
- /**
- * Gets the base Uniform Resource Identifier (URI) of the current node.
- * @return The base URI of the current node or an empty string if not available
- */
- TStringBuf GetBaseUri() const;
-
- /**
- * Gets the depth of the current node in the XML document.
- * @return The depth of the current node in the XML document
- */
- int GetDepth() const;
-
- /**
- * Gets a value indicating whether the current node has any attributes.
- * @return true if the current has attributes, false otherwise
- */
- bool HasAttributes() const;
-
- /**
- * Whether the node can have a text value.
- * @return true if the current node can have an associated text value, false otherwise
- */
- bool HasValue() const;
-
- /**
- * Whether an Attribute node was generated from the default value defined in the DTD or schema.
- * @return true if defaulted, false otherwise
- */
- bool IsDefault() const;
-
- /**
- * Check if the current node is empty.
- * @return true if empty, false otherwise
- */
- bool IsEmptyElement() const;
-
- /**
- * The local name of the node.
- * @return the local name or empty string if not available
- */
- TStringBuf GetLocalName() const;
-
- /**
- * The qualified name of the node, equal to Prefix:LocalName.
- * @return the name or empty string if not available
- */
- TStringBuf GetName() const;
-
- /**
- * The URI defining the namespace associated with the node.
- * @return the namespace URI or empty string if not available
- */
- TStringBuf GetNamespaceUri() const;
-
- /**
- * Get the node type of the current node.
- * @return the ENodeType of the current node
- */
- ENodeType GetNodeType() const;
-
- /**
- * Get the namespace prefix associated with the current node.
- * @return the namespace prefix, or an empty string if not available
- */
- TStringBuf GetPrefix() const;
-
- /**
- * Get the quotation mark character used to enclose the value of an attribute.
- * @return " or '
- */
- char GetQuoteChar() const;
-
- /**
- * Provides the text value of the node if present.
- * @return the string or empty if not available
- */
- TStringBuf GetValue() const;
-
- /**
- * Gets the read state of the reader.
- * @return the state value
- */
- EReadState GetReadState() const;
-
- /**
- * This method releases any resources allocated by the current instance
- * changes the state to Closed and close any underlying input.
- */
- void Close();
-
- /**
- * Provides the value of the attribute with the specified index relative to the containing element.
- * @param number the zero-based index of the attribute relative to the containing element
- */
+
+ /**
+ * Parses an attribute value into one or more Text and EntityReference nodes.
+ * @return A bool where true indicates the attribute value was parsed,
+ * and false indicates the reader was not positioned on an attribute node
+ * or all the attribute values have been read
+ */
+ bool ReadAttributeValue() const;
+
+ /**
+ * Gets the number of attributes on the current node.
+ * @return The number of attributes on the current node, or zero if the current node
+ * does not support attributes
+ */
+ int GetAttributeCount() const;
+
+ /**
+ * Gets the base Uniform Resource Identifier (URI) of the current node.
+ * @return The base URI of the current node or an empty string if not available
+ */
+ TStringBuf GetBaseUri() const;
+
+ /**
+ * Gets the depth of the current node in the XML document.
+ * @return The depth of the current node in the XML document
+ */
+ int GetDepth() const;
+
+ /**
+ * Gets a value indicating whether the current node has any attributes.
+ * @return true if the current has attributes, false otherwise
+ */
+ bool HasAttributes() const;
+
+ /**
+ * Whether the node can have a text value.
+ * @return true if the current node can have an associated text value, false otherwise
+ */
+ bool HasValue() const;
+
+ /**
+ * Whether an Attribute node was generated from the default value defined in the DTD or schema.
+ * @return true if defaulted, false otherwise
+ */
+ bool IsDefault() const;
+
+ /**
+ * Check if the current node is empty.
+ * @return true if empty, false otherwise
+ */
+ bool IsEmptyElement() const;
+
+ /**
+ * The local name of the node.
+ * @return the local name or empty string if not available
+ */
+ TStringBuf GetLocalName() const;
+
+ /**
+ * The qualified name of the node, equal to Prefix:LocalName.
+ * @return the name or empty string if not available
+ */
+ TStringBuf GetName() const;
+
+ /**
+ * The URI defining the namespace associated with the node.
+ * @return the namespace URI or empty string if not available
+ */
+ TStringBuf GetNamespaceUri() const;
+
+ /**
+ * Get the node type of the current node.
+ * @return the ENodeType of the current node
+ */
+ ENodeType GetNodeType() const;
+
+ /**
+ * Get the namespace prefix associated with the current node.
+ * @return the namespace prefix, or an empty string if not available
+ */
+ TStringBuf GetPrefix() const;
+
+ /**
+ * Get the quotation mark character used to enclose the value of an attribute.
+ * @return " or '
+ */
+ char GetQuoteChar() const;
+
+ /**
+ * Provides the text value of the node if present.
+ * @return the string or empty if not available
+ */
+ TStringBuf GetValue() const;
+
+ /**
+ * Gets the read state of the reader.
+ * @return the state value
+ */
+ EReadState GetReadState() const;
+
+ /**
+ * This method releases any resources allocated by the current instance
+ * changes the state to Closed and close any underlying input.
+ */
+ void Close();
+
+ /**
+ * Provides the value of the attribute with the specified index relative to the containing element.
+ * @param number the zero-based index of the attribute relative to the containing element
+ */
TString GetAttribute(int number) const;
-
- /**
- * Provides the value of the attribute with the specified qualified name.
- * @param name the qualified name of the attribute
- */
+
+ /**
+ * Provides the value of the attribute with the specified qualified name.
+ * @param name the qualified name of the attribute
+ */
TString GetAttribute(TZtStringBuf name) const;
-
- /**
- * Provides the value of the specified attribute.
- * @param localName the local name of the attribute
- * @param nsUri the namespace URI of the attribute
- */
+
+ /**
+ * Provides the value of the specified attribute.
+ * @param localName the local name of the attribute
+ * @param nsUri the namespace URI of the attribute
+ */
TString GetAttribute(TZtStringBuf localName, TZtStringBuf nsUri) const;
-
- /**
- * Resolves a namespace prefix in the scope of the current element.
- * @param prefix the prefix whose namespace URI is to be resolved. To return the default namespace, specify empty string.
- * @return a string containing the namespace URI to which the prefix maps.
- */
+
+ /**
+ * Resolves a namespace prefix in the scope of the current element.
+ * @param prefix the prefix whose namespace URI is to be resolved. To return the default namespace, specify empty string.
+ * @return a string containing the namespace URI to which the prefix maps.
+ */
TString LookupNamespace(TZtStringBuf prefix) const;
-
- /**
- * Moves the position of the current instance to the attribute with the specified index relative to the containing element.
- * @param number the zero-based index of the attribute relative to the containing element
- * @return true in case of success, false if not found
- */
- bool MoveToAttribute(int number);
-
- /**
- * Moves the position of the current instance to the attribute with the specified qualified name.
- * @param name the qualified name of the attribute
- * @return true in case of success, false if not found
- */
+
+ /**
+ * Moves the position of the current instance to the attribute with the specified index relative to the containing element.
+ * @param number the zero-based index of the attribute relative to the containing element
+ * @return true in case of success, false if not found
+ */
+ bool MoveToAttribute(int number);
+
+ /**
+ * Moves the position of the current instance to the attribute with the specified qualified name.
+ * @param name the qualified name of the attribute
+ * @return true in case of success, false if not found
+ */
bool MoveToAttribute(TZtStringBuf name);
-
- /**
- * Moves the position of the current instance to the attribute with the specified local name and namespace URI.
- * @param localName the local name of the attribute
- * @param nsUri the namespace URI of the attribute
- * @return true in case of success, false if not found
- */
+
+ /**
+ * Moves the position of the current instance to the attribute with the specified local name and namespace URI.
+ * @param localName the local name of the attribute
+ * @param nsUri the namespace URI of the attribute
+ * @return true in case of success, false if not found
+ */
bool MoveToAttribute(TZtStringBuf localName, TZtStringBuf nsUri);
-
- /**
- * Moves the position of the current instance to the first attribute associated with the current node.
- * @return true in case of success, false if not found
- */
- bool MoveToFirstAttribute();
-
- /**
- * Moves the position of the current instance to the next attribute associated with the current node.
- * @return true in case of success, false if not found
- */
- bool MoveToNextAttribute();
-
- /**
- * Moves the position of the current instance to the node that contains the current Attribute node.
- * @return true in case of success, false if not found
- */
- bool MoveToElement();
-
- /**
- * Reads the contents of the current node and the full subtree. It then makes the subtree available until the next Read() call.
- */
- TConstNode Expand() const;
-
- /**
- * Skip to the node following the current one in document order while avoiding the subtree if any.
- * @return true if the node was read successfully, false if there is no more nodes to read
- */
- bool Next();
-
- /**
- * Retrieve the validity status from the parser context.
- */
- bool IsValid() const;
-
- private:
- static int ReadFromInputStreamCallback(void* context, char* buffer, int len);
- static void OnLibxmlError(void* arg, const char* msg, xmlParserSeverities severity, xmlTextReaderLocatorPtr locator);
-
- void SetupErrorHandler();
- TStringStream& LogError() const;
- void CheckForExceptions() const;
- void ThrowException() const;
-
- // helpers that check return codes of C functions from libxml
- bool BoolResult(int value) const;
- int IntResult(int value) const;
- char CharResult(int value) const;
- TStringBuf ConstStringResult(const xmlChar* value) const;
- TStringBuf ConstStringOrEmptyResult(const xmlChar* value) const;
+
+ /**
+ * Moves the position of the current instance to the first attribute associated with the current node.
+ * @return true in case of success, false if not found
+ */
+ bool MoveToFirstAttribute();
+
+ /**
+ * Moves the position of the current instance to the next attribute associated with the current node.
+ * @return true in case of success, false if not found
+ */
+ bool MoveToNextAttribute();
+
+ /**
+ * Moves the position of the current instance to the node that contains the current Attribute node.
+ * @return true in case of success, false if not found
+ */
+ bool MoveToElement();
+
+ /**
+ * Reads the contents of the current node and the full subtree. It then makes the subtree available until the next Read() call.
+ */
+ TConstNode Expand() const;
+
+ /**
+ * Skip to the node following the current one in document order while avoiding the subtree if any.
+ * @return true if the node was read successfully, false if there is no more nodes to read
+ */
+ bool Next();
+
+ /**
+ * Retrieve the validity status from the parser context.
+ */
+ bool IsValid() const;
+
+ private:
+ static int ReadFromInputStreamCallback(void* context, char* buffer, int len);
+ static void OnLibxmlError(void* arg, const char* msg, xmlParserSeverities severity, xmlTextReaderLocatorPtr locator);
+
+ void SetupErrorHandler();
+ TStringStream& LogError() const;
+ void CheckForExceptions() const;
+ void ThrowException() const;
+
+ // helpers that check return codes of C functions from libxml
+ bool BoolResult(int value) const;
+ int IntResult(int value) const;
+ char CharResult(int value) const;
+ TStringBuf ConstStringResult(const xmlChar* value) const;
+ TStringBuf ConstStringOrEmptyResult(const xmlChar* value) const;
TString TempStringResult(TCharPtr value) const;
TString TempStringOrEmptyResult(TCharPtr value) const;
-
- private:
+
+ private:
IInputStream& Stream;
-
- mutable bool IsError;
- mutable TStringStream ErrorBuffer;
-
- struct TDeleter;
- THolder<xmlTextReader, TDeleter> Impl;
- };
-
+
+ mutable bool IsError;
+ mutable TStringStream ErrorBuffer;
+
+ struct TDeleter;
+ THolder<xmlTextReader, TDeleter> Impl;
+ };
+
}
diff --git a/library/cpp/xml/document/xml-textreader_ut.cpp b/library/cpp/xml/document/xml-textreader_ut.cpp
index 6232dfe47e..9f54523fef 100644
--- a/library/cpp/xml/document/xml-textreader_ut.cpp
+++ b/library/cpp/xml/document/xml-textreader_ut.cpp
@@ -1,34 +1,34 @@
-#include "xml-textreader.h"
-
+#include "xml-textreader.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
-#include <util/generic/hash.h>
-#include <util/generic/vector.h>
-#include <util/string/join.h>
-
-namespace {
- /**
- * Simple wrapper around the xmlTextReader wrapper
- */
+
+#include <util/generic/hash.h>
+#include <util/generic/vector.h>
+#include <util/string/join.h>
+
+namespace {
+ /**
+ * Simple wrapper around the xmlTextReader wrapper
+ */
void ParseXml(const TString& xmlData,
std::function<void(NXml::TConstNode)> nodeHandlerFunc,
const TString& localName,
const TString& namespaceUri = TString()) {
- TStringInput in(xmlData);
- NXml::TTextReader reader(in);
-
- while (reader.Read()) {
- if (reader.GetNodeType() == NXml::TTextReader::ENodeType::Element &&
- reader.GetLocalName() == localName &&
+ TStringInput in(xmlData);
+ NXml::TTextReader reader(in);
+
+ while (reader.Read()) {
+ if (reader.GetNodeType() == NXml::TTextReader::ENodeType::Element &&
+ reader.GetLocalName() == localName &&
reader.GetNamespaceUri() == namespaceUri)
{
- const NXml::TConstNode node = reader.Expand();
- nodeHandlerFunc(node);
- }
- }
- }
+ const NXml::TConstNode node = reader.Expand();
+ nodeHandlerFunc(node);
+ }
+ }
+ }
}
-
+
Y_UNIT_TEST_SUITE(TestXmlTextReader) {
Y_UNIT_TEST(BasicExample) {
const TString xml = "<?xml version=\"1.0\"?>\n"
@@ -40,73 +40,73 @@ Y_UNIT_TEST_SUITE(TestXmlTextReader) {
" <child_of_child>Some content : -)</child_of_child>\n"
" </examplechild>\n"
"</example>\n";
-
- TStringInput input(xml);
- NXml::TTextReader reader(input);
-
- using ENT = NXml::TTextReader::ENodeType;
-
- struct TItem {
- int Depth;
- ENT Type;
+
+ TStringInput input(xml);
+ NXml::TTextReader reader(input);
+
+ using ENT = NXml::TTextReader::ENodeType;
+
+ struct TItem {
+ int Depth;
+ ENT Type;
TString Name;
TString Attrs;
TString Value;
- };
-
+ };
+
TVector<TItem> found;
TVector<TString> msgs;
-
- while (reader.Read()) {
- // dump attributes as "k1: v1, k2: v2, ..."
+
+ while (reader.Read()) {
+ // dump attributes as "k1: v1, k2: v2, ..."
TVector<TString> kv;
- if (reader.HasAttributes()) {
- reader.MoveToFirstAttribute();
- do {
+ if (reader.HasAttributes()) {
+ reader.MoveToFirstAttribute();
+ do {
kv.push_back(TString::Join(reader.GetName(), ": ", reader.GetValue()));
- } while (reader.MoveToNextAttribute());
- reader.MoveToElement();
- }
-
- found.push_back(TItem{
- reader.GetDepth(),
- reader.GetNodeType(),
+ } while (reader.MoveToNextAttribute());
+ reader.MoveToElement();
+ }
+
+ found.push_back(TItem{
+ reader.GetDepth(),
+ reader.GetNodeType(),
TString(reader.GetName()),
- JoinSeq(", ", kv),
+ JoinSeq(", ", kv),
reader.HasValue() ? TString(reader.GetValue()) : TString(),
- });
- }
-
+ });
+ }
+
const TVector<TItem> expected = {
- TItem{0, ENT::Element, "example", "toto: 1", ""},
- TItem{1, ENT::SignificantWhitespace, "#text", "", "\n "},
- TItem{1, ENT::Element, "examplechild", "id: 1", ""},
- TItem{2, ENT::SignificantWhitespace, "#text", "", "\n "},
- TItem{2, ENT::Element, "child_of_child", "", ""},
- TItem{2, ENT::SignificantWhitespace, "#text", "", "\n "},
- TItem{1, ENT::EndElement, "examplechild", "id: 1", ""},
- TItem{1, ENT::SignificantWhitespace, "#text", "", "\n "},
- TItem{1, ENT::Element, "examplechild", "id: 2, toto: 3", ""},
- TItem{2, ENT::SignificantWhitespace, "#text", "", "\n "},
- TItem{2, ENT::Element, "child_of_child", "", ""},
- TItem{3, ENT::Text, "#text", "", "Some content : -)"},
- TItem{2, ENT::EndElement, "child_of_child", "", ""},
- TItem{2, ENT::SignificantWhitespace, "#text", "", "\n "},
- TItem{1, ENT::EndElement, "examplechild", "id: 2, toto: 3", ""},
- TItem{1, ENT::SignificantWhitespace, "#text", "", "\n"},
+ TItem{0, ENT::Element, "example", "toto: 1", ""},
+ TItem{1, ENT::SignificantWhitespace, "#text", "", "\n "},
+ TItem{1, ENT::Element, "examplechild", "id: 1", ""},
+ TItem{2, ENT::SignificantWhitespace, "#text", "", "\n "},
+ TItem{2, ENT::Element, "child_of_child", "", ""},
+ TItem{2, ENT::SignificantWhitespace, "#text", "", "\n "},
+ TItem{1, ENT::EndElement, "examplechild", "id: 1", ""},
+ TItem{1, ENT::SignificantWhitespace, "#text", "", "\n "},
+ TItem{1, ENT::Element, "examplechild", "id: 2, toto: 3", ""},
+ TItem{2, ENT::SignificantWhitespace, "#text", "", "\n "},
+ TItem{2, ENT::Element, "child_of_child", "", ""},
+ TItem{3, ENT::Text, "#text", "", "Some content : -)"},
+ TItem{2, ENT::EndElement, "child_of_child", "", ""},
+ TItem{2, ENT::SignificantWhitespace, "#text", "", "\n "},
+ TItem{1, ENT::EndElement, "examplechild", "id: 2, toto: 3", ""},
+ TItem{1, ENT::SignificantWhitespace, "#text", "", "\n"},
TItem{0, ENT::EndElement, "example", "toto: 1", ""}};
-
- UNIT_ASSERT_VALUES_EQUAL(found.size(), expected.size());
-
- for (size_t i = 0; i < expected.size(); ++i) {
- UNIT_ASSERT_VALUES_EQUAL_C(found[i].Depth, expected[i].Depth, "line " << i);
- UNIT_ASSERT_EQUAL_C(found[i].Type, expected[i].Type, "line " << i);
- UNIT_ASSERT_VALUES_EQUAL_C(found[i].Name, expected[i].Name, "line " << i);
- UNIT_ASSERT_VALUES_EQUAL_C(found[i].Attrs, expected[i].Attrs, "line " << i);
- UNIT_ASSERT_VALUES_EQUAL_C(found[i].Value, expected[i].Value, "line " << i);
- }
- }
-
+
+ UNIT_ASSERT_VALUES_EQUAL(found.size(), expected.size());
+
+ for (size_t i = 0; i < expected.size(); ++i) {
+ UNIT_ASSERT_VALUES_EQUAL_C(found[i].Depth, expected[i].Depth, "line " << i);
+ UNIT_ASSERT_EQUAL_C(found[i].Type, expected[i].Type, "line " << i);
+ UNIT_ASSERT_VALUES_EQUAL_C(found[i].Name, expected[i].Name, "line " << i);
+ UNIT_ASSERT_VALUES_EQUAL_C(found[i].Attrs, expected[i].Attrs, "line " << i);
+ UNIT_ASSERT_VALUES_EQUAL_C(found[i].Value, expected[i].Value, "line " << i);
+ }
+ }
+
const TString GEODATA = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
"<root>"
""
@@ -133,158 +133,158 @@ Y_UNIT_TEST_SUITE(TestXmlTextReader) {
" </country>"
""
"</root>";
-
+
Y_UNIT_TEST(ParseXmlSimple) {
- struct TCountry {
+ struct TCountry {
TString Name;
TVector<TString> Cities;
- };
-
+ };
+
THashMap<int, TCountry> data;
-
- auto handler = [&data](NXml::TConstNode node) {
- const int id = node.Attr<int>("id");
-
- TCountry& c = data[id];
-
+
+ auto handler = [&data](NXml::TConstNode node) {
+ const int id = node.Attr<int>("id");
+
+ TCountry& c = data[id];
+
c.Name = node.FirstChild("name").Value<TString>();
-
- const NXml::TConstNodes cityNodes = node.Nodes("cities/city");
+
+ const NXml::TConstNodes cityNodes = node.Nodes("cities/city");
for (auto cityNode : cityNodes) {
c.Cities.push_back(cityNode.Value<TString>());
- }
- };
-
- ParseXml(GEODATA, handler, "country");
-
- UNIT_ASSERT_EQUAL(data.size(), 3);
-
+ }
+ };
+
+ ParseXml(GEODATA, handler, "country");
+
+ UNIT_ASSERT_EQUAL(data.size(), 3);
+
UNIT_ASSERT(data.contains(225));
- const TCountry& russia = data.at(225);
- UNIT_ASSERT_EQUAL(russia.Name, "Россия");
- UNIT_ASSERT_EQUAL(russia.Cities.size(), 2);
- UNIT_ASSERT_EQUAL(russia.Cities[0], "Москва");
- UNIT_ASSERT_EQUAL(russia.Cities[1], "Санкт-Петербург");
-
+ const TCountry& russia = data.at(225);
+ UNIT_ASSERT_EQUAL(russia.Name, "Россия");
+ UNIT_ASSERT_EQUAL(russia.Cities.size(), 2);
+ UNIT_ASSERT_EQUAL(russia.Cities[0], "Москва");
+ UNIT_ASSERT_EQUAL(russia.Cities[1], "Санкт-Петербург");
+
UNIT_ASSERT(data.contains(149));
- const TCountry& belarus = data.at(149);
- UNIT_ASSERT_EQUAL(belarus.Name, "Беларусь");
- UNIT_ASSERT_EQUAL(belarus.Cities.size(), 1);
- UNIT_ASSERT_EQUAL(belarus.Cities[0], "Минск");
-
+ const TCountry& belarus = data.at(149);
+ UNIT_ASSERT_EQUAL(belarus.Name, "Беларусь");
+ UNIT_ASSERT_EQUAL(belarus.Cities.size(), 1);
+ UNIT_ASSERT_EQUAL(belarus.Cities[0], "Минск");
+
UNIT_ASSERT(data.contains(187));
- const TCountry& ukraine = data.at(187);
- UNIT_ASSERT_EQUAL(ukraine.Name, "Украина");
- UNIT_ASSERT_EQUAL(ukraine.Cities.size(), 1);
- UNIT_ASSERT_EQUAL(ukraine.Cities[0], "Киев");
- }
-
+ const TCountry& ukraine = data.at(187);
+ UNIT_ASSERT_EQUAL(ukraine.Name, "Украина");
+ UNIT_ASSERT_EQUAL(ukraine.Cities.size(), 1);
+ UNIT_ASSERT_EQUAL(ukraine.Cities[0], "Киев");
+ }
+
Y_UNIT_TEST(ParseXmlDeepLevel) {
TVector<TString> cities;
-
- auto handler = [&cities](NXml::TConstNode node) {
+
+ auto handler = [&cities](NXml::TConstNode node) {
cities.push_back(node.Value<TString>());
- };
-
- ParseXml(GEODATA, handler, "city");
-
- UNIT_ASSERT_EQUAL(cities.size(), 4);
- UNIT_ASSERT_EQUAL(cities[0], "Москва");
- UNIT_ASSERT_EQUAL(cities[1], "Санкт-Петербург");
- UNIT_ASSERT_EQUAL(cities[2], "Минск");
- UNIT_ASSERT_EQUAL(cities[3], "Киев");
- }
-
+ };
+
+ ParseXml(GEODATA, handler, "city");
+
+ UNIT_ASSERT_EQUAL(cities.size(), 4);
+ UNIT_ASSERT_EQUAL(cities[0], "Москва");
+ UNIT_ASSERT_EQUAL(cities[1], "Санкт-Петербург");
+ UNIT_ASSERT_EQUAL(cities[2], "Минск");
+ UNIT_ASSERT_EQUAL(cities[3], "Киев");
+ }
+
Y_UNIT_TEST(ParseXmlException) {
- // Check that exception properly passes through plain C code of libxml,
- // no leaks are detected by valgrind.
- auto handler = [](NXml::TConstNode node) {
- const int id = node.Attr<int>("id");
- if (id != 225) {
- ythrow yexception() << "unsupported id: " << id;
- }
- };
-
- UNIT_ASSERT_EXCEPTION(ParseXml(GEODATA, handler, "country"), yexception);
- UNIT_ASSERT_EXCEPTION(ParseXml("<a></b>", handler, "a"), yexception);
- UNIT_ASSERT_EXCEPTION(ParseXml("<root><a id=\"1\"></a><a id=\"2\"></b></root>", handler, "a"), yexception);
- UNIT_ASSERT_EXCEPTION(ParseXml("<root><a id=\"1\"></a><a id=\"2></a></root>", handler, "a"), yexception);
- }
-
+ // Check that exception properly passes through plain C code of libxml,
+ // no leaks are detected by valgrind.
+ auto handler = [](NXml::TConstNode node) {
+ const int id = node.Attr<int>("id");
+ if (id != 225) {
+ ythrow yexception() << "unsupported id: " << id;
+ }
+ };
+
+ UNIT_ASSERT_EXCEPTION(ParseXml(GEODATA, handler, "country"), yexception);
+ UNIT_ASSERT_EXCEPTION(ParseXml("<a></b>", handler, "a"), yexception);
+ UNIT_ASSERT_EXCEPTION(ParseXml("<root><a id=\"1\"></a><a id=\"2\"></b></root>", handler, "a"), yexception);
+ UNIT_ASSERT_EXCEPTION(ParseXml("<root><a id=\"1\"></a><a id=\"2></a></root>", handler, "a"), yexception);
+ }
+
const TString BACKA = // UTF-8 encoding is used implicitly
- "<Companies"
- " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
- " xmlns=\"http://maps.yandex.ru/backa/1.x\""
- " xmlns:atom=\"http://www.w3.org/2005/Atom\""
- " xmlns:biz=\"http://maps.yandex.ru/business/1.x\""
- " xmlns:xal=\"urn:oasis:names:tc:ciq:xsdschema:xAL:2.0\""
- " xmlns:gml=\"http://www.opengis.net/gml\""
- ">"
- ""
- " <Company id=\"0001\">"
- " <Geo>"
- " <Location>"
- " <gml:pos>37.62669 55.664827</gml:pos>"
- " <kind>house</kind>"
- " </Location>"
- " <AddressDetails xmlns=\"urn:oasis:names:tc:ciq:xsdschema:xAL:2.0\">"
- " <Country>"
- " <AddressLine xml:lang=\"ru\">Москва, Каширское ш., 14</AddressLine>"
- " </Country>"
- " </AddressDetails>"
- " </Geo>"
- " </Company>"
- ""
- " <Company id=\"0002\">"
- " <Geo>"
- " <Location>"
- " <pos xmlns=\"http://www.opengis.net/gml\">150.819797 59.56092</pos>"
- " <kind>locality</kind>"
- " </Location>"
- " <xal:AddressDetails>"
- " <xal:Country>"
- " <xal:AddressLine xml:lang=\"ru\">Магадан, ул. Пролетарская, 43</xal:AddressLine>"
- " </xal:Country>"
- " </xal:AddressDetails>"
- " </Geo>"
- " </Company>"
- ""
- "</Companies>";
-
+ "<Companies"
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ " xmlns=\"http://maps.yandex.ru/backa/1.x\""
+ " xmlns:atom=\"http://www.w3.org/2005/Atom\""
+ " xmlns:biz=\"http://maps.yandex.ru/business/1.x\""
+ " xmlns:xal=\"urn:oasis:names:tc:ciq:xsdschema:xAL:2.0\""
+ " xmlns:gml=\"http://www.opengis.net/gml\""
+ ">"
+ ""
+ " <Company id=\"0001\">"
+ " <Geo>"
+ " <Location>"
+ " <gml:pos>37.62669 55.664827</gml:pos>"
+ " <kind>house</kind>"
+ " </Location>"
+ " <AddressDetails xmlns=\"urn:oasis:names:tc:ciq:xsdschema:xAL:2.0\">"
+ " <Country>"
+ " <AddressLine xml:lang=\"ru\">Москва, Каширское ш., 14</AddressLine>"
+ " </Country>"
+ " </AddressDetails>"
+ " </Geo>"
+ " </Company>"
+ ""
+ " <Company id=\"0002\">"
+ " <Geo>"
+ " <Location>"
+ " <pos xmlns=\"http://www.opengis.net/gml\">150.819797 59.56092</pos>"
+ " <kind>locality</kind>"
+ " </Location>"
+ " <xal:AddressDetails>"
+ " <xal:Country>"
+ " <xal:AddressLine xml:lang=\"ru\">Магадан, ул. Пролетарская, 43</xal:AddressLine>"
+ " </xal:Country>"
+ " </xal:AddressDetails>"
+ " </Geo>"
+ " </Company>"
+ ""
+ "</Companies>";
+
Y_UNIT_TEST(NamespaceHell) {
- using TNS = NXml::TNamespaceForXPath;
+ using TNS = NXml::TNamespaceForXPath;
const NXml::TNamespacesForXPath ns = {
- TNS{"b", "http://maps.yandex.ru/backa/1.x"},
- TNS{"gml", "http://www.opengis.net/gml"},
+ TNS{"b", "http://maps.yandex.ru/backa/1.x"},
+ TNS{"gml", "http://www.opengis.net/gml"},
TNS{"xal", "urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"}};
-
- int count = 0;
+
+ int count = 0;
THashMap<TString, TString> positions;
THashMap<TString, TString> addresses;
-
- auto handler = [&](NXml::TConstNode node) {
- count++;
+
+ auto handler = [&](NXml::TConstNode node) {
+ count++;
const auto id = node.Attr<TString>("id");
-
- NXml::TXPathContextPtr ctxt = node.CreateXPathContext(ns);
-
- const NXml::TConstNode location = node.Node("b:Geo/b:Location", false, *ctxt);
+
+ NXml::TXPathContextPtr ctxt = node.CreateXPathContext(ns);
+
+ const NXml::TConstNode location = node.Node("b:Geo/b:Location", false, *ctxt);
positions[id] = location.Node("gml:pos", false, *ctxt).Value<TString>();
addresses[id] = node.Node("b:Geo/xal:AddressDetails/xal:Country/xal:AddressLine", false, *ctxt).Value<TString>();
- };
-
- ParseXml(BACKA, handler, "Company");
- UNIT_ASSERT_EQUAL(count, 0);
- // nothing found because namespace was not specified
-
- ParseXml(BACKA, handler, "Company", "http://maps.yandex.ru/backa/1.x");
-
- UNIT_ASSERT_VALUES_EQUAL(count, 2);
-
- UNIT_ASSERT_VALUES_EQUAL(positions["0001"], "37.62669 55.664827");
- UNIT_ASSERT_VALUES_EQUAL(positions["0002"], "150.819797 59.56092");
-
- UNIT_ASSERT_VALUES_EQUAL(addresses["0001"], "Москва, Каширское ш., 14");
- UNIT_ASSERT_VALUES_EQUAL(addresses["0002"], "Магадан, ул. Пролетарская, 43");
- }
-}
+ };
+
+ ParseXml(BACKA, handler, "Company");
+ UNIT_ASSERT_EQUAL(count, 0);
+ // nothing found because namespace was not specified
+
+ ParseXml(BACKA, handler, "Company", "http://maps.yandex.ru/backa/1.x");
+
+ UNIT_ASSERT_VALUES_EQUAL(count, 2);
+
+ UNIT_ASSERT_VALUES_EQUAL(positions["0001"], "37.62669 55.664827");
+ UNIT_ASSERT_VALUES_EQUAL(positions["0002"], "150.819797 59.56092");
+
+ UNIT_ASSERT_VALUES_EQUAL(addresses["0001"], "Москва, Каширское ш., 14");
+ UNIT_ASSERT_VALUES_EQUAL(addresses["0002"], "Магадан, ул. Пролетарская, 43");
+ }
+}
diff --git a/library/cpp/xml/document/ya.make b/library/cpp/xml/document/ya.make
index 86bbd639cf..06a0065972 100644
--- a/library/cpp/xml/document/ya.make
+++ b/library/cpp/xml/document/ya.make
@@ -4,7 +4,7 @@ OWNER(finder)
SRCS(
xml-document.cpp
- xml-textreader.cpp
+ xml-textreader.cpp
xml-options.cpp
)
diff --git a/library/cpp/ya.make b/library/cpp/ya.make
index 8c1193b007..7c808ec29b 100644
--- a/library/cpp/ya.make
+++ b/library/cpp/ya.make
@@ -129,7 +129,7 @@ RECURSE(
fuid
fuid/ut
function_tracer
- geo
+ geo
geobase
geobase/ut
geohash
diff --git a/library/python/pytest/plugins/collection.py b/library/python/pytest/plugins/collection.py
index e36f47a78f..f49c675d36 100644
--- a/library/python/pytest/plugins/collection.py
+++ b/library/python/pytest/plugins/collection.py
@@ -85,8 +85,8 @@ def pytest_ignore_collect(module, session, filenames_from_full_filters, accept_f
if filenames_from_full_filters is not None and module.name not in filenames_from_full_filters:
return True
- test_file_filter = getattr(session.config.option, 'test_file_filter', None)
- if test_file_filter is None:
+ test_file_filter = getattr(session.config.option, 'test_file_filter', None)
+ if test_file_filter is None:
return False
if module.name != test_file_filter.replace('/', '.'):
return True
diff --git a/library/python/pytest/yatest_tools.py b/library/python/pytest/yatest_tools.py
index 6b8b896394..7b37688fd4 100644
--- a/library/python/pytest/yatest_tools.py
+++ b/library/python/pytest/yatest_tools.py
@@ -210,8 +210,8 @@ def get_unique_file_path(dir_path, filename, cache=collections.defaultdict(set))
max_path = 260
filename_len = len(dir_path) + len(extension) + tail_length + len(os.sep)
if filename_len < max_path:
- filename = yatest_lib.tools.trim_string(filename, max_path - filename_len)
- filename = yatest_lib.tools.trim_string(filename, get_max_filename_length(dir_path) - tail_length - len(extension)) + extension
+ filename = yatest_lib.tools.trim_string(filename, max_path - filename_len)
+ filename = yatest_lib.tools.trim_string(filename, get_max_filename_length(dir_path) - tail_length - len(extension)) + extension
candidate = os.path.join(dir_path, filename)
key = dir_path + filename
diff --git a/library/python/testing/recipe/__init__.py b/library/python/testing/recipe/__init__.py
index 5ef9c5c189..91d31d370a 100644
--- a/library/python/testing/recipe/__init__.py
+++ b/library/python/testing/recipe/__init__.py
@@ -1,5 +1,5 @@
-from __future__ import print_function
-
+from __future__ import print_function
+
import os
import sys
import json
@@ -86,7 +86,7 @@ def declare_recipe(start, stop):
parsed_args, argv = get_options()
if parsed_args.show_cwd:
- print("Recipe \"{} {}\" working dir is {}".format(sys.argv[0], " ".join(argv), os.getcwd()))
+ print("Recipe \"{} {}\" working dir is {}".format(sys.argv[0], " ".join(argv), os.getcwd()))
try:
if argv[0] == RECIPE_START_OPTION:
diff --git a/library/python/testing/recipe/ya.make b/library/python/testing/recipe/ya.make
index dd323aa245..0d98ecc3d6 100644
--- a/library/python/testing/recipe/ya.make
+++ b/library/python/testing/recipe/ya.make
@@ -3,7 +3,7 @@ OWNER(
g:yatest
)
-PY23_LIBRARY()
+PY23_LIBRARY()
PY_SRCS(
__init__.py
diff --git a/library/python/testing/yatest_lib/tools.py b/library/python/testing/yatest_lib/tools.py
index b72d79c162..0cf2ce87c8 100644
--- a/library/python/testing/yatest_lib/tools.py
+++ b/library/python/testing/yatest_lib/tools.py
@@ -1,4 +1,4 @@
-import six
+import six
import sys
@@ -16,46 +16,46 @@ def to_utf8(value):
return value.encode('utf-8', 'ignore')
else:
return str(value)
-
-
-def trim_string(s, max_bytes):
- """
- Adjusts the length of the string s in order to fit it
- into max_bytes bytes of storage after encoding as UTF-8.
- Useful when cutting filesystem paths.
- :param s: unicode string
- :param max_bytes: number of bytes
- :return the prefix of s
- """
- if isinstance(s, six.text_type):
- return _trim_unicode_string(s, max_bytes)
-
- if isinstance(s, six.binary_type):
- if len(s) <= max_bytes:
- return s
- s = s.decode('utf-8', errors='ignore')
- s = _trim_unicode_string(s, max_bytes)
- s = s.encode('utf-8', errors='ignore')
- return s
-
- raise TypeError('a string is expected')
-
-
-def _trim_unicode_string(s, max_bytes):
- if len(s) * 4 <= max_bytes:
- # UTF-8 uses at most 4 bytes per character
- return s
-
- result = []
- cur_byte_length = 0
-
- for ch in s:
- cur_byte_length += len(ch.encode('utf-8'))
- if cur_byte_length > max_bytes:
- break
- result.append(ch)
-
- return ''.join(result)
+
+
+def trim_string(s, max_bytes):
+ """
+ Adjusts the length of the string s in order to fit it
+ into max_bytes bytes of storage after encoding as UTF-8.
+ Useful when cutting filesystem paths.
+ :param s: unicode string
+ :param max_bytes: number of bytes
+ :return the prefix of s
+ """
+ if isinstance(s, six.text_type):
+ return _trim_unicode_string(s, max_bytes)
+
+ if isinstance(s, six.binary_type):
+ if len(s) <= max_bytes:
+ return s
+ s = s.decode('utf-8', errors='ignore')
+ s = _trim_unicode_string(s, max_bytes)
+ s = s.encode('utf-8', errors='ignore')
+ return s
+
+ raise TypeError('a string is expected')
+
+
+def _trim_unicode_string(s, max_bytes):
+ if len(s) * 4 <= max_bytes:
+ # UTF-8 uses at most 4 bytes per character
+ return s
+
+ result = []
+ cur_byte_length = 0
+
+ for ch in s:
+ cur_byte_length += len(ch.encode('utf-8'))
+ if cur_byte_length > max_bytes:
+ break
+ result.append(ch)
+
+ return ''.join(result)
def to_str(s):
diff --git a/util/charset/benchmark/utf8_to_wide/main.cpp b/util/charset/benchmark/utf8_to_wide/main.cpp
index 09fa567fe5..e9e0d9e612 100644
--- a/util/charset/benchmark/utf8_to_wide/main.cpp
+++ b/util/charset/benchmark/utf8_to_wide/main.cpp
@@ -26,7 +26,7 @@ namespace {
unsigned char* textEnd = data.begin();
for (size_t i = 0; i < N; ++i) {
size_t runeLen;
- WriteUTF8Char(RandomNumber<ui32>(0x7FF) + 1, runeLen, textEnd);
+ WriteUTF8Char(RandomNumber<ui32>(0x7FF) + 1, runeLen, textEnd);
textEnd += runeLen;
}
assign(reinterpret_cast<const char*>(data.begin()), reinterpret_cast<const char*>(textEnd));
diff --git a/util/datetime/base.h b/util/datetime/base.h
index 5e902b8f63..c1529a1793 100644
--- a/util/datetime/base.h
+++ b/util/datetime/base.h
@@ -123,10 +123,10 @@ public:
return Value_ * (1 / 1000000.0);
}
- constexpr double MillisecondsFloat() const noexcept {
- return Value_ * (1 / 1000.0);
- }
-
+ constexpr double MillisecondsFloat() const noexcept {
+ return Value_ * (1 / 1000.0);
+ }
+
constexpr TValue MicroSeconds() const noexcept {
return Value_;
}
diff --git a/util/datetime/base_ut.cpp b/util/datetime/base_ut.cpp
index afc3f802eb..49313d60de 100644
--- a/util/datetime/base_ut.cpp
+++ b/util/datetime/base_ut.cpp
@@ -448,17 +448,17 @@ Y_UNIT_TEST_SUITE(DateTimeTest) {
UNIT_ASSERT_DOUBLES_EQUAL(TDuration::Minutes(1) / TDuration::Seconds(10), 6.0, 1e-9);
}
- Y_UNIT_TEST(TestDurationGetters) {
- const TDuration value = TDuration::MicroSeconds(1234567);
- UNIT_ASSERT_VALUES_EQUAL(value.Seconds(), 1);
- UNIT_ASSERT_DOUBLES_EQUAL(value.SecondsFloat(), 1.234567, 1e-9);
-
- UNIT_ASSERT_VALUES_EQUAL(value.MilliSeconds(), 1234);
- UNIT_ASSERT_DOUBLES_EQUAL(value.MillisecondsFloat(), 1234.567, 1e-9);
-
- UNIT_ASSERT_VALUES_EQUAL(value.MicroSeconds(), 1234567);
- }
-
+ Y_UNIT_TEST(TestDurationGetters) {
+ const TDuration value = TDuration::MicroSeconds(1234567);
+ UNIT_ASSERT_VALUES_EQUAL(value.Seconds(), 1);
+ UNIT_ASSERT_DOUBLES_EQUAL(value.SecondsFloat(), 1.234567, 1e-9);
+
+ UNIT_ASSERT_VALUES_EQUAL(value.MilliSeconds(), 1234);
+ UNIT_ASSERT_DOUBLES_EQUAL(value.MillisecondsFloat(), 1234.567, 1e-9);
+
+ UNIT_ASSERT_VALUES_EQUAL(value.MicroSeconds(), 1234567);
+ }
+
template <class T>
void TestTimeUnits() {
T withTime = T::MicroSeconds(1249571946000000L);
diff --git a/util/draft/datetime.cpp b/util/draft/datetime.cpp
index 5cbe7d8847..aebbec25d3 100644
--- a/util/draft/datetime.cpp
+++ b/util/draft/datetime.cpp
@@ -17,25 +17,25 @@ namespace NDatetime {
{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} //leap
};
- const ui32 MonthDaysNewYear[2][13] = {
- {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}, //nleap
- {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} //leap
+ const ui32 MonthDaysNewYear[2][13] = {
+ {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}, //nleap
+ {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} //leap
};
- void YDayToMonthAndDay(ui32 yday, bool isleap, ui32* month, ui32* mday) {
- const ui32* begin = MonthDaysNewYear[isleap] + 1;
- const ui32* end = begin + 12;
- // [31, ..., 365] or [31, ..., 366] (12 elements)
-
- const ui32* pos = UpperBound(begin, end, yday);
+ void YDayToMonthAndDay(ui32 yday, bool isleap, ui32* month, ui32* mday) {
+ const ui32* begin = MonthDaysNewYear[isleap] + 1;
+ const ui32* end = begin + 12;
+ // [31, ..., 365] or [31, ..., 366] (12 elements)
+
+ const ui32* pos = UpperBound(begin, end, yday);
Y_ENSURE(pos != end, "day no. " << yday << " does not exist in " << (isleap ? "leap" : "non-leap") << " year");
-
- *month = pos - begin;
- *mday = yday - *(pos - 1) + 1;
-
+
+ *month = pos - begin;
+ *mday = yday - *(pos - 1) + 1;
+
Y_ASSERT((*month < 12) && (1 <= *mday) && (*mday <= MonthDays[isleap][*month]));
- }
-
+ }
+
struct TTimeData {
i32 IsDst = 0;
i32 GMTOff = 0;
diff --git a/util/draft/datetime.h b/util/draft/datetime.h
index 8a387ea6f1..8f84d13132 100644
--- a/util/draft/datetime.h
+++ b/util/draft/datetime.h
@@ -12,7 +12,7 @@
namespace NDatetime {
extern const ui32 MonthDays[2][12]; // !leapYear; !!leapYear
- extern const ui32 MonthDaysNewYear[2][13]; // !leapYear; !!leapYear
+ extern const ui32 MonthDaysNewYear[2][13]; // !leapYear; !!leapYear
inline ui32 YearDaysAD(ui32 year) {
year = Max<ui32>(year, 1) - 1; //1 AD comes straight after 1 BC, no 0 AD
@@ -27,8 +27,8 @@ namespace NDatetime {
return MonthDaysNewYear[isleap][Min(month, (ui32)11u)] + mday - 1;
}
- void YDayToMonthAndDay(ui32 yday /*0 - based*/, bool isleap, ui32* month /*0 - based*/, ui32* mday /*1 - based*/);
-
+ void YDayToMonthAndDay(ui32 yday /*0 - based*/, bool isleap, ui32* month /*0 - based*/, ui32* mday /*1 - based*/);
+
struct TSimpleTM {
enum EField {
F_NONE = 0,
diff --git a/util/draft/datetime_ut.cpp b/util/draft/datetime_ut.cpp
index a5e065ef6e..da103dace6 100644
--- a/util/draft/datetime_ut.cpp
+++ b/util/draft/datetime_ut.cpp
@@ -62,23 +62,23 @@ Y_UNIT_TEST_SUITE(TSimpleTMTest) {
}
Y_UNIT_TEST(TestYDayConversion) {
- using namespace NDatetime;
- ui32 month;
- ui32 mday;
-
- for (ui32 yday = 0; yday < 365; ++yday) {
- YDayToMonthAndDay(yday, false, &month, &mday);
- UNIT_ASSERT_VALUES_EQUAL(yday, YDayFromMonthAndDay(month, mday, false));
- }
- for (ui32 yday = 0; yday < 366; ++yday) {
- YDayToMonthAndDay(yday, true, &month, &mday);
- UNIT_ASSERT_VALUES_EQUAL(yday, YDayFromMonthAndDay(month, mday, true));
- }
-
- UNIT_ASSERT_EXCEPTION(YDayToMonthAndDay(365, false, &month, &mday), yexception);
- UNIT_ASSERT_EXCEPTION(YDayToMonthAndDay(366, true, &month, &mday), yexception);
- }
-
+ using namespace NDatetime;
+ ui32 month;
+ ui32 mday;
+
+ for (ui32 yday = 0; yday < 365; ++yday) {
+ YDayToMonthAndDay(yday, false, &month, &mday);
+ UNIT_ASSERT_VALUES_EQUAL(yday, YDayFromMonthAndDay(month, mday, false));
+ }
+ for (ui32 yday = 0; yday < 366; ++yday) {
+ YDayToMonthAndDay(yday, true, &month, &mday);
+ UNIT_ASSERT_VALUES_EQUAL(yday, YDayFromMonthAndDay(month, mday, true));
+ }
+
+ UNIT_ASSERT_EXCEPTION(YDayToMonthAndDay(365, false, &month, &mday), yexception);
+ UNIT_ASSERT_EXCEPTION(YDayToMonthAndDay(366, true, &month, &mday), yexception);
+ }
+
Y_UNIT_TEST(SimpleTMTest) {
using namespace NDatetime;
diff --git a/util/generic/strbuf_ut.cpp b/util/generic/strbuf_ut.cpp
index 69cde785af..65f431d1a3 100644
--- a/util/generic/strbuf_ut.cpp
+++ b/util/generic/strbuf_ut.cpp
@@ -347,27 +347,27 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {
UNIT_ASSERT_STRINGS_EQUAL(s, "");
}
}
-
-Y_UNIT_TEST_SUITE(TWtrBufTest) {
- Y_UNIT_TEST(TestConstExpr) {
- static constexpr TWtringBuf str1(u"qwe\0rty", 7);
- static constexpr TWtringBuf str2(str1.data(), str1.size());
+
+Y_UNIT_TEST_SUITE(TWtrBufTest) {
+ Y_UNIT_TEST(TestConstExpr) {
+ static constexpr TWtringBuf str1(u"qwe\0rty", 7);
+ static constexpr TWtringBuf str2(str1.data(), str1.size());
static constexpr TWtringBuf str3 = u"qwe\0rty"sv;
-
- UNIT_ASSERT_VALUES_EQUAL(str1.size(), 7);
-
- UNIT_ASSERT_VALUES_EQUAL(str1, str2);
- UNIT_ASSERT_VALUES_EQUAL(str2, str3);
- UNIT_ASSERT_VALUES_EQUAL(str1, str3);
-
- static constexpr std::u16string_view view1(str1);
- UNIT_ASSERT_VALUES_EQUAL(str1, view1);
- static_assert(str1.data() == view1.data());
- static_assert(str1.size() == view1.size());
-
- static constexpr TWtringBuf str4(view1);
- UNIT_ASSERT_VALUES_EQUAL(str1, str4);
- static_assert(str1.data() == str4.data());
- static_assert(str1.size() == str4.size());
- }
-}
+
+ UNIT_ASSERT_VALUES_EQUAL(str1.size(), 7);
+
+ UNIT_ASSERT_VALUES_EQUAL(str1, str2);
+ UNIT_ASSERT_VALUES_EQUAL(str2, str3);
+ UNIT_ASSERT_VALUES_EQUAL(str1, str3);
+
+ static constexpr std::u16string_view view1(str1);
+ UNIT_ASSERT_VALUES_EQUAL(str1, view1);
+ static_assert(str1.data() == view1.data());
+ static_assert(str1.size() == view1.size());
+
+ static constexpr TWtringBuf str4(view1);
+ UNIT_ASSERT_VALUES_EQUAL(str1, str4);
+ static_assert(str1.data() == str4.data());
+ static_assert(str1.size() == str4.size());
+ }
+}
diff --git a/util/generic/string_ut.cpp b/util/generic/string_ut.cpp
index ac82e9091d..61855f9b0b 100644
--- a/util/generic/string_ut.cpp
+++ b/util/generic/string_ut.cpp
@@ -811,7 +811,7 @@ public:
UNIT_TEST(TestDecodingMethods);
UNIT_TEST(TestIterators);
UNIT_TEST(TestReverseIterators);
- UNIT_TEST(TestStringLiterals);
+ UNIT_TEST(TestStringLiterals);
UNIT_TEST_SUITE_END();
private:
@@ -895,14 +895,14 @@ private:
str = hello;
UNIT_ASSERT(str == hello);
}
-
- void TestStringLiterals() {
- TUtf16String s1 = u"hello";
- UNIT_ASSERT_VALUES_EQUAL(s1, TUtf16String::FromAscii("hello"));
-
- TUtf16String s2 = u"привет";
- UNIT_ASSERT_VALUES_EQUAL(s2, TUtf16String::FromUtf8("привет"));
- }
+
+ void TestStringLiterals() {
+ TUtf16String s1 = u"hello";
+ UNIT_ASSERT_VALUES_EQUAL(s1, TUtf16String::FromAscii("hello"));
+
+ TUtf16String s2 = u"привет";
+ UNIT_ASSERT_VALUES_EQUAL(s2, TUtf16String::FromUtf8("привет"));
+ }
};
UNIT_TEST_SUITE_REGISTRATION(TWideStringTest);
@@ -936,7 +936,7 @@ public:
UNIT_TEST(TestDecodingMethodsMixedStr);
UNIT_TEST(TestIterators);
UNIT_TEST(TestReverseIterators);
- UNIT_TEST(TestStringLiterals);
+ UNIT_TEST(TestStringLiterals);
UNIT_TEST_SUITE_END();
private:
@@ -1093,14 +1093,14 @@ private:
str = hello;
UNIT_ASSERT(str == hello);
}
-
- void TestStringLiterals() {
- TUtf32String s1 = U"hello";
- UNIT_ASSERT_VALUES_EQUAL(s1, TUtf32String::FromAscii("hello"));
-
- TUtf32String s2 = U"привет";
- UNIT_ASSERT_VALUES_EQUAL(s2, TUtf32String::FromUtf8("привет"));
- }
+
+ void TestStringLiterals() {
+ TUtf32String s1 = U"hello";
+ UNIT_ASSERT_VALUES_EQUAL(s1, TUtf32String::FromAscii("hello"));
+
+ TUtf32String s2 = U"привет";
+ UNIT_ASSERT_VALUES_EQUAL(s2, TUtf32String::FromUtf8("привет"));
+ }
};
UNIT_TEST_SUITE_REGISTRATION(TUtf32StringTest);
diff --git a/util/network/socket.cpp b/util/network/socket.cpp
index 4f6e804346..15a663c524 100644
--- a/util/network/socket.cpp
+++ b/util/network/socket.cpp
@@ -423,15 +423,15 @@ void SetSocketToS(SOCKET s, int tos) {
SetSocketToS(s, &addr, tos);
}
-void SetSocketPriority(SOCKET s, int priority) {
-#if defined(SO_PRIORITY)
- CheckedSetSockOpt(s, SOL_SOCKET, SO_PRIORITY, priority, "priority");
-#else
- Y_UNUSED(s);
- Y_UNUSED(priority);
-#endif
-}
-
+void SetSocketPriority(SOCKET s, int priority) {
+#if defined(SO_PRIORITY)
+ CheckedSetSockOpt(s, SOL_SOCKET, SO_PRIORITY, priority, "priority");
+#else
+ Y_UNUSED(s);
+ Y_UNUSED(priority);
+#endif
+}
+
bool HasLocalAddress(SOCKET socket) {
TOpaqueAddr localAddr;
if (getsockname(socket, localAddr.MutableAddr(), localAddr.LenPtr()) != 0) {
diff --git a/util/network/socket.h b/util/network/socket.h
index 40c8648b40..b4690bebe1 100644
--- a/util/network/socket.h
+++ b/util/network/socket.h
@@ -116,7 +116,7 @@ void SetSocketToS(SOCKET s, int tos);
void SetSocketToS(SOCKET s, const NAddr::IRemoteAddr* addr, int tos);
int GetSocketToS(SOCKET s);
int GetSocketToS(SOCKET s, const NAddr::IRemoteAddr* addr);
-void SetSocketPriority(SOCKET s, int priority);
+void SetSocketPriority(SOCKET s, int priority);
void SetTcpFastOpen(SOCKET s, int qlen);
/**
* Deprecated, consider using HasSocketDataToRead instead.
diff --git a/util/stream/ios_ut.cpp b/util/stream/ios_ut.cpp
index 139f4296e5..9600edf228 100644
--- a/util/stream/ios_ut.cpp
+++ b/util/stream/ios_ut.cpp
@@ -27,9 +27,9 @@ class TStreamsTest: public TTestBase {
UNIT_TEST(TestReadTo);
UNIT_TEST(TestWtrokaOutput);
UNIT_TEST(TestIStreamOperators);
- UNIT_TEST(TestWchar16Output);
- UNIT_TEST(TestWchar32Output);
- UNIT_TEST(TestUtf16StingOutputByChars);
+ UNIT_TEST(TestWchar16Output);
+ UNIT_TEST(TestWchar32Output);
+ UNIT_TEST(TestUtf16StingOutputByChars);
UNIT_TEST_SUITE_END();
public:
@@ -45,9 +45,9 @@ public:
void TestWtrokaOutput();
void TestIStreamOperators();
void TestReadTo();
- void TestWchar16Output();
- void TestWchar32Output();
- void TestUtf16StingOutputByChars();
+ void TestWchar16Output();
+ void TestWchar32Output();
+ void TestUtf16StingOutputByChars();
};
UNIT_TEST_SUITE_REGISTRATION(TStreamsTest);
@@ -450,48 +450,48 @@ void TStreamsTest::TestWtrokaOutput() {
UNIT_ASSERT(s == Text);
}
-
-void TStreamsTest::TestWchar16Output() {
- TString s;
- TStringOutput os(s);
- os << wchar16(97); // latin a
+
+void TStreamsTest::TestWchar16Output() {
+ TString s;
+ TStringOutput os(s);
+ os << wchar16(97); // latin a
os << u'\u044E'; // cyrillic ю
- os << u'я';
- os << wchar16(0xD801); // high surrogate is printed as replacement character U+FFFD
- os << u'b';
-
+ os << u'я';
+ os << wchar16(0xD801); // high surrogate is printed as replacement character U+FFFD
+ os << u'b';
+
UNIT_ASSERT_VALUES_EQUAL(s, "aюя"
"\xEF\xBF\xBD"
"b");
-}
-
-void TStreamsTest::TestWchar32Output() {
- TString s;
- TStringOutput os(s);
- os << wchar32(97); // latin a
+}
+
+void TStreamsTest::TestWchar32Output() {
+ TString s;
+ TStringOutput os(s);
+ os << wchar32(97); // latin a
os << U'\u044E'; // cyrillic ю
- os << U'я';
- os << U'\U0001F600'; // grinning face
- os << u'b';
-
+ os << U'я';
+ os << U'\U0001F600'; // grinning face
+ os << u'b';
+
UNIT_ASSERT_VALUES_EQUAL(s, "aюя"
"\xF0\x9F\x98\x80"
"b");
-}
-
-void TStreamsTest::TestUtf16StingOutputByChars() {
- TString s = "\xd1\x87\xd0\xb8\xd1\x81\xd1\x82\xd0\xb8\xd1\x87\xd0\xb8\xd1\x81\xd1\x82\xd0\xb8";
- TUtf16String w = UTF8ToWide(s);
-
- UNIT_ASSERT_VALUES_EQUAL(w.size(), 10);
-
- TStringStream stream0;
- stream0 << w;
- UNIT_ASSERT_VALUES_EQUAL(stream0.Str(), s);
-
- TStringStream stream1;
- for (size_t i = 0; i < 10; i++) {
- stream1 << w[i];
- }
- UNIT_ASSERT_VALUES_EQUAL(stream1.Str(), s);
-}
+}
+
+void TStreamsTest::TestUtf16StingOutputByChars() {
+ TString s = "\xd1\x87\xd0\xb8\xd1\x81\xd1\x82\xd0\xb8\xd1\x87\xd0\xb8\xd1\x81\xd1\x82\xd0\xb8";
+ TUtf16String w = UTF8ToWide(s);
+
+ UNIT_ASSERT_VALUES_EQUAL(w.size(), 10);
+
+ TStringStream stream0;
+ stream0 << w;
+ UNIT_ASSERT_VALUES_EQUAL(stream0.Str(), s);
+
+ TStringStream stream1;
+ for (size_t i = 0; i < 10; i++) {
+ stream1 << w[i];
+ }
+ UNIT_ASSERT_VALUES_EQUAL(stream1.Str(), s);
+}
diff --git a/util/stream/output.cpp b/util/stream/output.cpp
index db81b81b70..552a58eff7 100644
--- a/util/stream/output.cpp
+++ b/util/stream/output.cpp
@@ -5,7 +5,7 @@
#include <util/memory/tempbuf.h>
#include <util/generic/singleton.h>
#include <util/generic/yexception.h>
-#include <util/charset/utf8.h>
+#include <util/charset/utf8.h>
#include <util/charset/wide.h>
#if defined(_android_)
@@ -24,8 +24,8 @@
#include <io.h>
#endif
-constexpr size_t MAX_UTF8_BYTES = 4; // UTF-8-encoded code point takes between 1 and 4 bytes
-
+constexpr size_t MAX_UTF8_BYTES = 4; // UTF-8-encoded code point takes between 1 and 4 bytes
+
IOutputStream::IOutputStream() noexcept = default;
IOutputStream::~IOutputStream() = default;
@@ -52,25 +52,25 @@ void IOutputStream::DoWriteC(char ch) {
DoWrite(&ch, 1);
}
-template <>
-void Out<wchar16>(IOutputStream& o, wchar16 ch) {
- const wchar32 w32ch = ReadSymbol(&ch, &ch + 1);
- size_t length;
- unsigned char buffer[MAX_UTF8_BYTES];
- WriteUTF8Char(w32ch, length, buffer);
- o.Write(buffer, length);
-}
-
-template <>
-void Out<wchar32>(IOutputStream& o, wchar32 ch) {
- size_t length;
- unsigned char buffer[MAX_UTF8_BYTES];
- WriteUTF8Char(ch, length, buffer);
- o.Write(buffer, length);
-}
-
+template <>
+void Out<wchar16>(IOutputStream& o, wchar16 ch) {
+ const wchar32 w32ch = ReadSymbol(&ch, &ch + 1);
+ size_t length;
+ unsigned char buffer[MAX_UTF8_BYTES];
+ WriteUTF8Char(w32ch, length, buffer);
+ o.Write(buffer, length);
+}
+
+template <>
+void Out<wchar32>(IOutputStream& o, wchar32 ch) {
+ size_t length;
+ unsigned char buffer[MAX_UTF8_BYTES];
+ WriteUTF8Char(ch, length, buffer);
+ o.Write(buffer, length);
+}
+
static void WriteString(IOutputStream& o, const wchar16* w, size_t n) {
- const size_t buflen = (n * MAX_UTF8_BYTES); // * 4 because the conversion functions can convert unicode character into maximum 4 bytes of UTF8
+ const size_t buflen = (n * MAX_UTF8_BYTES); // * 4 because the conversion functions can convert unicode character into maximum 4 bytes of UTF8
TTempBuf buffer(buflen + 1);
char* const data = buffer.Data();
size_t written = 0;
@@ -80,7 +80,7 @@ static void WriteString(IOutputStream& o, const wchar16* w, size_t n) {
}
static void WriteString(IOutputStream& o, const wchar32* w, size_t n) {
- const size_t buflen = (n * MAX_UTF8_BYTES); // * 4 because the conversion functions can convert unicode character into maximum 4 bytes of UTF8
+ const size_t buflen = (n * MAX_UTF8_BYTES); // * 4 because the conversion functions can convert unicode character into maximum 4 bytes of UTF8
TTempBuf buffer(buflen + 1);
char* const data = buffer.Data();
size_t written = 0;
@@ -105,16 +105,16 @@ void Out<std::string_view>(IOutputStream& o, const std::string_view& p) {
}
template <>
-void Out<std::u16string_view>(IOutputStream& o, const std::u16string_view& p) {
- WriteString(o, p.data(), p.length());
-}
-
-template <>
-void Out<std::u32string_view>(IOutputStream& o, const std::u32string_view& p) {
- WriteString(o, p.data(), p.length());
-}
-
-template <>
+void Out<std::u16string_view>(IOutputStream& o, const std::u16string_view& p) {
+ WriteString(o, p.data(), p.length());
+}
+
+template <>
+void Out<std::u32string_view>(IOutputStream& o, const std::u32string_view& p) {
+ WriteString(o, p.data(), p.length());
+}
+
+template <>
void Out<TStringBuf>(IOutputStream& o, const TStringBuf& p) {
o.Write(p.data(), p.length());
}
diff --git a/util/string/cast.cpp b/util/string/cast.cpp
index aa1e65a8e9..75e80dbd3c 100644
--- a/util/string/cast.cpp
+++ b/util/string/cast.cpp
@@ -455,8 +455,8 @@ using TWCharIType = std::conditional_t<std::is_signed<wchar_t>::value, i64, ui64
DEF_INT_SPEC_I(char, TCharIType)
DEF_INT_SPEC_I(wchar_t, TWCharIType)
-DEF_INT_SPEC_I(wchar16, ui64) // wchar16 is always unsigned
-DEF_INT_SPEC_I(wchar32, ui64) // wchar32 is always unsigned
+DEF_INT_SPEC_I(wchar16, ui64) // wchar16 is always unsigned
+DEF_INT_SPEC_I(wchar32, ui64) // wchar32 is always unsigned
#undef DEF_INT_SPEC
#undef DEF_INT_SPEC_I
diff --git a/util/string/cast_ut.cpp b/util/string/cast_ut.cpp
index 033450c38c..1c124aeb4e 100644
--- a/util/string/cast_ut.cpp
+++ b/util/string/cast_ut.cpp
@@ -350,13 +350,13 @@ Y_UNIT_TEST_SUITE(TCastTest) {
#endif
Y_UNIT_TEST(TestWide) {
- TUtf16String iw = u"-100500";
+ TUtf16String iw = u"-100500";
int iv = 0;
UNIT_ASSERT_VALUES_EQUAL(TryFromString(iw, iv), true);
UNIT_ASSERT_VALUES_EQUAL(iv, -100500);
ui64 uv = 0;
- TUtf16String uw = u"21474836470";
+ TUtf16String uw = u"21474836470";
UNIT_ASSERT_VALUES_EQUAL(TryFromString(uw, uv), true);
UNIT_ASSERT_VALUES_EQUAL(uv, 21474836470ull);
@@ -413,7 +413,7 @@ Y_UNIT_TEST_SUITE(TCastTest) {
int res2 = 0;
const int def2 = -6;
- TUtf16String s3 = u"-100500";
+ TUtf16String s3 = u"-100500";
UNIT_ASSERT_VALUES_EQUAL(TryFromStringWithDefault(s3, res2, def2), true);
UNIT_ASSERT_VALUES_EQUAL(res2, -100500);
@@ -424,7 +424,7 @@ Y_UNIT_TEST_SUITE(TCastTest) {
UNIT_ASSERT_VALUES_EQUAL(FromStringWithDefault(s3, def2), -100500);
UNIT_ASSERT_VALUES_EQUAL(FromStringWithDefault<size_t>(s3), size_t());
- TUtf16String s4 = u"-f100500";
+ TUtf16String s4 = u"-f100500";
UNIT_ASSERT_VALUES_EQUAL(TryFromStringWithDefault(s4, res2, def2), false);
UNIT_ASSERT_VALUES_EQUAL(res2, def2);
@@ -456,12 +456,12 @@ Y_UNIT_TEST_SUITE(TCastTest) {
UNIT_ASSERT_DOUBLES_EQUAL((float)FromString(TString("10E-5")), 10E-5, EPS);
UNIT_ASSERT_VALUES_EQUAL((bool)FromString("da"), true);
UNIT_ASSERT_VALUES_EQUAL((bool)FromString("no"), false);
- UNIT_ASSERT_VALUES_EQUAL((short)FromString(u"9000"), 9000);
- UNIT_ASSERT_VALUES_EQUAL((int)FromString(u"-100500"), -100500);
- UNIT_ASSERT_VALUES_EQUAL((unsigned long long)FromString(TWtringBuf(u"42", 1)), 4);
+ UNIT_ASSERT_VALUES_EQUAL((short)FromString(u"9000"), 9000);
+ UNIT_ASSERT_VALUES_EQUAL((int)FromString(u"-100500"), -100500);
+ UNIT_ASSERT_VALUES_EQUAL((unsigned long long)FromString(TWtringBuf(u"42", 1)), 4);
int integer = FromString("125");
- ui16 wideCharacterCode = FromString(u"125");
- UNIT_ASSERT_VALUES_EQUAL(integer, wideCharacterCode);
+ ui16 wideCharacterCode = FromString(u"125");
+ UNIT_ASSERT_VALUES_EQUAL(integer, wideCharacterCode);
}
static void CheckMessage(TFromStringException& exc, const TString& phrase) {
@@ -530,7 +530,7 @@ Y_UNIT_TEST_SUITE(TCastTest) {
UNIT_ASSERT_VALUES_EQUAL(empty, out);
}
{
- const auto hello = u"hello";
+ const auto hello = u"hello";
TWtringBuf out;
UNIT_ASSERT(TryFromString(hello, out));
UNIT_ASSERT_VALUES_EQUAL(hello, out);
@@ -578,25 +578,25 @@ Y_UNIT_TEST_SUITE(TCastTest) {
UNIT_ASSERT_VALUES_EQUAL(ToString(87423.2031250000001), "87423.20313");
UNIT_ASSERT_VALUES_EQUAL(FloatToString(1.0e60, PREC_POINT_DIGITS_STRIP_ZEROES, 0), "1e+60");
}
-
- Y_UNIT_TEST(TestChar) {
- // Given a character ch, ToString(ch) returns
- // the decimal representation of its integral value
-
- // char
- UNIT_ASSERT_VALUES_EQUAL(ToString('\0'), "0");
- UNIT_ASSERT_VALUES_EQUAL(ToString('0'), "48");
-
- // wchar16
- UNIT_ASSERT_VALUES_EQUAL(ToString(u'\0'), "0");
- UNIT_ASSERT_VALUES_EQUAL(ToString(u'0'), "48");
- UNIT_ASSERT_VALUES_EQUAL(ToString(u'я'), "1103");
- UNIT_ASSERT_VALUES_EQUAL(ToString(u'\uFFFF'), "65535");
-
- // wchar32
- UNIT_ASSERT_VALUES_EQUAL(ToString(U'\0'), "0");
- UNIT_ASSERT_VALUES_EQUAL(ToString(U'0'), "48");
- UNIT_ASSERT_VALUES_EQUAL(ToString(U'я'), "1103");
- UNIT_ASSERT_VALUES_EQUAL(ToString(U'\U0001F600'), "128512"); // 'GRINNING FACE' (U+1F600)
- }
+
+ Y_UNIT_TEST(TestChar) {
+ // Given a character ch, ToString(ch) returns
+ // the decimal representation of its integral value
+
+ // char
+ UNIT_ASSERT_VALUES_EQUAL(ToString('\0'), "0");
+ UNIT_ASSERT_VALUES_EQUAL(ToString('0'), "48");
+
+ // wchar16
+ UNIT_ASSERT_VALUES_EQUAL(ToString(u'\0'), "0");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(u'0'), "48");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(u'я'), "1103");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(u'\uFFFF'), "65535");
+
+ // wchar32
+ UNIT_ASSERT_VALUES_EQUAL(ToString(U'\0'), "0");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(U'0'), "48");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(U'я'), "1103");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(U'\U0001F600'), "128512"); // 'GRINNING FACE' (U+1F600)
+ }
};
diff --git a/util/string/escape.cpp b/util/string/escape.cpp
index cd09a7dbd0..e448d4cf1a 100644
--- a/util/string/escape.cpp
+++ b/util/string/escape.cpp
@@ -179,7 +179,7 @@ template TUtf16String& EscapeCImpl<TUtf16String::TChar>(const TUtf16String::TCha
namespace {
template <class TStr>
- inline void AppendUnicode(TStr& s, wchar32 v) {
+ inline void AppendUnicode(TStr& s, wchar32 v) {
char buf[10];
size_t sz = 0;
@@ -187,7 +187,7 @@ namespace {
s.AppendNoAlias(buf, sz);
}
- inline void AppendUnicode(TUtf16String& s, wchar32 v) {
+ inline void AppendUnicode(TUtf16String& s, wchar32 v) {
WriteSymbol(v, s);
}
@@ -264,12 +264,12 @@ static TStr& DoUnescapeC(const TChar* p, size_t sz, TStr& res) {
res.append('\v');
break;
case 'u': {
- ui16 cp[2];
+ ui16 cp[2];
if (ParseHex<4>(p + 1, pe, cp[0])) {
if (Y_UNLIKELY(cp[0] >= 0xD800 && cp[0] <= 0xDBFF && ParseHex<4>(p + 7, pe, cp[1]) && p[5] == '\\' && p[6] == 'u')) {
- const wchar16 wbuf[] = {wchar16(cp[0]), wchar16(cp[1])};
- AppendUnicode(res, ReadSymbol(wbuf, wbuf + 2));
+ const wchar16 wbuf[] = {wchar16(cp[0]), wchar16(cp[1])};
+ AppendUnicode(res, ReadSymbol(wbuf, wbuf + 2));
p += 10;
} else {
AppendUnicode(res, (wchar32)cp[0]);
diff --git a/util/string/escape_ut.cpp b/util/string/escape_ut.cpp
index cd38ecffd3..110546be71 100644
--- a/util/string/escape_ut.cpp
+++ b/util/string/escape_ut.cpp
@@ -90,9 +90,9 @@ Y_UNIT_TEST_SUITE(TEscapeCTest) {
UNIT_ASSERT_VALUES_EQUAL(source, actual2);
}
- UNIT_ASSERT_VALUES_EQUAL(u"http://ya.ru/\\x17\\n\\u1234", EscapeC(u"http://ya.ru/\x17\n\u1234"));
- UNIT_ASSERT_VALUES_EQUAL(u"h", EscapeC(u'h'));
- UNIT_ASSERT_VALUES_EQUAL(u"\\xFF", EscapeC(wchar16(255)));
+ UNIT_ASSERT_VALUES_EQUAL(u"http://ya.ru/\\x17\\n\\u1234", EscapeC(u"http://ya.ru/\x17\n\u1234"));
+ UNIT_ASSERT_VALUES_EQUAL(u"h", EscapeC(u'h'));
+ UNIT_ASSERT_VALUES_EQUAL(u"\\xFF", EscapeC(wchar16(255)));
}
Y_UNIT_TEST(TestEscapeTrigraphs) {
diff --git a/util/string/split_ut.cpp b/util/string/split_ut.cpp
index 43e59f2d75..a1ae92779a 100644
--- a/util/string/split_ut.cpp
+++ b/util/string/split_ut.cpp
@@ -131,8 +131,8 @@ Y_UNIT_TEST_SUITE(SplitStringTest) {
}
Y_UNIT_TEST(TestWideSingleDelimiter) {
- TUtf16String data(u"qw ab qwabcab");
- TUtf16String canonic[] = {u"qw", u"ab", TUtf16String(), u"qwabcab"};
+ TUtf16String data(u"qw ab qwabcab");
+ TUtf16String canonic[] = {u"qw", u"ab", TUtf16String(), u"qwabcab"};
TVector<TUtf16String> good(canonic, canonic + 4);
TCharDelimiter<const wchar16> delim(' ');
@@ -188,10 +188,10 @@ Y_UNIT_TEST_SUITE(SplitStringTest) {
}
Y_UNIT_TEST(TestWideStringDelimiter) {
- TUtf16String data(u"qw ab qwababcab");
- TUtf16String canonic[] = {u"qw ", u" qw", TUtf16String(), u"c", TUtf16String()};
+ TUtf16String data(u"qw ab qwababcab");
+ TUtf16String canonic[] = {u"qw ", u" qw", TUtf16String(), u"c", TUtf16String()};
TVector<TUtf16String> good(canonic, canonic + 5);
- TUtf16String wideDelim(u"ab");
+ TUtf16String wideDelim(u"ab");
TStringDelimiter<const wchar16> delim(wideDelim.data());
TestDelimiterOnString<TContainerConsumer>(good, data.data(), delim);
@@ -209,20 +209,20 @@ Y_UNIT_TEST_SUITE(SplitStringTest) {
}
Y_UNIT_TEST(TestWideSetDelimiter) {
- TUtf16String data(u"qw ab qwababccab");
- TUtf16String canonic[] = {u"q", u" ab q", u"abab", TUtf16String(), u"ab"};
+ TUtf16String data(u"qw ab qwababccab");
+ TUtf16String canonic[] = {u"q", u" ab q", u"abab", TUtf16String(), u"ab"};
TVector<TUtf16String> good(canonic, canonic + 5);
- TUtf16String wideDelim(u"wc");
+ TUtf16String wideDelim(u"wc");
TSetDelimiter<const wchar16> delim(wideDelim.data());
TestDelimiterOnString<TContainerConsumer>(good, data.data(), delim);
}
Y_UNIT_TEST(TestWideSetDelimiterRange) {
- TUtf16String data(u"qw ab qwababccab");
- TUtf16String canonic[] = {u"q", u" ab q", u"abab", TUtf16String(), u"ab"};
+ TUtf16String data(u"qw ab qwababccab");
+ TUtf16String canonic[] = {u"q", u" ab q", u"abab", TUtf16String(), u"ab"};
TVector<TUtf16String> good(1);
- TUtf16String wideDelim(u"wc");
+ TUtf16String wideDelim(u"wc");
TSetDelimiter<const wchar16> delim(wideDelim.data());
TVector<TUtf16String> test;
diff --git a/util/string/strip_ut.cpp b/util/string/strip_ut.cpp
index d1029d1498..34adeb9a19 100644
--- a/util/string/strip_ut.cpp
+++ b/util/string/strip_ut.cpp
@@ -103,8 +103,8 @@ Y_UNIT_TEST_SUITE(TStripStringTest) {
UNIT_ASSERT_EQUAL(
StripString(
TWtringBuf(u"/abc/"),
- EqualsStripAdapter(u'/')),
- u"abc");
+ EqualsStripAdapter(u'/')),
+ u"abc");
}
Y_UNIT_TEST(TestCollapse) {
diff --git a/util/string/subst_ut.cpp b/util/string/subst_ut.cpp
index 21eccef779..284d54c095 100644
--- a/util/string/subst_ut.cpp
+++ b/util/string/subst_ut.cpp
@@ -161,9 +161,9 @@ Y_UNIT_TEST_SUITE(TStringSubst) {
}
Y_UNIT_TEST(TestSubstCharGlobal) {
- TUtf16String w = u"abcdabcd";
+ TUtf16String w = u"abcdabcd";
SubstGlobal(w, wchar16('b'), wchar16('B'), 3);
- UNIT_ASSERT_EQUAL(w, u"abcdaBcd");
+ UNIT_ASSERT_EQUAL(w, u"abcdaBcd");
TString s = "aaa";
SubstGlobal(s, 'a', 'b', 1);
@@ -171,9 +171,9 @@ Y_UNIT_TEST_SUITE(TStringSubst) {
}
Y_UNIT_TEST(TestSubstCharGlobalRet) {
- const TUtf16String w1 = u"abcdabcd";
+ const TUtf16String w1 = u"abcdabcd";
const TUtf16String w2 = SubstGlobalCopy(w1, wchar16('b'), wchar16('B'), 3);
- UNIT_ASSERT_EQUAL(w2, u"abcdaBcd");
+ UNIT_ASSERT_EQUAL(w2, u"abcdaBcd");
const TString s1 = "aaa";
const TString s2 = SubstGlobalCopy(s1, 'a', 'b', 1);
diff --git a/util/string/type_ut.cpp b/util/string/type_ut.cpp
index 03e7af62bd..890f7062d9 100644
--- a/util/string/type_ut.cpp
+++ b/util/string/type_ut.cpp
@@ -47,11 +47,11 @@ Y_UNIT_TEST_SUITE(TStringClassify) {
UNIT_ASSERT(!IsNumber("foobar"));
UNIT_ASSERT(!IsNumber(""));
- UNIT_ASSERT(IsNumber(u"0"));
- UNIT_ASSERT(IsNumber(u"12345678901234567890"));
- UNIT_ASSERT(!IsNumber(u"1234567890a"));
- UNIT_ASSERT(!IsNumber(u"12345xx67890a"));
- UNIT_ASSERT(!IsNumber(u"foobar"));
+ UNIT_ASSERT(IsNumber(u"0"));
+ UNIT_ASSERT(IsNumber(u"12345678901234567890"));
+ UNIT_ASSERT(!IsNumber(u"1234567890a"));
+ UNIT_ASSERT(!IsNumber(u"12345xx67890a"));
+ UNIT_ASSERT(!IsNumber(u"foobar"));
}
Y_UNIT_TEST(TestIsHexNumber) {
@@ -64,13 +64,13 @@ Y_UNIT_TEST_SUITE(TStringClassify) {
UNIT_ASSERT(!IsHexNumber("foobar"));
UNIT_ASSERT(!IsHexNumber(TString()));
- UNIT_ASSERT(IsHexNumber(u"0"));
- UNIT_ASSERT(IsHexNumber(u"aaaadddAAAAA"));
- UNIT_ASSERT(IsHexNumber(u"0123456789ABCDEFabcdef"));
- UNIT_ASSERT(IsHexNumber(u"12345678901234567890"));
- UNIT_ASSERT(IsHexNumber(u"1234567890a"));
- UNIT_ASSERT(!IsHexNumber(u"12345xx67890a"));
- UNIT_ASSERT(!IsHexNumber(u"foobar"));
+ UNIT_ASSERT(IsHexNumber(u"0"));
+ UNIT_ASSERT(IsHexNumber(u"aaaadddAAAAA"));
+ UNIT_ASSERT(IsHexNumber(u"0123456789ABCDEFabcdef"));
+ UNIT_ASSERT(IsHexNumber(u"12345678901234567890"));
+ UNIT_ASSERT(IsHexNumber(u"1234567890a"));
+ UNIT_ASSERT(!IsHexNumber(u"12345xx67890a"));
+ UNIT_ASSERT(!IsHexNumber(u"foobar"));
UNIT_ASSERT(!IsHexNumber(TUtf16String()));
}
}
diff --git a/util/string/vector_ut.cpp b/util/string/vector_ut.cpp
index 817120f268..2bedd38534 100644
--- a/util/string/vector_ut.cpp
+++ b/util/string/vector_ut.cpp
@@ -30,7 +30,7 @@ Y_UNIT_TEST_SUITE(TStringJoinTest) {
}
Y_UNIT_TEST(TestJoinWStrings) {
- const TUtf16String str = u"Яндекс";
+ const TUtf16String str = u"Яндекс";
const TVector<TUtf16String> v(1, str);
UNIT_ASSERT_EQUAL(JoinStrings(v, TUtf16String()), str);
diff --git a/util/system/types.h b/util/system/types.h
index 12e68a6060..37e9526216 100644
--- a/util/system/types.h
+++ b/util/system/types.h
@@ -101,13 +101,13 @@ typedef i64 SUPERLONG;
#endif
// UNICODE
-#ifdef __cplusplus
+#ifdef __cplusplus
// UCS-2, native byteorder
-typedef char16_t wchar16;
+typedef char16_t wchar16;
// internal symbol type: UTF-16LE
typedef wchar16 TChar;
-typedef char32_t wchar32;
-#endif
+typedef char32_t wchar32;
+#endif
#if defined(_MSC_VER)
#include <basetsd.h>
diff --git a/ydb/core/mind/bscontroller/table_merger.h b/ydb/core/mind/bscontroller/table_merger.h
index d63db583ee..2c135a863e 100644
--- a/ydb/core/mind/bscontroller/table_merger.h
+++ b/ydb/core/mind/bscontroller/table_merger.h
@@ -70,7 +70,7 @@ namespace NKikimr {
// the row has been added or modified
adapter->IssueUpdateRow(txc, cur->first, cur->second);
}
- auto processInline = [&](const auto (TRow::*cell), const auto *table) {
+ auto processInline = [&](const auto (TRow::*cell), const auto *table) {
auto [prev, cur] = row;
using TCell = std::remove_reference_t<decltype(std::declval<TRow>().*cell)>;
const TCell *prevInline = prev ? &(prev->second.*cell) : nullptr;
diff --git a/ydb/core/mind/table_adapter.h b/ydb/core/mind/table_adapter.h
index f0ec8db1e2..6db02450b8 100644
--- a/ydb/core/mind/table_adapter.h
+++ b/ydb/core/mind/table_adapter.h
@@ -476,7 +476,7 @@ namespace NKikimr {
struct TNotReady : yexception {};
- auto processInlineTable = [&](auto (TRow::*member), const auto *inlineTable) {
+ auto processInlineTable = [&](auto (TRow::*member), const auto *inlineTable) {
using TInlineTable = std::remove_pointer_t<decltype(inlineTable)>;
if (!FetchTable<TInlineTable>(db, param, item.*member, key)) {
ythrow TNotReady();
diff --git a/ydb/library/yql/parser/proto_ast/proto_ast.h b/ydb/library/yql/parser/proto_ast/proto_ast.h
index 5bb8a9f5f9..6d02df05bb 100644
--- a/ydb/library/yql/parser/proto_ast/proto_ast.h
+++ b/ydb/library/yql/parser/proto_ast/proto_ast.h
@@ -17,7 +17,7 @@ namespace NProtoAST {
auto begin = input->get_nextChar();
auto end = begin + input->get_sizeBuf();
if (begin != end && SafeReadUTF8Char(rune, runeLen, begin, end) == RECODE_OK) {
- err << " '" << TStringBuf((const char*)begin, runeLen) << "' (Unicode character <" << ui32(rune) << ">)";
+ err << " '" << TStringBuf((const char*)begin, runeLen) << "' (Unicode character <" << ui32(rune) << ">)";
}
}