aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorermolovd <ermolovd@yandex-team.ru>2022-02-10 16:47:53 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:53 +0300
commitb91bcef7c99a119b0846479ef71bfab4beec72ca (patch)
treebe118d54d12a61bc4812ceb0a266a170a2fa3bc9 /library/cpp
parentf421873774cf0b71743afbe5f6677861e66601ea (diff)
downloadydb-b91bcef7c99a119b0846479ef71bfab4beec72ca.tar.gz
Restoring authorship annotation for <ermolovd@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/digest/md5/md5.h4
-rw-r--r--library/cpp/digest/md5/md5_medium_ut.cpp20
-rw-r--r--library/cpp/digest/md5/medium_ut/ya.make8
-rw-r--r--library/cpp/digest/ya.make2
-rw-r--r--library/cpp/http/io/chunk.cpp22
-rw-r--r--library/cpp/http/io/chunk.h10
-rw-r--r--library/cpp/http/io/compression.h2
-rw-r--r--library/cpp/http/io/headers.h12
-rw-r--r--library/cpp/http/io/stream.cpp44
-rw-r--r--library/cpp/http/io/stream.h20
-rw-r--r--library/cpp/http/io/stream_ut.cpp140
-rw-r--r--library/cpp/int128/int128.cpp20
-rw-r--r--library/cpp/int128/int128.h2
-rw-r--r--library/cpp/int128/ut/int128_ut.cpp58
-rw-r--r--library/cpp/json/yson/json2yson.cpp6
-rw-r--r--library/cpp/json/yson/json2yson.h2
-rw-r--r--library/cpp/json/yson/ya.make4
-rw-r--r--library/cpp/messagebus/messqueue.cpp6
-rw-r--r--library/cpp/messagebus/oldmodule/module.cpp26
-rw-r--r--library/cpp/messagebus/oldmodule/module.h2
-rw-r--r--library/cpp/messagebus/test/ut/messagebus_ut.cpp12
-rw-r--r--library/cpp/messagebus/ybus.h2
-rw-r--r--library/cpp/threading/future/future_ut.cpp4
-rw-r--r--library/cpp/threading/ya.make4
-rw-r--r--library/cpp/ya.make14
-rw-r--r--library/cpp/yson/consumer.cpp4
-rw-r--r--library/cpp/yson/consumer.h4
-rw-r--r--library/cpp/yson/detail.h4
-rw-r--r--library/cpp/yson/format.h4
-rw-r--r--library/cpp/yson/json/json_writer.h6
-rw-r--r--library/cpp/yson/json/ya.make34
-rw-r--r--library/cpp/yson/json/yson2json_adapter.h6
-rw-r--r--library/cpp/yson/lexer.cpp4
-rw-r--r--library/cpp/yson/lexer.h4
-rw-r--r--library/cpp/yson/lexer_detail.h4
-rw-r--r--library/cpp/yson/node/node.cpp590
-rw-r--r--library/cpp/yson/node/node.h244
-rw-r--r--library/cpp/yson/node/node_builder.h6
-rw-r--r--library/cpp/yson/node/node_io.cpp148
-rw-r--r--library/cpp/yson/node/node_io.h16
-rw-r--r--library/cpp/yson/node/node_ut.cpp366
-rw-r--r--library/cpp/yson/node/node_visitor.cpp50
-rw-r--r--library/cpp/yson/node/node_visitor.h6
-rw-r--r--library/cpp/yson/node/pybind/node.cpp2
-rw-r--r--library/cpp/yson/node/pybind/node.h2
-rw-r--r--library/cpp/yson/node/pybind/ya.make2
-rw-r--r--library/cpp/yson/node/serialize.cpp2
-rw-r--r--library/cpp/yson/node/serialize.h10
-rw-r--r--library/cpp/yson/node/ut/ya.make22
-rw-r--r--library/cpp/yson/node/ya.make46
-rw-r--r--library/cpp/yson/parser.cpp4
-rw-r--r--library/cpp/yson/parser.h4
-rw-r--r--library/cpp/yson/parser_detail.h4
-rw-r--r--library/cpp/yson/public.h16
-rw-r--r--library/cpp/yson/token.cpp4
-rw-r--r--library/cpp/yson/token.h4
-rw-r--r--library/cpp/yson/tokenizer.cpp4
-rw-r--r--library/cpp/yson/tokenizer.h4
-rw-r--r--library/cpp/yson/varint.cpp12
-rw-r--r--library/cpp/yson/varint.h4
-rw-r--r--library/cpp/yson/writer.cpp12
-rw-r--r--library/cpp/yson/writer.h4
-rw-r--r--library/cpp/yson/ya.make12
-rw-r--r--library/cpp/yson/zigzag.h4
-rw-r--r--library/cpp/yt/coding/varint-inl.h82
-rw-r--r--library/cpp/yt/coding/varint.h12
-rw-r--r--library/cpp/yt/memory/new-inl.h24
-rw-r--r--library/cpp/yt/memory/ref-inl.h4
-rw-r--r--library/cpp/yt/memory/ref.cpp8
-rw-r--r--library/cpp/yt/memory/ref.h4
-rw-r--r--library/cpp/yt/memory/unittests/ya.make6
-rw-r--r--library/cpp/yt/misc/enum-inl.h8
-rw-r--r--library/cpp/yt/misc/enum.h8
-rw-r--r--library/cpp/yt/misc/port.h6
-rw-r--r--library/cpp/yt/small_containers/compact_vector.h8
-rw-r--r--library/cpp/yt/string/string_builder-inl.h4
-rw-r--r--library/cpp/yt/string/string_builder.h10
-rw-r--r--library/cpp/yt/string/unittests/format_ut.cpp6
-rw-r--r--library/cpp/yt/ya.make16
79 files changed, 1165 insertions, 1165 deletions
diff --git a/library/cpp/digest/md5/md5.h b/library/cpp/digest/md5/md5.h
index 2c17aa0518..33ce58ac92 100644
--- a/library/cpp/digest/md5/md5.h
+++ b/library/cpp/digest/md5/md5.h
@@ -68,8 +68,8 @@ public:
private:
void UpdatePart(TArrayRef<const ui8> data);
-
-private:
+
+private:
ui8 BufferSize; /* size of buffer */
ui8 Buffer[64]; /* input buffer */
ui32 State[4]; /* state (ABCD) */
diff --git a/library/cpp/digest/md5/md5_medium_ut.cpp b/library/cpp/digest/md5/md5_medium_ut.cpp
index a940c5cb66..ec1146e059 100644
--- a/library/cpp/digest/md5/md5_medium_ut.cpp
+++ b/library/cpp/digest/md5/md5_medium_ut.cpp
@@ -5,21 +5,21 @@
Y_UNIT_TEST_SUITE(TMD5MediumTest) {
Y_UNIT_TEST(TestOverflow) {
if (sizeof(size_t) > sizeof(unsigned int)) {
- const size_t maxUi32 = (size_t)Max<unsigned int>();
+ const size_t maxUi32 = (size_t)Max<unsigned int>();
TArrayHolder<char> buf(new char[maxUi32]);
- memset(buf.Get(), 0, maxUi32);
+ memset(buf.Get(), 0, maxUi32);
- MD5 r;
- for (int i = 0; i < 5; ++i) {
- r.Update(buf.Get(), maxUi32);
- }
+ MD5 r;
+ for (int i = 0; i < 5; ++i) {
+ r.Update(buf.Get(), maxUi32);
+ }
- char rs[33];
- TString s(r.End(rs));
- s.to_lower();
+ char rs[33];
+ TString s(r.End(rs));
+ s.to_lower();
- UNIT_ASSERT_VALUES_EQUAL(s, "34a5a7ed4f0221310084e21a1e599659");
+ UNIT_ASSERT_VALUES_EQUAL(s, "34a5a7ed4f0221310084e21a1e599659");
}
}
}
diff --git a/library/cpp/digest/md5/medium_ut/ya.make b/library/cpp/digest/md5/medium_ut/ya.make
index 418c57f086..406d56cf34 100644
--- a/library/cpp/digest/md5/medium_ut/ya.make
+++ b/library/cpp/digest/md5/medium_ut/ya.make
@@ -1,16 +1,16 @@
UNITTEST_FOR(library/cpp/digest/md5)
-SIZE(MEDIUM)
-
-TIMEOUT(120)
+SIZE(MEDIUM)
+TIMEOUT(120)
+
OWNER(
pg
g:util
)
SRCS(
- md5_medium_ut.cpp
+ md5_medium_ut.cpp
)
REQUIREMENTS(ram:10)
diff --git a/library/cpp/digest/ya.make b/library/cpp/digest/ya.make
index 61d4b50903..dd627aa48e 100644
--- a/library/cpp/digest/ya.make
+++ b/library/cpp/digest/ya.make
@@ -9,7 +9,7 @@ RECURSE(
lower_case/ut
md5
md5/ut
- md5/medium_ut
+ md5/medium_ut
md5/bench
murmur
murmur/ut
diff --git a/library/cpp/http/io/chunk.cpp b/library/cpp/http/io/chunk.cpp
index 6975d9eac1..7edd115b75 100644
--- a/library/cpp/http/io/chunk.cpp
+++ b/library/cpp/http/io/chunk.cpp
@@ -1,7 +1,7 @@
#include "chunk.h"
-#include "headers.h"
-
+#include "headers.h"
+
#include <util/string/cast.h>
#include <util/generic/utility.h>
#include <util/generic/yexception.h>
@@ -52,13 +52,13 @@ class TChunkedInput::TImpl {
public:
inline TImpl(IInputStream* slave, TMaybe<THttpHeaders>* trailers)
: Slave_(slave)
- , Trailers_(trailers)
+ , Trailers_(trailers)
, Pending_(0)
, LastChunkReaded_(false)
{
- if (Trailers_) {
- Trailers_->Clear();
- }
+ if (Trailers_) {
+ Trailers_->Clear();
+ }
}
inline ~TImpl() {
@@ -127,9 +127,9 @@ private:
return true;
}
- if (Trailers_) {
- Trailers_->ConstructInPlace(Slave_);
- }
+ if (Trailers_) {
+ Trailers_->ConstructInPlace(Slave_);
+ }
LastChunkReaded_ = true;
return false;
@@ -137,13 +137,13 @@ private:
private:
IInputStream* Slave_;
- TMaybe<THttpHeaders>* Trailers_;
+ TMaybe<THttpHeaders>* Trailers_;
size_t Pending_;
bool LastChunkReaded_;
};
TChunkedInput::TChunkedInput(IInputStream* slave, TMaybe<THttpHeaders>* trailers)
- : Impl_(new TImpl(slave, trailers))
+ : Impl_(new TImpl(slave, trailers))
{
}
diff --git a/library/cpp/http/io/chunk.h b/library/cpp/http/io/chunk.h
index 88d89fafda..a94b2083db 100644
--- a/library/cpp/http/io/chunk.h
+++ b/library/cpp/http/io/chunk.h
@@ -1,11 +1,11 @@
#pragma once
#include <util/stream/output.h>
-#include <util/generic/maybe.h>
+#include <util/generic/maybe.h>
#include <util/generic/ptr.h>
-class THttpHeaders;
-
+class THttpHeaders;
+
/// @addtogroup Streams_Chunked
/// @{
/// Ввод данных порциями.
@@ -13,8 +13,8 @@ class THttpHeaders;
/// данные записаны в виде <длина блока><блок данных>.
class TChunkedInput: public IInputStream {
public:
- /// Если передан указатель на trailers, то туда будут записаны HTTP trailer'ы (возможно пустые),
- /// которые идут после чанков.
+ /// Если передан указатель на trailers, то туда будут записаны HTTP trailer'ы (возможно пустые),
+ /// которые идут после чанков.
TChunkedInput(IInputStream* slave, TMaybe<THttpHeaders>* trailers = nullptr);
~TChunkedInput() override;
diff --git a/library/cpp/http/io/compression.h b/library/cpp/http/io/compression.h
index f16c4a18eb..2a603d4634 100644
--- a/library/cpp/http/io/compression.h
+++ b/library/cpp/http/io/compression.h
@@ -15,7 +15,7 @@ public:
static inline TCompressionCodecFactory& Instance() noexcept {
return *SingletonWithPriority<TCompressionCodecFactory, 0>();
}
-
+
inline const TDecoderConstructor* FindDecoder(TStringBuf name) const {
if (auto codec = Codecs_.FindPtr(name)) {
return &codec->Decoder;
diff --git a/library/cpp/http/io/headers.h b/library/cpp/http/io/headers.h
index a71793d1c6..265796f8aa 100644
--- a/library/cpp/http/io/headers.h
+++ b/library/cpp/http/io/headers.h
@@ -59,17 +59,17 @@ public:
inline TConstIterator Begin() const noexcept {
return Headers_.begin();
}
- inline TConstIterator begin() const noexcept {
- return Headers_.begin();
- }
+ inline TConstIterator begin() const noexcept {
+ return Headers_.begin();
+ }
/// Стандартный итератор.
inline TConstIterator End() const noexcept {
return Headers_.end();
}
- inline TConstIterator end() const noexcept {
- return Headers_.end();
- }
+ inline TConstIterator end() const noexcept {
+ return Headers_.end();
+ }
/// Возвращает количество заголовков в контейнере.
inline size_t Count() const noexcept {
diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp
index 6689be684f..cb3959db27 100644
--- a/library/cpp/http/io/stream.cpp
+++ b/library/cpp/http/io/stream.cpp
@@ -176,10 +176,10 @@ public:
return Headers_;
}
- inline const TMaybe<THttpHeaders>& Trailers() const noexcept {
- return Trailers_;
- }
-
+ inline const TMaybe<THttpHeaders>& Trailers() const noexcept {
+ return Trailers_;
+ }
+
inline bool IsKeepAlive() const noexcept {
return KeepAlive_;
}
@@ -212,16 +212,16 @@ private:
template <class Operation>
inline size_t Perform(size_t len, const Operation& operation) {
size_t processed = operation(len);
- if (processed == 0 && len > 0) {
- if (!ChunkedInput_) {
- Trailers_.ConstructInPlace();
- } else {
- // Read the header of the trailing chunk. It remains in
- // the TChunkedInput stream if the HTTP response is compressed.
- char symbol;
- if (ChunkedInput_->Read(&symbol, 1) != 0) {
- ythrow THttpParseException() << "some data remaining in TChunkedInput";
- }
+ if (processed == 0 && len > 0) {
+ if (!ChunkedInput_) {
+ Trailers_.ConstructInPlace();
+ } else {
+ // Read the header of the trailing chunk. It remains in
+ // the TChunkedInput stream if the HTTP response is compressed.
+ char symbol;
+ if (ChunkedInput_->Read(&symbol, 1) != 0) {
+ ythrow THttpParseException() << "some data remaining in TChunkedInput";
+ }
}
}
return processed;
@@ -337,10 +337,10 @@ private:
}
if (p.Chunked) {
- ChunkedInput_ = Streams_.Add(new TChunkedInput(&Buffered_, &Trailers_));
- Input_ = ChunkedInput_;
+ ChunkedInput_ = Streams_.Add(new TChunkedInput(&Buffered_, &Trailers_));
+ Input_ = ChunkedInput_;
} else {
- // disable buffering
+ // disable buffering
Buffered_.Reset(&Cnull);
Input_ = Streams_.Add(new TMultiInput(&Buffered_, Slave_));
@@ -377,7 +377,7 @@ private:
TString FirstLine_;
THttpHeaders Headers_;
- TMaybe<THttpHeaders> Trailers_;
+ TMaybe<THttpHeaders> Trailers_;
bool KeepAlive_;
TAcceptCodings Codings_;
@@ -411,10 +411,10 @@ const THttpHeaders& THttpInput::Headers() const noexcept {
return Impl_->Headers();
}
-const TMaybe<THttpHeaders>& THttpInput::Trailers() const noexcept {
- return Impl_->Trailers();
-}
-
+const TMaybe<THttpHeaders>& THttpInput::Trailers() const noexcept {
+ return Impl_->Trailers();
+}
+
const TString& THttpInput::FirstLine() const noexcept {
return Impl_->FirstLine();
}
diff --git a/library/cpp/http/io/stream.h b/library/cpp/http/io/stream.h
index 78ca4fc814..d2009adb79 100644
--- a/library/cpp/http/io/stream.h
+++ b/library/cpp/http/io/stream.h
@@ -3,7 +3,7 @@
#include "headers.h"
#include <util/stream/output.h>
-#include <util/generic/maybe.h>
+#include <util/generic/maybe.h>
#include <util/generic/ptr.h>
#include <util/generic/string.h>
#include <util/generic/strbuf.h>
@@ -35,15 +35,15 @@ public:
const THttpHeaders& Headers() const noexcept;
/*
- * parsed http trailers
- */
- /// Возвращает контейнер (возможно пустой) с trailer'ами ответа HTTP-сервера.
- /// Поток должен быть вычитан полностью прежде чем trailer'ы будут доступны.
- /// Пока поток не вычитан до конца возвращается Nothing.
- /// https://tools.ietf.org/html/rfc7230#section-4.1.2
- const TMaybe<THttpHeaders>& Trailers() const noexcept;
-
- /*
+ * parsed http trailers
+ */
+ /// Возвращает контейнер (возможно пустой) с trailer'ами ответа HTTP-сервера.
+ /// Поток должен быть вычитан полностью прежде чем trailer'ы будут доступны.
+ /// Пока поток не вычитан до конца возвращается Nothing.
+ /// https://tools.ietf.org/html/rfc7230#section-4.1.2
+ const TMaybe<THttpHeaders>& Trailers() const noexcept;
+
+ /*
* first line - response or request
*/
/// Возвращает первую строку ответа HTTP-сервера.
diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp
index 1ea35df675..ff27378996 100644
--- a/library/cpp/http/io/stream_ut.cpp
+++ b/library/cpp/http/io/stream_ut.cpp
@@ -488,82 +488,82 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
}
Y_UNIT_TEST(HasTrailers) {
- TMemoryInput response(
- "HTTP/1.1 200 OK\r\n"
- "Transfer-Encoding: chunked\r\n"
- "\r\n"
- "3\r\n"
- "foo"
- "0\r\n"
- "Bar: baz\r\n"
- "\r\n");
- THttpInput i(&response);
- TMaybe<THttpHeaders> trailers = i.Trailers();
- UNIT_ASSERT(!trailers.Defined());
- i.ReadAll();
- trailers = i.Trailers();
- UNIT_ASSERT_VALUES_EQUAL(trailers.GetRef().Count(), 1);
- UNIT_ASSERT_VALUES_EQUAL(trailers.GetRef().Begin()->ToString(), "Bar: baz");
- }
-
+ TMemoryInput response(
+ "HTTP/1.1 200 OK\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "\r\n"
+ "3\r\n"
+ "foo"
+ "0\r\n"
+ "Bar: baz\r\n"
+ "\r\n");
+ THttpInput i(&response);
+ TMaybe<THttpHeaders> trailers = i.Trailers();
+ UNIT_ASSERT(!trailers.Defined());
+ i.ReadAll();
+ trailers = i.Trailers();
+ UNIT_ASSERT_VALUES_EQUAL(trailers.GetRef().Count(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(trailers.GetRef().Begin()->ToString(), "Bar: baz");
+ }
+
Y_UNIT_TEST(NoTrailersWithChunks) {
- TMemoryInput response(
- "HTTP/1.1 200 OK\r\n"
- "Transfer-Encoding: chunked\r\n"
- "\r\n"
- "3\r\n"
- "foo"
- "0\r\n"
- "\r\n");
- THttpInput i(&response);
- TMaybe<THttpHeaders> trailers = i.Trailers();
- UNIT_ASSERT(!trailers.Defined());
- i.ReadAll();
- trailers = i.Trailers();
- UNIT_ASSERT_VALUES_EQUAL(trailers.GetRef().Count(), 0);
- }
-
+ TMemoryInput response(
+ "HTTP/1.1 200 OK\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "\r\n"
+ "3\r\n"
+ "foo"
+ "0\r\n"
+ "\r\n");
+ THttpInput i(&response);
+ TMaybe<THttpHeaders> trailers = i.Trailers();
+ UNIT_ASSERT(!trailers.Defined());
+ i.ReadAll();
+ trailers = i.Trailers();
+ UNIT_ASSERT_VALUES_EQUAL(trailers.GetRef().Count(), 0);
+ }
+
Y_UNIT_TEST(NoTrailersNoChunks) {
- TMemoryInput response(
- "HTTP/1.1 200 OK\r\n"
- "Content-Length: 3\r\n"
- "\r\n"
- "bar");
- THttpInput i(&response);
- TMaybe<THttpHeaders> trailers = i.Trailers();
- UNIT_ASSERT(!trailers.Defined());
- i.ReadAll();
- trailers = i.Trailers();
- UNIT_ASSERT_VALUES_EQUAL(trailers.GetRef().Count(), 0);
- }
-
+ TMemoryInput response(
+ "HTTP/1.1 200 OK\r\n"
+ "Content-Length: 3\r\n"
+ "\r\n"
+ "bar");
+ THttpInput i(&response);
+ TMaybe<THttpHeaders> trailers = i.Trailers();
+ UNIT_ASSERT(!trailers.Defined());
+ i.ReadAll();
+ trailers = i.Trailers();
+ UNIT_ASSERT_VALUES_EQUAL(trailers.GetRef().Count(), 0);
+ }
+
Y_UNIT_TEST(RequestWithoutContentLength) {
- TStringStream request;
- {
- THttpOutput httpOutput(&request);
+ TStringStream request;
+ {
+ THttpOutput httpOutput(&request);
httpOutput << "POST / HTTP/1.1\r\n"
"Host: yandex.ru\r\n"
"\r\n";
- httpOutput << "GGLOL";
- }
- {
- TStringInput input(request.Str());
- THttpInput httpInput(&input);
- bool chunkedOrHasContentLength = false;
- for (const auto& header : httpInput.Headers()) {
- if (header.Name() == "Transfer-Encoding" && header.Value() == "chunked" || header.Name() == "Content-Length") {
- chunkedOrHasContentLength = true;
- }
- }
-
- // If request doesn't contain neither Content-Length header nor Transfer-Encoding header
- // then server considers message body length to be zero.
- // (See https://tools.ietf.org/html/rfc7230#section-3.3.3)
- UNIT_ASSERT(chunkedOrHasContentLength);
-
- UNIT_ASSERT_VALUES_EQUAL(httpInput.ReadAll(), "GGLOL");
- }
- }
+ httpOutput << "GGLOL";
+ }
+ {
+ TStringInput input(request.Str());
+ THttpInput httpInput(&input);
+ bool chunkedOrHasContentLength = false;
+ for (const auto& header : httpInput.Headers()) {
+ if (header.Name() == "Transfer-Encoding" && header.Value() == "chunked" || header.Name() == "Content-Length") {
+ chunkedOrHasContentLength = true;
+ }
+ }
+
+ // If request doesn't contain neither Content-Length header nor Transfer-Encoding header
+ // then server considers message body length to be zero.
+ // (See https://tools.ietf.org/html/rfc7230#section-3.3.3)
+ UNIT_ASSERT(chunkedOrHasContentLength);
+
+ UNIT_ASSERT_VALUES_EQUAL(httpInput.ReadAll(), "GGLOL");
+ }
+ }
Y_UNIT_TEST(TestInputHasContent) {
{
diff --git a/library/cpp/int128/int128.cpp b/library/cpp/int128/int128.cpp
index a28a389fe8..d81204f0b4 100644
--- a/library/cpp/int128/int128.cpp
+++ b/library/cpp/int128/int128.cpp
@@ -50,13 +50,13 @@ void TSerializer<ui128>::Load(IInputStream* in, ui128& Number) {
::Load(in, Low);
Number = ui128(High, Low);
}
-
-IOutputStream& operator<<(IOutputStream& out, const i128& other)
-{
- if (other >= 0) {
- out << ui128{other};
- } else {
- out << '-' << ui128{-other};
- }
- return out;
-}
+
+IOutputStream& operator<<(IOutputStream& out, const i128& other)
+{
+ if (other >= 0) {
+ out << ui128{other};
+ } else {
+ out << '-' << ui128{-other};
+ }
+ return out;
+}
diff --git a/library/cpp/int128/int128.h b/library/cpp/int128/int128.h
index f1121fc0c6..c015a93af6 100644
--- a/library/cpp/int128/int128.h
+++ b/library/cpp/int128/int128.h
@@ -204,7 +204,7 @@ public:
}
constexpr TInteger128& operator^=(const TInteger128 other) noexcept {
- return *this = *this ^ other;
+ return *this = *this ^ other;
}
constexpr TInteger128& operator|=(const TInteger128 other) noexcept {
diff --git a/library/cpp/int128/ut/int128_ut.cpp b/library/cpp/int128/ut/int128_ut.cpp
index 7339264017..dbc5634d5e 100644
--- a/library/cpp/int128/ut/int128_ut.cpp
+++ b/library/cpp/int128/ut/int128_ut.cpp
@@ -51,33 +51,33 @@ Y_UNIT_TEST_SUITE(Uint128Suite) {
UNIT_ASSERT(!std::signbit(i128{0}));
UNIT_ASSERT(std::signbit(i128{-1}));
}
-
- Y_UNIT_TEST(ToStringTest) {
- // int128
- UNIT_ASSERT_VALUES_EQUAL(ToString(i128(0)), "0");
- UNIT_ASSERT_VALUES_EQUAL(ToString(i128(42)), "42");
- UNIT_ASSERT_VALUES_EQUAL(ToString(i128(-142)), "-142");
- UNIT_ASSERT_VALUES_EQUAL(ToString(std::numeric_limits<i128>::min()), "-170141183460469231731687303715884105728");
- UNIT_ASSERT_VALUES_EQUAL(ToString(std::numeric_limits<i128>::max()), "170141183460469231731687303715884105727");
-
- // Just random number
- UNIT_ASSERT_VALUES_EQUAL(
- ToString(
- - ((i128(8741349088318632894ul) << 64) | i128(1258331728153556511ul))
- ),
- "-161249429491168133245752281683002013215");
-
- // uint128
- UNIT_ASSERT_VALUES_EQUAL(ToString(ui128(0)), "0");
- UNIT_ASSERT_VALUES_EQUAL(ToString(ui128(42)), "42");
- UNIT_ASSERT_VALUES_EQUAL(ToString(std::numeric_limits<ui128>::min()), "0");
- UNIT_ASSERT_VALUES_EQUAL(ToString(std::numeric_limits<ui128>::max()), "340282366920938463463374607431768211455");
-
- // Just random number
- UNIT_ASSERT_VALUES_EQUAL(
- ToString(
- ((ui128(12745260439834612983ul) << 64) | ui128(10970669179777569799ul))
- ),
- "235108557486403940296800289353599800327");
- }
+
+ Y_UNIT_TEST(ToStringTest) {
+ // int128
+ UNIT_ASSERT_VALUES_EQUAL(ToString(i128(0)), "0");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(i128(42)), "42");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(i128(-142)), "-142");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(std::numeric_limits<i128>::min()), "-170141183460469231731687303715884105728");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(std::numeric_limits<i128>::max()), "170141183460469231731687303715884105727");
+
+ // Just random number
+ UNIT_ASSERT_VALUES_EQUAL(
+ ToString(
+ - ((i128(8741349088318632894ul) << 64) | i128(1258331728153556511ul))
+ ),
+ "-161249429491168133245752281683002013215");
+
+ // uint128
+ UNIT_ASSERT_VALUES_EQUAL(ToString(ui128(0)), "0");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(ui128(42)), "42");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(std::numeric_limits<ui128>::min()), "0");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(std::numeric_limits<ui128>::max()), "340282366920938463463374607431768211455");
+
+ // Just random number
+ UNIT_ASSERT_VALUES_EQUAL(
+ ToString(
+ ((ui128(12745260439834612983ul) << 64) | ui128(10970669179777569799ul))
+ ),
+ "235108557486403940296800289353599800327");
+ }
}
diff --git a/library/cpp/json/yson/json2yson.cpp b/library/cpp/json/yson/json2yson.cpp
index f72cb7a9ef..2f9eb596cc 100644
--- a/library/cpp/json/yson/json2yson.cpp
+++ b/library/cpp/json/yson/json2yson.cpp
@@ -1,8 +1,8 @@
#include "json2yson.h"
-#include <library/cpp/yson/parser.h>
-#include <library/cpp/yson/json/json_writer.h>
-#include <library/cpp/yson/json/yson2json_adapter.h>
+#include <library/cpp/yson/parser.h>
+#include <library/cpp/yson/json/json_writer.h>
+#include <library/cpp/yson/json/yson2json_adapter.h>
namespace NJson2Yson {
static void WriteJsonValue(const NJson::TJsonValue& jsonValue, NYT::TYson2JsonCallbacksAdapter* adapter) {
diff --git a/library/cpp/json/yson/json2yson.h b/library/cpp/json/yson/json2yson.h
index 758eb6d0cf..577b9edac7 100644
--- a/library/cpp/json/yson/json2yson.h
+++ b/library/cpp/json/yson/json2yson.h
@@ -2,7 +2,7 @@
#include <library/cpp/json/json_reader.h>
#include <library/cpp/json/json_value.h>
-#include <library/cpp/yson/writer.h>
+#include <library/cpp/yson/writer.h>
namespace NJson2Yson {
class TJsonBuilderImpl: public NYson::TYsonConsumerBase {
diff --git a/library/cpp/json/yson/ya.make b/library/cpp/json/yson/ya.make
index 9b289d674f..fc72c560df 100644
--- a/library/cpp/json/yson/ya.make
+++ b/library/cpp/json/yson/ya.make
@@ -7,8 +7,8 @@ OWNER(
PEERDIR(
library/cpp/json
- library/cpp/yson
- library/cpp/yson/json
+ library/cpp/yson
+ library/cpp/yson/json
)
SRCS(
diff --git a/library/cpp/messagebus/messqueue.cpp b/library/cpp/messagebus/messqueue.cpp
index 3474d62705..09c33a3b7c 100644
--- a/library/cpp/messagebus/messqueue.cpp
+++ b/library/cpp/messagebus/messqueue.cpp
@@ -186,12 +186,12 @@ void TBusMessageQueue::DestroyAllSessions() {
for (auto& session : sessions) {
Y_VERIFY(session->IsDown(), "Session must be shut down prior to queue shutdown");
- }
+ }
}
-
+
void TBusMessageQueue::Schedule(IScheduleItemAutoPtr i) {
Scheduler.Schedule(i);
-}
+}
TString TBusMessageQueue::GetNameInternal() const {
return Config.Name;
diff --git a/library/cpp/messagebus/oldmodule/module.cpp b/library/cpp/messagebus/oldmodule/module.cpp
index 24bd778799..42d6e0b202 100644
--- a/library/cpp/messagebus/oldmodule/module.cpp
+++ b/library/cpp/messagebus/oldmodule/module.cpp
@@ -10,15 +10,15 @@
#include <util/generic/singleton.h>
#include <util/string/printf.h>
#include <util/system/event.h>
-
+
using namespace NActor;
using namespace NBus;
using namespace NBus::NPrivate;
-namespace {
+namespace {
Y_POD_STATIC_THREAD(TBusJob*)
ThreadCurrentJob;
-
+
struct TThreadCurrentJobGuard {
TBusJob* Prev;
@@ -53,13 +53,13 @@ namespace {
for (auto& call : *vec) {
ClearState(&call);
- }
-
+ }
+
vec->clear();
- }
-
-}
-
+ }
+
+}
+
namespace NBus {
namespace NPrivate {
class TJobStorage {
@@ -146,7 +146,7 @@ namespace NBus {
Y_VERIFY(State != RUNNING, "if running, must explicitly call Shutdown() before destructor");
Scheduler.Stop();
-
+
while (!Jobs.empty()) {
DestroyJob(Jobs.front());
}
@@ -577,7 +577,7 @@ namespace NBus {
ClearJobStateVector(&Finished);
ClearJobStateVector(&Pending);
}
-
+
void TBusJob::Sleep(int milliSeconds) {
CheckThreadCurrentJob();
@@ -831,8 +831,8 @@ void TBusModuleImpl::Shutdown() {
ShutdownCondVar.WaitI(Lock);
}
}
-}
-
+}
+
EMessageStatus TBusModule::StartJob(TAutoPtr<TBusMessage> message) {
Y_VERIFY(Impl->State == TBusModuleImpl::RUNNING);
Y_VERIFY(!!Impl->Queue);
diff --git a/library/cpp/messagebus/oldmodule/module.h b/library/cpp/messagebus/oldmodule/module.h
index 8d1c4a5d52..be02e6eeec 100644
--- a/library/cpp/messagebus/oldmodule/module.h
+++ b/library/cpp/messagebus/oldmodule/module.h
@@ -264,7 +264,7 @@ namespace NBus {
/// clears all message states
void ClearAllMessageStates();
-
+
/// returns true if job is done
bool IsDone();
diff --git a/library/cpp/messagebus/test/ut/messagebus_ut.cpp b/library/cpp/messagebus/test/ut/messagebus_ut.cpp
index 040f9b7702..254afad737 100644
--- a/library/cpp/messagebus/test/ut/messagebus_ut.cpp
+++ b/library/cpp/messagebus/test/ut/messagebus_ut.cpp
@@ -5,16 +5,16 @@
#include <library/cpp/messagebus/test/helper/hanging_server.h>
#include <library/cpp/messagebus/test/helper/object_count_check.h>
#include <library/cpp/messagebus/test/helper/wait_for.h>
-
+
#include <library/cpp/messagebus/misc/test_sync.h>
-
+
#include <util/network/sock.h>
#include <utility>
-using namespace NBus;
+using namespace NBus;
using namespace NBus::NTest;
-
+
namespace {
struct TExampleClientSlowOnMessageSent: public TExampleClient {
TAtomic SentCompleted;
@@ -55,7 +55,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
TExampleClient client(sessionConfig);
client.CrashOnError = true;
-
+
server.UseCompression = useCompression;
client.UseCompression = useCompression;
@@ -1148,4 +1148,4 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
// but it should occur at least once
UNIT_ASSERT(client.Session->GetConnectSyscallsNumForTest(noServerAddr) > 2);
};
-};
+};
diff --git a/library/cpp/messagebus/ybus.h b/library/cpp/messagebus/ybus.h
index de21ad8521..7433aef821 100644
--- a/library/cpp/messagebus/ybus.h
+++ b/library/cpp/messagebus/ybus.h
@@ -187,7 +187,7 @@ namespace NBus {
public:
void Schedule(NPrivate::IScheduleItemAutoPtr i);
-
+
private:
void DestroyAllSessions();
void Add(TIntrusivePtr< ::NBus::NPrivate::TBusSessionImpl> session);
diff --git a/library/cpp/threading/future/future_ut.cpp b/library/cpp/threading/future/future_ut.cpp
index 05950a568d..14230c86a8 100644
--- a/library/cpp/threading/future/future_ut.cpp
+++ b/library/cpp/threading/future/future_ut.cpp
@@ -232,12 +232,12 @@ namespace {
} catch (...) {
promise.SetException(std::current_exception());
}
-
+
UNIT_ASSERT(!promise.HasValue());
UNIT_ASSERT(promise.HasException());
UNIT_ASSERT_EXCEPTION(promise.GetValue(), TCustomException);
UNIT_ASSERT_EXCEPTION(promise.TryRethrow(), TCustomException);
- }
+ }
Y_UNIT_TEST(ShouldRethrowCallbackException) {
TPromise<int> promise = NewPromise<int>();
diff --git a/library/cpp/threading/ya.make b/library/cpp/threading/ya.make
index f4d850ee17..ecdc24b9da 100644
--- a/library/cpp/threading/ya.make
+++ b/library/cpp/threading/ya.make
@@ -1,4 +1,4 @@
-RECURSE(
+RECURSE(
algorithm
async_task_batch
async_task_batch/ut
@@ -61,4 +61,4 @@ RECURSE(
ticket_lock/ut
work_stealing
work_stealing/ut
-)
+)
diff --git a/library/cpp/ya.make b/library/cpp/ya.make
index 8c1193b007..d1c8535b08 100644
--- a/library/cpp/ya.make
+++ b/library/cpp/ya.make
@@ -362,7 +362,7 @@ RECURSE(
terminate_handler/sample
testing
text_processing
- threading
+ threading
timezone_conversion
timezone_conversion/ut
tld
@@ -380,8 +380,8 @@ RECURSE(
trace_usage/ut
tvmauth
tvmknife
- type_info
- type_info/bench
+ type_info
+ type_info/bench
ucompress
udp
uilangdetect
@@ -410,10 +410,10 @@ RECURSE(
yconf/patcher
yconf/patcher/ut
yconf/ut
- yson
- yson/json
- yson/node
- yson/node/pybind
+ yson
+ yson/json
+ yson/node
+ yson/node/pybind
yson_pull
yson_pull/ut
yt
diff --git a/library/cpp/yson/consumer.cpp b/library/cpp/yson/consumer.cpp
index 40ae452978..b1cd000631 100644
--- a/library/cpp/yson/consumer.cpp
+++ b/library/cpp/yson/consumer.cpp
@@ -2,7 +2,7 @@
#include "string.h"
#include "parser.h"
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
@@ -12,4 +12,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/consumer.h b/library/cpp/yson/consumer.h
index d5a9d66335..ad17a7e2dd 100644
--- a/library/cpp/yson/consumer.h
+++ b/library/cpp/yson/consumer.h
@@ -5,9 +5,9 @@
#include <util/generic/strbuf.h>
#include <util/system/defaults.h>
-namespace NYson {
+namespace NYson {
struct TYsonConsumerBase
: public virtual NYT::NYson::IYsonConsumer {
void OnRaw(TStringBuf ysonNode, NYT::NYson::EYsonType type) override;
};
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/detail.h b/library/cpp/yson/detail.h
index 27f5e8ffff..d2e965373f 100644
--- a/library/cpp/yson/detail.h
+++ b/library/cpp/yson/detail.h
@@ -10,7 +10,7 @@
#include <util/string/cast.h>
#include <util/stream/input.h>
-namespace NYson {
+namespace NYson {
namespace NDetail {
////////////////////////////////////////////////////////////////////////////////
@@ -803,4 +803,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/format.h b/library/cpp/yson/format.h
index 2ff6dc9f6e..92053e05ab 100644
--- a/library/cpp/yson/format.h
+++ b/library/cpp/yson/format.h
@@ -2,7 +2,7 @@
#include "token.h"
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
const ETokenType BeginListToken = LeftBracket;
@@ -22,4 +22,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/json/json_writer.h b/library/cpp/yson/json/json_writer.h
index d84ac0de53..39a3c85ba7 100644
--- a/library/cpp/yson/json/json_writer.h
+++ b/library/cpp/yson/json/json_writer.h
@@ -1,7 +1,7 @@
#pragma once
-#include <library/cpp/yson/public.h>
-#include <library/cpp/yson/consumer.h>
+#include <library/cpp/yson/public.h>
+#include <library/cpp/yson/consumer.h>
#include <library/cpp/json/json_writer.h>
@@ -27,7 +27,7 @@ namespace NYT {
};
class TJsonWriter
- : public ::NYson::TYsonConsumerBase {
+ : public ::NYson::TYsonConsumerBase {
public:
TJsonWriter(
IOutputStream* output,
diff --git a/library/cpp/yson/json/ya.make b/library/cpp/yson/json/ya.make
index 625a6b231e..0d9314d455 100644
--- a/library/cpp/yson/json/ya.make
+++ b/library/cpp/yson/json/ya.make
@@ -1,17 +1,17 @@
-LIBRARY()
-
-OWNER(
- ermolovd
- g:yt
-)
-
-SRCS(
- json_writer.cpp
- yson2json_adapter.cpp
-)
-
-PEERDIR(
- library/cpp/json
-)
-
-END()
+LIBRARY()
+
+OWNER(
+ ermolovd
+ g:yt
+)
+
+SRCS(
+ json_writer.cpp
+ yson2json_adapter.cpp
+)
+
+PEERDIR(
+ library/cpp/json
+)
+
+END()
diff --git a/library/cpp/yson/json/yson2json_adapter.h b/library/cpp/yson/json/yson2json_adapter.h
index da1bf5ba70..4056be7559 100644
--- a/library/cpp/yson/json/yson2json_adapter.h
+++ b/library/cpp/yson/json/yson2json_adapter.h
@@ -1,6 +1,6 @@
#pragma once
-#include <library/cpp/yson/consumer.h>
+#include <library/cpp/yson/consumer.h>
#include <library/cpp/json/json_reader.h>
@@ -21,7 +21,7 @@ namespace NYT {
};
public:
- TYson2JsonCallbacksAdapter(::NYson::TYsonConsumerBase* impl, bool throwException = false);
+ TYson2JsonCallbacksAdapter(::NYson::TYsonConsumerBase* impl, bool throwException = false);
bool OnNull() override;
bool OnBoolean(bool val) override;
@@ -47,7 +47,7 @@ namespace NYT {
void WrapIfListItem();
private:
- ::NYson::TYsonConsumerBase* Impl_;
+ ::NYson::TYsonConsumerBase* Impl_;
TState State_;
};
}
diff --git a/library/cpp/yson/lexer.cpp b/library/cpp/yson/lexer.cpp
index 5eae94273b..acb7987bdc 100644
--- a/library/cpp/yson/lexer.cpp
+++ b/library/cpp/yson/lexer.cpp
@@ -4,7 +4,7 @@
#include <util/generic/ptr.h>
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
class TStatelessLexer::TImpl {
@@ -40,4 +40,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/lexer.h b/library/cpp/yson/lexer.h
index d9d701874d..7a1dcf77aa 100644
--- a/library/cpp/yson/lexer.h
+++ b/library/cpp/yson/lexer.h
@@ -5,7 +5,7 @@
#include <util/generic/ptr.h>
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
class TStatelessLexer {
@@ -23,4 +23,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/lexer_detail.h b/library/cpp/yson/lexer_detail.h
index 0bba30acdd..f6ff4f46a1 100644
--- a/library/cpp/yson/lexer_detail.h
+++ b/library/cpp/yson/lexer_detail.h
@@ -3,7 +3,7 @@
#include "detail.h"
#include "token.h"
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
namespace NDetail {
@@ -293,4 +293,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/node/node.cpp b/library/cpp/yson/node/node.cpp
index b39e070718..14c9aaefea 100644
--- a/library/cpp/yson/node/node.cpp
+++ b/library/cpp/yson/node/node.cpp
@@ -1,26 +1,26 @@
-#include "node.h"
-
-#include "node_io.h"
-
-#include <library/cpp/yson/writer.h>
+#include "node.h"
+#include "node_io.h"
+
+#include <library/cpp/yson/writer.h>
+
#include <util/generic/overloaded.h>
-namespace NYT {
+namespace NYT {
-////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
-bool TNode::TNull::operator==(const TNull&) const {
- return true;
-}
+bool TNode::TNull::operator==(const TNull&) const {
+ return true;
+}
////////////////////////////////////////////////////////////////////////////////
-bool TNode::TUndefined::operator==(const TUndefined&) const {
- return true;
-}
+bool TNode::TUndefined::operator==(const TUndefined&) const {
+ return true;
+}
-////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
namespace NNodeCmp {
@@ -91,17 +91,17 @@ bool operator>=(const TNode& lhs, const TNode& rhs)
////////////////////////////////////////////////////////////////////////////////
-TNode::TNode()
+TNode::TNode()
: Value_(TUndefined{})
-{ }
+{ }
-TNode::TNode(const char* s)
+TNode::TNode(const char* s)
: Value_(TString(s))
-{ }
+{ }
TNode::TNode(TStringBuf s)
: Value_(TString(s))
-{ }
+{ }
TNode::TNode(std::string_view s)
: Value_(TString(s))
@@ -113,172 +113,172 @@ TNode::TNode(const std::string& s)
TNode::TNode(TString s)
: Value_(std::move(s))
-{ }
+{ }
-TNode::TNode(int i)
+TNode::TNode(int i)
: Value_(static_cast<i64>(i))
-{ }
+{ }
-TNode::TNode(unsigned int ui)
+TNode::TNode(unsigned int ui)
: Value_(static_cast<ui64>(ui))
-{ }
+{ }
-TNode::TNode(long i)
+TNode::TNode(long i)
: Value_(static_cast<i64>(i))
-{ }
+{ }
-TNode::TNode(unsigned long ui)
+TNode::TNode(unsigned long ui)
: Value_(static_cast<ui64>(ui))
-{ }
+{ }
-TNode::TNode(long long i)
+TNode::TNode(long long i)
: Value_(static_cast<i64>(i))
-{ }
+{ }
-TNode::TNode(unsigned long long ui)
+TNode::TNode(unsigned long long ui)
: Value_(static_cast<ui64>(ui))
-{ }
+{ }
-TNode::TNode(double d)
+TNode::TNode(double d)
: Value_(d)
-{ }
+{ }
-TNode::TNode(bool b)
+TNode::TNode(bool b)
: Value_(b)
-{ }
+{ }
TNode::TNode(TMapType map)
: Value_(std::move(map))
{ }
-TNode::TNode(const TNode& rhs)
- : TNode()
-{
- if (rhs.Attributes_) {
- CreateAttributes();
- *Attributes_ = *rhs.Attributes_;
- }
- Value_ = rhs.Value_;
-}
-
-TNode& TNode::operator=(const TNode& rhs)
-{
- if (this != &rhs) {
- TNode tmp = rhs;
- Move(std::move(tmp));
- }
- return *this;
-}
+TNode::TNode(const TNode& rhs)
+ : TNode()
+{
+ if (rhs.Attributes_) {
+ CreateAttributes();
+ *Attributes_ = *rhs.Attributes_;
+ }
+ Value_ = rhs.Value_;
+}
+
+TNode& TNode::operator=(const TNode& rhs)
+{
+ if (this != &rhs) {
+ TNode tmp = rhs;
+ Move(std::move(tmp));
+ }
+ return *this;
+}
TNode::TNode(TNode&& rhs) noexcept
- : TNode()
-{
- Move(std::move(rhs));
-}
+ : TNode()
+{
+ Move(std::move(rhs));
+}
TNode& TNode::operator=(TNode&& rhs) noexcept
-{
- if (this != &rhs) {
- TNode tmp = std::move(rhs);
- Move(std::move(tmp));
+{
+ if (this != &rhs) {
+ TNode tmp = std::move(rhs);
+ Move(std::move(tmp));
}
- return *this;
-}
+ return *this;
+}
-TNode::~TNode() = default;
+TNode::~TNode() = default;
-void TNode::Clear()
-{
- ClearAttributes();
- Value_ = TUndefined();
-}
+void TNode::Clear()
+{
+ ClearAttributes();
+ Value_ = TUndefined();
+}
-bool TNode::IsString() const
-{
+bool TNode::IsString() const
+{
return std::holds_alternative<TString>(Value_);
-}
-
-bool TNode::IsInt64() const
-{
+}
+
+bool TNode::IsInt64() const
+{
return std::holds_alternative<i64>(Value_);
-}
+}
-bool TNode::IsUint64() const
-{
+bool TNode::IsUint64() const
+{
return std::holds_alternative<ui64>(Value_);
-}
+}
-bool TNode::IsDouble() const
-{
+bool TNode::IsDouble() const
+{
return std::holds_alternative<double>(Value_);
-}
+}
-bool TNode::IsBool() const
-{
+bool TNode::IsBool() const
+{
return std::holds_alternative<bool>(Value_);
-}
+}
-bool TNode::IsList() const
-{
+bool TNode::IsList() const
+{
return std::holds_alternative<TListType>(Value_);
-}
+}
-bool TNode::IsMap() const
-{
+bool TNode::IsMap() const
+{
return std::holds_alternative<TMapType>(Value_);
-}
+}
-bool TNode::IsEntity() const
-{
- return IsNull();
-}
+bool TNode::IsEntity() const
+{
+ return IsNull();
+}
-bool TNode::IsNull() const
-{
+bool TNode::IsNull() const
+{
return std::holds_alternative<TNull>(Value_);
-}
-
-bool TNode::IsUndefined() const
-{
+}
+
+bool TNode::IsUndefined() const
+{
return std::holds_alternative<TUndefined>(Value_);
-}
-
+}
+
bool TNode::HasValue() const
{
return !IsNull() && !IsUndefined();
}
-bool TNode::Empty() const
-{
- switch (GetType()) {
- case String:
+bool TNode::Empty() const
+{
+ switch (GetType()) {
+ case String:
return std::get<TString>(Value_).empty();
- case List:
+ case List:
return std::get<TListType>(Value_).empty();
- case Map:
+ case Map:
return std::get<TMapType>(Value_).empty();
- default:
+ default:
ythrow TTypeError() << "Empty() called for type " << GetType();
}
-}
+}
-size_t TNode::Size() const
-{
- switch (GetType()) {
- case String:
+size_t TNode::Size() const
+{
+ switch (GetType()) {
+ case String:
return std::get<TString>(Value_).size();
- case List:
+ case List:
return std::get<TListType>(Value_).size();
- case Map:
+ case Map:
return std::get<TMapType>(Value_).size();
- default:
+ default:
ythrow TTypeError() << "Size() called for type " << GetType();
}
-}
+}
-TNode::EType TNode::GetType() const
-{
+TNode::EType TNode::GetType() const
+{
return std::visit(TOverloaded{
[](const TUndefined&) { return Undefined; },
[](const TString&) { return String; },
@@ -290,61 +290,61 @@ TNode::EType TNode::GetType() const
[](const TMapType&) { return Map; },
[](const TNull&) { return Null; }
}, Value_);
-}
+}
const TString& TNode::AsString() const
-{
- CheckType(String);
+{
+ CheckType(String);
return std::get<TString>(Value_);
-}
+}
-i64 TNode::AsInt64() const
-{
- CheckType(Int64);
+i64 TNode::AsInt64() const
+{
+ CheckType(Int64);
return std::get<i64>(Value_);
-}
+}
-ui64 TNode::AsUint64() const
-{
- CheckType(Uint64);
+ui64 TNode::AsUint64() const
+{
+ CheckType(Uint64);
return std::get<ui64>(Value_);
-}
+}
-double TNode::AsDouble() const
-{
- CheckType(Double);
+double TNode::AsDouble() const
+{
+ CheckType(Double);
return std::get<double>(Value_);
-}
+}
-bool TNode::AsBool() const
-{
- CheckType(Bool);
+bool TNode::AsBool() const
+{
+ CheckType(Bool);
return std::get<bool>(Value_);
-}
+}
const TNode::TListType& TNode::AsList() const
-{
- CheckType(List);
+{
+ CheckType(List);
return std::get<TListType>(Value_);
-}
+}
const TNode::TMapType& TNode::AsMap() const
-{
- CheckType(Map);
+{
+ CheckType(Map);
return std::get<TMapType>(Value_);
-}
+}
TNode::TListType& TNode::AsList()
-{
- CheckType(List);
+{
+ CheckType(List);
return std::get<TListType>(Value_);
-}
+}
TNode::TMapType& TNode::AsMap()
-{
- CheckType(Map);
+{
+ CheckType(Map);
return std::get<TMapType>(Value_);
-}
+}
const TString& TNode::UncheckedAsString() const noexcept
{
@@ -391,52 +391,52 @@ TNode::TMapType& TNode::UncheckedAsMap() noexcept
return std::get<TMapType>(Value_);
}
-TNode TNode::CreateList()
-{
- TNode node;
+TNode TNode::CreateList()
+{
+ TNode node;
node.Value_ = TListType{};
- return node;
-}
-
-TNode TNode::CreateList(TListType list)
-{
- TNode node;
- node.Value_ = std::move(list);
- return node;
-}
-
-TNode TNode::CreateMap()
-{
- TNode node;
+ return node;
+}
+
+TNode TNode::CreateList(TListType list)
+{
+ TNode node;
+ node.Value_ = std::move(list);
+ return node;
+}
+
+TNode TNode::CreateMap()
+{
+ TNode node;
node.Value_ = TMapType{};
- return node;
-}
-
-TNode TNode::CreateMap(TMapType map)
-{
- TNode node;
- node.Value_ = std::move(map);
- return node;
-}
-
-TNode TNode::CreateEntity()
-{
- TNode node;
+ return node;
+}
+
+TNode TNode::CreateMap(TMapType map)
+{
+ TNode node;
+ node.Value_ = std::move(map);
+ return node;
+}
+
+TNode TNode::CreateEntity()
+{
+ TNode node;
node.Value_ = TNull{};
- return node;
-}
+ return node;
+}
-const TNode& TNode::operator[](size_t index) const
-{
- CheckType(List);
+const TNode& TNode::operator[](size_t index) const
+{
+ CheckType(List);
return std::get<TListType>(Value_)[index];
-}
+}
-TNode& TNode::operator[](size_t index)
-{
- CheckType(List);
+TNode& TNode::operator[](size_t index)
+{
+ CheckType(List);
return std::get<TListType>(Value_)[index];
-}
+}
const TNode& TNode::At(size_t index) const {
CheckType(List);
@@ -457,88 +457,88 @@ TNode& TNode::At(size_t index) {
}
TNode& TNode::Add() &
-{
- AssureList();
+{
+ AssureList();
return std::get<TListType>(Value_).emplace_back();
-}
+}
TNode TNode::Add() &&
-{
+{
return std::move(Add());
}
TNode& TNode::Add(const TNode& node) &
{
- AssureList();
+ AssureList();
std::get<TListType>(Value_).emplace_back(node);
- return *this;
-}
+ return *this;
+}
TNode TNode::Add(const TNode& node) &&
-{
+{
return std::move(Add(node));
}
TNode& TNode::Add(TNode&& node) &
{
- AssureList();
+ AssureList();
std::get<TListType>(Value_).emplace_back(std::move(node));
- return *this;
-}
+ return *this;
+}
TNode TNode::Add(TNode&& node) &&
{
return std::move(Add(std::move(node)));
}
-bool TNode::HasKey(const TStringBuf key) const
-{
- CheckType(Map);
+bool TNode::HasKey(const TStringBuf key) const
+{
+ CheckType(Map);
return std::get<TMapType>(Value_).contains(key);
-}
+}
TNode& TNode::operator()(const TString& key, const TNode& value) &
-{
- AssureMap();
+{
+ AssureMap();
std::get<TMapType>(Value_)[key] = value;
- return *this;
-}
+ return *this;
+}
TNode TNode::operator()(const TString& key, const TNode& value) &&
-{
+{
return std::move(operator()(key, value));
}
TNode& TNode::operator()(const TString& key, TNode&& value) &
{
- AssureMap();
+ AssureMap();
std::get<TMapType>(Value_)[key] = std::move(value);
- return *this;
-}
+ return *this;
+}
TNode TNode::operator()(const TString& key, TNode&& value) &&
{
return std::move(operator()(key, std::move(value)));
}
-const TNode& TNode::operator[](const TStringBuf key) const
-{
- CheckType(Map);
- static TNode notFound;
+const TNode& TNode::operator[](const TStringBuf key) const
+{
+ CheckType(Map);
+ static TNode notFound;
const auto& map = std::get<TMapType>(Value_);
TMapType::const_iterator i = map.find(key);
- if (i == map.end()) {
- return notFound;
- } else {
- return i->second;
+ if (i == map.end()) {
+ return notFound;
+ } else {
+ return i->second;
}
-}
+}
-TNode& TNode::operator[](const TStringBuf key)
-{
- AssureMap();
+TNode& TNode::operator[](const TStringBuf key)
+{
+ AssureMap();
return std::get<TMapType>(Value_)[key];
-}
+}
const TNode& TNode::At(const TStringBuf key) const {
CheckType(Map);
@@ -778,101 +778,101 @@ TNode::TMapType& TNode::ChildAsMap(size_t index) {
}
}
-bool TNode::HasAttributes() const
-{
- return Attributes_ && !Attributes_->Empty();
-}
+bool TNode::HasAttributes() const
+{
+ return Attributes_ && !Attributes_->Empty();
+}
-void TNode::ClearAttributes()
-{
- if (Attributes_) {
- Attributes_.Destroy();
+void TNode::ClearAttributes()
+{
+ if (Attributes_) {
+ Attributes_.Destroy();
}
-}
+}
-const TNode& TNode::GetAttributes() const
-{
- static TNode notFound = TNode::CreateMap();
- if (!Attributes_) {
- return notFound;
+const TNode& TNode::GetAttributes() const
+{
+ static TNode notFound = TNode::CreateMap();
+ if (!Attributes_) {
+ return notFound;
}
- return *Attributes_;
-}
+ return *Attributes_;
+}
-TNode& TNode::Attributes()
-{
- if (!Attributes_) {
- CreateAttributes();
+TNode& TNode::Attributes()
+{
+ if (!Attributes_) {
+ CreateAttributes();
}
- return *Attributes_;
-}
+ return *Attributes_;
+}
-void TNode::MoveWithoutAttributes(TNode&& rhs)
-{
- Value_ = std::move(rhs.Value_);
- rhs.Clear();
-}
+void TNode::MoveWithoutAttributes(TNode&& rhs)
+{
+ Value_ = std::move(rhs.Value_);
+ rhs.Clear();
+}
-void TNode::Move(TNode&& rhs)
-{
- Value_ = std::move(rhs.Value_);
- Attributes_ = std::move(rhs.Attributes_);
-}
+void TNode::Move(TNode&& rhs)
+{
+ Value_ = std::move(rhs.Value_);
+ Attributes_ = std::move(rhs.Attributes_);
+}
-void TNode::CheckType(EType type) const
-{
- Y_ENSURE_EX(GetType() == type,
+void TNode::CheckType(EType type) const
+{
+ Y_ENSURE_EX(GetType() == type,
TTypeError() << "TNode type " << type << " expected, actual type " << GetType();
- );
-}
+ );
+}
-void TNode::AssureMap()
-{
+void TNode::AssureMap()
+{
if (std::holds_alternative<TUndefined>(Value_)) {
Value_ = TMapType();
- } else {
- CheckType(Map);
+ } else {
+ CheckType(Map);
}
-}
+}
-void TNode::AssureList()
-{
+void TNode::AssureList()
+{
if (std::holds_alternative<TUndefined>(Value_)) {
Value_ = TListType();
- } else {
- CheckType(List);
+ } else {
+ CheckType(List);
}
-}
+}
-void TNode::CreateAttributes()
-{
+void TNode::CreateAttributes()
+{
Attributes_ = MakeHolder<TNode>();
Attributes_->Value_ = TMapType();
-}
+}
void TNode::Save(IOutputStream* out) const
-{
+{
NodeToYsonStream(*this, out, NYson::EYsonFormat::Binary);
-}
-
+}
+
void TNode::Load(IInputStream* in)
-{
- Clear();
+{
+ Clear();
*this = NodeFromYsonStream(in, ::NYson::EYsonType::Node);
-}
+}
+
+////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-
-bool operator==(const TNode& lhs, const TNode& rhs)
-{
+bool operator==(const TNode& lhs, const TNode& rhs)
+{
if (std::holds_alternative<TNode::TUndefined>(lhs.Value_) ||
std::holds_alternative<TNode::TUndefined>(rhs.Value_))
{
- // TODO: should try to remove this behaviour if nobody uses it.
- return false;
+ // TODO: should try to remove this behaviour if nobody uses it.
+ return false;
}
- if (lhs.GetType() != rhs.GetType()) {
+ if (lhs.GetType() != rhs.GetType()) {
return false;
}
@@ -890,15 +890,15 @@ bool operator==(const TNode& lhs, const TNode& rhs)
}
}
- return rhs.Value_ == lhs.Value_;
+ return rhs.Value_ == lhs.Value_;
}
-bool operator!=(const TNode& lhs, const TNode& rhs)
+bool operator!=(const TNode& lhs, const TNode& rhs)
{
return !(lhs == rhs);
}
-bool GetBool(const TNode& node)
+bool GetBool(const TNode& node)
{
if (node.IsBool()) {
return node.AsBool();
diff --git a/library/cpp/yson/node/node.h b/library/cpp/yson/node/node.h
index 5f90f95df0..2fc3cb4213 100644
--- a/library/cpp/yson/node/node.h
+++ b/library/cpp/yson/node/node.h
@@ -1,9 +1,9 @@
#pragma once
-#include <util/generic/bt_exception.h>
+#include <util/generic/bt_exception.h>
#include <util/generic/cast.h>
#include <util/generic/hash.h>
-#include <util/generic/variant.h>
+#include <util/generic/variant.h>
#include <util/generic/vector.h>
#include <util/generic/yexception.h>
#include <util/generic/ylimits.h>
@@ -31,57 +31,57 @@ public:
{ };
enum EType {
- Undefined = 0 /*"undefined"*/,
-
- // NOTE: string representation of all node types
- // are compatible with server node type (except `Undefined' which is missing on server).
- String = 1 /*"string_node"*/,
- Int64 = 2 /*"int64_node"*/,
- Uint64 = 3 /*"uint64_node"*/,
- Double = 4 /*"double_node"*/,
- Bool = 5 /*"boolean_node"*/,
- List = 6 /*"list_node"*/,
- Map = 7 /*"map_node"*/,
- Null = 8 /*"null"*/,
+ Undefined = 0 /*"undefined"*/,
+
+ // NOTE: string representation of all node types
+ // are compatible with server node type (except `Undefined' which is missing on server).
+ String = 1 /*"string_node"*/,
+ Int64 = 2 /*"int64_node"*/,
+ Uint64 = 3 /*"uint64_node"*/,
+ Double = 4 /*"double_node"*/,
+ Bool = 5 /*"boolean_node"*/,
+ List = 6 /*"list_node"*/,
+ Map = 7 /*"map_node"*/,
+ Null = 8 /*"null"*/,
};
using TListType = TVector<TNode>;
using TMapType = THashMap<TString, TNode>;
-private:
- struct TNull {
- bool operator==(const TNull&) const;
- };
+private:
+ struct TNull {
+ bool operator==(const TNull&) const;
+ };
- struct TUndefined {
- bool operator==(const TUndefined&) const;
- };
+ struct TUndefined {
+ bool operator==(const TUndefined&) const;
+ };
using TValue = std::variant<
- bool,
- i64,
- ui64,
- double,
+ bool,
+ i64,
+ ui64,
+ double,
TString,
TListType,
TMapType,
- TNull,
- TUndefined
- >;
+ TNull,
+ TUndefined
+ >;
-public:
+public:
- TNode();
- TNode(const char* s);
+ TNode();
+ TNode(const char* s);
TNode(TStringBuf s);
explicit TNode(std::string_view s);
explicit TNode(const std::string& s);
TNode(TString s);
- TNode(int i);
+ TNode(int i);
//this case made speccially for prevent mess cast of EType into TNode through TNode(int) constructor
- //usual case of error SomeNode == TNode::Undefined <-- SomeNode indeed will be compared with TNode(0) without this method
- //correct way is SomeNode.GetType() == TNode::Undefined
+ //usual case of error SomeNode == TNode::Undefined <-- SomeNode indeed will be compared with TNode(0) without this method
+ //correct way is SomeNode.GetType() == TNode::Undefined
template<class T = EType>
Y_FORCE_INLINE TNode(EType)
{
@@ -94,37 +94,37 @@ public:
static_assert(!std::is_same<T,T>::value, "looks like a mistake, and pointer have converted to bool");
}
- TNode(unsigned int ui);
- TNode(long i);
- TNode(unsigned long ui);
- TNode(long long i);
- TNode(unsigned long long ui);
- TNode(double d);
- TNode(bool b);
+ TNode(unsigned int ui);
+ TNode(long i);
+ TNode(unsigned long ui);
+ TNode(long long i);
+ TNode(unsigned long long ui);
+ TNode(double d);
+ TNode(bool b);
TNode(TMapType map);
- TNode(const TNode& rhs);
- TNode& operator=(const TNode& rhs);
+ TNode(const TNode& rhs);
+ TNode& operator=(const TNode& rhs);
TNode(TNode&& rhs) noexcept;
TNode& operator=(TNode&& rhs) noexcept;
- ~TNode();
-
- void Clear();
-
- bool IsString() const;
- bool IsInt64() const;
- bool IsUint64() const;
- bool IsDouble() const;
- bool IsBool() const;
- bool IsList() const;
- bool IsMap() const;
-
- // `IsEntity' is deprecated use `IsNull' instead.
- bool IsEntity() const;
- bool IsNull() const;
- bool IsUndefined() const;
+ ~TNode();
+
+ void Clear();
+
+ bool IsString() const;
+ bool IsInt64() const;
+ bool IsUint64() const;
+ bool IsDouble() const;
+ bool IsBool() const;
+ bool IsList() const;
+ bool IsMap() const;
+
+ // `IsEntity' is deprecated use `IsNull' instead.
+ bool IsEntity() const;
+ bool IsNull() const;
+ bool IsUndefined() const;
// Returns true if TNode is neither Null, nor Undefined
bool HasValue() const;
@@ -134,16 +134,16 @@ public:
// Int64, Uint64, Double, or Bool
bool IsArithmetic() const;
- bool Empty() const;
- size_t Size() const;
+ bool Empty() const;
+ size_t Size() const;
- EType GetType() const;
+ EType GetType() const;
const TString& AsString() const;
- i64 AsInt64() const;
- ui64 AsUint64() const;
- double AsDouble() const;
- bool AsBool() const;
+ i64 AsInt64() const;
+ ui64 AsUint64() const;
+ double AsDouble() const;
+ bool AsBool() const;
const TListType& AsList() const;
const TMapType& AsMap() const;
TListType& AsList();
@@ -175,14 +175,14 @@ public:
template<typename T>
const T& As() const;
- static TNode CreateList();
- static TNode CreateList(TListType list);
- static TNode CreateMap();
- static TNode CreateMap(TMapType map);
- static TNode CreateEntity();
+ static TNode CreateList();
+ static TNode CreateList(TListType list);
+ static TNode CreateMap();
+ static TNode CreateMap(TMapType map);
+ static TNode CreateEntity();
- const TNode& operator[](size_t index) const;
- TNode& operator[](size_t index);
+ const TNode& operator[](size_t index) const;
+ TNode& operator[](size_t index);
const TNode& At(size_t index) const;
TNode& At(size_t index);
@@ -193,15 +193,15 @@ public:
TNode& Add(TNode&& node) &;
TNode Add(TNode&& node) &&;
- bool HasKey(const TStringBuf key) const;
-
+ bool HasKey(const TStringBuf key) const;
+
TNode& operator()(const TString& key, const TNode& value) &;
TNode operator()(const TString& key, const TNode& value) &&;
TNode& operator()(const TString& key, TNode&& value) &;
TNode operator()(const TString& key, TNode&& value) &&;
- const TNode& operator[](const TStringBuf key) const;
- TNode& operator[](const TStringBuf key);
+ const TNode& operator[](const TStringBuf key) const;
+ TNode& operator[](const TStringBuf key);
const TNode& At(const TStringBuf key) const;
TNode& At(const TStringBuf key);
@@ -255,40 +255,40 @@ public:
// attributes
- bool HasAttributes() const;
- void ClearAttributes();
- const TNode& GetAttributes() const;
- TNode& Attributes();
+ bool HasAttributes() const;
+ void ClearAttributes();
+ const TNode& GetAttributes() const;
+ TNode& Attributes();
- void MoveWithoutAttributes(TNode&& rhs);
+ void MoveWithoutAttributes(TNode&& rhs);
- // Serialize TNode using binary yson format.
- // Methods for ysaveload.
+ // Serialize TNode using binary yson format.
+ // Methods for ysaveload.
void Save(IOutputStream* output) const;
void Load(IInputStream* input);
-
+
private:
- void Move(TNode&& rhs);
+ void Move(TNode&& rhs);
- void CheckType(EType type) const;
+ void CheckType(EType type) const;
- void AssureMap();
- void AssureList();
+ void AssureMap();
+ void AssureList();
- void CreateAttributes();
+ void CreateAttributes();
private:
- TValue Value_;
- THolder<TNode> Attributes_;
+ TValue Value_;
+ THolder<TNode> Attributes_;
friend bool operator==(const TNode& lhs, const TNode& rhs);
friend bool operator!=(const TNode& lhs, const TNode& rhs);
};
-bool operator==(const TNode& lhs, const TNode& rhs);
-bool operator!=(const TNode& lhs, const TNode& rhs);
+bool operator==(const TNode& lhs, const TNode& rhs);
+bool operator!=(const TNode& lhs, const TNode& rhs);
-bool GetBool(const TNode& node);
+bool GetBool(const TNode& node);
inline bool TNode::IsArithmetic() const {
return IsInt64() || IsUint64() || IsDouble() || IsBool();
@@ -344,20 +344,20 @@ inline T TNode::ConvertTo() const {
template<>
inline TString TNode::ConvertTo<TString>() const {
switch (GetType()) {
- case NYT::TNode::String:
+ case NYT::TNode::String:
return AsString();
- case NYT::TNode::Int64:
+ case NYT::TNode::Int64:
return ::ToString(AsInt64());
- case NYT::TNode::Uint64:
+ case NYT::TNode::Uint64:
return ::ToString(AsUint64());
- case NYT::TNode::Double:
+ case NYT::TNode::Double:
return ::ToString(AsDouble());
- case NYT::TNode::Bool:
+ case NYT::TNode::Bool:
return ::ToString(AsBool());
- case NYT::TNode::List:
- case NYT::TNode::Map:
- case NYT::TNode::Null:
- case NYT::TNode::Undefined:
+ case NYT::TNode::List:
+ case NYT::TNode::Map:
+ case NYT::TNode::Null:
+ case NYT::TNode::Undefined:
ythrow TTypeError() << "ConvertTo<TString>() called for type " << GetType();
}
Y_UNREACHABLE();
@@ -366,20 +366,20 @@ inline TString TNode::ConvertTo<TString>() const {
template<>
inline double TNode::ConvertTo<double>() const {
switch (GetType()) {
- case NYT::TNode::String:
+ case NYT::TNode::String:
return ::FromString(AsString());
- case NYT::TNode::Int64:
+ case NYT::TNode::Int64:
return AsInt64();
- case NYT::TNode::Uint64:
+ case NYT::TNode::Uint64:
return AsUint64();
- case NYT::TNode::Double:
+ case NYT::TNode::Double:
return AsDouble();
- case NYT::TNode::Bool:
+ case NYT::TNode::Bool:
return AsBool();
- case NYT::TNode::List:
- case NYT::TNode::Map:
- case NYT::TNode::Null:
- case NYT::TNode::Undefined:
+ case NYT::TNode::List:
+ case NYT::TNode::Map:
+ case NYT::TNode::Null:
+ case NYT::TNode::Undefined:
ythrow TTypeError() << "ConvertTo<double>() called for type " << GetType();
}
}
@@ -387,20 +387,20 @@ inline double TNode::ConvertTo<double>() const {
template<>
inline bool TNode::ConvertTo<bool>() const {
switch (GetType()) {
- case NYT::TNode::String:
+ case NYT::TNode::String:
return ::FromString(AsString());
- case NYT::TNode::Int64:
+ case NYT::TNode::Int64:
return AsInt64();
- case NYT::TNode::Uint64:
+ case NYT::TNode::Uint64:
return AsUint64();
- case NYT::TNode::Double:
+ case NYT::TNode::Double:
return AsDouble();
- case NYT::TNode::Bool:
+ case NYT::TNode::Bool:
return AsBool();
- case NYT::TNode::List:
- case NYT::TNode::Map:
- case NYT::TNode::Null:
- case NYT::TNode::Undefined:
+ case NYT::TNode::List:
+ case NYT::TNode::Map:
+ case NYT::TNode::Null:
+ case NYT::TNode::Undefined:
ythrow TTypeError() << "ConvertTo<bool>() called for type " << GetType();
}
}
diff --git a/library/cpp/yson/node/node_builder.h b/library/cpp/yson/node/node_builder.h
index 69800016e0..8e0dd57fc1 100644
--- a/library/cpp/yson/node/node_builder.h
+++ b/library/cpp/yson/node/node_builder.h
@@ -1,10 +1,10 @@
#pragma once
-#include "node.h"
+#include "node.h"
#include <library/cpp/json/json_reader.h>
-#include <library/cpp/yson/consumer.h>
+#include <library/cpp/yson/consumer.h>
#include <util/generic/stack.h>
@@ -13,7 +13,7 @@ namespace NYT {
////////////////////////////////////////////////////////////////////////////////
class TNodeBuilder
- : public ::NYson::TYsonConsumerBase
+ : public ::NYson::TYsonConsumerBase
{
public:
TNodeBuilder(TNode* node);
diff --git a/library/cpp/yson/node/node_io.cpp b/library/cpp/yson/node/node_io.cpp
index 294a7f7217..2d8c4f3c5a 100644
--- a/library/cpp/yson/node/node_io.cpp
+++ b/library/cpp/yson/node/node_io.cpp
@@ -1,12 +1,12 @@
-#include "node_io.h"
+#include "node_io.h"
#include "node_builder.h"
#include "node_visitor.h"
-#include <library/cpp/yson/json/json_writer.h>
-#include <library/cpp/yson/parser.h>
-#include <library/cpp/yson/writer.h>
-#include <library/cpp/yson/json/yson2json_adapter.h>
+#include <library/cpp/yson/json/json_writer.h>
+#include <library/cpp/yson/parser.h>
+#include <library/cpp/yson/writer.h>
+#include <library/cpp/yson/json/yson2json_adapter.h>
#include <library/cpp/json/json_reader.h>
#include <library/cpp/json/json_value.h>
@@ -18,56 +18,56 @@
namespace NYT {
-static void WalkJsonTree(const NJson::TJsonValue& jsonValue, NJson::TJsonCallbacks* callbacks)
-{
- using namespace NJson;
- switch (jsonValue.GetType()) {
- case JSON_NULL:
- callbacks->OnNull();
- return;
- case JSON_BOOLEAN:
- callbacks->OnBoolean(jsonValue.GetBoolean());
- return;
- case JSON_INTEGER:
- callbacks->OnInteger(jsonValue.GetInteger());
- return;
- case JSON_UINTEGER:
- callbacks->OnUInteger(jsonValue.GetUInteger());
- return;
- case JSON_DOUBLE:
- callbacks->OnDouble(jsonValue.GetDouble());
- return;
- case JSON_STRING:
- callbacks->OnString(jsonValue.GetString());
- return;
- case JSON_MAP:
- {
- callbacks->OnOpenMap();
- for (const auto& item : jsonValue.GetMap()) {
- callbacks->OnMapKey(item.first);
- WalkJsonTree(item.second, callbacks);
- }
- callbacks->OnCloseMap();
- }
- return;
- case JSON_ARRAY:
- {
- callbacks->OnOpenArray();
- for (const auto& item : jsonValue.GetArray()) {
- WalkJsonTree(item, callbacks);
- }
- callbacks->OnCloseArray();
- }
- return;
- case JSON_UNDEFINED:
- ythrow yexception() << "cannot consume undefined json value";
- return;
- }
- Y_UNREACHABLE();
-}
-
+static void WalkJsonTree(const NJson::TJsonValue& jsonValue, NJson::TJsonCallbacks* callbacks)
+{
+ using namespace NJson;
+ switch (jsonValue.GetType()) {
+ case JSON_NULL:
+ callbacks->OnNull();
+ return;
+ case JSON_BOOLEAN:
+ callbacks->OnBoolean(jsonValue.GetBoolean());
+ return;
+ case JSON_INTEGER:
+ callbacks->OnInteger(jsonValue.GetInteger());
+ return;
+ case JSON_UINTEGER:
+ callbacks->OnUInteger(jsonValue.GetUInteger());
+ return;
+ case JSON_DOUBLE:
+ callbacks->OnDouble(jsonValue.GetDouble());
+ return;
+ case JSON_STRING:
+ callbacks->OnString(jsonValue.GetString());
+ return;
+ case JSON_MAP:
+ {
+ callbacks->OnOpenMap();
+ for (const auto& item : jsonValue.GetMap()) {
+ callbacks->OnMapKey(item.first);
+ WalkJsonTree(item.second, callbacks);
+ }
+ callbacks->OnCloseMap();
+ }
+ return;
+ case JSON_ARRAY:
+ {
+ callbacks->OnOpenArray();
+ for (const auto& item : jsonValue.GetArray()) {
+ WalkJsonTree(item, callbacks);
+ }
+ callbacks->OnCloseArray();
+ }
+ return;
+ case JSON_UNDEFINED:
+ ythrow yexception() << "cannot consume undefined json value";
+ return;
+ }
+ Y_UNREACHABLE();
+}
+
static TNode CreateEmptyNodeByType(::NYson::EYsonType type)
-{
+{
TNode result;
switch (type) {
case ::NYson::EYsonType::ListFragment:
@@ -85,16 +85,16 @@ static TNode CreateEmptyNodeByType(::NYson::EYsonType type)
TNode NodeFromYsonString(const TStringBuf input, ::NYson::EYsonType type)
{
TMemoryInput stream(input);
- return NodeFromYsonStream(&stream, type);
-}
+ return NodeFromYsonStream(&stream, type);
+}
TString NodeToYsonString(const TNode& node, NYson::EYsonFormat format)
-{
- TStringStream stream;
- NodeToYsonStream(node, &stream, format);
- return stream.Str();
-}
-
+{
+ TStringStream stream;
+ NodeToYsonStream(node, &stream, format);
+ return stream.Str();
+}
+
TString NodeToCanonicalYsonString(const TNode& node, NYson::EYsonFormat format)
{
TStringStream stream;
@@ -103,7 +103,7 @@ TString NodeToCanonicalYsonString(const TNode& node, NYson::EYsonFormat format)
}
TNode NodeFromYsonStream(IInputStream* input, ::NYson::EYsonType type)
-{
+{
TNode result = CreateEmptyNodeByType(type);
TNodeBuilder builder(&result);
@@ -127,10 +127,10 @@ void NodeToCanonicalYsonStream(const TNode& node, IOutputStream* output, NYson::
}
TNode NodeFromJsonString(const TStringBuf input)
-{
+{
TMemoryInput stream(input);
- TNode result;
+ TNode result;
TNodeBuilder builder(&result);
TYson2JsonCallbacksAdapter callbacks(&builder, /*throwException*/ true);
@@ -140,15 +140,15 @@ TNode NodeFromJsonString(const TStringBuf input)
return result;
}
-TNode NodeFromJsonValue(const NJson::TJsonValue& input)
-{
- TNode result;
- TNodeBuilder builder(&result);
- TYson2JsonCallbacksAdapter callbacks(&builder, /*throwException*/ true);
- WalkJsonTree(input, &callbacks);
- return result;
-}
-
+TNode NodeFromJsonValue(const NJson::TJsonValue& input)
+{
+ TNode result;
+ TNodeBuilder builder(&result);
+ TYson2JsonCallbacksAdapter callbacks(&builder, /*throwException*/ true);
+ WalkJsonTree(input, &callbacks);
+ return result;
+}
+
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
diff --git a/library/cpp/yson/node/node_io.h b/library/cpp/yson/node/node_io.h
index 2ad23b658f..1fb4ead92f 100644
--- a/library/cpp/yson/node/node_io.h
+++ b/library/cpp/yson/node/node_io.h
@@ -1,12 +1,12 @@
#pragma once
-#include "node.h"
-#include <library/cpp/yson/public.h>
-
-namespace NJson {
- class TJsonValue;
-} // namespace NJson
+#include "node.h"
+#include <library/cpp/yson/public.h>
+namespace NJson {
+ class TJsonValue;
+} // namespace NJson
+
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
@@ -25,7 +25,7 @@ TNode NodeFromYsonStream(IInputStream* input, ::NYson::EYsonType type = ::NYson:
// Serialize TNode to stream in one of YSON formats with random order of maps' keys (don't use in tests)
void NodeToYsonStream(const TNode& node, IOutputStream* output, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Text);
-
+
// Same as the latter, but maps' keys are sorted lexicographically (to be used in tests)
void NodeToCanonicalYsonStream(const TNode& node, IOutputStream* output, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Text);
@@ -33,7 +33,7 @@ void NodeToCanonicalYsonStream(const TNode& node, IOutputStream* output, ::NYson
TNode NodeFromJsonString(const TStringBuf input);
// Convert TJsonValue to TNode
-TNode NodeFromJsonValue(const NJson::TJsonValue& input);
+TNode NodeFromJsonValue(const NJson::TJsonValue& input);
////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/yson/node/node_ut.cpp b/library/cpp/yson/node/node_ut.cpp
index 448e99f575..4728ce3c35 100644
--- a/library/cpp/yson/node/node_ut.cpp
+++ b/library/cpp/yson/node/node_ut.cpp
@@ -1,55 +1,55 @@
-#include "node.h"
-#include "node_io.h"
-
+#include "node.h"
+#include "node_io.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
-#include <util/ysaveload.h>
-
-using namespace NYT;
-
-template<>
+
+#include <util/ysaveload.h>
+
+using namespace NYT;
+
+template<>
void Out<NYT::TNode>(IOutputStream& s, const NYT::TNode& node)
-{
- s << "TNode:" << NodeToYsonString(node);
-}
-
+{
+ s << "TNode:" << NodeToYsonString(node);
+}
+
Y_UNIT_TEST_SUITE(YtNodeTest) {
Y_UNIT_TEST(TestConstsructors) {
- TNode nodeEmpty;
- UNIT_ASSERT_EQUAL(nodeEmpty.GetType(), TNode::Undefined);
-
- TNode nodeString("foobar");
- UNIT_ASSERT_EQUAL(nodeString.GetType(), TNode::String);
- UNIT_ASSERT(nodeString.IsString());
- UNIT_ASSERT_VALUES_EQUAL(nodeString.AsString(), "foobar");
-
- TNode nodeInt(int(54));
- UNIT_ASSERT_EQUAL(nodeInt.GetType(), TNode::Int64);
- UNIT_ASSERT(nodeInt.IsInt64());
- UNIT_ASSERT(!nodeInt.IsUint64());
- UNIT_ASSERT_VALUES_EQUAL(nodeInt.AsInt64(), 54ull);
-
- TNode nodeUint(ui64(42));
- UNIT_ASSERT_EQUAL(nodeUint.GetType(), TNode::Uint64);
- UNIT_ASSERT(nodeUint.IsUint64());
- UNIT_ASSERT(!nodeUint.IsInt64());
- UNIT_ASSERT_VALUES_EQUAL(nodeUint.AsUint64(), 42ull);
-
- TNode nodeDouble(double(2.3));
- UNIT_ASSERT_EQUAL(nodeDouble.GetType(), TNode::Double);
- UNIT_ASSERT(nodeDouble.IsDouble());
- UNIT_ASSERT_VALUES_EQUAL(nodeDouble.AsDouble(), double(2.3));
-
- TNode nodeBool(true);
- UNIT_ASSERT_EQUAL(nodeBool.GetType(), TNode::Bool);
- UNIT_ASSERT(nodeBool.IsBool());
- UNIT_ASSERT_VALUES_EQUAL(nodeBool.AsBool(), true);
-
- TNode nodeEntity = TNode::CreateEntity();
- UNIT_ASSERT_EQUAL(nodeEntity.GetType(), TNode::Null);
- UNIT_ASSERT(nodeEntity.IsEntity());
- }
-
+ TNode nodeEmpty;
+ UNIT_ASSERT_EQUAL(nodeEmpty.GetType(), TNode::Undefined);
+
+ TNode nodeString("foobar");
+ UNIT_ASSERT_EQUAL(nodeString.GetType(), TNode::String);
+ UNIT_ASSERT(nodeString.IsString());
+ UNIT_ASSERT_VALUES_EQUAL(nodeString.AsString(), "foobar");
+
+ TNode nodeInt(int(54));
+ UNIT_ASSERT_EQUAL(nodeInt.GetType(), TNode::Int64);
+ UNIT_ASSERT(nodeInt.IsInt64());
+ UNIT_ASSERT(!nodeInt.IsUint64());
+ UNIT_ASSERT_VALUES_EQUAL(nodeInt.AsInt64(), 54ull);
+
+ TNode nodeUint(ui64(42));
+ UNIT_ASSERT_EQUAL(nodeUint.GetType(), TNode::Uint64);
+ UNIT_ASSERT(nodeUint.IsUint64());
+ UNIT_ASSERT(!nodeUint.IsInt64());
+ UNIT_ASSERT_VALUES_EQUAL(nodeUint.AsUint64(), 42ull);
+
+ TNode nodeDouble(double(2.3));
+ UNIT_ASSERT_EQUAL(nodeDouble.GetType(), TNode::Double);
+ UNIT_ASSERT(nodeDouble.IsDouble());
+ UNIT_ASSERT_VALUES_EQUAL(nodeDouble.AsDouble(), double(2.3));
+
+ TNode nodeBool(true);
+ UNIT_ASSERT_EQUAL(nodeBool.GetType(), TNode::Bool);
+ UNIT_ASSERT(nodeBool.IsBool());
+ UNIT_ASSERT_VALUES_EQUAL(nodeBool.AsBool(), true);
+
+ TNode nodeEntity = TNode::CreateEntity();
+ UNIT_ASSERT_EQUAL(nodeEntity.GetType(), TNode::Null);
+ UNIT_ASSERT(nodeEntity.IsEntity());
+ }
+
Y_UNIT_TEST(TestPredicates) {
const TNode undefinedNode;
UNIT_ASSERT(undefinedNode.IsUndefined());
@@ -72,62 +72,62 @@ Y_UNIT_TEST_SUITE(YtNodeTest) {
UNIT_ASSERT(stringNode.HasValue());
}
- Y_UNIT_TEST(TestComplexConstructors) {
- const TNode listNode = TNode::CreateList({"one", 2, "tree"});
- const auto expectedListValue = std::vector<TNode>({"one", 2, "tree"});
- UNIT_ASSERT_VALUES_EQUAL(listNode.AsList(), expectedListValue);
-
- const TNode mapNode = TNode::CreateMap({{"one", 1}, {"two", 2u}});
- const auto expectedMapValue = THashMap<TString, TNode>({{"one", 1}, {"two", 2u}});
- UNIT_ASSERT_VALUES_EQUAL(mapNode.AsMap(), expectedMapValue);
- }
-
+ Y_UNIT_TEST(TestComplexConstructors) {
+ const TNode listNode = TNode::CreateList({"one", 2, "tree"});
+ const auto expectedListValue = std::vector<TNode>({"one", 2, "tree"});
+ UNIT_ASSERT_VALUES_EQUAL(listNode.AsList(), expectedListValue);
+
+ const TNode mapNode = TNode::CreateMap({{"one", 1}, {"two", 2u}});
+ const auto expectedMapValue = THashMap<TString, TNode>({{"one", 1}, {"two", 2u}});
+ UNIT_ASSERT_VALUES_EQUAL(mapNode.AsMap(), expectedMapValue);
+ }
+
Y_UNIT_TEST(TestNodeMap) {
- TNode nodeMap = TNode()("foo", "bar")("bar", "baz");
- UNIT_ASSERT(nodeMap.IsMap());
- UNIT_ASSERT_EQUAL(nodeMap.GetType(), TNode::Map);
- UNIT_ASSERT_VALUES_EQUAL(nodeMap.Size(), 2);
-
- UNIT_ASSERT(nodeMap.HasKey("foo"));
- UNIT_ASSERT(!nodeMap.HasKey("42"));
- UNIT_ASSERT_EQUAL(nodeMap["foo"], TNode("bar"));
- UNIT_ASSERT_EQUAL(nodeMap["bar"], TNode("baz"));
-
- // const version of operator[]
- UNIT_ASSERT_EQUAL(static_cast<const TNode&>(nodeMap)["42"].GetType(), TNode::Undefined);
- UNIT_ASSERT(!nodeMap.HasKey("42"));
-
- // nonconst version of operator[]
- UNIT_ASSERT_EQUAL(nodeMap["42"].GetType(), TNode::Undefined);
- UNIT_ASSERT(nodeMap.HasKey("42"));
-
- nodeMap("rock!!!", TNode()
- ("Pink", "Floyd")
- ("Purple", "Deep"));
-
- TNode copyNode;
- copyNode = nodeMap;
- UNIT_ASSERT_EQUAL(copyNode["foo"], TNode("bar"));
- UNIT_ASSERT_EQUAL(copyNode["bar"], TNode("baz"));
- UNIT_ASSERT(copyNode["42"].GetType() == TNode::Undefined);
- UNIT_ASSERT_EQUAL(copyNode["rock!!!"]["Purple"], TNode("Deep"));
- }
-
+ TNode nodeMap = TNode()("foo", "bar")("bar", "baz");
+ UNIT_ASSERT(nodeMap.IsMap());
+ UNIT_ASSERT_EQUAL(nodeMap.GetType(), TNode::Map);
+ UNIT_ASSERT_VALUES_EQUAL(nodeMap.Size(), 2);
+
+ UNIT_ASSERT(nodeMap.HasKey("foo"));
+ UNIT_ASSERT(!nodeMap.HasKey("42"));
+ UNIT_ASSERT_EQUAL(nodeMap["foo"], TNode("bar"));
+ UNIT_ASSERT_EQUAL(nodeMap["bar"], TNode("baz"));
+
+ // const version of operator[]
+ UNIT_ASSERT_EQUAL(static_cast<const TNode&>(nodeMap)["42"].GetType(), TNode::Undefined);
+ UNIT_ASSERT(!nodeMap.HasKey("42"));
+
+ // nonconst version of operator[]
+ UNIT_ASSERT_EQUAL(nodeMap["42"].GetType(), TNode::Undefined);
+ UNIT_ASSERT(nodeMap.HasKey("42"));
+
+ nodeMap("rock!!!", TNode()
+ ("Pink", "Floyd")
+ ("Purple", "Deep"));
+
+ TNode copyNode;
+ copyNode = nodeMap;
+ UNIT_ASSERT_EQUAL(copyNode["foo"], TNode("bar"));
+ UNIT_ASSERT_EQUAL(copyNode["bar"], TNode("baz"));
+ UNIT_ASSERT(copyNode["42"].GetType() == TNode::Undefined);
+ UNIT_ASSERT_EQUAL(copyNode["rock!!!"]["Purple"], TNode("Deep"));
+ }
+
Y_UNIT_TEST(TestNodeList) {
- TNode nodeList = TNode().Add("foo").Add(42).Add(3.14);
- UNIT_ASSERT(nodeList.IsList());
- UNIT_ASSERT_EQUAL(nodeList.GetType(), TNode::List);
- UNIT_ASSERT_VALUES_EQUAL(nodeList.Size(), 3);
-
- UNIT_ASSERT_EQUAL(nodeList[1], TNode(42));
- nodeList.Add(TNode().Add("ls").Add("pwd"));
-
- TNode copyNode;
- copyNode = nodeList;
- UNIT_ASSERT_EQUAL(copyNode[0], TNode("foo"));
- UNIT_ASSERT_EQUAL(copyNode[3][1], TNode("pwd"));
- }
-
+ TNode nodeList = TNode().Add("foo").Add(42).Add(3.14);
+ UNIT_ASSERT(nodeList.IsList());
+ UNIT_ASSERT_EQUAL(nodeList.GetType(), TNode::List);
+ UNIT_ASSERT_VALUES_EQUAL(nodeList.Size(), 3);
+
+ UNIT_ASSERT_EQUAL(nodeList[1], TNode(42));
+ nodeList.Add(TNode().Add("ls").Add("pwd"));
+
+ TNode copyNode;
+ copyNode = nodeList;
+ UNIT_ASSERT_EQUAL(copyNode[0], TNode("foo"));
+ UNIT_ASSERT_EQUAL(copyNode[3][1], TNode("pwd"));
+ }
+
Y_UNIT_TEST(TestInsertingMethodsFromTemporaryObjects) {
// check that .Add(...) doesn't return lvalue reference to temporary object
{
@@ -143,59 +143,59 @@ Y_UNIT_TEST_SUITE(YtNodeTest) {
}
Y_UNIT_TEST(TestAttributes) {
- TNode node = TNode()("lee", 42)("faa", 54);
- UNIT_ASSERT(!node.HasAttributes());
- node.Attributes()("foo", true)("bar", false);
- UNIT_ASSERT(node.HasAttributes());
-
- {
- TNode copyNode;
- UNIT_ASSERT(!copyNode.HasAttributes());
- copyNode = node;
- UNIT_ASSERT(copyNode.HasAttributes());
- UNIT_ASSERT_EQUAL(copyNode.GetAttributes()["foo"], TNode(true));
- }
-
- {
- TNode movedWithoutAttributes(42);
- movedWithoutAttributes.Attributes()("one", 1)("two", 2);
- movedWithoutAttributes.MoveWithoutAttributes(TNode(node));
- UNIT_ASSERT(movedWithoutAttributes.IsMap());
- UNIT_ASSERT_EQUAL(movedWithoutAttributes["lee"], TNode(42));
- UNIT_ASSERT_EQUAL(movedWithoutAttributes.GetAttributes()["one"], TNode(1));
- UNIT_ASSERT(!movedWithoutAttributes.GetAttributes().HasKey("foo"));
- }
-
- {
- TNode copyNode = node;
- UNIT_ASSERT(copyNode.HasAttributes());
- UNIT_ASSERT(copyNode.GetAttributes().HasKey("foo"));
- copyNode.ClearAttributes();
- UNIT_ASSERT(!copyNode.HasAttributes());
- UNIT_ASSERT(!copyNode.GetAttributes().HasKey("foo"));
- }
-
- {
- TNode copyNode = node;
- UNIT_ASSERT(copyNode.HasAttributes());
- UNIT_ASSERT(copyNode.GetAttributes().HasKey("foo"));
- copyNode.Clear();
- UNIT_ASSERT(!copyNode.HasAttributes());
- UNIT_ASSERT(!copyNode.GetAttributes().HasKey("foo"));
- }
- }
-
+ TNode node = TNode()("lee", 42)("faa", 54);
+ UNIT_ASSERT(!node.HasAttributes());
+ node.Attributes()("foo", true)("bar", false);
+ UNIT_ASSERT(node.HasAttributes());
+
+ {
+ TNode copyNode;
+ UNIT_ASSERT(!copyNode.HasAttributes());
+ copyNode = node;
+ UNIT_ASSERT(copyNode.HasAttributes());
+ UNIT_ASSERT_EQUAL(copyNode.GetAttributes()["foo"], TNode(true));
+ }
+
+ {
+ TNode movedWithoutAttributes(42);
+ movedWithoutAttributes.Attributes()("one", 1)("two", 2);
+ movedWithoutAttributes.MoveWithoutAttributes(TNode(node));
+ UNIT_ASSERT(movedWithoutAttributes.IsMap());
+ UNIT_ASSERT_EQUAL(movedWithoutAttributes["lee"], TNode(42));
+ UNIT_ASSERT_EQUAL(movedWithoutAttributes.GetAttributes()["one"], TNode(1));
+ UNIT_ASSERT(!movedWithoutAttributes.GetAttributes().HasKey("foo"));
+ }
+
+ {
+ TNode copyNode = node;
+ UNIT_ASSERT(copyNode.HasAttributes());
+ UNIT_ASSERT(copyNode.GetAttributes().HasKey("foo"));
+ copyNode.ClearAttributes();
+ UNIT_ASSERT(!copyNode.HasAttributes());
+ UNIT_ASSERT(!copyNode.GetAttributes().HasKey("foo"));
+ }
+
+ {
+ TNode copyNode = node;
+ UNIT_ASSERT(copyNode.HasAttributes());
+ UNIT_ASSERT(copyNode.GetAttributes().HasKey("foo"));
+ copyNode.Clear();
+ UNIT_ASSERT(!copyNode.HasAttributes());
+ UNIT_ASSERT(!copyNode.GetAttributes().HasKey("foo"));
+ }
+ }
+
Y_UNIT_TEST(TestEq) {
- TNode nodeNoAttributes = TNode()("lee", 42)("faa", 54);
- TNode node = nodeNoAttributes;
- node.Attributes()("foo", true)("bar", false);
- UNIT_ASSERT(node != nodeNoAttributes);
- UNIT_ASSERT(nodeNoAttributes != node);
- TNode copyNode = node;
- UNIT_ASSERT(copyNode == node);
- UNIT_ASSERT(node == copyNode);
- }
-
+ TNode nodeNoAttributes = TNode()("lee", 42)("faa", 54);
+ TNode node = nodeNoAttributes;
+ node.Attributes()("foo", true)("bar", false);
+ UNIT_ASSERT(node != nodeNoAttributes);
+ UNIT_ASSERT(nodeNoAttributes != node);
+ TNode copyNode = node;
+ UNIT_ASSERT(copyNode == node);
+ UNIT_ASSERT(node == copyNode);
+ }
+
Y_UNIT_TEST(TestComparison) {
using namespace NYT::NNodeCmp;
{
@@ -261,23 +261,23 @@ Y_UNIT_TEST_SUITE(YtNodeTest) {
}
Y_UNIT_TEST(TestSaveLoad) {
- TNode node = TNode()("foo", "bar")("baz", 42);
- node.Attributes()["attr_name"] = "attr_value";
-
- TString bytes;
- {
- TStringOutput s(bytes);
- ::Save(&s, node);
- }
-
- TNode nodeCopy;
- {
- TStringInput s(bytes);
- ::Load(&s, nodeCopy);
- }
-
- UNIT_ASSERT_VALUES_EQUAL(node, nodeCopy);
- }
+ TNode node = TNode()("foo", "bar")("baz", 42);
+ node.Attributes()["attr_name"] = "attr_value";
+
+ TString bytes;
+ {
+ TStringOutput s(bytes);
+ ::Save(&s, node);
+ }
+
+ TNode nodeCopy;
+ {
+ TStringInput s(bytes);
+ ::Load(&s, nodeCopy);
+ }
+
+ UNIT_ASSERT_VALUES_EQUAL(node, nodeCopy);
+ }
Y_UNIT_TEST(TestIntCast) {
TNode node = 1ull << 31;
@@ -381,7 +381,7 @@ Y_UNIT_TEST_SUITE(YtNodeTest) {
UNIT_ASSERT_VALUES_EQUAL(TNode(0).ConvertTo<bool>(), false);
UNIT_ASSERT_EXCEPTION(TNode("random").ConvertTo<bool>(), TFromStringException);
UNIT_ASSERT_EXCEPTION(TNode("").ConvertTo<bool>(), TFromStringException);
- }
+ }
Y_UNIT_TEST(TestCanonicalSerialization) {
auto node = TNode()
@@ -396,16 +396,16 @@ Y_UNIT_TEST_SUITE(YtNodeTest) {
"\"c\"=\"c\";\"ca\"=\"ca\"}");
}
- Y_UNIT_TEST(OperatorEqualSubnode) {
- TNode node;
- node["a"]["b"] = "c";
-
- node = node["a"];
- node = node["b"];
-
- UNIT_ASSERT_VALUES_EQUAL(node.AsString(), "c");
- }
-
+ Y_UNIT_TEST(OperatorEqualSubnode) {
+ TNode node;
+ node["a"]["b"] = "c";
+
+ node = node["a"];
+ node = node["b"];
+
+ UNIT_ASSERT_VALUES_EQUAL(node.AsString(), "c");
+ }
+
Y_UNIT_TEST(TestMapGetters) {
auto node = TNode::CreateMap()
("string", "7")
@@ -481,4 +481,4 @@ Y_UNIT_TEST_SUITE(YtNodeTest) {
childString = "yaddayadda";
UNIT_ASSERT_VALUES_EQUAL(node.ChildAs<TString>(0), "yaddayadda");
}
-}
+}
diff --git a/library/cpp/yson/node/node_visitor.cpp b/library/cpp/yson/node/node_visitor.cpp
index 899fbfa02a..c56c4829cb 100644
--- a/library/cpp/yson/node/node_visitor.cpp
+++ b/library/cpp/yson/node/node_visitor.cpp
@@ -1,8 +1,8 @@
#include "node_visitor.h"
#include <util/generic/algorithm.h>
-#include <util/string/printf.h>
-
+#include <util/string/printf.h>
+
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
@@ -30,7 +30,7 @@ void Iterate(const TNode::TMapType& nodeMap, bool sortByKey, Fun action)
////////////////////////////////////////////////////////////////////////////////
-TNodeVisitor::TNodeVisitor(NYson::IYsonConsumer* consumer, bool sortMapKeys)
+TNodeVisitor::TNodeVisitor(NYson::IYsonConsumer* consumer, bool sortMapKeys)
: Consumer_(consumer)
, SortMapKeys_(sortMapKeys)
{ }
@@ -46,44 +46,44 @@ void TNodeVisitor::VisitAny(const TNode& node)
Consumer_->OnBeginAttributes();
Iterate(node.GetAttributes().AsMap(), SortMapKeys_, [&](const std::pair<TString, TNode>& item) {
Consumer_->OnKeyedItem(item.first);
- if (item.second.IsUndefined()) {
+ if (item.second.IsUndefined()) {
ythrow TNode::TTypeError() << "unable to visit attribute value of type "
<< TNode::EType::Undefined << "; attribute name: `" << item.first << '\'' ;
- }
+ }
VisitAny(item.second);
});
Consumer_->OnEndAttributes();
}
switch (node.GetType()) {
- case TNode::String:
+ case TNode::String:
VisitString(node);
break;
- case TNode::Int64:
+ case TNode::Int64:
VisitInt64(node);
break;
- case TNode::Uint64:
+ case TNode::Uint64:
VisitUint64(node);
break;
- case TNode::Double:
+ case TNode::Double:
VisitDouble(node);
break;
- case TNode::Bool:
+ case TNode::Bool:
VisitBool(node);
break;
- case TNode::List:
- VisitList(node.AsList());
+ case TNode::List:
+ VisitList(node.AsList());
break;
- case TNode::Map:
- VisitMap(node.AsMap());
+ case TNode::Map:
+ VisitMap(node.AsMap());
break;
- case TNode::Null:
+ case TNode::Null:
VisitEntity();
break;
- case TNode::Undefined:
+ case TNode::Undefined:
ythrow TNode::TTypeError() << "unable to visit TNode of type " << node.GetType();
- default:
- Y_FAIL("Unexpected type: %d", node.GetType());
+ default:
+ Y_FAIL("Unexpected type: %d", node.GetType());
}
}
@@ -115,15 +115,15 @@ void TNodeVisitor::VisitBool(const TNode& node)
void TNodeVisitor::VisitList(const TNode::TListType& nodeList)
{
Consumer_->OnBeginList();
- size_t index = 0;
- for (const auto& item : nodeList) {
+ size_t index = 0;
+ for (const auto& item : nodeList) {
Consumer_->OnListItem();
- if (item.IsUndefined()) {
+ if (item.IsUndefined()) {
ythrow TNode::TTypeError() << "unable to visit list node child of type "
<< TNode::EType::Undefined << "; list index: " << index;
- }
+ }
VisitAny(item);
- ++index;
+ ++index;
}
Consumer_->OnEndList();
}
@@ -133,10 +133,10 @@ void TNodeVisitor::VisitMap(const TNode::TMapType& nodeMap)
Consumer_->OnBeginMap();
Iterate(nodeMap, SortMapKeys_, [&](const std::pair<TString, TNode>& item) {
Consumer_->OnKeyedItem(item.first);
- if (item.second.IsUndefined()) {
+ if (item.second.IsUndefined()) {
ythrow TNode::TTypeError() << "unable to visit map node child of type "
<< TNode::EType::Undefined << "; map key: `" << item.first << '\'' ;
- }
+ }
VisitAny(item.second);
});
Consumer_->OnEndMap();
diff --git a/library/cpp/yson/node/node_visitor.h b/library/cpp/yson/node/node_visitor.h
index db25832309..4c0d6347a7 100644
--- a/library/cpp/yson/node/node_visitor.h
+++ b/library/cpp/yson/node/node_visitor.h
@@ -1,8 +1,8 @@
#pragma once
-#include "node.h"
-
-#include <library/cpp/yson/consumer.h>
+#include "node.h"
+
+#include <library/cpp/yson/consumer.h>
namespace NYT {
diff --git a/library/cpp/yson/node/pybind/node.cpp b/library/cpp/yson/node/pybind/node.cpp
index 79beba3647..70731409dd 100644
--- a/library/cpp/yson/node/pybind/node.cpp
+++ b/library/cpp/yson/node/pybind/node.cpp
@@ -1,6 +1,6 @@
#include "node.h"
-#include <library/cpp/yson/node/node.h>
+#include <library/cpp/yson/node/node.h>
#include <library/cpp/pybind/cast.h>
diff --git a/library/cpp/yson/node/pybind/node.h b/library/cpp/yson/node/pybind/node.h
index 65f7236de6..25bf736ff0 100644
--- a/library/cpp/yson/node/pybind/node.h
+++ b/library/cpp/yson/node/pybind/node.h
@@ -2,7 +2,7 @@
#include <Python.h>
-#include <library/cpp/yson/node/node.h>
+#include <library/cpp/yson/node/node.h>
namespace NYT {
PyObject* BuildPyObject(const TNode& val);
diff --git a/library/cpp/yson/node/pybind/ya.make b/library/cpp/yson/node/pybind/ya.make
index 97b7583e96..938472dcf7 100644
--- a/library/cpp/yson/node/pybind/ya.make
+++ b/library/cpp/yson/node/pybind/ya.make
@@ -7,7 +7,7 @@ OWNER(
PEERDIR(
library/cpp/pybind
- library/cpp/yson/node
+ library/cpp/yson/node
)
SRCS(
node.cpp
diff --git a/library/cpp/yson/node/serialize.cpp b/library/cpp/yson/node/serialize.cpp
index aeb467622b..d204e03e0e 100644
--- a/library/cpp/yson/node/serialize.cpp
+++ b/library/cpp/yson/node/serialize.cpp
@@ -2,7 +2,7 @@
#include "node_visitor.h"
-#include <library/cpp/yson/consumer.h>
+#include <library/cpp/yson/consumer.h>
namespace NYT {
diff --git a/library/cpp/yson/node/serialize.h b/library/cpp/yson/node/serialize.h
index 99b598a44c..00090d0df6 100644
--- a/library/cpp/yson/node/serialize.h
+++ b/library/cpp/yson/node/serialize.h
@@ -4,10 +4,10 @@
namespace NYT {
-namespace NYson {
-struct IYsonConsumer;
-} // namespace NYson
-
+namespace NYson {
+struct IYsonConsumer;
+} // namespace NYson
+
////////////////////////////////////////////////////////////////////////////////
void Serialize(const TString& value, NYson::IYsonConsumer* consumer);
@@ -39,7 +39,7 @@ void Serialize(const TNode& node, NYson::IYsonConsumer* consumer);
void Deserialize(TNode& value, const TNode& node);
void Serialize(const THashMap<TString, TString>& renameColumns, NYson::IYsonConsumer* consumer);
-
+
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
diff --git a/library/cpp/yson/node/ut/ya.make b/library/cpp/yson/node/ut/ya.make
index f49a0bf7df..601c45d8a9 100644
--- a/library/cpp/yson/node/ut/ya.make
+++ b/library/cpp/yson/node/ut/ya.make
@@ -1,12 +1,12 @@
-UNITTEST_FOR(library/cpp/yson/node)
-
-OWNER(
- ermolovd
+UNITTEST_FOR(library/cpp/yson/node)
+
+OWNER(
+ ermolovd
g:yt
-)
-
-SRCS(
- node_ut.cpp
-)
-
-END()
+)
+
+SRCS(
+ node_ut.cpp
+)
+
+END()
diff --git a/library/cpp/yson/node/ya.make b/library/cpp/yson/node/ya.make
index a082b293c4..827f3fbab3 100644
--- a/library/cpp/yson/node/ya.make
+++ b/library/cpp/yson/node/ya.make
@@ -1,25 +1,25 @@
-LIBRARY()
-
-GENERATE_ENUM_SERIALIZATION(node.h)
-
-PEERDIR(
- library/cpp/yson
- library/cpp/yson/json
-)
-
-OWNER(
- ermolovd
+LIBRARY()
+
+GENERATE_ENUM_SERIALIZATION(node.h)
+
+PEERDIR(
+ library/cpp/yson
+ library/cpp/yson/json
+)
+
+OWNER(
+ ermolovd
g:yt
-)
-
-SRCS(
- node.cpp
- node_io.cpp
- node_builder.cpp
- node_visitor.cpp
+)
+
+SRCS(
+ node.cpp
+ node_io.cpp
+ node_builder.cpp
+ node_visitor.cpp
serialize.cpp
-)
-
-END()
-
-RECURSE_FOR_TESTS(ut)
+)
+
+END()
+
+RECURSE_FOR_TESTS(ut)
diff --git a/library/cpp/yson/parser.cpp b/library/cpp/yson/parser.cpp
index 783f9b9047..a8f47edf86 100644
--- a/library/cpp/yson/parser.cpp
+++ b/library/cpp/yson/parser.cpp
@@ -6,7 +6,7 @@
#include <util/stream/input.h>
#include <util/generic/buffer.h>
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
class TYsonParser::TImpl {
@@ -176,4 +176,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/parser.h b/library/cpp/yson/parser.h
index dce35a8cd4..248d569efc 100644
--- a/library/cpp/yson/parser.h
+++ b/library/cpp/yson/parser.h
@@ -11,7 +11,7 @@ namespace NYT::NYson {
struct IYsonConsumer;
} // namespace NYT::NYson
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
class TYsonParser {
@@ -80,4 +80,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/parser_detail.h b/library/cpp/yson/parser_detail.h
index 44223caf12..5ec425b7d9 100644
--- a/library/cpp/yson/parser_detail.h
+++ b/library/cpp/yson/parser_detail.h
@@ -2,7 +2,7 @@
#include "detail.h"
-namespace NYson {
+namespace NYson {
namespace NDetail {
////////////////////////////////////////////////////////////////////////////////
@@ -378,4 +378,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/public.h b/library/cpp/yson/public.h
index 1ed793592b..b343a63722 100644
--- a/library/cpp/yson/public.h
+++ b/library/cpp/yson/public.h
@@ -6,7 +6,7 @@
#include <library/cpp/yt/yson_string/public.h>
#include <library/cpp/yt/yson/public.h>
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
@@ -15,16 +15,16 @@ namespace NYson {
class TYsonStringBuf;
- struct TYsonConsumerBase;
-
- class TYsonWriter;
- class TYsonParser;
- class TStatelessYsonParser;
- class TYsonListParser;
+ struct TYsonConsumerBase;
+ class TYsonWriter;
+ class TYsonParser;
+ class TStatelessYsonParser;
+ class TYsonListParser;
+
class TYsonException
: public yexception {};
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/token.cpp b/library/cpp/yson/token.cpp
index c8584c8c2e..f614656bbe 100644
--- a/library/cpp/yson/token.cpp
+++ b/library/cpp/yson/token.cpp
@@ -3,7 +3,7 @@
#include <util/string/vector.h>
#include <util/string/printf.h>
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
ETokenType CharToTokenType(char ch) {
@@ -233,4 +233,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/token.h b/library/cpp/yson/token.h
index 7283e56950..abe6978243 100644
--- a/library/cpp/yson/token.h
+++ b/library/cpp/yson/token.h
@@ -4,7 +4,7 @@
#include <util/generic/strbuf.h>
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
enum ETokenType {
@@ -90,4 +90,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/tokenizer.cpp b/library/cpp/yson/tokenizer.cpp
index 06760170d4..59c6575f6e 100644
--- a/library/cpp/yson/tokenizer.cpp
+++ b/library/cpp/yson/tokenizer.cpp
@@ -1,6 +1,6 @@
#include "tokenizer.h"
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
TTokenizer::TTokenizer(const TStringBuf& input)
@@ -34,4 +34,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/tokenizer.h b/library/cpp/yson/tokenizer.h
index 0576aace95..b25ae01c7e 100644
--- a/library/cpp/yson/tokenizer.h
+++ b/library/cpp/yson/tokenizer.h
@@ -3,7 +3,7 @@
#include "public.h"
#include "lexer.h"
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
class TTokenizer {
@@ -25,4 +25,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/varint.cpp b/library/cpp/yson/varint.cpp
index d538ee3cff..c917161665 100644
--- a/library/cpp/yson/varint.cpp
+++ b/library/cpp/yson/varint.cpp
@@ -1,10 +1,10 @@
-#include "varint.h"
-
+#include "varint.h"
+
#include "zigzag.h"
-#include <util/generic/yexception.h>
+#include <util/generic/yexception.h>
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
int WriteVarUInt64(IOutputStream* output, ui64 value) {
@@ -55,7 +55,7 @@ namespace NYson {
ui64 varInt;
int bytesRead = ReadVarUInt64(input, &varInt);
if (varInt > Max<ui32>()) {
- ythrow yexception() << "The data is too long to read ui64";
+ ythrow yexception() << "The data is too long to read ui64";
}
*value = ZigZagDecode32(static_cast<ui32>(varInt));
return bytesRead;
@@ -68,4 +68,4 @@ namespace NYson {
return bytesRead;
}
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/varint.h b/library/cpp/yson/varint.h
index 80b1184e57..8031ca1094 100644
--- a/library/cpp/yson/varint.h
+++ b/library/cpp/yson/varint.h
@@ -4,7 +4,7 @@
#include <util/stream/output.h>
#include <util/system/defaults.h>
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
// Various functions that read/write varints from/to a stream.
@@ -21,4 +21,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/writer.cpp b/library/cpp/yson/writer.cpp
index 054459f9f5..8d130a6500 100644
--- a/library/cpp/yson/writer.cpp
+++ b/library/cpp/yson/writer.cpp
@@ -1,16 +1,16 @@
#include "writer.h"
-
-#include "detail.h"
+
+#include "detail.h"
#include "format.h"
-#include "parser.h"
-#include "varint.h"
+#include "parser.h"
+#include "varint.h"
#include "zigzag.h"
#include <util/string/cast.h>
#include <cmath>
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
// Copied from <util/string/escape.cpp>
@@ -352,4 +352,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/writer.h b/library/cpp/yson/writer.h
index 40f5d7d501..278fd08624 100644
--- a/library/cpp/yson/writer.h
+++ b/library/cpp/yson/writer.h
@@ -9,7 +9,7 @@
class IOutputStream;
class IZeroCopyInput;
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
class TYsonWriter
@@ -86,4 +86,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yson/ya.make b/library/cpp/yson/ya.make
index c55a189b10..23896d164c 100644
--- a/library/cpp/yson/ya.make
+++ b/library/cpp/yson/ya.make
@@ -1,9 +1,9 @@
LIBRARY()
-OWNER(
- ermolovd
+OWNER(
+ ermolovd
g:yt
-)
+)
PEERDIR(
library/cpp/yt/misc
@@ -11,12 +11,12 @@ PEERDIR(
)
SRCS(
- consumer.cpp
+ consumer.cpp
lexer.cpp
- parser.cpp
+ parser.cpp
token.cpp
tokenizer.cpp
- varint.cpp
+ varint.cpp
writer.cpp
)
diff --git a/library/cpp/yson/zigzag.h b/library/cpp/yson/zigzag.h
index 2f1190508f..4b39db202b 100644
--- a/library/cpp/yson/zigzag.h
+++ b/library/cpp/yson/zigzag.h
@@ -2,7 +2,7 @@
#include <util/system/defaults.h>
-namespace NYson {
+namespace NYson {
////////////////////////////////////////////////////////////////////////////////
//! Functions that provide coding of integers with property: 0 <= f(x) <= 2 * |x|
@@ -28,4 +28,4 @@ namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYson
+} // namespace NYson
diff --git a/library/cpp/yt/coding/varint-inl.h b/library/cpp/yt/coding/varint-inl.h
index f0a09e9d30..8a2eca7068 100644
--- a/library/cpp/yt/coding/varint-inl.h
+++ b/library/cpp/yt/coding/varint-inl.h
@@ -139,25 +139,25 @@ Y_FORCE_INLINE int ReadVarUint64(const char* input, ui64* value)
}, value);
}
-Y_FORCE_INLINE int ReadVarUint64(const char* input, const char* end, ui64* value)
-{
- return ReadVarUint64Impl([&] () {
- if (input == end) {
+Y_FORCE_INLINE int ReadVarUint64(const char* input, const char* end, ui64* value)
+{
+ return ReadVarUint64Impl([&] () {
+ if (input == end) {
throw TSimpleException("Premature end of data while reading varuint64");
- }
- char byte = *input;
- ++input;
- return byte;
- }, value);
-}
-
+ }
+ char byte = *input;
+ ++input;
+ return byte;
+ }, value);
+}
+
////////////////////////////////////////////////////////////////////////////////
-template <class... Args>
-Y_FORCE_INLINE int ReadVarUint32Impl(ui32* value, Args... args)
+template <class... Args>
+Y_FORCE_INLINE int ReadVarUint32Impl(ui32* value, Args... args)
{
ui64 varInt;
- int bytesRead = ReadVarUint64(args..., &varInt);
+ int bytesRead = ReadVarUint64(args..., &varInt);
if (varInt > std::numeric_limits<ui32>::max()) {
throw TSimpleException("Value is too big for varuint32");
}
@@ -167,26 +167,26 @@ Y_FORCE_INLINE int ReadVarUint32Impl(ui32* value, Args... args)
Y_FORCE_INLINE int ReadVarUint32(IInputStream* input, ui32* value)
{
- return ReadVarUint32Impl(value, input);
+ return ReadVarUint32Impl(value, input);
}
Y_FORCE_INLINE int ReadVarUint32(const char* input, ui32* value)
{
- return ReadVarUint32Impl(value, input);
-}
-
-Y_FORCE_INLINE int ReadVarUint32(const char* input, const char* end, ui32* value)
-{
- return ReadVarUint32Impl(value, input, end);
+ return ReadVarUint32Impl(value, input);
}
+Y_FORCE_INLINE int ReadVarUint32(const char* input, const char* end, ui32* value)
+{
+ return ReadVarUint32Impl(value, input, end);
+}
+
////////////////////////////////////////////////////////////////////////////////
-template <class... Args>
-Y_FORCE_INLINE int ReadVarInt32Impl(i32* value, Args... args)
+template <class... Args>
+Y_FORCE_INLINE int ReadVarInt32Impl(i32* value, Args... args)
{
ui64 varInt;
- int bytesRead = ReadVarUint64(args..., &varInt);
+ int bytesRead = ReadVarUint64(args..., &varInt);
if (varInt > std::numeric_limits<ui32>::max()) {
throw TSimpleException("Value is too big for varint32");
}
@@ -196,45 +196,45 @@ Y_FORCE_INLINE int ReadVarInt32Impl(i32* value, Args... args)
Y_FORCE_INLINE int ReadVarInt32(IInputStream* input, i32* value)
{
- return ReadVarInt32Impl(value, input);
+ return ReadVarInt32Impl(value, input);
}
Y_FORCE_INLINE int ReadVarInt32(const char* input, i32* value)
{
- return ReadVarInt32Impl(value, input);
-}
-
-Y_FORCE_INLINE int ReadVarInt32(const char* input, const char* end, i32* value)
-{
- return ReadVarInt32Impl(value, input, end);
+ return ReadVarInt32Impl(value, input);
}
+Y_FORCE_INLINE int ReadVarInt32(const char* input, const char* end, i32* value)
+{
+ return ReadVarInt32Impl(value, input, end);
+}
+
////////////////////////////////////////////////////////////////////////////////
-template <class... Args>
-Y_FORCE_INLINE int ReadVarInt64Impl(i64* value, Args... args)
+template <class... Args>
+Y_FORCE_INLINE int ReadVarInt64Impl(i64* value, Args... args)
{
ui64 varInt;
- int bytesRead = ReadVarUint64(args..., &varInt);
+ int bytesRead = ReadVarUint64(args..., &varInt);
*value = ZigZagDecode64(varInt);
return bytesRead;
}
Y_FORCE_INLINE int ReadVarInt64(IInputStream* input, i64* value)
{
- return ReadVarInt64Impl(value, input);
+ return ReadVarInt64Impl(value, input);
}
Y_FORCE_INLINE int ReadVarInt64(const char* input, i64* value)
{
- return ReadVarInt64Impl(value, input);
-}
-
-Y_FORCE_INLINE int ReadVarInt64(const char* input, const char* end, i64* value)
-{
- return ReadVarInt64Impl(value, input, end);
+ return ReadVarInt64Impl(value, input);
}
+Y_FORCE_INLINE int ReadVarInt64(const char* input, const char* end, i64* value)
+{
+ return ReadVarInt64Impl(value, input, end);
+}
+
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
diff --git a/library/cpp/yt/coding/varint.h b/library/cpp/yt/coding/varint.h
index c5399f8b06..96b609a042 100644
--- a/library/cpp/yt/coding/varint.h
+++ b/library/cpp/yt/coding/varint.h
@@ -41,12 +41,12 @@ int ReadVarUint32(const char* input, ui32* value);
int ReadVarInt32(const char* input, i32* value);
int ReadVarInt64(const char* input, i64* value);
-// Throws exception if integer is not complete when `end' is reached.
-int ReadVarUint64(const char* input, const char* end, ui64* value);
-int ReadVarUint32(const char* input, const char* end, ui32* value);
-int ReadVarInt32(const char* input, const char* end, i32* value);
-int ReadVarInt64(const char* input, const char* end, i64* value);
-
+// Throws exception if integer is not complete when `end' is reached.
+int ReadVarUint64(const char* input, const char* end, ui64* value);
+int ReadVarUint32(const char* input, const char* end, ui32* value);
+int ReadVarInt32(const char* input, const char* end, i32* value);
+int ReadVarInt64(const char* input, const char* end, i64* value);
+
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
diff --git a/library/cpp/yt/memory/new-inl.h b/library/cpp/yt/memory/new-inl.h
index 0a84818516..63ff4ba97b 100644
--- a/library/cpp/yt/memory/new-inl.h
+++ b/library/cpp/yt/memory/new-inl.h
@@ -92,17 +92,17 @@ struct TRefCountedWrapperWithCookie final
namespace NDetail {
-Y_FORCE_INLINE void* AllignedMalloc(size_t size, size_t allignment)
-{
-#ifdef _win_
- return ::_aligned_malloc(size, allignment);
-#else
- void* ptr = nullptr;
- ::posix_memalign(&ptr, allignment, size);
- return ptr;
-#endif
-}
-
+Y_FORCE_INLINE void* AllignedMalloc(size_t size, size_t allignment)
+{
+#ifdef _win_
+ return ::_aligned_malloc(size, allignment);
+#else
+ void* ptr = nullptr;
+ ::posix_memalign(&ptr, allignment, size);
+ return ptr;
+#endif
+}
+
template <class... Args>
Y_FORCE_INLINE void CustomInitialize(Args... args)
{
@@ -189,7 +189,7 @@ void* AllocateConstSizeAligned()
if (Alignment <= 16) {
return NYTAlloc::AllocateConstSize<Size>();
} else {
- return AllignedMalloc(Size, Alignment);
+ return AllignedMalloc(Size, Alignment);
}
}
diff --git a/library/cpp/yt/memory/ref-inl.h b/library/cpp/yt/memory/ref-inl.h
index 79be8356c5..2ef0179b69 100644
--- a/library/cpp/yt/memory/ref-inl.h
+++ b/library/cpp/yt/memory/ref-inl.h
@@ -10,8 +10,8 @@ namespace NYT {
namespace NDetail {
-extern const char EmptyRefData[];
-extern char MutableEmptyRefData[];
+extern const char EmptyRefData[];
+extern char MutableEmptyRefData[];
} // namespace NDetail
diff --git a/library/cpp/yt/memory/ref.cpp b/library/cpp/yt/memory/ref.cpp
index e8ff42e976..9dcdb46a7e 100644
--- a/library/cpp/yt/memory/ref.cpp
+++ b/library/cpp/yt/memory/ref.cpp
@@ -11,10 +11,10 @@ namespace NYT {
namespace NDetail {
-// N.B. We would prefer these arrays to be zero sized
-// but zero sized arrays are not supported in MSVC.
-const char EmptyRefData[1] = {0};
-char MutableEmptyRefData[1] = {0};
+// N.B. We would prefer these arrays to be zero sized
+// but zero sized arrays are not supported in MSVC.
+const char EmptyRefData[1] = {0};
+char MutableEmptyRefData[1] = {0};
} // namespace NDetail
diff --git a/library/cpp/yt/memory/ref.h b/library/cpp/yt/memory/ref.h
index 73d19d9013..da9c8394b0 100644
--- a/library/cpp/yt/memory/ref.h
+++ b/library/cpp/yt/memory/ref.h
@@ -59,8 +59,8 @@ class TMutableRef
{
public:
//! Creates a null TMutableRef.
- //! Note empty TMutableRef is not the same as null TMutableRef.
- //! `operator bool` can be used to check if ref is nonnull.
+ //! Note empty TMutableRef is not the same as null TMutableRef.
+ //! `operator bool` can be used to check if ref is nonnull.
TMutableRef() = default;
//! Creates a TMutableRef for a given block of memory.
diff --git a/library/cpp/yt/memory/unittests/ya.make b/library/cpp/yt/memory/unittests/ya.make
index f09ad7d0c9..16b29a729f 100644
--- a/library/cpp/yt/memory/unittests/ya.make
+++ b/library/cpp/yt/memory/unittests/ya.make
@@ -2,9 +2,9 @@ GTEST(unittester-library-memory)
OWNER(g:yt)
-IF (NOT OS_WINDOWS)
- ALLOCATOR(YT)
-ENDIF()
+IF (NOT OS_WINDOWS)
+ ALLOCATOR(YT)
+ENDIF()
SRCS(
intrusive_ptr_ut.cpp
diff --git a/library/cpp/yt/misc/enum-inl.h b/library/cpp/yt/misc/enum-inl.h
index 59ef704775..6c102bf772 100644
--- a/library/cpp/yt/misc/enum-inl.h
+++ b/library/cpp/yt/misc/enum-inl.h
@@ -368,14 +368,14 @@ bool TEnumIndexedVector<E, T, Min, Max>::IsDomainValue(E value)
////////////////////////////////////////////////////////////////////////////////
-template <typename E, typename>
-bool Any(E value)
+template <typename E, typename>
+bool Any(E value)
{
return static_cast<typename TEnumTraits<E>::TUnderlying>(value) != 0;
}
-template <class E, typename>
-bool None(E value)
+template <class E, typename>
+bool None(E value)
{
return static_cast<typename TEnumTraits<E>::TUnderlying>(value) == 0;
}
diff --git a/library/cpp/yt/misc/enum.h b/library/cpp/yt/misc/enum.h
index 894364aa43..71f7f9853c 100644
--- a/library/cpp/yt/misc/enum.h
+++ b/library/cpp/yt/misc/enum.h
@@ -227,12 +227,12 @@ private:
////////////////////////////////////////////////////////////////////////////////
//! Returns |true| iff the enumeration value is not bitwise zero.
-template <typename E, typename = std::enable_if_t<NYT::TEnumTraits<E>::IsBitEnum, E>>
-bool Any(E value);
+template <typename E, typename = std::enable_if_t<NYT::TEnumTraits<E>::IsBitEnum, E>>
+bool Any(E value);
//! Returns |true| iff the enumeration value is bitwise zero.
-template <typename E, typename = std::enable_if_t<NYT::TEnumTraits<E>::IsBitEnum, E>>
-bool None(E value);
+template <typename E, typename = std::enable_if_t<NYT::TEnumTraits<E>::IsBitEnum, E>>
+bool None(E value);
////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/yt/misc/port.h b/library/cpp/yt/misc/port.h
index b24ac50995..3c36e976ae 100644
--- a/library/cpp/yt/misc/port.h
+++ b/library/cpp/yt/misc/port.h
@@ -1,9 +1,9 @@
#pragma once
-#include <util/system/platform.h>
-
+#include <util/system/platform.h>
+
// Check platform bitness.
-#if !defined(_64_)
+#if !defined(_64_)
#error YT requires 64-bit platform
#endif
diff --git a/library/cpp/yt/small_containers/compact_vector.h b/library/cpp/yt/small_containers/compact_vector.h
index 6c4a0b0e39..c49c02be65 100644
--- a/library/cpp/yt/small_containers/compact_vector.h
+++ b/library/cpp/yt/small_containers/compact_vector.h
@@ -1,7 +1,7 @@
#pragma once
-#include <util/system/defaults.h>
-
+#include <util/system/defaults.h>
+
#include <cstdint>
#include <iterator>
#include <limits>
@@ -162,13 +162,13 @@ private:
// > 0 indicates inline storage
// == 0 indicates on-heap storage
uint8_t SizePlusOne;
- } alias_hack;
+ } alias_hack;
struct TOnHeapMeta
{
char Padding[ByteSize - sizeof(uintptr_t)];
TOnHeapStorage* Storage;
- } alias_hack;
+ } alias_hack;
union
{
diff --git a/library/cpp/yt/string/string_builder-inl.h b/library/cpp/yt/string/string_builder-inl.h
index 151fcabf7f..96b85dadc4 100644
--- a/library/cpp/yt/string/string_builder-inl.h
+++ b/library/cpp/yt/string/string_builder-inl.h
@@ -12,7 +12,7 @@ namespace NYT {
inline char* TStringBuilderBase::Preallocate(size_t size)
{
- if (Y_UNLIKELY(End_ - Current_ < static_cast<ssize_t>(size))) {
+ if (Y_UNLIKELY(End_ - Current_ < static_cast<ssize_t>(size))) {
size_t length = GetLength();
auto newLength = std::max(length + size, MinBufferLength);
DoPreallocate(newLength);
@@ -69,7 +69,7 @@ inline void TStringBuilderBase::AppendString(const char* str)
inline void TStringBuilderBase::Reset()
{
- Begin_ = Current_ = End_ = nullptr;
+ Begin_ = Current_ = End_ = nullptr;
DoReset();
}
diff --git a/library/cpp/yt/string/string_builder.h b/library/cpp/yt/string/string_builder.h
index 0e13e70904..9b15eb9c5c 100644
--- a/library/cpp/yt/string/string_builder.h
+++ b/library/cpp/yt/string/string_builder.h
@@ -22,8 +22,8 @@ void Format(TStringBuilderBase* builder, TStringBuf format, TArgs&&... args);
class TStringBuilderBase
{
public:
- virtual ~TStringBuilderBase() = default;
-
+ virtual ~TStringBuilderBase() = default;
+
char* Preallocate(size_t size);
size_t GetLength() const;
@@ -46,9 +46,9 @@ public:
void Reset();
protected:
- char* Begin_ = nullptr;
- char* Current_ = nullptr;
- char* End_ = nullptr;
+ char* Begin_ = nullptr;
+ char* Current_ = nullptr;
+ char* End_ = nullptr;
virtual void DoReset() = 0;
virtual void DoPreallocate(size_t newLength) = 0;
diff --git a/library/cpp/yt/string/unittests/format_ut.cpp b/library/cpp/yt/string/unittests/format_ut.cpp
index ee069bb2c0..c8d30b65b7 100644
--- a/library/cpp/yt/string/unittests/format_ut.cpp
+++ b/library/cpp/yt/string/unittests/format_ut.cpp
@@ -19,9 +19,9 @@ static_assert(TFormatTraits<const char*>::HasCustomFormatValue);
static_assert(TFormatTraits<TStringBuf>::HasCustomFormatValue);
static_assert(TFormatTraits<TString>::HasCustomFormatValue);
static_assert(TFormatTraits<std::vector<int>>::HasCustomFormatValue);
-
-// N.B. TCompactVector<int, 1> is not buildable on Windows
-static_assert(TFormatTraits<TCompactVector<int, 2>>::HasCustomFormatValue);
+
+// N.B. TCompactVector<int, 1> is not buildable on Windows
+static_assert(TFormatTraits<TCompactVector<int, 2>>::HasCustomFormatValue);
static_assert(TFormatTraits<std::set<int>>::HasCustomFormatValue);
static_assert(TFormatTraits<std::map<int, int>>::HasCustomFormatValue);
static_assert(TFormatTraits<std::multimap<int, int>>::HasCustomFormatValue);
diff --git a/library/cpp/yt/ya.make b/library/cpp/yt/ya.make
index f4d43806f4..75e3e16434 100644
--- a/library/cpp/yt/ya.make
+++ b/library/cpp/yt/ya.make
@@ -1,14 +1,14 @@
-RECURSE(
- assert
+RECURSE(
+ assert
coding
exception
- misc
- string
+ misc
+ string
system
yson
- yson_string
-)
-
+ yson_string
+)
+
IF (NOT OS_WINDOWS)
RECURSE(
containers
@@ -21,4 +21,4 @@ IF (NOT OS_WINDOWS)
small_containers
threading
)
-ENDIF()
+ENDIF()