diff options
author | Vasily Gerasimov <UgnineSirdis@gmail.com> | 2022-02-10 16:49:10 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:10 +0300 |
commit | 1eb755fbca92172a6aec2f57371b2b3a19dfab43 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/protobuf/json/config.h | |
parent | 6cdc8f140213c595e4ad38bc3d97fcef1146b8c3 (diff) | |
download | ydb-1eb755fbca92172a6aec2f57371b2b3a19dfab43.tar.gz |
Restoring authorship annotation for Vasily Gerasimov <UgnineSirdis@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/protobuf/json/config.h')
-rw-r--r-- | library/cpp/protobuf/json/config.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/library/cpp/protobuf/json/config.h b/library/cpp/protobuf/json/config.h index 3985b917bc..dc84fb4d5d 100644 --- a/library/cpp/protobuf/json/config.h +++ b/library/cpp/protobuf/json/config.h @@ -1,19 +1,19 @@ -#pragma once - -#include "string_transform.h" +#pragma once + +#include "string_transform.h" #include "name_generator.h" - -#include <util/generic/vector.h> + +#include <util/generic/vector.h> #include <util/generic/yexception.h> - + #include <functional> -namespace NProtobufJson { +namespace NProtobufJson { struct TProto2JsonConfig { using TSelf = TProto2JsonConfig; - + bool FormatOutput = false; - + enum MissingKeyMode { // Skip missing keys MissingKeySkip = 0, @@ -32,10 +32,10 @@ namespace NProtobufJson { }; MissingKeyMode MissingSingleKeyMode = MissingKeySkip; MissingKeyMode MissingRepeatedKeyMode = MissingKeySkip; - + /// Add null value for missing fields (false by default). bool AddMissingFields = false; - + enum EnumValueMode { EnumNumber = 0, // default EnumName, @@ -44,7 +44,7 @@ namespace NProtobufJson { EnumFullNameLowerCase, }; EnumValueMode EnumMode = EnumNumber; - + enum FldNameMode { FieldNameOriginalCase = 0, // default FieldNameLowerCase, @@ -54,7 +54,7 @@ namespace NProtobufJson { FieldNameSnakeCaseDense // ABC -> abc, UserID -> user_id }; FldNameMode FieldNameMode = FieldNameOriginalCase; - + enum ExtFldNameMode { ExtFldNameFull = 0, // default, field.full_name() ExtFldNameShort // field.name() @@ -64,14 +64,14 @@ namespace NProtobufJson { /// Use 'json_name' protobuf option for field name, mutually exclusive /// with FieldNameMode. bool UseJsonName = false; - + /// 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; - + /// Stringify long integers which are not exactly representable by float or double values enum EStringifyLongNumbersMode { StringifyLongNumbersNever = 0, // default @@ -97,34 +97,34 @@ namespace NProtobufJson { MissingSingleKeyMode = mode; return *this; } - + TSelf& SetMissingRepeatedKeyMode(MissingKeyMode mode) { MissingRepeatedKeyMode = mode; return *this; } - + TSelf& SetAddMissingFields(bool add) { AddMissingFields = add; return *this; } - + TSelf& SetEnumMode(EnumValueMode mode) { EnumMode = mode; return *this; } - + TSelf& SetFieldNameMode(FldNameMode mode) { Y_ENSURE(mode == FieldNameOriginalCase || !UseJsonName, "FieldNameMode and UseJsonName are mutually exclusive"); FieldNameMode = mode; return *this; } - + TSelf& SetUseJsonName(bool jsonName) { Y_ENSURE(!jsonName || FieldNameMode == FieldNameOriginalCase, "FieldNameMode and UseJsonName are mutually exclusive"); UseJsonName = jsonName; return *this; } - + TSelf& SetExtensionFieldNameMode(ExtFldNameMode mode) { ExtensionFieldNameMode = mode; return *this; |