diff options
| author | serxa <[email protected]> | 2022-02-10 16:49:08 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:49:08 +0300 | 
| commit | d6d7db348c2cc64e71243cab9940ee6778f4317d (patch) | |
| tree | bac67f42a02f9368eb4d329f5d79b77d0a6adc18 /library/cpp/scheme | |
| parent | 8d57b69dee81198a59c39e64704f7dc9f04b4fbf (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/scheme')
| -rw-r--r-- | library/cpp/scheme/scheme.h | 12 | ||||
| -rw-r--r-- | library/cpp/scheme/scimpl_defs.h | 16 | ||||
| -rw-r--r-- | library/cpp/scheme/scimpl_protobuf.cpp | 60 | 
3 files changed, 44 insertions, 44 deletions
diff --git a/library/cpp/scheme/scheme.h b/library/cpp/scheme/scheme.h index 3d7c59f3c97..cfbb61580df 100644 --- a/library/cpp/scheme/scheme.h +++ b/library/cpp/scheme/scheme.h @@ -387,7 +387,7 @@ namespace NSc {          static TValue From(const ::google::protobuf::Message&, bool mapAsDict = false); -        void To(::google::protobuf::Message&, const TProtoOpts& opts = {}) const; +        void To(::google::protobuf::Message&, const TProtoOpts& opts = {}) const;       public:          inline explicit TValue(TPoolPtr&); @@ -421,11 +421,11 @@ namespace NSc {          static TValue FromField(const ::google::protobuf::Message&, const ::google::protobuf::FieldDescriptor*);          static TValue FromRepeatedField(const ::google::protobuf::Message&, const ::google::protobuf::FieldDescriptor*, int index); -        void ValueToField(const TValue& value, ::google::protobuf::Message&, const ::google::protobuf::FieldDescriptor*, const TProtoOpts& opts) const; -        void ToField(::google::protobuf::Message&, const ::google::protobuf::FieldDescriptor*, const TProtoOpts& opts) const; -        void ToEnumField(::google::protobuf::Message&, const ::google::protobuf::FieldDescriptor*, const TProtoOpts& opts) const; -        void ToRepeatedField(::google::protobuf::Message&, const ::google::protobuf::FieldDescriptor*, const TProtoOpts& opts) const; -        void ToMapField(::google::protobuf::Message&, const ::google::protobuf::FieldDescriptor*, const TProtoOpts& opts) const; +        void ValueToField(const TValue& value, ::google::protobuf::Message&, const ::google::protobuf::FieldDescriptor*, const TProtoOpts& opts) const;  +        void ToField(::google::protobuf::Message&, const ::google::protobuf::FieldDescriptor*, const TProtoOpts& opts) const;  +        void ToEnumField(::google::protobuf::Message&, const ::google::protobuf::FieldDescriptor*, const TProtoOpts& opts) const;  +        void ToRepeatedField(::google::protobuf::Message&, const ::google::protobuf::FieldDescriptor*, const TProtoOpts& opts) const;  +        void ToMapField(::google::protobuf::Message&, const ::google::protobuf::FieldDescriptor*, const TProtoOpts& opts) const;       }; diff --git a/library/cpp/scheme/scimpl_defs.h b/library/cpp/scheme/scimpl_defs.h index f3dd66b4379..8937b758374 100644 --- a/library/cpp/scheme/scimpl_defs.h +++ b/library/cpp/scheme/scimpl_defs.h @@ -117,14 +117,14 @@ namespace NSc {          }      }; -    struct TProtoOpts { -        // Serialization throws on unknown enum value if not set, else use default value -        bool UnknownEnumValueIsDefault = false; - -        // Serialization throws on type mismatch if not set, else leaves protobuf empty -        bool SkipTypeMismatch = false; -    }; - +    struct TProtoOpts {  +        // Serialization throws on unknown enum value if not set, else use default value  +        bool UnknownEnumValueIsDefault = false;  +  +        // Serialization throws on type mismatch if not set, else leaves protobuf empty  +        bool SkipTypeMismatch = false;  +    };  +       namespace NImpl {          class TKeySortContext;          class TSelfLoopContext; diff --git a/library/cpp/scheme/scimpl_protobuf.cpp b/library/cpp/scheme/scimpl_protobuf.cpp index 0c99122c69a..190449effab 100644 --- a/library/cpp/scheme/scimpl_protobuf.cpp +++ b/library/cpp/scheme/scimpl_protobuf.cpp @@ -129,7 +129,7 @@ namespace NSc {          return v;      } -    void TValue::To(Message& msg, const TProtoOpts& opts) const { +    void TValue::To(Message& msg, const TProtoOpts& opts) const {           msg.Clear();          if (IsNull()) { @@ -144,16 +144,16 @@ namespace NSc {          for (int i = 0, count = descriptor->field_count(); i < count; ++i) {              const FieldDescriptor* field = descriptor->field(i);              if (field->is_map()) { -                ToMapField(msg, field, opts); +                ToMapField(msg, field, opts);               } else if (field->is_repeated()) { -                ToRepeatedField(msg, field, opts); +                ToRepeatedField(msg, field, opts);               } else { -                ToField(msg, field, opts); +                ToField(msg, field, opts);               }          }      } -    void TValue::ValueToField(const TValue& value, Message& msg, const FieldDescriptor* field, const TProtoOpts& opts) const { +    void TValue::ValueToField(const TValue& value, Message& msg, const FieldDescriptor* field, const TProtoOpts& opts) const {           const TString& name = field->name();          if (value.IsNull()) {              if (field->is_required() && !field->has_default_value()) { @@ -190,10 +190,10 @@ namespace NSc {                  reflection->SetString(&msg, field, value.ForceString());                  break;              case FieldDescriptor::CPPTYPE_ENUM: -                value.ToEnumField(msg, field, opts); +                value.ToEnumField(msg, field, opts);                   break;              case FieldDescriptor::CPPTYPE_MESSAGE: -                value.To(*reflection->MutableMessage(&msg, field), opts); +                value.To(*reflection->MutableMessage(&msg, field), opts);                   break;              default:                  ythrow TSchemeException() @@ -202,13 +202,13 @@ namespace NSc {          }      } -    void TValue::ToField(Message& msg, const FieldDescriptor* field, const TProtoOpts& opts) const { +    void TValue::ToField(Message& msg, const FieldDescriptor* field, const TProtoOpts& opts) const {           const TString& name = field->name();          const TValue& value = Get(name); -        ValueToField(value, msg, field, opts); +        ValueToField(value, msg, field, opts);       } -    void TValue::ToEnumField(Message& msg, const FieldDescriptor* field, const TProtoOpts& opts) const { +    void TValue::ToEnumField(Message& msg, const FieldDescriptor* field, const TProtoOpts& opts) const {           const EnumDescriptor* enumField = field->enum_type();          const EnumValueDescriptor* enumFieldValue = IsString() @@ -216,11 +216,11 @@ namespace NSc {                                                          : enumField->FindValueByNumber(ForceIntNumber());          if (!enumFieldValue) { -            if (opts.UnknownEnumValueIsDefault) { -                enumFieldValue = field->default_value_enum(); -            } else { -                ythrow TSchemeException() << "invalid value of enum field " << field->name(); -            } +            if (opts.UnknownEnumValueIsDefault) {  +                enumFieldValue = field->default_value_enum();  +            } else {  +                ythrow TSchemeException() << "invalid value of enum field " << field->name();  +            }           }          const Reflection* reflection = msg.GetReflection(); @@ -232,7 +232,7 @@ namespace NSc {          }      } -    void TValue::ToRepeatedField(Message& msg, const FieldDescriptor* field, const TProtoOpts& opts) const { +    void TValue::ToRepeatedField(Message& msg, const FieldDescriptor* field, const TProtoOpts& opts) const {           const TString& name = field->name();          const TValue& fieldValue = Get(name); @@ -241,11 +241,11 @@ namespace NSc {          }          if (!fieldValue.IsArray()) { -            if (opts.SkipTypeMismatch) { -                return; // leave repeated field empty -            } else { -                ythrow TSchemeException() << "invalid type of repeated field " << name << ": not an array"; -            } +            if (opts.SkipTypeMismatch) {  +                return; // leave repeated field empty  +            } else {  +                ythrow TSchemeException() << "invalid type of repeated field " << name << ": not an array";  +            }           }          const Reflection* reflection = msg.GetReflection(); @@ -277,7 +277,7 @@ namespace NSc {                      reflection->AddString(&msg, field, value.ForceString());                      break;                  case FieldDescriptor::CPPTYPE_ENUM: -                    value.ToEnumField(msg, field, opts); +                    value.ToEnumField(msg, field, opts);                       break;                  case FieldDescriptor::CPPTYPE_MESSAGE:                      value.To(*reflection->AddMessage(&msg, field)); @@ -290,7 +290,7 @@ namespace NSc {          }      } -    void TValue::ToMapField(Message& msg, const FieldDescriptor* field, const TProtoOpts& opts) const { +    void TValue::ToMapField(Message& msg, const FieldDescriptor* field, const TProtoOpts& opts) const {           const TString& name = field->name();          const TValue& fieldValue = Get(name); @@ -300,16 +300,16 @@ namespace NSc {          if (fieldValue.IsArray()) {              // read dict from key, value array -            ToRepeatedField(msg, field, opts); +            ToRepeatedField(msg, field, opts);               return;          }          if (!fieldValue.IsDict()) { -            if (opts.SkipTypeMismatch) { -                return; // leave map field empty -            } else { -                ythrow TSchemeException() << "invalid type of map field " << name << ": not dict or array"; -            } +            if (opts.SkipTypeMismatch) {  +                return; // leave map field empty  +            } else {  +                ythrow TSchemeException() << "invalid type of map field " << name << ": not dict or array";  +            }           }          const Reflection* reflection = msg.GetReflection(); @@ -322,7 +322,7 @@ namespace NSc {              auto valueField = entryDesc->FindFieldByNumber(2);              auto entryReflection = entry->GetReflection();              entryReflection->SetString(entry.Get(), keyField, TString(value.first)); -            ValueToField(value.second, *entry, valueField, opts); +            ValueToField(value.second, *entry, valueField, opts);               mutableField.Add(*entry);          }      }  | 
