aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf/util
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:23 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:23 +0300
commit706b83ed7de5a473436620367af31fc0ceecde07 (patch)
tree103305d30dec77e8f6367753367f59b3cd68f9f1 /library/cpp/protobuf/util
parent918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff)
downloadydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/protobuf/util')
-rw-r--r--library/cpp/protobuf/util/is_equal_ut.cpp4
-rw-r--r--library/cpp/protobuf/util/pb_io.cpp20
-rw-r--r--library/cpp/protobuf/util/pb_io.h16
-rw-r--r--library/cpp/protobuf/util/pb_io_ut.cpp40
-rw-r--r--library/cpp/protobuf/util/simple_reflection_ut.cpp8
-rw-r--r--library/cpp/protobuf/util/walk_ut.cpp4
6 files changed, 46 insertions, 46 deletions
diff --git a/library/cpp/protobuf/util/is_equal_ut.cpp b/library/cpp/protobuf/util/is_equal_ut.cpp
index 3ca4c90dd5..b3388783c4 100644
--- a/library/cpp/protobuf/util/is_equal_ut.cpp
+++ b/library/cpp/protobuf/util/is_equal_ut.cpp
@@ -24,7 +24,7 @@ Y_UNIT_TEST_SUITE(ProtobufIsEqual) {
a.SetName("aaa");
b.SetName("bbb");
- TString path;
+ TString path;
bool equal = NProtoBuf::IsEqual(a, b, &path);
UNIT_ASSERT(!equal);
@@ -40,7 +40,7 @@ Y_UNIT_TEST_SUITE(ProtobufIsEqual) {
a.MutableInner()->SetBrbrbr("aaa");
b.MutableInner()->SetBrbrbr("bbb");
- TString path;
+ TString path;
bool equal = NProtoBuf::IsEqual(a, b, &path);
UNIT_ASSERT(!equal);
diff --git a/library/cpp/protobuf/util/pb_io.cpp b/library/cpp/protobuf/util/pb_io.cpp
index 6270ee0624..0a01549d79 100644
--- a/library/cpp/protobuf/util/pb_io.cpp
+++ b/library/cpp/protobuf/util/pb_io.cpp
@@ -7,7 +7,7 @@
#include <google/protobuf/messagext.h>
#include <google/protobuf/text_format.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/stream/file.h>
#include <util/stream/str.h>
#include <util/string/cast.h>
@@ -101,10 +101,10 @@ void SerializeToTextFormat(const NProtoBuf::Message& m, IOutputStream& out) {
}
}
-void SerializeToTextFormat(const NProtoBuf::Message& m, const TString& fileName) {
- /* TUnbufferedFileOutput is unbuffered, but TCopyingOutputStreamAdaptor adds
+void SerializeToTextFormat(const NProtoBuf::Message& m, const TString& fileName) {
+ /* TUnbufferedFileOutput is unbuffered, but TCopyingOutputStreamAdaptor adds
* a buffer on top of it. */
- TUnbufferedFileOutput stream(fileName);
+ TUnbufferedFileOutput stream(fileName);
SerializeToTextFormat(m, stream);
}
@@ -150,15 +150,15 @@ void ParseFromTextFormat(IInputStream& in, NProtoBuf::Message& m,
}
}
-void ParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m,
+void ParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m,
const EParseFromTextFormatOptions options) {
- /* TUnbufferedFileInput is unbuffered, but TCopyingInputStreamAdaptor adds
+ /* TUnbufferedFileInput is unbuffered, but TCopyingInputStreamAdaptor adds
* a buffer on top of it. */
- TUnbufferedFileInput stream(fileName);
+ TUnbufferedFileInput stream(fileName);
ParseFromTextFormat(stream, m, options);
}
-bool TryParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m,
+bool TryParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m,
const EParseFromTextFormatOptions options) {
try {
ParseFromTextFormat(fileName, m, options);
@@ -192,9 +192,9 @@ void MergeFromTextFormat(IInputStream& in, NProtoBuf::Message& m,
void MergeFromTextFormat(const TString& fileName, NProtoBuf::Message& m,
const EParseFromTextFormatOptions options) {
- /* TUnbufferedFileInput is unbuffered, but TCopyingInputStreamAdaptor adds
+ /* TUnbufferedFileInput is unbuffered, but TCopyingInputStreamAdaptor adds
* a buffer on top of it. */
- TUnbufferedFileInput stream(fileName);
+ TUnbufferedFileInput stream(fileName);
MergeFromTextFormat(stream, m, options);
}
diff --git a/library/cpp/protobuf/util/pb_io.h b/library/cpp/protobuf/util/pb_io.h
index 493c84cb5f..3a5e16ad67 100644
--- a/library/cpp/protobuf/util/pb_io.h
+++ b/library/cpp/protobuf/util/pb_io.h
@@ -32,11 +32,11 @@ namespace NProtoBuf {
/* Serialize message into string and apply base64 URL encoding.
*/
- TString SerializeToBase64String(const Message& m);
- void SerializeToBase64String(const Message& m, TString& dataBase64);
- bool TrySerializeToBase64String(const Message& m, TString& dataBase64);
+ TString SerializeToBase64String(const Message& m);
+ void SerializeToBase64String(const Message& m, TString& dataBase64);
+ bool TrySerializeToBase64String(const Message& m, TString& dataBase64);
- const TString ShortUtf8DebugString(const Message& message);
+ const TString ShortUtf8DebugString(const Message& message);
bool MergePartialFromString(NProtoBuf::Message& m, const TStringBuf serializedProtoMessage);
bool MergeFromString(NProtoBuf::Message& m, const TStringBuf serializedProtoMessage);
@@ -45,7 +45,7 @@ namespace NProtoBuf {
int operator&(NProtoBuf::Message& m, IBinSaver& f);
// Write a textual representation of the given message to the given file.
-void SerializeToTextFormat(const NProtoBuf::Message& m, const TString& fileName);
+void SerializeToTextFormat(const NProtoBuf::Message& m, const TString& fileName);
void SerializeToTextFormat(const NProtoBuf::Message& m, IOutputStream& out);
// Write a textual representation of the given message to the given output stream
@@ -64,7 +64,7 @@ enum class EParseFromTextFormatOption : ui64 {
Y_DECLARE_FLAGS(EParseFromTextFormatOptions, EParseFromTextFormatOption);
// Parse a text-format protocol message from the given file into message object.
-void ParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m,
+void ParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m,
const EParseFromTextFormatOptions options = {});
// NOTE: will read `in` till the end.
void ParseFromTextFormat(IInputStream& in, NProtoBuf::Message& m,
@@ -74,7 +74,7 @@ void ParseFromTextFormat(IInputStream& in, NProtoBuf::Message& m,
*
* @see `ParseFromTextFormat`
*/
-bool TryParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m,
+bool TryParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m,
const EParseFromTextFormatOptions options = {});
// NOTE: will read `in` till the end.
bool TryParseFromTextFormat(IInputStream& in, NProtoBuf::Message& m,
@@ -82,7 +82,7 @@ bool TryParseFromTextFormat(IInputStream& in, NProtoBuf::Message& m,
// @see `ParseFromTextFormat`
template <typename T>
-static T ParseFromTextFormat(const TString& fileName,
+static T ParseFromTextFormat(const TString& fileName,
const EParseFromTextFormatOptions options = {}) {
T message;
ParseFromTextFormat(fileName, message, options);
diff --git a/library/cpp/protobuf/util/pb_io_ut.cpp b/library/cpp/protobuf/util/pb_io_ut.cpp
index 875d6dc602..de62b0b0a1 100644
--- a/library/cpp/protobuf/util/pb_io_ut.cpp
+++ b/library/cpp/protobuf/util/pb_io_ut.cpp
@@ -23,7 +23,7 @@ static NProtobufUtilUt::TTextEnumTest GetCorrectEnumMessage() {
return m;
}
-static const TString CORRECT_MESSAGE =
+static const TString CORRECT_MESSAGE =
R"(Foo: 42
)";
static const TString CORRECT_ENUM_NAME_MESSAGE =
@@ -33,7 +33,7 @@ static const TString CORRECT_ENUM_ID_MESSAGE =
R"(Slot: 1
)";
-static const TString INCORRECT_MESSAGE =
+static const TString INCORRECT_MESSAGE =
R"(Bar: 1
)";
static const TString INCORRECT_ENUM_NAME_MESSAGE =
@@ -43,11 +43,11 @@ static const TString INCORRECT_ENUM_ID_MESSAGE =
R"(Slot: 3
)";
-static const TString CORRECT_BASE64_MESSAGE = "CCo,";
+static const TString CORRECT_BASE64_MESSAGE = "CCo,";
static const TString CORRECT_UNEVEN_BASE64_MESSAGE = "CCo";
-static const TString INCORRECT_BASE64_MESSAGE = "CC";
+static const TString INCORRECT_BASE64_MESSAGE = "CC";
Y_UNIT_TEST_SUITE(TTestProtoBufIO) {
Y_UNIT_TEST(TestBase64) {
@@ -81,8 +81,8 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) {
const TFsPath correctFileName = TFsPath{tempDir()} / "correct.pb.txt";
const TFsPath incorrectFileName = TFsPath{tempDir()} / "incorrect.pb.txt";
- TFileOutput{correctFileName}.Write(CORRECT_MESSAGE);
- TFileOutput{incorrectFileName}.Write(INCORRECT_MESSAGE);
+ TFileOutput{correctFileName}.Write(CORRECT_MESSAGE);
+ TFileOutput{incorrectFileName}.Write(INCORRECT_MESSAGE);
{
NProtobufUtilUt::TTextTest message;
@@ -138,8 +138,8 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) {
}
{
NProtobufUtilUt::TTextTest m;
- const auto f = [&correctFileName](NProtobufUtilUt::TTextTest& mm) {
- mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>(correctFileName);
+ const auto f = [&correctFileName](NProtobufUtilUt::TTextTest& mm) {
+ mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>(correctFileName);
};
UNIT_ASSERT_NO_EXCEPTION(f(m));
UNIT_ASSERT(NProtoBuf::IsEqual(GetCorrectMessage(), m));
@@ -150,8 +150,8 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) {
{
NProtobufUtilUt::TTextTest m;
TStringInput in{CORRECT_MESSAGE};
- const auto f = [&in](NProtobufUtilUt::TTextTest& mm) {
- mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>(in);
+ const auto f = [&in](NProtobufUtilUt::TTextTest& mm) {
+ mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>(in);
};
UNIT_ASSERT_NO_EXCEPTION(f(m));
UNIT_ASSERT(NProtoBuf::IsEqual(GetCorrectMessage(), m));
@@ -161,10 +161,10 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) {
UNIT_ASSERT_EXCEPTION(ParseFromTextFormat<NProtobufUtilUt::TTextTest>(in), yexception);
}
{
- const TFsPath correctFileName2 = TFsPath{tempDir()} / "serialized.pb.txt";
+ const TFsPath correctFileName2 = TFsPath{tempDir()} / "serialized.pb.txt";
const auto original = GetCorrectMessage();
- UNIT_ASSERT_NO_EXCEPTION(SerializeToTextFormat(original, correctFileName2));
- const auto serializedStr = TUnbufferedFileInput{correctFileName2}.ReadAll();
+ UNIT_ASSERT_NO_EXCEPTION(SerializeToTextFormat(original, correctFileName2));
+ const auto serializedStr = TUnbufferedFileInput{correctFileName2}.ReadAll();
UNIT_ASSERT_VALUES_EQUAL(serializedStr, CORRECT_MESSAGE);
}
{
@@ -175,8 +175,8 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) {
}
{
NProtobufUtilUt::TTextTest m;
- const auto f = [&correctFileName](NProtobufUtilUt::TTextTest& mm) {
- mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>(
+ const auto f = [&correctFileName](NProtobufUtilUt::TTextTest& mm) {
+ mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>(
correctFileName,
EParseFromTextFormatOption::AllowUnknownField);
};
@@ -186,8 +186,8 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) {
{
const NProtobufUtilUt::TTextTest empty;
NProtobufUtilUt::TTextTest m;
- const auto f = [&incorrectFileName](NProtobufUtilUt::TTextTest& mm) {
- mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>(
+ const auto f = [&incorrectFileName](NProtobufUtilUt::TTextTest& mm) {
+ mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>(
incorrectFileName,
EParseFromTextFormatOption::AllowUnknownField);
};
@@ -258,8 +258,8 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) {
const TFsPath correctFileName = TFsPath{tempDir()} / "correct.pb.txt";
const TFsPath incorrectFileName = TFsPath{tempDir()} / "incorrect.pb.txt";
- TFileOutput{correctFileName}.Write(CORRECT_MESSAGE);
- TFileOutput{incorrectFileName}.Write(INCORRECT_MESSAGE);
+ TFileOutput{correctFileName}.Write(CORRECT_MESSAGE);
+ TFileOutput{incorrectFileName}.Write(INCORRECT_MESSAGE);
{
NProtobufUtilUt::TTextTest message;
@@ -341,7 +341,7 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) {
const TFsPath correctFileName2 = TFsPath{tempDir()} / "serialized.pb.txt";
const auto original = GetCorrectMessage();
UNIT_ASSERT_NO_EXCEPTION(SerializeToTextFormat(original, correctFileName2));
- const auto serializedStr = TUnbufferedFileInput{correctFileName2}.ReadAll();
+ const auto serializedStr = TUnbufferedFileInput{correctFileName2}.ReadAll();
UNIT_ASSERT_VALUES_EQUAL(serializedStr, CORRECT_MESSAGE);
}
{
diff --git a/library/cpp/protobuf/util/simple_reflection_ut.cpp b/library/cpp/protobuf/util/simple_reflection_ut.cpp
index 169d4703c9..28a1d3d360 100644
--- a/library/cpp/protobuf/util/simple_reflection_ut.cpp
+++ b/library/cpp/protobuf/util/simple_reflection_ut.cpp
@@ -157,7 +157,7 @@ Y_UNIT_TEST_SUITE(ProtobufSimpleReflection) {
TMaybe<TConstField> field = TConstField::ByPath(msg, "OneStr");
UNIT_ASSERT(field);
UNIT_ASSERT(field->HasValue());
- UNIT_ASSERT_VALUES_EQUAL("1", (field->Get<TString>()));
+ UNIT_ASSERT_VALUES_EQUAL("1", (field->Get<TString>()));
}
{
@@ -218,7 +218,7 @@ Y_UNIT_TEST_SUITE(ProtobufSimpleReflection) {
TMaybe<TMutableField> field = TMutableField::ByPath(msg, "OneStr");
UNIT_ASSERT(field);
UNIT_ASSERT(!field->HasValue());
- field->Set(TString("zz"));
+ field->Set(TString("zz"));
UNIT_ASSERT(field->HasValue());
UNIT_ASSERT_VALUES_EQUAL("zz", msg.GetOneStr());
}
@@ -227,7 +227,7 @@ Y_UNIT_TEST_SUITE(ProtobufSimpleReflection) {
TMaybe<TMutableField> field = TMutableField::ByPath(msg, "OneStr");
UNIT_ASSERT(field);
UNIT_ASSERT(field->HasValue());
- field->Set(TString("dd"));
+ field->Set(TString("dd"));
UNIT_ASSERT(field->HasValue());
UNIT_ASSERT_VALUES_EQUAL("dd", msg.GetOneStr());
}
@@ -268,7 +268,7 @@ Y_UNIT_TEST_SUITE(ProtobufSimpleReflection) {
{
TMaybe<TMutableField> field = TMutableField::ByPath(msg, "RepMsg/RepInt", true);
TMaybe<TMutableField> fieldCopy = TMutableField::ByPath(msg, "RepMsg/RepInt", true);
- Y_UNUSED(fieldCopy);
+ Y_UNUSED(fieldCopy);
UNIT_ASSERT(field);
UNIT_ASSERT(!field->HasValue());
UNIT_ASSERT_VALUES_EQUAL(1, msg.RepMsgSize());
diff --git a/library/cpp/protobuf/util/walk_ut.cpp b/library/cpp/protobuf/util/walk_ut.cpp
index 2ea6071b17..134c0a49f7 100644
--- a/library/cpp/protobuf/util/walk_ut.cpp
+++ b/library/cpp/protobuf/util/walk_ut.cpp
@@ -37,8 +37,8 @@ Y_UNIT_TEST_SUITE(ProtobufWalk) {
TMutableField f(msg, fd);
if (f.IsString()) {
for (size_t i = 0; i < f.Size(); ++i)
- if (f.Get<TString>(i).StartsWith('1'))
- f.Set(f.Get<TString>(i) + f.Get<TString>(i), i);
+ if (f.Get<TString>(i).StartsWith('1'))
+ f.Set(f.Get<TString>(i) + f.Get<TString>(i), i);
}
return true;
}