aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorstakanviski <stakanviski@yandex-team.ru>2022-02-10 16:50:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:01 +0300
commit95ab23a39b5482a434361566cabdd5b0a433cb43 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp
parentda8356a5535e6177965cba3bbae73c5fb28f6ccc (diff)
downloadydb-95ab23a39b5482a434361566cabdd5b0a433cb43.tar.gz
Restoring authorship annotation for <stakanviski@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/protobuf/json/config.h6
-rw-r--r--library/cpp/protobuf/json/json2proto.cpp40
-rw-r--r--library/cpp/protobuf/json/json2proto.h8
-rw-r--r--library/cpp/protobuf/json/proto2json_printer.cpp10
-rw-r--r--library/cpp/protobuf/json/ut/fields.incl4
-rw-r--r--library/cpp/protobuf/json/ut/json2proto_ut.cpp70
-rw-r--r--library/cpp/protobuf/json/ut/proto2json_ut.cpp22
-rw-r--r--library/cpp/protobuf/json/ut/test.proto30
-rw-r--r--library/cpp/protobuf/json/ut/ya.make4
-rw-r--r--library/cpp/scheme/scheme.h2
-rw-r--r--library/cpp/scheme/scimpl_defs.h6
-rw-r--r--library/cpp/scheme/scimpl_protobuf.cpp46
-rw-r--r--library/cpp/scheme/tests/ut/scheme_ut.proto160
-rw-r--r--library/cpp/scheme/ya.make4
14 files changed, 206 insertions, 206 deletions
diff --git a/library/cpp/protobuf/json/config.h b/library/cpp/protobuf/json/config.h
index 7168b6b012..dc84fb4d5d 100644
--- a/library/cpp/protobuf/json/config.h
+++ b/library/cpp/protobuf/json/config.h
@@ -4,7 +4,7 @@
#include "name_generator.h"
#include <util/generic/vector.h>
-#include <util/generic/yexception.h>
+#include <util/generic/yexception.h>
#include <functional>
@@ -68,7 +68,7 @@ namespace NProtobufJson {
/// Transforms will be applied only to string values (== protobuf fields of string / bytes type).
/// yajl_encode_string will be used if no transforms are specified.
TVector<TStringTransformPtr> StringTransforms;
-
+
/// Print map as object, otherwise print it as array of key/value objects
bool MapAsObject = false;
@@ -134,7 +134,7 @@ namespace NProtobufJson {
StringTransforms.push_back(transform);
return *this;
}
-
+
TSelf& SetMapAsObject(bool value) {
MapAsObject = value;
return *this;
diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp
index 8476cc83d7..640c10f5a5 100644
--- a/library/cpp/protobuf/json/json2proto.cpp
+++ b/library/cpp/protobuf/json/json2proto.cpp
@@ -8,30 +8,30 @@
#include <util/generic/hash.h>
#include <util/generic/maybe.h>
-#include <util/string/ascii.h>
+#include <util/string/ascii.h>
#include <util/string/cast.h>
#define JSON_TO_FIELD(EProtoCppType, name, json, JsonCheckType, ProtoSet, JsonGet) \
- case FieldDescriptor::EProtoCppType: { \
+ case FieldDescriptor::EProtoCppType: { \
if (config.CastRobust) { \
reflection->ProtoSet(&proto, &field, json.JsonGet##Robust()); \
break; \
} \
- if (!json.JsonCheckType()) { \
- if (config.CastFromString && json.IsString()) { \
+ if (!json.JsonCheckType()) { \
+ if (config.CastFromString && json.IsString()) { \
if (config.DoNotCastEmptyStrings && json.GetString().empty()) { \
/* Empty string is same as "no value" for scalar types.*/ \
break; \
} \
- reflection->ProtoSet(&proto, &field, FromString(json.GetString())); \
- break; \
- } \
+ reflection->ProtoSet(&proto, &field, FromString(json.GetString())); \
+ break; \
+ } \
ythrow yexception() << "Invalid type of JSON field " << name << ": " \
- << #JsonCheckType << "() failed while " \
- << #EProtoCppType << " is expected."; \
- } \
- reflection->ProtoSet(&proto, &field, json.JsonGet()); \
- break; \
+ << #JsonCheckType << "() failed while " \
+ << #EProtoCppType << " is expected."; \
+ } \
+ reflection->ProtoSet(&proto, &field, json.JsonGet()); \
+ break; \
}
static TString GetFieldName(const google::protobuf::FieldDescriptor& field,
@@ -40,16 +40,16 @@ static TString GetFieldName(const google::protobuf::FieldDescriptor& field,
return config.NameGenerator(field);
}
- if (config.UseJsonName) {
- Y_ASSERT(!field.json_name().empty());
+ if (config.UseJsonName) {
+ Y_ASSERT(!field.json_name().empty());
TString name = field.json_name();
if (!field.has_json_name() && !name.empty()) {
// FIXME: https://st.yandex-team.ru/CONTRIB-139
name[0] = AsciiToLower(name[0]);
}
return name;
- }
-
+ }
+
TString name = field.name();
switch (config.FieldNameMode) {
case NProtobufJson::TJson2ProtoConfig::FieldNameOriginalCase:
@@ -60,11 +60,11 @@ static TString GetFieldName(const google::protobuf::FieldDescriptor& field,
case NProtobufJson::TJson2ProtoConfig::FieldNameUpperCase:
name.to_upper();
break;
- case NProtobufJson::TJson2ProtoConfig::FieldNameCamelCase:
+ case NProtobufJson::TJson2ProtoConfig::FieldNameCamelCase:
if (!name.empty()) {
- name[0] = AsciiToLower(name[0]);
- }
- break;
+ name[0] = AsciiToLower(name[0]);
+ }
+ break;
case NProtobufJson::TJson2ProtoConfig::FieldNameSnakeCase:
NProtobufJson::ToSnakeCase(&name);
break;
diff --git a/library/cpp/protobuf/json/json2proto.h b/library/cpp/protobuf/json/json2proto.h
index 00e7a9accb..4c33498dfa 100644
--- a/library/cpp/protobuf/json/json2proto.h
+++ b/library/cpp/protobuf/json/json2proto.h
@@ -52,7 +52,7 @@ namespace NProtobufJson {
StringTransforms.push_back(transform);
return *this;
}
-
+
TSelf& SetCastFromString(bool cast) {
CastFromString = cast;
return *this;
@@ -67,7 +67,7 @@ namespace NProtobufJson {
CastRobust = cast;
return *this;
}
-
+
TSelf& SetMapAsObject(bool mapAsObject) {
MapAsObject = mapAsObject;
return *this;
@@ -112,7 +112,7 @@ namespace NProtobufJson {
/// Transforms will be applied only to string values (== protobuf fields of string / bytes type).
TVector<TStringTransformPtr> StringTransforms;
-
+
/// Cast string json values to protobuf field type
bool CastFromString = false;
/// Skip empty strings, instead casting from string into scalar types.
@@ -120,7 +120,7 @@ namespace NProtobufJson {
bool DoNotCastEmptyStrings = false;
/// Cast all json values to protobuf field types
bool CastRobust = false;
-
+
/// Consider map to be an object, otherwise consider it to be an array of key/value objects
bool MapAsObject = false;
diff --git a/library/cpp/protobuf/json/proto2json_printer.cpp b/library/cpp/protobuf/json/proto2json_printer.cpp
index dd244978da..6123eab0f2 100644
--- a/library/cpp/protobuf/json/proto2json_printer.cpp
+++ b/library/cpp/protobuf/json/proto2json_printer.cpp
@@ -3,7 +3,7 @@
#include "util.h"
#include <util/generic/yexception.h>
-#include <util/string/ascii.h>
+#include <util/string/ascii.h>
#include <util/string/cast.h>
namespace NProtobufJson {
@@ -36,7 +36,7 @@ namespace NProtobufJson {
NewKeyBuf = field.name();
break;
}
-
+
case TProto2JsonConfig::FieldNameLowerCase: {
NewKeyStr = field.name();
NewKeyStr.to_lower();
@@ -76,9 +76,9 @@ namespace NProtobufJson {
default:
Y_VERIFY_DEBUG(false, "Unknown FieldNameMode.");
- }
- }
-
+ }
+ }
+
const TStringBuf& GetKey() const {
return NewKeyBuf;
}
diff --git a/library/cpp/protobuf/json/ut/fields.incl b/library/cpp/protobuf/json/ut/fields.incl
index d848f614cd..4b22985836 100644
--- a/library/cpp/protobuf/json/ut/fields.incl
+++ b/library/cpp/protobuf/json/ut/fields.incl
@@ -17,7 +17,7 @@ DEFINE_FIELD(Bytes, "מחשב")
DEFINE_FIELD(Enum, E_1)
DEFINE_FIELD(Float, 1.123f)
DEFINE_FIELD(Double, 1.123456789012)
-DEFINE_FIELD(OneString, "Lorem ipsum dolor")
-DEFINE_FIELD(OneTwoString, "Lorem ipsum dolor sit")
+DEFINE_FIELD(OneString, "Lorem ipsum dolor")
+DEFINE_FIELD(OneTwoString, "Lorem ipsum dolor sit")
DEFINE_FIELD(ABC, "abc")
DEFINE_FIELD(UserID, "some_id") \ No newline at end of file
diff --git a/library/cpp/protobuf/json/ut/json2proto_ut.cpp b/library/cpp/protobuf/json/ut/json2proto_ut.cpp
index 55dd9f18cb..0dfe57bc7a 100644
--- a/library/cpp/protobuf/json/ut/json2proto_ut.cpp
+++ b/library/cpp/protobuf/json/ut/json2proto_ut.cpp
@@ -16,7 +16,7 @@
#include <util/generic/string.h>
#include <util/generic/ylimits.h>
#include <util/stream/str.h>
-#include <util/string/cast.h>
+#include <util/string/cast.h>
#include <util/system/defaults.h>
#include <util/system/yassert.h>
@@ -33,7 +33,7 @@ namespace google {
} // namespace protobuf
}
-namespace {
+namespace {
class TInit {
public:
TInit() {
@@ -41,15 +41,15 @@ namespace {
}
} Init;
- template <typename T>
- TString ConvertToString(T value) {
- return ToString(value);
- }
-
- // default ToString<double>() implementation loses precision
- TString ConvertToString(double value) {
- return FloatToString(value);
- }
+ template <typename T>
+ TString ConvertToString(T value) {
+ return ToString(value);
+ }
+
+ // default ToString<double>() implementation loses precision
+ TString ConvertToString(double value) {
+ return FloatToString(value);
+ }
TString JsonValueToString(const NJson::TJsonValue& json) {
NJsonWriter::TBuf buf(NJsonWriter::HEM_UNSAFE);
@@ -68,8 +68,8 @@ namespace {
UNIT_ASSERT_PROTOS_EQUAL(proto, modelProto);
}
-}
-
+}
+
Y_UNIT_TEST_SUITE(TJson2ProtoTest) {
Y_UNIT_TEST(TestFlatOptional){
{const NJson::TJsonValue& json = CreateFlatJson();
@@ -369,35 +369,35 @@ Y_UNIT_TEST(TestFieldNameMode) {
// Camelcase
{
TString modelStr(R"_({"string":"value"})_");
-
+
TFlatOptional proto;
TJson2ProtoConfig config;
config.FieldNameMode = TJson2ProtoConfig::FieldNameCamelCase;
-
+
UNIT_ASSERT_NO_EXCEPTION(proto = Json2Proto<TFlatOptional>(modelStr, config));
UNIT_ASSERT(proto.GetString() == "value");
}
{
TString modelStr(R"_({"oneString":"value"})_");
-
+
TFlatOptional proto;
TJson2ProtoConfig config;
config.FieldNameMode = TJson2ProtoConfig::FieldNameCamelCase;
-
+
UNIT_ASSERT_NO_EXCEPTION(proto = Json2Proto<TFlatOptional>(modelStr, config));
UNIT_ASSERT(proto.GetOneString() == "value");
}
{
TString modelStr(R"_({"oneTwoString":"value"})_");
-
+
TFlatOptional proto;
TJson2ProtoConfig config;
config.FieldNameMode = TJson2ProtoConfig::FieldNameCamelCase;
-
+
UNIT_ASSERT_NO_EXCEPTION(proto = Json2Proto<TFlatOptional>(modelStr, config));
UNIT_ASSERT(proto.GetOneTwoString() == "value");
}
-
+
// snake_case
{
TString modelStr(R"_({"string":"value"})_");
@@ -457,7 +457,7 @@ Y_UNIT_TEST(TestFieldNameMode) {
UNIT_ASSERT(proto.GetI32(0) == 1);
UNIT_ASSERT(proto.GetI32(1) == 2);
}
-
+
// UseJsonName
{
// FIXME(CONTRIB-139): since protobuf 3.1, Def_upper json name is
@@ -465,18 +465,18 @@ Y_UNIT_TEST(TestFieldNameMode) {
// updated, library/cpp/protobuf/json preserves compatibility with
// protobuf 3.0 by lowercasing default names, making it "defUpper".
TString modelStr(R"_({"My-Upper":1,"my-lower":2,"defUpper":3,"defLower":4})_");
-
+
TWithJsonName proto;
TJson2ProtoConfig config;
config.SetUseJsonName(true);
-
+
UNIT_ASSERT_NO_EXCEPTION(proto = Json2Proto<TWithJsonName>(modelStr, config));
UNIT_ASSERT_EQUAL(proto.Getmy_upper(), 1);
UNIT_ASSERT_EQUAL(proto.GetMy_lower(), 2);
UNIT_ASSERT_EQUAL(proto.GetDef_upper(), 3);
UNIT_ASSERT_EQUAL(proto.Getdef_lower(), 4);
}
-
+
// FieldNameMode with UseJsonName
{
TJson2ProtoConfig config;
@@ -589,23 +589,23 @@ Y_UNIT_TEST(TestCastFromString) {
// single fields
{
NJson::TJsonValue json;
-#define DEFINE_FIELD(name, value) \
+#define DEFINE_FIELD(name, value) \
json.InsertValue(#name, ConvertToString(value));
#include <library/cpp/protobuf/json/ut/fields.incl>
-#undef DEFINE_FIELD
-
+#undef DEFINE_FIELD
+
TFlatOptional proto;
UNIT_ASSERT_EXCEPTION_CONTAINS(Json2Proto(json, proto), yexception, "Invalid type");
-
+
TJson2ProtoConfig config;
config.SetCastFromString(true);
Json2Proto(json, proto, config);
-
+
TFlatOptional modelProto;
FillFlatProto(&modelProto);
UNIT_ASSERT_PROTOS_EQUAL(proto, modelProto);
}
-
+
// repeated fields
{
NJson::TJsonValue json;
@@ -619,21 +619,21 @@ Y_UNIT_TEST(TestCastFromString) {
json.InsertValue(#name, array); \
}
#include <library/cpp/protobuf/json/ut/repeated_fields.incl>
-#undef DEFINE_REPEATED_FIELD
-
+#undef DEFINE_REPEATED_FIELD
+
TFlatRepeated proto;
UNIT_ASSERT_EXCEPTION_CONTAINS(Json2Proto(json, proto), yexception, "Invalid type");
-
+
TJson2ProtoConfig config;
config.SetCastFromString(true);
Json2Proto(json, proto, config);
-
+
TFlatRepeated modelProto;
FillRepeatedProto(&modelProto);
UNIT_ASSERT_PROTOS_EQUAL(proto, modelProto);
}
} // TestCastFromString
-
+
Y_UNIT_TEST(TestMap) {
TMapType modelProto;
diff --git a/library/cpp/protobuf/json/ut/proto2json_ut.cpp b/library/cpp/protobuf/json/ut/proto2json_ut.cpp
index 7fc3a1e403..07e52d7f2f 100644
--- a/library/cpp/protobuf/json/ut/proto2json_ut.cpp
+++ b/library/cpp/protobuf/json/ut/proto2json_ut.cpp
@@ -721,41 +721,41 @@ Y_UNIT_TEST(TestFieldNameMode) {
// Camelcase
{
TString modelStr(R"_({"string":"value"})_");
-
+
TFlatOptional proto;
proto.SetString("value");
TStringStream jsonStr;
TProto2JsonConfig config;
config.FieldNameMode = TProto2JsonConfig::FieldNameCamelCase;
-
+
UNIT_ASSERT_NO_EXCEPTION(Proto2Json(proto, jsonStr, config));
UNIT_ASSERT_JSON_STRINGS_EQUAL(jsonStr.Str(), modelStr);
}
{
TString modelStr(R"_({"oneString":"value"})_");
-
+
TFlatOptional proto;
proto.SetOneString("value");
TStringStream jsonStr;
TProto2JsonConfig config;
config.FieldNameMode = TProto2JsonConfig::FieldNameCamelCase;
-
+
UNIT_ASSERT_NO_EXCEPTION(Proto2Json(proto, jsonStr, config));
UNIT_ASSERT_JSON_STRINGS_EQUAL(jsonStr.Str(), modelStr);
}
{
TString modelStr(R"_({"oneTwoString":"value"})_");
-
+
TFlatOptional proto;
proto.SetOneTwoString("value");
TStringStream jsonStr;
TProto2JsonConfig config;
config.FieldNameMode = TProto2JsonConfig::FieldNameCamelCase;
-
+
UNIT_ASSERT_NO_EXCEPTION(Proto2Json(proto, jsonStr, config));
UNIT_ASSERT_JSON_STRINGS_EQUAL(jsonStr.Str(), modelStr);
}
-
+
// snake_case
{
TString modelStr(R"_({"string":"value"})_");
@@ -857,7 +857,7 @@ Y_UNIT_TEST(TestFieldNameMode) {
// FIXME(CONTRIB-139): see the comment about UseJsonName in json2proto_ut.cpp:
// Def_upper json name should be "DefUpper".
TString modelStr(R"_({"My-Upper":1,"my-lower":2,"defUpper":3,"defLower":4})_");
-
+
TWithJsonName proto;
proto.Setmy_upper(1);
proto.SetMy_lower(2);
@@ -866,11 +866,11 @@ Y_UNIT_TEST(TestFieldNameMode) {
TStringStream jsonStr;
TProto2JsonConfig config;
config.SetUseJsonName(true);
-
+
UNIT_ASSERT_NO_EXCEPTION(Proto2Json(proto, jsonStr, config));
UNIT_ASSERT_STRINGS_EQUAL(jsonStr.Str(), modelStr);
}
-
+
// FieldNameMode with UseJsonName
{
TProto2JsonConfig config;
@@ -884,7 +884,7 @@ Y_UNIT_TEST(TestFieldNameMode) {
UNIT_ASSERT_EXCEPTION_CONTAINS(
config.SetFieldNameMode(TProto2JsonConfig::FieldNameLowerCase), yexception, "mutually exclusive");
}
-
+
/// TODO: test missing keys
} // TestFieldNameMode
diff --git a/library/cpp/protobuf/json/ut/test.proto b/library/cpp/protobuf/json/ut/test.proto
index 1285cb430d..0fa996fd41 100644
--- a/library/cpp/protobuf/json/ut/test.proto
+++ b/library/cpp/protobuf/json/ut/test.proto
@@ -28,9 +28,9 @@ message TFlatOptional {
optional float Float = 15;
optional double Double = 16;
-
- optional string OneString = 17;
- optional string OneTwoString = 18;
+
+ optional string OneString = 17;
+ optional string OneTwoString = 18;
optional string ABC = 19;
optional string UserID = 20;
};
@@ -56,9 +56,9 @@ message TFlatRequired {
required float Float = 15;
required double Double = 16;
-
- required string OneString = 17;
- required string OneTwoString = 18;
+
+ required string OneString = 17;
+ required string OneTwoString = 18;
required string ABC = 19;
required string UserID = 20;
};
@@ -84,9 +84,9 @@ message TFlatRepeated {
repeated float Float = 15;
repeated double Double = 16;
-
- repeated string OneString = 17;
- repeated string OneTwoString = 18;
+
+ repeated string OneString = 17;
+ repeated string OneTwoString = 18;
repeated string ABC = 19;
repeated string UserID = 20;
};
@@ -112,9 +112,9 @@ message TFlatDefault {
optional float Float = 15 [default = 0.123];
optional double Double = 16 [default = 0.456];
-
- optional string OneString = 17 [default = "string"];
- optional string OneTwoString = 18 [default = "string"];
+
+ optional string OneString = 17 [default = "string"];
+ optional string OneTwoString = 18 [default = "string"];
optional string ABC = 19 [default = "abc"];
optional string UserID = 20 [default = "some_id"];
};
@@ -134,7 +134,7 @@ message TCompositeRepeated {
message TMapType {
map<string, string> Items = 1;
};
-
+
message TNameGeneratorType {
optional int32 Field = 1;
};
@@ -171,12 +171,12 @@ message TComplexMapType {
map<string, TComplexMapType> Nested = 16;
};
-message TWithJsonName {
+message TWithJsonName {
optional int32 my_upper = 1 [json_name = "My-Upper"];
optional int32 My_lower = 2 [json_name = "my-lower"];
optional int32 Def_upper = 3; // json_name = "DefUpper"
optional int32 def_lower = 4; // json_name = "defLower"
-}
+}
message TSingleRequiredString {
required string String = 1;
diff --git a/library/cpp/protobuf/json/ut/ya.make b/library/cpp/protobuf/json/ut/ya.make
index 68a087d224..b60a6d3c17 100644
--- a/library/cpp/protobuf/json/ut/ya.make
+++ b/library/cpp/protobuf/json/ut/ya.make
@@ -14,8 +14,8 @@ SRCS(
util_ut.cpp
)
-GENERATE_ENUM_SERIALIZATION(test.pb.h)
-
+GENERATE_ENUM_SERIALIZATION(test.pb.h)
+
PEERDIR(
library/cpp/protobuf/json
)
diff --git a/library/cpp/scheme/scheme.h b/library/cpp/scheme/scheme.h
index f8399292cd..3d7c59f3c9 100644
--- a/library/cpp/scheme/scheme.h
+++ b/library/cpp/scheme/scheme.h
@@ -384,7 +384,7 @@ namespace NSc {
public:
// very specific methods useful in very specific corner cases
-
+
static TValue From(const ::google::protobuf::Message&, bool mapAsDict = false);
void To(::google::protobuf::Message&, const TProtoOpts& opts = {}) const;
diff --git a/library/cpp/scheme/scimpl_defs.h b/library/cpp/scheme/scimpl_defs.h
index 40962a30a2..f3dd66b437 100644
--- a/library/cpp/scheme/scimpl_defs.h
+++ b/library/cpp/scheme/scimpl_defs.h
@@ -131,10 +131,10 @@ namespace NSc {
class TSelfOverrideContext;
}
}
-
-namespace google {
+
+namespace google {
namespace protobuf {
class Message;
class FieldDescriptor;
}
-}
+}
diff --git a/library/cpp/scheme/scimpl_protobuf.cpp b/library/cpp/scheme/scimpl_protobuf.cpp
index af6cca56bf..0c99122c69 100644
--- a/library/cpp/scheme/scimpl_protobuf.cpp
+++ b/library/cpp/scheme/scimpl_protobuf.cpp
@@ -1,22 +1,22 @@
-#include "scheme.h"
-
-#include <util/generic/vector.h>
-#include <util/generic/yexception.h>
-
+#include "scheme.h"
+
+#include <util/generic/vector.h>
+#include <util/generic/yexception.h>
+
#include <google/protobuf/descriptor.h>
#include <google/protobuf/message.h>
#include <google/protobuf/reflection.h>
-
-using namespace google::protobuf;
-
-namespace NSc {
+
+using namespace google::protobuf;
+
+namespace NSc {
TValue TValue::From(const Message& msg, bool mapAsDict) {
TValue v;
const Reflection* r = msg.GetReflection();
TVector<const FieldDescriptor*> fields;
TVector<const FieldDescriptor*>::iterator it;
int i1;
-
+
r->ListFields(msg, &fields);
for (it = fields.begin(), i1 = 0; it != fields.end(); ++it, ++i1) {
const FieldDescriptor* field = *it;
@@ -39,16 +39,16 @@ namespace NSc {
}
} catch (...) {
/* conversion failed, skip this field */
- }
- }
+ }
+ }
return v;
- }
-
+ }
+
TValue TValue::FromField(const Message& msg, const FieldDescriptor* field) {
TValue v;
const Reflection* r = msg.GetReflection();
-
+
switch (field->cpp_type()) {
case FieldDescriptor::CPPTYPE_INT32:
v = r->GetInt32(msg, field);
@@ -83,14 +83,14 @@ namespace NSc {
default:
ythrow TSchemeException() << "field " << field->full_name() << " unexpected type " << (int)field->cpp_type();
}
-
+
return v;
- }
-
+ }
+
TValue TValue::FromRepeatedField(const Message& msg, const FieldDescriptor* field, int index) {
TValue v;
const Reflection* r = msg.GetReflection();
-
+
switch (field->cpp_type()) {
case FieldDescriptor::CPPTYPE_INT32:
v = r->GetRepeatedInt32(msg, field, index);
@@ -125,10 +125,10 @@ namespace NSc {
default:
ythrow TSchemeException() << "field " << field->full_name() << " unexpected type " << (int)field->cpp_type();
}
-
+
return v;
- }
-
+ }
+
void TValue::To(Message& msg, const TProtoOpts& opts) const {
msg.Clear();
@@ -326,4 +326,4 @@ namespace NSc {
mutableField.Add(*entry);
}
}
-}
+}
diff --git a/library/cpp/scheme/tests/ut/scheme_ut.proto b/library/cpp/scheme/tests/ut/scheme_ut.proto
index 139c293b3c..7981af7eae 100644
--- a/library/cpp/scheme/tests/ut/scheme_ut.proto
+++ b/library/cpp/scheme/tests/ut/scheme_ut.proto
@@ -1,84 +1,84 @@
-package NSc;
-
-message TMessage {
- optional double Double = 1;
- optional float Float = 2;
- optional int32 Int32 = 3;
- optional int64 Int64 = 4;
- optional uint32 UInt32 = 5;
- optional uint64 UInt64 = 6;
- optional sint32 SInt32 = 7;
- optional sint64 SInt64 = 8;
- optional fixed32 Fixed32 = 9;
- optional fixed64 Fixed64 = 10;
- optional sfixed32 SFixed32 = 11;
- optional sfixed64 SFixed64 = 12;
- optional bool Bool = 13;
- optional string String = 14;
- optional bytes Bytes = 15;
- optional EEnum Enum = 16;
- optional TMessage2 Message = 17;
-
- repeated double Doubles = 18;
- repeated float Floats = 19;
- repeated int32 Int32s = 20;
- repeated int64 Int64s = 21;
- repeated uint32 UInt32s = 22;
- repeated uint64 UInt64s = 23;
- repeated sint32 SInt32s = 24;
- repeated sint64 SInt64s = 25;
- repeated fixed32 Fixed32s = 26;
- repeated fixed64 Fixed64s = 27;
- repeated sfixed32 SFixed32s = 28;
- repeated sfixed64 SFixed64s = 29;
- repeated bool Bools = 30;
- repeated string Strings = 31;
- repeated bytes Bytess = 32;
- repeated EEnum Enums = 33;
- repeated TMessage2 Messages = 34;
+package NSc;
+
+message TMessage {
+ optional double Double = 1;
+ optional float Float = 2;
+ optional int32 Int32 = 3;
+ optional int64 Int64 = 4;
+ optional uint32 UInt32 = 5;
+ optional uint64 UInt64 = 6;
+ optional sint32 SInt32 = 7;
+ optional sint64 SInt64 = 8;
+ optional fixed32 Fixed32 = 9;
+ optional fixed64 Fixed64 = 10;
+ optional sfixed32 SFixed32 = 11;
+ optional sfixed64 SFixed64 = 12;
+ optional bool Bool = 13;
+ optional string String = 14;
+ optional bytes Bytes = 15;
+ optional EEnum Enum = 16;
+ optional TMessage2 Message = 17;
+
+ repeated double Doubles = 18;
+ repeated float Floats = 19;
+ repeated int32 Int32s = 20;
+ repeated int64 Int64s = 21;
+ repeated uint32 UInt32s = 22;
+ repeated uint64 UInt64s = 23;
+ repeated sint32 SInt32s = 24;
+ repeated sint64 SInt64s = 25;
+ repeated fixed32 Fixed32s = 26;
+ repeated fixed64 Fixed64s = 27;
+ repeated sfixed32 SFixed32s = 28;
+ repeated sfixed64 SFixed64s = 29;
+ repeated bool Bools = 30;
+ repeated string Strings = 31;
+ repeated bytes Bytess = 32;
+ repeated EEnum Enums = 33;
+ repeated TMessage2 Messages = 34;
map<string, double> MapDoubles = 35;
map<string, int32> MapInt32s = 36;
map<string, string> MapString = 37;
-}
-
-enum EEnum {
- VALUE1 = 0;
- VALUE2 = 1;
-}
-
-message TMessage2 {
- optional double Double = 1;
- optional float Float = 2;
- optional int32 Int32 = 3;
- optional int64 Int64 = 4;
- optional uint32 UInt32 = 5;
- optional uint64 UInt64 = 6;
- optional sint32 SInt32 = 7;
- optional sint64 SInt64 = 8;
- optional fixed32 Fixed32 = 9;
- optional fixed64 Fixed64 = 10;
- optional sfixed32 SFixed32 = 11;
- optional sfixed64 SFixed64 = 12;
- optional bool Bool = 13;
- optional string String = 14;
- optional bytes Bytes = 15;
- optional EEnum Enum = 16;
-
- repeated double Doubles = 18;
- repeated float Floats = 19;
- repeated int32 Int32s = 20;
- repeated int64 Int64s = 21;
- repeated uint32 UInt32s = 22;
- repeated uint64 UInt64s = 23;
- repeated sint32 SInt32s = 24;
- repeated sint64 SInt64s = 25;
- repeated fixed32 Fixed32s = 26;
- repeated fixed64 Fixed64s = 27;
- repeated sfixed32 SFixed32s = 28;
- repeated sfixed64 SFixed64s = 29;
- repeated bool Bools = 30;
- repeated string Strings = 31;
- repeated bytes Bytess = 32;
- repeated EEnum Enums = 33;
-}
+}
+
+enum EEnum {
+ VALUE1 = 0;
+ VALUE2 = 1;
+}
+
+message TMessage2 {
+ optional double Double = 1;
+ optional float Float = 2;
+ optional int32 Int32 = 3;
+ optional int64 Int64 = 4;
+ optional uint32 UInt32 = 5;
+ optional uint64 UInt64 = 6;
+ optional sint32 SInt32 = 7;
+ optional sint64 SInt64 = 8;
+ optional fixed32 Fixed32 = 9;
+ optional fixed64 Fixed64 = 10;
+ optional sfixed32 SFixed32 = 11;
+ optional sfixed64 SFixed64 = 12;
+ optional bool Bool = 13;
+ optional string String = 14;
+ optional bytes Bytes = 15;
+ optional EEnum Enum = 16;
+
+ repeated double Doubles = 18;
+ repeated float Floats = 19;
+ repeated int32 Int32s = 20;
+ repeated int64 Int64s = 21;
+ repeated uint32 UInt32s = 22;
+ repeated uint64 UInt64s = 23;
+ repeated sint32 SInt32s = 24;
+ repeated sint64 SInt64s = 25;
+ repeated fixed32 Fixed32s = 26;
+ repeated fixed64 Fixed64s = 27;
+ repeated sfixed32 SFixed32s = 28;
+ repeated sfixed64 SFixed64s = 29;
+ repeated bool Bools = 30;
+ repeated string Strings = 31;
+ repeated bytes Bytess = 32;
+ repeated EEnum Enums = 33;
+}
diff --git a/library/cpp/scheme/ya.make b/library/cpp/scheme/ya.make
index 9f1d307a71..bac08ba5a4 100644
--- a/library/cpp/scheme/ya.make
+++ b/library/cpp/scheme/ya.make
@@ -8,7 +8,7 @@ SRCS(
scimpl.h
scimpl_defs.h
scimpl_private.cpp
- scimpl_protobuf.cpp
+ scimpl_protobuf.cpp
scimpl_select.rl6
scimpl_json_read.cpp
scimpl_json_write.cpp
@@ -22,4 +22,4 @@ PEERDIR(
GENERATE_ENUM_SERIALIZATION(scheme.h)
-END()
+END()