diff options
author | ermolovd <ermolovd@yandex-team.ru> | 2022-02-10 16:47:53 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:53 +0300 |
commit | b91bcef7c99a119b0846479ef71bfab4beec72ca (patch) | |
tree | be118d54d12a61bc4812ceb0a266a170a2fa3bc9 | |
parent | f421873774cf0b71743afbe5f6677861e66601ea (diff) | |
download | ydb-b91bcef7c99a119b0846479ef71bfab4beec72ca.tar.gz |
Restoring authorship annotation for <ermolovd@yandex-team.ru>. Commit 1 of 2.
151 files changed, 1593 insertions, 1593 deletions
diff --git a/build/rules/yt.policy b/build/rules/yt.policy index 2924025dd5..a0b80e3aca 100644 --- a/build/rules/yt.policy +++ b/build/rules/yt.policy @@ -1,6 +1,6 @@ ALLOW yt -> yt/yt/server DENY .* -> yt/yt/server - -ALLOW mapreduce/yt/experiments -> mapreduce/yt/experiments -DENY .* -> mapreduce/yt/experiments + +ALLOW mapreduce/yt/experiments -> mapreduce/yt/experiments +DENY .* -> mapreduce/yt/experiments diff --git a/contrib/libs/protobuf/src/google/protobuf/messagext.cc b/contrib/libs/protobuf/src/google/protobuf/messagext.cc index 1923205598..613b1ca114 100644 --- a/contrib/libs/protobuf/src/google/protobuf/messagext.cc +++ b/contrib/libs/protobuf/src/google/protobuf/messagext.cc @@ -74,33 +74,33 @@ bool SerializeToZeroCopyStreamSeq(const Message* msg, io::ZeroCopyOutputStream* } -int TInputStreamProxy::Read(void* buffer, int size) { - try { - return (int)mSlave->Read(buffer, (size_t)size); - } catch (const yexception& e) { - GOOGLE_LOG(ERROR) << e.what(); - } catch (...) { - GOOGLE_LOG(ERROR) << "unknown exception caught"; - } - TErrorState::SetError(); - return -1; -} - - -bool TOutputStreamProxy::Write(const void* buffer, int size) { - try { - mSlave->Write(buffer, (size_t)size); - return true; - } catch (const yexception& e) { - GOOGLE_LOG(ERROR) << e.what(); - } catch (...) { - GOOGLE_LOG(ERROR) << "unknown exception caught"; - } - TErrorState::SetError(); - return false; -} - - +int TInputStreamProxy::Read(void* buffer, int size) { + try { + return (int)mSlave->Read(buffer, (size_t)size); + } catch (const yexception& e) { + GOOGLE_LOG(ERROR) << e.what(); + } catch (...) { + GOOGLE_LOG(ERROR) << "unknown exception caught"; + } + TErrorState::SetError(); + return -1; +} + + +bool TOutputStreamProxy::Write(const void* buffer, int size) { + try { + mSlave->Write(buffer, (size_t)size); + return true; + } catch (const yexception& e) { + GOOGLE_LOG(ERROR) << e.what(); + } catch (...) { + GOOGLE_LOG(ERROR) << "unknown exception caught"; + } + TErrorState::SetError(); + return false; +} + + void TProtoSerializer::Save(IOutputStream* out, const Message& msg) { int size = msg.ByteSize(); if (size > MaxSizeBytes) { diff --git a/contrib/libs/protobuf/src/google/protobuf/messagext.h b/contrib/libs/protobuf/src/google/protobuf/messagext.h index 9176cee1e8..7cac1f9668 100644 --- a/contrib/libs/protobuf/src/google/protobuf/messagext.h +++ b/contrib/libs/protobuf/src/google/protobuf/messagext.h @@ -67,7 +67,7 @@ class TInputStreamProxy: public io::CopyingInputStream, public TErrorState { { } - virtual int Read(void* buffer, int size); + virtual int Read(void* buffer, int size); private: IInputStream* mSlave; @@ -80,7 +80,7 @@ class TOutputStreamProxy: public io::CopyingOutputStream, public TErrorState { { } - virtual bool Write(const void* buffer, int size); + virtual bool Write(const void* buffer, int size); private: IOutputStream* mSlave; 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() diff --git a/util/datetime/base.h b/util/datetime/base.h index 5e902b8f63..7803a80d9f 100644 --- a/util/datetime/base.h +++ b/util/datetime/base.h @@ -354,7 +354,7 @@ private: /** * private construct from microseconds since epoch */ - constexpr explicit TInstant(TValue value) noexcept + constexpr explicit TInstant(TValue value) noexcept : TBase(value) { } @@ -363,7 +363,7 @@ public: constexpr TInstant() noexcept { } - constexpr TInstant(const struct timeval& tv) noexcept + constexpr TInstant(const struct timeval& tv) noexcept : TBase(tv) { } diff --git a/util/digest/sequence.cpp b/util/digest/sequence.cpp index 5ab731f9bd..05251278bf 100644 --- a/util/digest/sequence.cpp +++ b/util/digest/sequence.cpp @@ -1 +1 @@ -#include "sequence.h" +#include "sequence.h" diff --git a/util/folder/path.cpp b/util/folder/path.cpp index bfe0c67d68..83bbfb2642 100644 --- a/util/folder/path.cpp +++ b/util/folder/path.cpp @@ -427,7 +427,7 @@ void TFsPath::CopyTo(const TString& newPath, bool force) const { if (force) { TFsPath(newPath).MkDirs(); } else if (!TFsPath(newPath).IsDirectory()) { - ythrow TIoException() << "Target path is not a directory " << newPath; + ythrow TIoException() << "Target path is not a directory " << newPath; } TVector<TFsPath> children; List(children); @@ -439,10 +439,10 @@ void TFsPath::CopyTo(const TString& newPath, bool force) const { TFsPath(newPath).Parent().MkDirs(); } else { if (!TFsPath(newPath).Parent().IsDirectory()) { - ythrow TIoException() << "Parent (" << TFsPath(newPath).Parent() << ") of a target path is not a directory " << newPath; + ythrow TIoException() << "Parent (" << TFsPath(newPath).Parent() << ") of a target path is not a directory " << newPath; } if (TFsPath(newPath).Exists()) { - ythrow TIoException() << "Path already exists " << newPath; + ythrow TIoException() << "Path already exists " << newPath; } } NFs::Copy(Path_, newPath); diff --git a/util/generic/deque.h b/util/generic/deque.h index 2dabaf3177..f4f2e8baa8 100644 --- a/util/generic/deque.h +++ b/util/generic/deque.h @@ -6,7 +6,7 @@ #include <deque> #include <memory> -#include <initializer_list> +#include <initializer_list> template <class T, class A> class TDeque: public std::deque<T, TReboundAllocator<A, T>> { diff --git a/util/generic/deque_ut.cpp b/util/generic/deque_ut.cpp index 93bf50fa92..f1b71c3ca8 100644 --- a/util/generic/deque_ut.cpp +++ b/util/generic/deque_ut.cpp @@ -59,10 +59,10 @@ void TDequeTest::TestConstructorsAndAssignments() { UNIT_ASSERT_VALUES_EQUAL(0, c2.size()); UNIT_ASSERT_VALUES_EQUAL(4, c3.size()); UNIT_ASSERT_VALUES_EQUAL(400, c3.at(3)); - - int array[] = {2, 3, 4}; - container c4 = {2, 3, 4}; - UNIT_ASSERT_VALUES_EQUAL(c4, container(std::begin(array), std::end(array))); + + int array[] = {2, 3, 4}; + container c4 = {2, 3, 4}; + UNIT_ASSERT_VALUES_EQUAL(c4, container(std::begin(array), std::end(array))); } void TDequeTest::TestDeque1() { diff --git a/util/generic/hash.h b/util/generic/hash.h index e46db21fa9..1ae5b8c476 100644 --- a/util/generic/hash.h +++ b/util/generic/hash.h @@ -12,9 +12,9 @@ #include "utility.h" #include <algorithm> -#include <initializer_list> -#include <memory> -#include <tuple> +#include <initializer_list> +#include <memory> +#include <tuple> #include <utility> #include <cstdlib> @@ -1834,13 +1834,13 @@ public: } THashMultiMap(std::initializer_list<std::pair<Key, T>> list) - : rep(list.size(), hasher(), key_equal()) - { - for (const auto& v : list) { - rep.emplace_equal_noresize(v); - } - } - + : rep(list.size(), hasher(), key_equal()) + { + for (const auto& v : list) { + rep.emplace_equal_noresize(v); + } + } + // THashMultiMap has implicit copy/move constructors and copy-/move-assignment operators // because its implementation is backed by THashTable. // See hash_ut.cpp @@ -1996,25 +1996,25 @@ public: template <class Key, class T, class HF, class EqKey, class Alloc> inline bool operator==(const THashMultiMap<Key, T, HF, EqKey, Alloc>& hm1, const THashMultiMap<Key, T, HF, EqKey, Alloc>& hm2) { - // NOTE: copy-pasted from - // contrib/libs/cxxsupp/libcxx/include/unordered_map + // NOTE: copy-pasted from + // contrib/libs/cxxsupp/libcxx/include/unordered_map // and adapted to THashMultiMap - if (hm1.size() != hm2.size()) { - return false; - } + if (hm1.size() != hm2.size()) { + return false; + } using const_iterator = typename THashMultiMap<Key, T, HF, EqKey, Alloc>::const_iterator; - using TEqualRange = std::pair<const_iterator, const_iterator>; - for (const_iterator it = hm1.begin(), end = hm1.end(); it != end;) { - TEqualRange eq1 = hm1.equal_range(it->first); - TEqualRange eq2 = hm2.equal_range(it->first); - if (std::distance(eq1.first, eq1.second) != std::distance(eq2.first, eq2.second) || + using TEqualRange = std::pair<const_iterator, const_iterator>; + for (const_iterator it = hm1.begin(), end = hm1.end(); it != end;) { + TEqualRange eq1 = hm1.equal_range(it->first); + TEqualRange eq2 = hm2.equal_range(it->first); + if (std::distance(eq1.first, eq1.second) != std::distance(eq2.first, eq2.second) || !std::is_permutation(eq1.first, eq1.second, eq2.first)) { - return false; - } - it = eq1.second; - } - return true; + return false; + } + it = eq1.second; + } + return true; } template <class Key, class T, class HF, class EqKey, class Alloc> diff --git a/util/generic/hash_set.h b/util/generic/hash_set.h index e8088cf23b..66c9bd5167 100644 --- a/util/generic/hash_set.h +++ b/util/generic/hash_set.h @@ -64,7 +64,7 @@ public: } THashSet(std::initializer_list<value_type> list) - : rep(list.size(), hasher(), key_equal()) + : rep(list.size(), hasher(), key_equal()) { rep.insert_unique(list.begin(), list.end()); } @@ -355,11 +355,11 @@ public: } THashMultiSet(std::initializer_list<value_type> list) - : rep(list.size(), hasher(), key_equal()) - { - rep.insert_equal(list.begin(), list.end()); - } - + : rep(list.size(), hasher(), key_equal()) + { + rep.insert_equal(list.begin(), list.end()); + } + // THashMultiSet has implicit copy/move constructors and copy-/move-assignment operators // because its implementation is backed by THashTable. // See hash_ut.cpp diff --git a/util/generic/hash_ut.cpp b/util/generic/hash_ut.cpp index 0551d58770..98f6fdaee5 100644 --- a/util/generic/hash_ut.cpp +++ b/util/generic/hash_ut.cpp @@ -16,7 +16,7 @@ class THashTest: public TTestBase { UNIT_TEST(TestHMapConstructorsAndAssignments); UNIT_TEST(TestHMap1); UNIT_TEST(TestHMapEqualityOperator); - UNIT_TEST(TestHMMapEqualityOperator); + UNIT_TEST(TestHMMapEqualityOperator); UNIT_TEST(TestHMMapConstructorsAndAssignments); UNIT_TEST(TestHMMap1); UNIT_TEST(TestHMMapHas); @@ -53,10 +53,10 @@ class THashTest: public TTestBase { UNIT_TEST(TestAssignmentClear); UNIT_TEST(TestReleaseNodes); UNIT_TEST(TestAt); - UNIT_TEST(TestHMapInitializerList); - UNIT_TEST(TestHMMapInitializerList); - UNIT_TEST(TestHSetInitializerList); - UNIT_TEST(TestHMSetInitializerList); + UNIT_TEST(TestHMapInitializerList); + UNIT_TEST(TestHMMapInitializerList); + UNIT_TEST(TestHSetInitializerList); + UNIT_TEST(TestHMSetInitializerList); UNIT_TEST(TestHSetInsertInitializerList); UNIT_TEST(TestTupleHash); UNIT_TEST_SUITE_END(); @@ -67,7 +67,7 @@ protected: void TestHMapConstructorsAndAssignments(); void TestHMap1(); void TestHMapEqualityOperator(); - void TestHMMapEqualityOperator(); + void TestHMMapEqualityOperator(); void TestHMMapConstructorsAndAssignments(); void TestHMMap1(); void TestHMMapHas(); @@ -104,10 +104,10 @@ protected: void TestAssignmentClear(); void TestReleaseNodes(); void TestAt(); - void TestHMapInitializerList(); - void TestHMMapInitializerList(); - void TestHSetInitializerList(); - void TestHMSetInitializerList(); + void TestHMapInitializerList(); + void TestHMMapInitializerList(); + void TestHSetInitializerList(); + void TestHMSetInitializerList(); void TestHSetInsertInitializerList(); void TestTupleHash(); }; @@ -225,41 +225,41 @@ void THashTest::TestHMapEqualityOperator() { UNIT_ASSERT(c3 != base); } -void THashTest::TestHMMapEqualityOperator() { +void THashTest::TestHMMapEqualityOperator() { using container = THashMultiMap<TString, int>; - using value = container::value_type; - - container base; - base.insert(value("one", 1)); - base.insert(value("one", -1)); - base.insert(value("two", 2)); - - container c1(base); - UNIT_ASSERT(c1 == base); - - container c2; - c2.insert(value("two", 2)); - c2.insert(value("one", -1)); - c2.insert(value("one", 1)); - UNIT_ASSERT(c2 == base); - - c2.insert(value("three", 3)); - UNIT_ASSERT(c2 != base); - - container c3; - c3.insert(value("one", 0)); - c3.insert(value("one", -1)); - c3.insert(value("two", 2)); - UNIT_ASSERT(c3 != base); - - container c4; - c4.insert(value("one", 1)); - c4.insert(value("one", -1)); - c4.insert(value("one", 0)); - c4.insert(value("two", 2)); - UNIT_ASSERT(c3 != base); -} - + using value = container::value_type; + + container base; + base.insert(value("one", 1)); + base.insert(value("one", -1)); + base.insert(value("two", 2)); + + container c1(base); + UNIT_ASSERT(c1 == base); + + container c2; + c2.insert(value("two", 2)); + c2.insert(value("one", -1)); + c2.insert(value("one", 1)); + UNIT_ASSERT(c2 == base); + + c2.insert(value("three", 3)); + UNIT_ASSERT(c2 != base); + + container c3; + c3.insert(value("one", 0)); + c3.insert(value("one", -1)); + c3.insert(value("two", 2)); + UNIT_ASSERT(c3 != base); + + container c4; + c4.insert(value("one", 1)); + c4.insert(value("one", -1)); + c4.insert(value("one", 0)); + c4.insert(value("two", 2)); + UNIT_ASSERT(c3 != base); +} + void THashTest::TestHMMapConstructorsAndAssignments() { using container = THashMultiMap<TString, int>; @@ -1147,46 +1147,46 @@ void THashTest::TestAt() { #undef TEST_AT_THROWN_EXCEPTION } - -void THashTest::TestHMapInitializerList() { + +void THashTest::TestHMapInitializerList() { THashMap<TString, TString> h1 = {{"foo", "bar"}, {"bar", "baz"}, {"baz", "qux"}}; THashMap<TString, TString> h2; h2.insert(std::pair<TString, TString>("foo", "bar")); h2.insert(std::pair<TString, TString>("bar", "baz")); h2.insert(std::pair<TString, TString>("baz", "qux")); - UNIT_ASSERT_EQUAL(h1, h2); -} - -void THashTest::TestHMMapInitializerList() { + UNIT_ASSERT_EQUAL(h1, h2); +} + +void THashTest::TestHMMapInitializerList() { THashMultiMap<TString, TString> h1 = { - {"foo", "bar"}, - {"foo", "baz"}, - {"baz", "qux"}}; + {"foo", "bar"}, + {"foo", "baz"}, + {"baz", "qux"}}; THashMultiMap<TString, TString> h2; h2.insert(std::pair<TString, TString>("foo", "bar")); h2.insert(std::pair<TString, TString>("foo", "baz")); h2.insert(std::pair<TString, TString>("baz", "qux")); - UNIT_ASSERT_EQUAL(h1, h2); -} - -void THashTest::TestHSetInitializerList() { + UNIT_ASSERT_EQUAL(h1, h2); +} + +void THashTest::TestHSetInitializerList() { THashSet<TString> h1 = {"foo", "bar", "baz"}; THashSet<TString> h2; - h2.insert("foo"); - h2.insert("bar"); - h2.insert("baz"); - UNIT_ASSERT_EQUAL(h1, h2); -} - -void THashTest::TestHMSetInitializerList() { + h2.insert("foo"); + h2.insert("bar"); + h2.insert("baz"); + UNIT_ASSERT_EQUAL(h1, h2); +} + +void THashTest::TestHMSetInitializerList() { THashMultiSet<TString> h1 = {"foo", "foo", "bar", "baz"}; THashMultiSet<TString> h2; - h2.insert("foo"); - h2.insert("foo"); - h2.insert("bar"); - h2.insert("baz"); - UNIT_ASSERT_EQUAL(h1, h2); -} + h2.insert("foo"); + h2.insert("foo"); + h2.insert("bar"); + h2.insert("baz"); + UNIT_ASSERT_EQUAL(h1, h2); +} namespace { struct TFoo { diff --git a/util/generic/list.h b/util/generic/list.h index 7b0b8ffc72..ddeb94be92 100644 --- a/util/generic/list.h +++ b/util/generic/list.h @@ -4,7 +4,7 @@ #include <util/memory/alloc.h> -#include <initializer_list> +#include <initializer_list> #include <list> #include <memory> #include <utility> diff --git a/util/generic/list_ut.cpp b/util/generic/list_ut.cpp index 9e60ecf01b..7101ee1843 100644 --- a/util/generic/list_ut.cpp +++ b/util/generic/list_ut.cpp @@ -1,14 +1,14 @@ -#include "list.h" - +#include "list.h" + #include <library/cpp/testing/unittest/registar.h> - + Y_UNIT_TEST_SUITE(TYListSuite) { Y_UNIT_TEST(TestInitializerList) { TList<int> l = {3, 42, 6}; TList<int> expected; - expected.push_back(3); - expected.push_back(42); - expected.push_back(6); - UNIT_ASSERT_VALUES_EQUAL(l, expected); - } -} + expected.push_back(3); + expected.push_back(42); + expected.push_back(6); + UNIT_ASSERT_VALUES_EQUAL(l, expected); + } +} diff --git a/util/generic/map.h b/util/generic/map.h index b5001b56c0..81698d753a 100644 --- a/util/generic/map.h +++ b/util/generic/map.h @@ -7,7 +7,7 @@ #include <util/memory/alloc.h> #include <utility> -#include <initializer_list> +#include <initializer_list> #include <map> #include <memory> diff --git a/util/generic/map_ut.cpp b/util/generic/map_ut.cpp index 79e832b024..8e01c8f365 100644 --- a/util/generic/map_ut.cpp +++ b/util/generic/map_ut.cpp @@ -445,37 +445,37 @@ Y_UNIT_TEST_SUITE(TYMapTest) { UNIT_ASSERT_VALUES_EQUAL(values[2], 101); } } - + Y_UNIT_TEST(TestMapInitializerList) { TMap<TString, int> m = { - {"one", 1}, - {"two", 2}, - {"three", 3}, - {"four", 4}, - }; - - UNIT_ASSERT_VALUES_EQUAL(m.size(), 4); - UNIT_ASSERT_VALUES_EQUAL(m["one"], 1); - UNIT_ASSERT_VALUES_EQUAL(m["two"], 2); - UNIT_ASSERT_VALUES_EQUAL(m["three"], 3); - UNIT_ASSERT_VALUES_EQUAL(m["four"], 4); - } - + {"one", 1}, + {"two", 2}, + {"three", 3}, + {"four", 4}, + }; + + UNIT_ASSERT_VALUES_EQUAL(m.size(), 4); + UNIT_ASSERT_VALUES_EQUAL(m["one"], 1); + UNIT_ASSERT_VALUES_EQUAL(m["two"], 2); + UNIT_ASSERT_VALUES_EQUAL(m["three"], 3); + UNIT_ASSERT_VALUES_EQUAL(m["four"], 4); + } + Y_UNIT_TEST(TestMMapInitializerList) { TMultiMap<TString, int> mm = { - {"one", 1}, - {"two", 2}, - {"two", -2}, - {"three", 3}, - }; + {"one", 1}, + {"two", 2}, + {"two", -2}, + {"three", 3}, + }; UNIT_ASSERT(mm.contains("two")); TMultiMap<TString, int> expected; - expected.emplace("one", 1); - expected.emplace("two", 2); - expected.emplace("two", -2); - expected.emplace("three", 3); - UNIT_ASSERT_VALUES_EQUAL(mm, expected); - } + expected.emplace("one", 1); + expected.emplace("two", 2); + expected.emplace("two", -2); + expected.emplace("three", 3); + UNIT_ASSERT_VALUES_EQUAL(mm, expected); + } Y_UNIT_TEST(TestMovePoolAlloc) { using TMapInPool = TMap<int, int, TLess<int>, TPoolAllocator>; diff --git a/util/generic/ptr.h b/util/generic/ptr.h index 19db0e3ec5..fa15f3a378 100644 --- a/util/generic/ptr.h +++ b/util/generic/ptr.h @@ -4,7 +4,7 @@ #include "utility.h" #include "intrlist.h" #include "refcount.h" -#include "typetraits.h" +#include "typetraits.h" #include "singleton.h" #include <utility> @@ -508,22 +508,22 @@ public: Ref(); } - // NOTE: + // NOTE: // without std::enable_if_t compiler sometimes tries to use this constructor inappropriately - // e.g. - // struct A {}; - // struct B {}; - // void Func(TIntrusivePtr<A>); - // void Func(TIntrusivePtr<B>); - // ... - // Func(TIntrusivePtr<A>(new A)); // <--- compiler can't decide which version of Func to use + // e.g. + // struct A {}; + // struct B {}; + // void Func(TIntrusivePtr<A>); + // void Func(TIntrusivePtr<B>); + // ... + // Func(TIntrusivePtr<A>(new A)); // <--- compiler can't decide which version of Func to use template <class U, class = TGuardConversion<T, U>> inline TIntrusivePtr(const TIntrusivePtr<U>& p) noexcept - : T_(p.Get()) - { - Ref(); - } - + : T_(p.Get()) + { + Ref(); + } + template <class U, class = TGuardConversion<T, U>> inline TIntrusivePtr(TIntrusivePtr<U>&& p) noexcept : T_(p.T_) @@ -645,11 +645,11 @@ public: template <class U, class = TGuardConversion<T, U>> inline TIntrusiveConstPtr(const TIntrusiveConstPtr<U>& p) noexcept - : T_(p.T_) - { - Ref(); - } - + : T_(p.T_) + { + Ref(); + } + template <class U, class = TGuardConversion<T, U>> inline TIntrusiveConstPtr(TIntrusiveConstPtr<U>&& p) noexcept : T_(p.T_) @@ -711,9 +711,9 @@ private: private: T* T_; - - template <class U, class O> - friend class TIntrusiveConstPtr; + + template <class U, class O> + friend class TIntrusiveConstPtr; }; template <class T, class Ops> diff --git a/util/generic/ptr_ut.cpp b/util/generic/ptr_ut.cpp index c2dcff23f6..a53f819c1f 100644 --- a/util/generic/ptr_ut.cpp +++ b/util/generic/ptr_ut.cpp @@ -23,8 +23,8 @@ class TPointerTest: public TTestBase { UNIT_TEST(TestAutoToHolder); UNIT_TEST(TestCopyPtr); UNIT_TEST(TestIntrPtr); - UNIT_TEST(TestIntrusiveConvertion); - UNIT_TEST(TestIntrusiveConstConvertion); + UNIT_TEST(TestIntrusiveConvertion); + UNIT_TEST(TestIntrusiveConstConvertion); UNIT_TEST(TestIntrusiveConstConstruction); UNIT_TEST(TestMakeIntrusive); UNIT_TEST(TestCopyOnWritePtr1); @@ -75,8 +75,8 @@ private: void TestAutoToHolder(); void TestCopyPtr(); void TestIntrPtr(); - void TestIntrusiveConvertion(); - void TestIntrusiveConstConvertion(); + void TestIntrusiveConvertion(); + void TestIntrusiveConstConvertion(); void TestIntrusiveConstConstruction(); void TestMakeIntrusive(); void TestCopyOnWritePtr1(); @@ -364,59 +364,59 @@ void TPointerTest::TestIntrPtr() { UNIT_ASSERT_VALUES_EQUAL(TOp::Cnt, 0); } -namespace NTestIntrusiveConvertion { +namespace NTestIntrusiveConvertion { struct TA: public TSimpleRefCount<TA> { - }; + }; struct TAA: public TA { - }; + }; struct TB: public TSimpleRefCount<TB> { - }; - - void Func(TIntrusivePtr<TA>) { - } - - void Func(TIntrusivePtr<TB>) { - } - - void Func(TIntrusiveConstPtr<TA>) { - } - - void Func(TIntrusiveConstPtr<TB>) { - } -} - + }; + + void Func(TIntrusivePtr<TA>) { + } + + void Func(TIntrusivePtr<TB>) { + } + + void Func(TIntrusiveConstPtr<TA>) { + } + + void Func(TIntrusiveConstPtr<TB>) { + } +} + void TPointerTest::TestIntrusiveConvertion() { - using namespace NTestIntrusiveConvertion; - - TIntrusivePtr<TAA> aa = new TAA; - - UNIT_ASSERT_VALUES_EQUAL(aa->RefCount(), 1); - TIntrusivePtr<TA> a = aa; - UNIT_ASSERT_VALUES_EQUAL(aa->RefCount(), 2); - UNIT_ASSERT_VALUES_EQUAL(a->RefCount(), 2); - aa.Reset(); - UNIT_ASSERT_VALUES_EQUAL(a->RefCount(), 1); - - // test that Func(TIntrusivePtr<TB>) doesn't participate in overload resolution - Func(aa); -} - + using namespace NTestIntrusiveConvertion; + + TIntrusivePtr<TAA> aa = new TAA; + + UNIT_ASSERT_VALUES_EQUAL(aa->RefCount(), 1); + TIntrusivePtr<TA> a = aa; + UNIT_ASSERT_VALUES_EQUAL(aa->RefCount(), 2); + UNIT_ASSERT_VALUES_EQUAL(a->RefCount(), 2); + aa.Reset(); + UNIT_ASSERT_VALUES_EQUAL(a->RefCount(), 1); + + // test that Func(TIntrusivePtr<TB>) doesn't participate in overload resolution + Func(aa); +} + void TPointerTest::TestIntrusiveConstConvertion() { - using namespace NTestIntrusiveConvertion; - - TIntrusiveConstPtr<TAA> aa = new TAA; - - UNIT_ASSERT_VALUES_EQUAL(aa->RefCount(), 1); - TIntrusiveConstPtr<TA> a = aa; - UNIT_ASSERT_VALUES_EQUAL(aa->RefCount(), 2); - UNIT_ASSERT_VALUES_EQUAL(a->RefCount(), 2); - aa.Reset(); - UNIT_ASSERT_VALUES_EQUAL(a->RefCount(), 1); - - // test that Func(TIntrusiveConstPtr<TB>) doesn't participate in overload resolution - Func(aa); -} - + using namespace NTestIntrusiveConvertion; + + TIntrusiveConstPtr<TAA> aa = new TAA; + + UNIT_ASSERT_VALUES_EQUAL(aa->RefCount(), 1); + TIntrusiveConstPtr<TA> a = aa; + UNIT_ASSERT_VALUES_EQUAL(aa->RefCount(), 2); + UNIT_ASSERT_VALUES_EQUAL(a->RefCount(), 2); + aa.Reset(); + UNIT_ASSERT_VALUES_EQUAL(a->RefCount(), 1); + + // test that Func(TIntrusiveConstPtr<TB>) doesn't participate in overload resolution + Func(aa); +} + void TPointerTest::TestMakeIntrusive() { { UNIT_ASSERT_VALUES_EQUAL(0, TOp::Cnt); diff --git a/util/generic/set.h b/util/generic/set.h index 4c437ca26f..575d16d064 100644 --- a/util/generic/set.h +++ b/util/generic/set.h @@ -5,7 +5,7 @@ #include <util/str_stl.h> #include <util/memory/alloc.h> -#include <initializer_list> +#include <initializer_list> #include <memory> #include <set> diff --git a/util/network/socket.cpp b/util/network/socket.cpp index 4f6e804346..cec676b032 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -538,19 +538,19 @@ ESocketReadStatus HasSocketDataToRead(SOCKET s) { } #if defined(_win_) -static ssize_t DoSendMsg(SOCKET sock, const struct iovec* iov, int iovcnt) { +static ssize_t DoSendMsg(SOCKET sock, const struct iovec* iov, int iovcnt) { return writev(sock, iov, iovcnt); -} -#else -static ssize_t DoSendMsg(SOCKET sock, const struct iovec* iov, int iovcnt) { - struct msghdr message; - - Zero(message); - message.msg_iov = const_cast<struct iovec*>(iov); - message.msg_iovlen = iovcnt; - - return sendmsg(sock, &message, MSG_NOSIGNAL); -} +} +#else +static ssize_t DoSendMsg(SOCKET sock, const struct iovec* iov, int iovcnt) { + struct msghdr message; + + Zero(message); + message.msg_iov = const_cast<struct iovec*>(iov); + message.msg_iovlen = iovcnt; + + return sendmsg(sock, &message, MSG_NOSIGNAL); +} #endif void TSocketHolder::Close() noexcept { @@ -709,7 +709,7 @@ static inline SOCKET DoConnect(const struct addrinfo* res, const TInstant& deadL static inline ssize_t DoSendV(SOCKET fd, const struct iovec* iov, size_t count) { ssize_t ret = -1; do { - ret = DoSendMsg(fd, iov, (int)count); + ret = DoSendMsg(fd, iov, (int)count); } while (ret == -1 && errno == EINTR); if (ret < 0) { @@ -760,7 +760,7 @@ public: ssize_t Send(SOCKET fd, const void* data, size_t len) override { ssize_t ret = -1; do { - ret = send(fd, (const char*)data, (int)len, MSG_NOSIGNAL); + ret = send(fd, (const char*)data, (int)len, MSG_NOSIGNAL); } while (ret == -1 && errno == EINTR); if (ret < 0) { diff --git a/util/network/socket_ut.cpp b/util/network/socket_ut.cpp index 6b20e11f70..5980c7d370 100644 --- a/util/network/socket_ut.cpp +++ b/util/network/socket_ut.cpp @@ -1,7 +1,7 @@ #include "socket.h" -#include "pair.h" - +#include "pair.h" + #include <library/cpp/testing/unittest/registar.h> #include <util/string/builder.h> @@ -23,7 +23,7 @@ class TSockTest: public TTestBase { #endif UNIT_TEST(TestNetworkResolutionError); UNIT_TEST(TestNetworkResolutionErrorMessage); - UNIT_TEST(TestBrokenPipe); + UNIT_TEST(TestBrokenPipe); UNIT_TEST(TestClose); UNIT_TEST(TestReusePortAvailCheck); UNIT_TEST_SUITE_END(); @@ -34,7 +34,7 @@ public: void TestConnectionRefused(); void TestNetworkResolutionError(); void TestNetworkResolutionErrorMessage(); - void TestBrokenPipe(); + void TestBrokenPipe(); void TestClose(); void TestReusePortAvailCheck(); }; @@ -129,43 +129,43 @@ void TSockTest::TestNetworkResolutionErrorMessage() { } class TTempEnableSigPipe { -public: - TTempEnableSigPipe() { +public: + TTempEnableSigPipe() { OriginalSigHandler_ = signal(SIGPIPE, SIG_DFL); Y_VERIFY(OriginalSigHandler_ != SIG_ERR); - } - - ~TTempEnableSigPipe() { + } + + ~TTempEnableSigPipe() { auto ret = signal(SIGPIPE, OriginalSigHandler_); - Y_VERIFY(ret != SIG_ERR); - } - -private: + Y_VERIFY(ret != SIG_ERR); + } + +private: void (*OriginalSigHandler_)(int); -}; - +}; + void TSockTest::TestBrokenPipe() { - TTempEnableSigPipe guard; - - SOCKET socks[2]; - - int ret = SocketPair(socks); - UNIT_ASSERT_VALUES_EQUAL(ret, 0); - - TSocket sender(socks[0]); - TSocket receiver(socks[1]); - receiver.ShutDown(SHUT_RDWR); - int sent = sender.Send("FOO", 3); - UNIT_ASSERT(sent < 0); - - IOutputStream::TPart parts[] = { - {"foo", 3}, - {"bar", 3}, - }; - sent = sender.SendV(parts, 2); - UNIT_ASSERT(sent < 0); -} - + TTempEnableSigPipe guard; + + SOCKET socks[2]; + + int ret = SocketPair(socks); + UNIT_ASSERT_VALUES_EQUAL(ret, 0); + + TSocket sender(socks[0]); + TSocket receiver(socks[1]); + receiver.ShutDown(SHUT_RDWR); + int sent = sender.Send("FOO", 3); + UNIT_ASSERT(sent < 0); + + IOutputStream::TPart parts[] = { + {"foo", 3}, + {"bar", 3}, + }; + sent = sender.SendV(parts, 2); + UNIT_ASSERT(sent < 0); +} + void TSockTest::TestClose() { SOCKET socks[2]; diff --git a/util/random/init_atfork.cpp b/util/random/init_atfork.cpp index 0faa3d119a..5cb74a1ab1 100644 --- a/util/random/init_atfork.cpp +++ b/util/random/init_atfork.cpp @@ -15,7 +15,7 @@ namespace { (void)&AtFork; #if defined(_unix_) - Y_VERIFY(pthread_atfork(nullptr, AtFork, nullptr) == 0, "it happens"); + Y_VERIFY(pthread_atfork(nullptr, AtFork, nullptr) == 0, "it happens"); #endif } diff --git a/util/string/split.h b/util/string/split.h index bc46d9e64c..50aaccad5e 100644 --- a/util/string/split.h +++ b/util/string/split.h @@ -18,7 +18,7 @@ #include <utility> #include <stlfwd> - + // NOTE: Check StringSplitter below to get more convenient split string interface. namespace NStringSplitPrivate { diff --git a/util/string/vector.h b/util/string/vector.h index e36c348bbe..4f142de6b3 100644 --- a/util/string/vector.h +++ b/util/string/vector.h @@ -12,9 +12,9 @@ #define KEEP_EMPTY_TOKENS 0x01 -// +// // NOTE: Check StringSplitter below to get more convenient split string interface. - + namespace NPrivate { void SplitStringImpl(TVector<TString>* res, const char* ptr, diff --git a/util/system/defaults.h b/util/system/defaults.h index dcd7abea38..02e786b7c2 100644 --- a/util/system/defaults.h +++ b/util/system/defaults.h @@ -130,10 +130,10 @@ constexpr bool Y_IS_DEBUG_BUILD = true; #undef Y_ARRAY_BEGIN #define Y_ARRAY_BEGIN(arr) (arr) - + #undef Y_ARRAY_END #define Y_ARRAY_END(arr) ((arr) + Y_ARRAY_SIZE(arr)) - + /** * Concatenates two symbols, even if one of them is itself a macro. */ diff --git a/util/system/env.cpp b/util/system/env.cpp index ead9b566a5..fc44e64c2e 100644 --- a/util/system/env.cpp +++ b/util/system/env.cpp @@ -1,7 +1,7 @@ #include "env.h" #include <util/generic/string.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #ifdef _win_ #include <util/generic/vector.h> diff --git a/util/system/file.cpp b/util/system/file.cpp index 4a261d020c..76b033cee2 100644 --- a/util/system/file.cpp +++ b/util/system/file.cpp @@ -425,8 +425,8 @@ bool TFileHandle::Flush() noexcept { */ return ok || GetLastError() == ERROR_INVALID_HANDLE; #elif defined(_unix_) - int ret = ::fsync(Fd_); - + int ret = ::fsync(Fd_); + /* * Ignore EROFS, EINVAL - fd is bound to a special file * (PIPE, FIFO, or socket) which does not support synchronization. @@ -449,10 +449,10 @@ bool TFileHandle::FlushData() noexcept { return false; } - int ret = ::fdatasync(Fd_); - + int ret = ::fdatasync(Fd_); + // Same loginc in error handling as for fsync above. - return ret == 0 || errno == EROFS || errno == EINVAL; + return ret == 0 || errno == EROFS || errno == EINVAL; #else return Flush(); #endif diff --git a/util/system/file_ut.cpp b/util/system/file_ut.cpp index 941e6a50f3..07b2b7a96d 100644 --- a/util/system/file_ut.cpp +++ b/util/system/file_ut.cpp @@ -17,8 +17,8 @@ class TFileTest: public TTestBase { UNIT_TEST(TestLinkTo); UNIT_TEST(TestResize); UNIT_TEST(TestLocale); - UNIT_TEST(TestFlush); - UNIT_TEST(TestFlushSpecialFile); + UNIT_TEST(TestFlush); + UNIT_TEST(TestFlushSpecialFile); UNIT_TEST(TestRawRead); UNIT_TEST(TestRead); UNIT_TEST(TestRawPread); @@ -31,8 +31,8 @@ public: void TestOpenSync(); void TestRW(); void TestLocale(); - void TestFlush(); - void TestFlushSpecialFile(); + void TestFlush(); + void TestFlushSpecialFile(); void TestRawRead(); void TestRead(); void TestRawPread(); @@ -216,29 +216,29 @@ void TFileTest::TestLocale() { #endif } -void TFileTest::TestFlush() { - TTempFile tmp("tmp"); - - { - TFile f(tmp.Name(), OpenAlways | WrOnly); - f.Flush(); - f.FlushData(); - f.Close(); - - UNIT_ASSERT_EXCEPTION(f.Flush(), TFileError); - UNIT_ASSERT_EXCEPTION(f.FlushData(), TFileError); - } -} - -void TFileTest::TestFlushSpecialFile() { -#ifdef _unix_ - TFile devNull("/dev/null", WrOnly); - devNull.FlushData(); - devNull.Flush(); - devNull.Close(); -#endif -} - +void TFileTest::TestFlush() { + TTempFile tmp("tmp"); + + { + TFile f(tmp.Name(), OpenAlways | WrOnly); + f.Flush(); + f.FlushData(); + f.Close(); + + UNIT_ASSERT_EXCEPTION(f.Flush(), TFileError); + UNIT_ASSERT_EXCEPTION(f.FlushData(), TFileError); + } +} + +void TFileTest::TestFlushSpecialFile() { +#ifdef _unix_ + TFile devNull("/dev/null", WrOnly); + devNull.FlushData(); + devNull.Flush(); + devNull.Close(); +#endif +} + void TFileTest::TestRawRead() { TTempFile tmp("tmp"); diff --git a/util/ya.make b/util/ya.make index 6ebe7e40cf..451774a976 100644 --- a/util/ya.make +++ b/util/ya.make @@ -49,7 +49,7 @@ JOIN_SRCS( digest/multi.cpp digest/murmur.cpp digest/numeric.cpp - digest/sequence.cpp + digest/sequence.cpp ) JOIN_SRCS( diff --git a/ydb/core/driver_lib/cli_utils/ya.make b/ydb/core/driver_lib/cli_utils/ya.make index cb1f9670be..db4dabcf3b 100644 --- a/ydb/core/driver_lib/cli_utils/ya.make +++ b/ydb/core/driver_lib/cli_utils/ya.make @@ -40,7 +40,7 @@ PEERDIR( library/cpp/deprecated/enum_codegen library/cpp/grpc/client library/cpp/protobuf/json - library/cpp/yson + library/cpp/yson ydb/core/actorlib_impl ydb/core/base ydb/core/blobstorage/pdisk diff --git a/ydb/core/grpc_services/rpc_explain_data_query.cpp b/ydb/core/grpc_services/rpc_explain_data_query.cpp index cc42fb9235..4a00fce07d 100644 --- a/ydb/core/grpc_services/rpc_explain_data_query.cpp +++ b/ydb/core/grpc_services/rpc_explain_data_query.cpp @@ -9,7 +9,7 @@ #include <ydb/library/yql/public/issue/yql_issue_message.h> #include <ydb/library/yql/public/issue/yql_issue.h> #include <google/protobuf/text_format.h> -#include <library/cpp/yson/writer.h> +#include <library/cpp/yson/writer.h> namespace NKikimr { namespace NGRpcService { diff --git a/ydb/core/kqp/ut/common/kqp_ut_common.h b/ydb/core/kqp/ut/common/kqp_ut_common.h index c1d64b65c3..5fe83cd541 100644 --- a/ydb/core/kqp/ut/common/kqp_ut_common.h +++ b/ydb/core/kqp/ut/common/kqp_ut_common.h @@ -8,14 +8,14 @@ #include <ydb/public/sdk/cpp/client/ydb_table/table.h> #include <ydb/public/sdk/cpp/client/draft/ydb_scripting.h> -#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_io.h> #include <ydb/library/yql/core/issue/yql_issue.h> #include <library/cpp/json/json_reader.h> #include <library/cpp/testing/unittest/tests_data.h> #include <library/cpp/testing/unittest/registar.h> -#include <library/cpp/yson/writer.h> +#include <library/cpp/yson/writer.h> #define Y_UNIT_TEST_TWIN(N, OPT) \ template <bool OPT> \ diff --git a/ydb/core/scheme/ya.make b/ydb/core/scheme/ya.make index 128ef015bf..5bd5c186ec 100644 --- a/ydb/core/scheme/ya.make +++ b/ydb/core/scheme/ya.make @@ -18,7 +18,7 @@ PEERDIR( library/cpp/charset library/cpp/containers/bitseq library/cpp/deprecated/enum_codegen - library/cpp/yson + library/cpp/yson ydb/core/base ydb/core/scheme_types ydb/core/util diff --git a/ydb/core/sys_view/ut_kqp.cpp b/ydb/core/sys_view/ut_kqp.cpp index 5e90eb5992..1c67282f5b 100644 --- a/ydb/core/sys_view/ut_kqp.cpp +++ b/ydb/core/sys_view/ut_kqp.cpp @@ -8,7 +8,7 @@ #include <ydb/public/sdk/cpp/client/draft/ydb_scripting.h> -#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_io.h> namespace NKikimr { namespace NSysView { diff --git a/ydb/core/sys_view/ut_kqp/ya.make b/ydb/core/sys_view/ut_kqp/ya.make index 3b75f4e6fe..f4fe5d2b7a 100644 --- a/ydb/core/sys_view/ut_kqp/ya.make +++ b/ydb/core/sys_view/ut_kqp/ya.make @@ -18,7 +18,7 @@ ENDIF() PEERDIR( library/cpp/testing/unittest - library/cpp/yson/node + library/cpp/yson/node ydb/core/kqp/ut/common ydb/core/testlib ydb/public/sdk/cpp/client/draft diff --git a/ydb/core/tablet/ya.make b/ydb/core/tablet/ya.make index 25e611b408..963b89b14f 100644 --- a/ydb/core/tablet/ya.make +++ b/ydb/core/tablet/ya.make @@ -60,7 +60,7 @@ PEERDIR( library/cpp/actors/util library/cpp/blockcodecs library/cpp/deprecated/enum_codegen - library/cpp/yson + library/cpp/yson ydb/core/base ydb/core/mon ydb/core/mon_alloc diff --git a/ydb/library/yql/core/facade/ya.make b/ydb/library/yql/core/facade/ya.make index c3b5188980..033bb4315a 100644 --- a/ydb/library/yql/core/facade/ya.make +++ b/ydb/library/yql/core/facade/ya.make @@ -12,8 +12,8 @@ PEERDIR( library/cpp/string_utils/base64 library/cpp/threading/future library/cpp/time_provider - library/cpp/yson - library/cpp/yson/node + library/cpp/yson + library/cpp/yson/node ydb/library/yql/core/extract_predicate ydb/library/yql/core/file_storage ydb/library/yql/core/services diff --git a/ydb/library/yql/core/facade/yql_facade.cpp b/ydb/library/yql/core/facade/yql_facade.cpp index b74abc1c34..1698569b20 100644 --- a/ydb/library/yql/core/facade/yql_facade.cpp +++ b/ydb/library/yql/core/facade/yql_facade.cpp @@ -23,9 +23,9 @@ #include <ydb/library/yql/providers/common/config/yql_setting.h> #include <ydb/library/yql/public/issue/yql_issue.h> -#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_io.h> #include <library/cpp/deprecated/split/split_iterator.h> -#include <library/cpp/yson/writer.h> +#include <library/cpp/yson/writer.h> #include <library/cpp/string_utils/base64/base64.h> #include <util/stream/file.h> diff --git a/ydb/library/yql/core/services/yql_eval_expr.cpp b/ydb/library/yql/core/services/yql_eval_expr.cpp index 811f22a605..4b3b62ebb1 100644 --- a/ydb/library/yql/core/services/yql_eval_expr.cpp +++ b/ydb/library/yql/core/services/yql_eval_expr.cpp @@ -13,7 +13,7 @@ #include <ydb/library/yql/providers/result/expr_nodes/yql_res_expr_nodes.h> #include <ydb/library/yql/utils/log/log.h> -#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_io.h> #include <library/cpp/string_utils/base64/base64.h> #include <util/string/builder.h> diff --git a/ydb/library/yql/core/services/yql_out_transformers.cpp b/ydb/library/yql/core/services/yql_out_transformers.cpp index d8363095f8..fa15a85352 100644 --- a/ydb/library/yql/core/services/yql_out_transformers.cpp +++ b/ydb/library/yql/core/services/yql_out_transformers.cpp @@ -2,7 +2,7 @@ #include <ydb/library/yql/ast/yql_expr.h> -#include <library/cpp/yson/writer.h> +#include <library/cpp/yson/writer.h> #include <util/stream/null.h> #include <util/stream/str.h> diff --git a/ydb/library/yql/core/services/yql_out_transformers.h b/ydb/library/yql/core/services/yql_out_transformers.h index d90f88cd99..a5b7be6d9e 100644 --- a/ydb/library/yql/core/services/yql_out_transformers.h +++ b/ydb/library/yql/core/services/yql_out_transformers.h @@ -6,7 +6,7 @@ #include <ydb/library/yql/core/yql_type_annotation.h> #include <ydb/library/yql/core/yql_graph_transformer.h> -#include <library/cpp/yson/public.h> +#include <library/cpp/yson/public.h> #include <util/stream/output.h> #include <util/generic/ptr.h> diff --git a/ydb/library/yql/core/services/yql_plan.h b/ydb/library/yql/core/services/yql_plan.h index 608c54fb8e..a0e4da794c 100644 --- a/ydb/library/yql/core/services/yql_plan.h +++ b/ydb/library/yql/core/services/yql_plan.h @@ -2,7 +2,7 @@ #include <ydb/library/yql/core/type_ann/type_ann_core.h> -#include <library/cpp/yson/writer.h> +#include <library/cpp/yson/writer.h> namespace NYql { diff --git a/ydb/library/yql/core/yql_data_provider.h b/ydb/library/yql/core/yql_data_provider.h index 3ffbdc041d..c407810f2a 100644 --- a/ydb/library/yql/core/yql_data_provider.h +++ b/ydb/library/yql/core/yql_data_provider.h @@ -5,7 +5,7 @@ #include <ydb/library/yql/public/udf/udf_validate.h> -#include <library/cpp/yson/writer.h> +#include <library/cpp/yson/writer.h> #include <util/generic/maybe.h> #include <util/generic/set.h> diff --git a/ydb/library/yql/core/yql_type_annotation.h b/ydb/library/yql/core/yql_type_annotation.h index 1a1f1fb476..4f2f6797f4 100644 --- a/ydb/library/yql/core/yql_type_annotation.h +++ b/ydb/library/yql/core/yql_type_annotation.h @@ -9,7 +9,7 @@ #include <ydb/library/yql/ast/yql_expr.h> -#include <library/cpp/yson/node/node.h> +#include <library/cpp/yson/node/node.h> #include <library/cpp/time_provider/time_provider.h> #include <library/cpp/random_provider/random_provider.h> #include <library/cpp/enumbitset/enumbitset.h> diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_weakmember.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_weakmember.cpp index e27d397bfd..8555cd749e 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_weakmember.cpp +++ b/ydb/library/yql/minikql/comp_nodes/mkql_weakmember.cpp @@ -1,6 +1,6 @@ #include "mkql_fromyson.h" -#include <library/cpp/yson/varint.h> -#include <library/cpp/yson/detail.h> +#include <library/cpp/yson/varint.h> +#include <library/cpp/yson/detail.h> #include <ydb/library/yql/minikql/computation/mkql_computation_node_holders.h> #include <ydb/library/yql/minikql/mkql_node_cast.h> #include <ydb/library/yql/minikql/mkql_node_builder.h> @@ -41,7 +41,7 @@ public: const auto size = ref.Size(); MKQL_ENSURE(size <= std::numeric_limits<i32>::max(), "TryWeakMemberFromDict: Unable to fit string to i32"); TUnboxedValueStream stringStream; - stringStream.DoWrite(&NYson::NDetail::StringMarker, 1); + stringStream.DoWrite(&NYson::NDetail::StringMarker, 1); NYson::WriteVarInt32(&stringStream, size); stringStream.DoWrite(ref.Data(), size); return stringStream.Value(); diff --git a/ydb/library/yql/minikql/computation/mkql_value_builder.cpp b/ydb/library/yql/minikql/computation/mkql_value_builder.cpp index ad47661715..9268c8f226 100644 --- a/ydb/library/yql/minikql/computation/mkql_value_builder.cpp +++ b/ydb/library/yql/minikql/computation/mkql_value_builder.cpp @@ -3,7 +3,7 @@ #include <ydb/library/yql/minikql/mkql_node_cast.h> #include <ydb/library/yql/minikql/mkql_string_util.h> -#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_io.h> #include <util/system/env.h> diff --git a/ydb/library/yql/minikql/mkql_type_ops.cpp b/ydb/library/yql/minikql/mkql_type_ops.cpp index d559bb108c..176d9608e9 100644 --- a/ydb/library/yql/minikql/mkql_type_ops.cpp +++ b/ydb/library/yql/minikql/mkql_type_ops.cpp @@ -15,10 +15,10 @@ #include <library/cpp/containers/stack_vector/stack_vec.h> -#include <library/cpp/yson/parser.h> -#include <library/cpp/yson/consumer.h> -#include <library/cpp/yson/varint.h> -#include <library/cpp/yson/detail.h> +#include <library/cpp/yson/parser.h> +#include <library/cpp/yson/consumer.h> +#include <library/cpp/yson/varint.h> +#include <library/cpp/yson/detail.h> #include <library/cpp/json/json_reader.h> #include <library/cpp/resource/resource.h> @@ -1753,7 +1753,7 @@ NUdf::TUnboxedValuePod ValueFromString(NUdf::EDataSlot type, NUdf::TStringRef bu } NUdf::TUnboxedValuePod SimpleValueFromYson(NUdf::EDataSlot type, NUdf::TStringRef buf) { - const bool isBinYson = !buf.Empty() && *buf.Data() <= NYson::NDetail::Uint64Marker; + const bool isBinYson = !buf.Empty() && *buf.Data() <= NYson::NDetail::Uint64Marker; if (!isBinYson) { auto textBuf = buf; switch (type) { @@ -1795,7 +1795,7 @@ NUdf::TUnboxedValuePod SimpleValueFromYson(NUdf::EDataSlot type, NUdf::TStringRe } const char ysonQuote = '"'; - if (*buf.Data() == NYson::NDetail::EntitySymbol) { + if (*buf.Data() == NYson::NDetail::EntitySymbol) { return NUdf::TUnboxedValuePod(); } else if (*buf.Data() != ysonQuote) { return MakeString(buf); @@ -1831,11 +1831,11 @@ NUdf::TUnboxedValuePod SimpleValueFromYson(NUdf::EDataSlot type, NUdf::TStringRe auto binPayload = buf.Substring(1, buf.Size() - 1); switch (type) { case NUdf::EDataSlot::Bool: { - if (ytBinType == NYson::NDetail::FalseMarker) { + if (ytBinType == NYson::NDetail::FalseMarker) { return NUdf::TUnboxedValuePod(false); } - if (ytBinType == NYson::NDetail::TrueMarker) { + if (ytBinType == NYson::NDetail::TrueMarker) { return NUdf::TUnboxedValuePod(true); } @@ -1849,7 +1849,7 @@ NUdf::TUnboxedValuePod SimpleValueFromYson(NUdf::EDataSlot type, NUdf::TStringRe case NUdf::EDataSlot::Date: case NUdf::EDataSlot::Datetime: case NUdf::EDataSlot::Timestamp: { - if (ytBinType != NYson::NDetail::Uint64Marker) { + if (ytBinType != NYson::NDetail::Uint64Marker) { return NUdf::TUnboxedValuePod(); } @@ -1868,7 +1868,7 @@ NUdf::TUnboxedValuePod SimpleValueFromYson(NUdf::EDataSlot type, NUdf::TStringRe case NUdf::EDataSlot::Int32: case NUdf::EDataSlot::Int64: case NUdf::EDataSlot::Interval: { - if (ytBinType != NYson::NDetail::Int64Marker) { + if (ytBinType != NYson::NDetail::Int64Marker) { return NUdf::TUnboxedValuePod(); } @@ -1883,7 +1883,7 @@ NUdf::TUnboxedValuePod SimpleValueFromYson(NUdf::EDataSlot type, NUdf::TStringRe } case NUdf::EDataSlot::Float: { - if (ytBinType != NYson::NDetail::DoubleMarker || binPayload.Size() != 8) { + if (ytBinType != NYson::NDetail::DoubleMarker || binPayload.Size() != 8) { return NUdf::TUnboxedValuePod(); } @@ -1892,7 +1892,7 @@ NUdf::TUnboxedValuePod SimpleValueFromYson(NUdf::EDataSlot type, NUdf::TStringRe } case NUdf::EDataSlot::Double: { - if (ytBinType != NYson::NDetail::DoubleMarker || binPayload.Size() != 8) { + if (ytBinType != NYson::NDetail::DoubleMarker || binPayload.Size() != 8) { return NUdf::TUnboxedValuePod(); } @@ -1903,7 +1903,7 @@ NUdf::TUnboxedValuePod SimpleValueFromYson(NUdf::EDataSlot type, NUdf::TStringRe case NUdf::EDataSlot::String: case NUdf::EDataSlot::Utf8: case NUdf::EDataSlot::Json: { - if (ytBinType != NYson::NDetail::StringMarker) { + if (ytBinType != NYson::NDetail::StringMarker) { return NUdf::TUnboxedValuePod(); } diff --git a/ydb/library/yql/minikql/ya.make b/ydb/library/yql/minikql/ya.make index c4b608128d..35de699495 100644 --- a/ydb/library/yql/minikql/ya.make +++ b/ydb/library/yql/minikql/ya.make @@ -61,7 +61,7 @@ PEERDIR( library/cpp/monlib/dynamic_counters library/cpp/packedtypes library/cpp/resource - library/cpp/yson + library/cpp/yson ydb/library/binary_json ydb/library/dynumber ydb/library/yql/minikql/dom diff --git a/ydb/library/yql/providers/common/codec/ya.make b/ydb/library/yql/providers/common/codec/ya.make index b3f3a92db5..55a1fd8160 100644 --- a/ydb/library/yql/providers/common/codec/ya.make +++ b/ydb/library/yql/providers/common/codec/ya.make @@ -19,8 +19,8 @@ PEERDIR( ydb/library/yql/minikql ydb/library/yql/minikql/computation ydb/library/yql/providers/common/mkql - library/cpp/yson/node - library/cpp/yson + library/cpp/yson/node + library/cpp/yson ) YQL_LAST_ABI_VERSION() diff --git a/ydb/library/yql/providers/common/codec/yql_codec.cpp b/ydb/library/yql/providers/common/codec/yql_codec.cpp index 7587e188fa..e17649453c 100644 --- a/ydb/library/yql/providers/common/codec/yql_codec.cpp +++ b/ydb/library/yql/providers/common/codec/yql_codec.cpp @@ -13,12 +13,12 @@ #include <ydb/library/yql/utils/yql_panic.h> #include <ydb/library/yql/utils/swap_bytes.h> -#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_io.h> #include <library/cpp/yson/writer.h> #include <library/cpp/string_utils/base64/base64.h> -#include <library/cpp/yson/parser.h> -#include <library/cpp/yson/detail.h> +#include <library/cpp/yson/parser.h> +#include <library/cpp/yson/detail.h> #include <util/string/cast.h> #include <util/generic/map.h> @@ -28,7 +28,7 @@ namespace NCommon { using namespace NKikimr; using namespace NKikimr::NMiniKQL; -using namespace NYson::NDetail; +using namespace NYson::NDetail; void WriteYsonValueImpl(TYsonResultWriter& writer, const NUdf::TUnboxedValuePod& value, TType* type, const TVector<ui32>* structPositions) { diff --git a/ydb/library/yql/providers/common/codec/yql_codec_results.h b/ydb/library/yql/providers/common/codec/yql_codec_results.h index e34d2a3a68..2005b3d882 100644 --- a/ydb/library/yql/providers/common/codec/yql_codec_results.h +++ b/ydb/library/yql/providers/common/codec/yql_codec_results.h @@ -1,6 +1,6 @@ #pragma once -#include <library/cpp/yson/writer.h> +#include <library/cpp/yson/writer.h> #include <util/generic/strbuf.h> #include <util/string/cast.h> diff --git a/ydb/library/yql/providers/common/codec/yql_restricted_yson.cpp b/ydb/library/yql/providers/common/codec/yql_restricted_yson.cpp index 08b4521748..eebb447b6a 100644 --- a/ydb/library/yql/providers/common/codec/yql_restricted_yson.cpp +++ b/ydb/library/yql/providers/common/codec/yql_restricted_yson.cpp @@ -3,11 +3,11 @@ #include <ydb/library/yql/utils/parse_double.h> #include <ydb/library/yql/utils/yql_panic.h> -#include <library/cpp/yson/detail.h> -#include <library/cpp/yson/parser.h> +#include <library/cpp/yson/detail.h> +#include <library/cpp/yson/parser.h> -#include <library/cpp/yson/node/node_io.h> -#include <library/cpp/yson/node/node_visitor.h> +#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_visitor.h> #include <util/generic/algorithm.h> #include <util/generic/stack.h> diff --git a/ydb/library/yql/providers/common/codec/yql_restricted_yson_ut.cpp b/ydb/library/yql/providers/common/codec/yql_restricted_yson_ut.cpp index aee6715a93..be5f0560a9 100644 --- a/ydb/library/yql/providers/common/codec/yql_restricted_yson_ut.cpp +++ b/ydb/library/yql/providers/common/codec/yql_restricted_yson_ut.cpp @@ -1,7 +1,7 @@ #include "yql_restricted_yson.h" -#include <library/cpp/yson/node/node_io.h> -#include <library/cpp/yson/node/node_visitor.h> +#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_visitor.h> #include <library/cpp/testing/unittest/registar.h> diff --git a/ydb/library/yql/providers/common/gateway/yql_provider_gateway.h b/ydb/library/yql/providers/common/gateway/yql_provider_gateway.h index c4b498e9a1..a24eded753 100644 --- a/ydb/library/yql/providers/common/gateway/yql_provider_gateway.h +++ b/ydb/library/yql/providers/common/gateway/yql_provider_gateway.h @@ -84,7 +84,7 @@ inline void SetPromiseValue(NThreading::TPromise<T>& promise, const NThreading:: try { promise.SetValue(f.GetValue()); } catch (...) { - promise.SetException(std::current_exception()); + promise.SetException(std::current_exception()); } }); } diff --git a/ydb/library/yql/providers/common/provider/yql_provider.h b/ydb/library/yql/providers/common/provider/yql_provider.h index 9e80cfd135..799e63630d 100644 --- a/ydb/library/yql/providers/common/provider/yql_provider.h +++ b/ydb/library/yql/providers/common/provider/yql_provider.h @@ -7,7 +7,7 @@ #include <ydb/library/yql/core/yql_expr_type_annotation.h> #include <ydb/library/yql/core/expr_nodes/yql_expr_nodes.h> -#include <library/cpp/yson/writer.h> +#include <library/cpp/yson/writer.h> #include <util/generic/hash_set.h> #include <util/generic/string.h> @@ -15,7 +15,7 @@ #include <utility> -namespace NYson { +namespace NYson { class TYsonWriter; } @@ -98,7 +98,7 @@ NYson::EYsonFormat GetYsonFormat(const IDataProvider::TFillSettings& fillSetting TVector<TString> GetStructFields(const TTypeAnnotationNode* type); -void TransformerStatsToYson(const TString& name, const IGraphTransformer::TStatistics& stats, NYson::TYsonWriter& writer); +void TransformerStatsToYson(const TString& name, const IGraphTransformer::TStatistics& stats, NYson::TYsonWriter& writer); void FillSecureParams(const TExprNode::TPtr& node, const TTypeAnnotationContext& types, THashMap<TString, TString>& secureParams); @@ -108,17 +108,17 @@ std::pair<IGraphTransformer::TStatus, TAsyncTransformCallbackFuture> FreezeUsedF bool FreezeUsedFilesSync(const TExprNode& node, TUserDataTable& files, const TTypeAnnotationContext& types, TExprContext& ctx, const std::function<bool(const TString&)>& urlDownloadFilter); -void WriteColumns(NYson::TYsonWriter& writer, const NNodes::TExprBase& columns); +void WriteColumns(NYson::TYsonWriter& writer, const NNodes::TExprBase& columns); TString SerializeExpr(TExprContext& ctx, const TExprNode& expr, bool withTypes = false); TString ExprToPrettyString(TExprContext& ctx, const TExprNode& expr); -void WriteStream(NYson::TYsonWriter& writer, const TExprNode* node, const TExprNode* source); -void WriteStreams(NYson::TYsonWriter& writer, TStringBuf name, const NNodes::TCoLambda& lambda); +void WriteStream(NYson::TYsonWriter& writer, const TExprNode* node, const TExprNode* source); +void WriteStreams(NYson::TYsonWriter& writer, TStringBuf name, const NNodes::TCoLambda& lambda); double GetDataReplicationFactor(const TExprNode& lambda, TExprContext& ctx); -void WriteStatistics(NYson::TYsonWriter& writer, bool totalOnly, const THashMap<ui32, TOperationStatistics>& statistics); +void WriteStatistics(NYson::TYsonWriter& writer, bool totalOnly, const THashMap<ui32, TOperationStatistics>& statistics); } // namespace NCommon } // namespace NYql diff --git a/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.cpp b/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.cpp index 0bbaf5c339..fba69712fe 100644 --- a/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.cpp +++ b/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.cpp @@ -6,9 +6,9 @@ #include <ydb/library/yql/utils/yql_panic.h> #include <ydb/library/yql/public/udf/udf_data_type.h> -#include <library/cpp/yson/node/node_io.h> -#include <library/cpp/yson/node/node_builder.h> -#include <library/cpp/yson/writer.h> +#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_builder.h> +#include <library/cpp/yson/writer.h> #include <util/generic/map.h> #include <util/stream/str.h> diff --git a/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.h b/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.h index 397063052f..c4806b4b80 100644 --- a/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.h +++ b/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.h @@ -2,8 +2,8 @@ #include <ydb/library/yql/public/issue/yql_issue.h> -#include <library/cpp/yson/consumer.h> -#include <library/cpp/yson/node/node.h> +#include <library/cpp/yson/consumer.h> +#include <library/cpp/yson/node/node.h> #include <util/generic/maybe.h> #include <util/generic/string.h> diff --git a/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.cpp b/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.cpp index 0a34105714..433a9bf035 100644 --- a/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.cpp +++ b/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.cpp @@ -11,8 +11,8 @@ #include <ydb/library/yql/public/udf/udf_data_type.h> #include <ydb/library/yql/utils/yql_panic.h> -#include <library/cpp/yson/node/node_io.h> -#include <library/cpp/yson/node/node_builder.h> +#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_builder.h> #include <library/cpp/yson/writer.h> #include <util/stream/str.h> diff --git a/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.h b/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.h index 9a21a1f388..77561e9bb2 100644 --- a/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.h +++ b/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.h @@ -1,7 +1,7 @@ #pragma once -#include <library/cpp/yson/consumer.h> -#include <library/cpp/yson/node/node.h> +#include <library/cpp/yson/consumer.h> +#include <library/cpp/yson/node/node.h> #include <util/stream/output.h> #include <util/generic/strbuf.h> diff --git a/ydb/library/yql/providers/common/schema/parser/yql_type_parser.cpp b/ydb/library/yql/providers/common/schema/parser/yql_type_parser.cpp index ae3f281ed2..eeeab598af 100644 --- a/ydb/library/yql/providers/common/schema/parser/yql_type_parser.cpp +++ b/ydb/library/yql/providers/common/schema/parser/yql_type_parser.cpp @@ -1,6 +1,6 @@ #include "yql_type_parser.h" -#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_io.h> namespace NYql { namespace NCommon { diff --git a/ydb/library/yql/providers/common/schema/parser/yql_type_parser.h b/ydb/library/yql/providers/common/schema/parser/yql_type_parser.h index a3116efb14..bbceedeed5 100644 --- a/ydb/library/yql/providers/common/schema/parser/yql_type_parser.h +++ b/ydb/library/yql/providers/common/schema/parser/yql_type_parser.h @@ -1,7 +1,7 @@ #pragma once -#include <library/cpp/yson/consumer.h> -#include <library/cpp/yson/node/node.h> +#include <library/cpp/yson/consumer.h> +#include <library/cpp/yson/node/node.h> #include <util/generic/maybe.h> #include <util/generic/string.h> diff --git a/ydb/library/yql/providers/common/schema/skiff/yql_skiff_schema.cpp b/ydb/library/yql/providers/common/schema/skiff/yql_skiff_schema.cpp index 2461a17094..bf72258a2d 100644 --- a/ydb/library/yql/providers/common/schema/skiff/yql_skiff_schema.cpp +++ b/ydb/library/yql/providers/common/schema/skiff/yql_skiff_schema.cpp @@ -4,7 +4,7 @@ #include <ydb/library/yql/providers/common/codec/yql_codec_type_flags.h> #include <ydb/library/yql/public/udf/udf_data_type.h> -#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_io.h> #include <util/generic/yexception.h> diff --git a/ydb/library/yql/providers/common/schema/skiff/yql_skiff_schema.h b/ydb/library/yql/providers/common/schema/skiff/yql_skiff_schema.h index 2c9799057c..926032a52a 100644 --- a/ydb/library/yql/providers/common/schema/skiff/yql_skiff_schema.h +++ b/ydb/library/yql/providers/common/schema/skiff/yql_skiff_schema.h @@ -1,6 +1,6 @@ #pragma once -#include <library/cpp/yson/node/node.h> +#include <library/cpp/yson/node/node.h> namespace NYql { namespace NCommon { diff --git a/ydb/library/yql/providers/common/schema/yql_schema_utils.h b/ydb/library/yql/providers/common/schema/yql_schema_utils.h index 45061285a8..3a8175d686 100644 --- a/ydb/library/yql/providers/common/schema/yql_schema_utils.h +++ b/ydb/library/yql/providers/common/schema/yql_schema_utils.h @@ -1,6 +1,6 @@ #pragma once -#include <library/cpp/yson/node/node.h> +#include <library/cpp/yson/node/node.h> #include <util/generic/string.h> #include <util/generic/vector.h> diff --git a/ydb/library/yql/providers/dq/actors/proto_builder.cpp b/ydb/library/yql/providers/dq/actors/proto_builder.cpp index e4b16403c3..6d985522d9 100644 --- a/ydb/library/yql/providers/dq/actors/proto_builder.cpp +++ b/ydb/library/yql/providers/dq/actors/proto_builder.cpp @@ -9,8 +9,8 @@ #include <ydb/library/mkql_proto/mkql_proto.h> -#include <library/cpp/yson/node/node_io.h> -#include <library/cpp/yson/writer.h> +#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/writer.h> namespace NYql::NDqs { diff --git a/ydb/library/yql/providers/dq/provider/yql_dq_gateway.cpp b/ydb/library/yql/providers/dq/provider/yql_dq_gateway.cpp index 2341b28ad4..28cd57f88e 100644 --- a/ydb/library/yql/providers/dq/provider/yql_dq_gateway.cpp +++ b/ydb/library/yql/providers/dq/provider/yql_dq_gateway.cpp @@ -10,7 +10,7 @@ #include <ydb/public/lib/yson_value/ydb_yson_value.h> #include <library/cpp/grpc/client/grpc_client_low.h> -#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_io.h> #include <library/cpp/threading/task_scheduler/task_scheduler.h> #include <util/system/thread.h> diff --git a/ydb/library/yql/providers/dq/service/interconnect_helpers.cpp b/ydb/library/yql/providers/dq/service/interconnect_helpers.cpp index bef368a961..2de40fa4ea 100644 --- a/ydb/library/yql/providers/dq/service/interconnect_helpers.cpp +++ b/ydb/library/yql/providers/dq/service/interconnect_helpers.cpp @@ -20,7 +20,7 @@ #include <library/cpp/actors/interconnect/interconnect_tcp_proxy.h> #include <library/cpp/actors/interconnect/interconnect_tcp_server.h> #include <library/cpp/actors/interconnect/poller_actor.h> -#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_io.h> #include <util/stream/file.h> #include <util/system/env.h> diff --git a/ydb/library/yql/providers/dq/service/interconnect_helpers.h b/ydb/library/yql/providers/dq/service/interconnect_helpers.h index 9009c8c179..b2392b294a 100644 --- a/ydb/library/yql/providers/dq/service/interconnect_helpers.h +++ b/ydb/library/yql/providers/dq/service/interconnect_helpers.h @@ -3,7 +3,7 @@ #include <library/cpp/actors/core/actorsystem.h> #include <library/cpp/actors/interconnect/poller_tcp.h> #include <library/cpp/actors/interconnect/interconnect.h> -#include <library/cpp/yson/node/node.h> +#include <library/cpp/yson/node/node.h> #include <ydb/library/yql/providers/dq/config/config.pb.h> diff --git a/ydb/library/yql/providers/result/provider/yql_result_provider.cpp b/ydb/library/yql/providers/result/provider/yql_result_provider.cpp index 13bfd5e0f7..44182a3cb2 100644 --- a/ydb/library/yql/providers/result/provider/yql_result_provider.cpp +++ b/ydb/library/yql/providers/result/provider/yql_result_provider.cpp @@ -14,7 +14,7 @@ #include <ydb/library/yql/ast/yql_gc_nodes.h> #include <ydb/library/yql/utils/log/log.h> -#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_io.h> #include <util/string/cast.h> diff --git a/ydb/library/yql/sql/v1/builtin.cpp b/ydb/library/yql/sql/v1/builtin.cpp index 43ef1243f1..1bce1c6d7a 100644 --- a/ydb/library/yql/sql/v1/builtin.cpp +++ b/ydb/library/yql/sql/v1/builtin.cpp @@ -12,7 +12,7 @@ #include <ydb/library/yql/public/issue/yql_issue_id.h> #include <library/cpp/charset/ci_string.h> -#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_io.h> #include <util/string/builder.h> #include <util/string/cast.h> #include <util/string/util.h> diff --git a/ydb/library/yql/sql/v1/ya.make b/ydb/library/yql/sql/v1/ya.make index 432fdefbf7..58113f0048 100644 --- a/ydb/library/yql/sql/v1/ya.make +++ b/ydb/library/yql/sql/v1/ya.make @@ -8,7 +8,7 @@ OWNER( PEERDIR( library/cpp/charset library/cpp/enumbitset - library/cpp/yson/node + library/cpp/yson/node ydb/library/yql/core/sql_types ydb/library/yql/minikql ydb/library/yql/public/udf diff --git a/ydb/public/lib/yson_value/ya.make b/ydb/public/lib/yson_value/ya.make index 21ab4f98d0..6235fd0af2 100644 --- a/ydb/public/lib/yson_value/ya.make +++ b/ydb/public/lib/yson_value/ya.make @@ -8,7 +8,7 @@ SRCS( PEERDIR( library/cpp/yson - library/cpp/yson/node + library/cpp/yson/node ydb/public/sdk/cpp/client/ydb_result ydb/public/sdk/cpp/client/ydb_value ) diff --git a/ydb/public/lib/yson_value/ydb_yson_value.h b/ydb/public/lib/yson_value/ydb_yson_value.h index c20bdf35e7..bbc0957463 100644 --- a/ydb/public/lib/yson_value/ydb_yson_value.h +++ b/ydb/public/lib/yson_value/ydb_yson_value.h @@ -4,9 +4,9 @@ #include <ydb/public/sdk/cpp/client/ydb_value/value.h> #include <ydb/public/sdk/cpp/client/ydb_types/fatal_error_handlers/handlers.h> -#include <library/cpp/yson/node/node_io.h> +#include <library/cpp/yson/node/node_io.h> -#include <library/cpp/yson/writer.h> +#include <library/cpp/yson/writer.h> namespace NYdb { |