diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/yson/json/json_writer.h | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yson/json/json_writer.h')
-rw-r--r-- | library/cpp/yson/json/json_writer.h | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/library/cpp/yson/json/json_writer.h b/library/cpp/yson/json/json_writer.h index 8dca12fe0e..d84ac0de53 100644 --- a/library/cpp/yson/json/json_writer.h +++ b/library/cpp/yson/json/json_writer.h @@ -8,33 +8,33 @@ #include <util/generic/vector.h> namespace NYT { - //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// - enum EJsonFormat { - JF_TEXT, - JF_PRETTY - }; + enum EJsonFormat { + JF_TEXT, + JF_PRETTY + }; - enum EJsonAttributesMode { - JAM_NEVER, - JAM_ON_DEMAND, - JAM_ALWAYS - }; + enum EJsonAttributesMode { + JAM_NEVER, + JAM_ON_DEMAND, + JAM_ALWAYS + }; - enum ESerializedBoolFormat { - SBF_BOOLEAN, - SBF_STRING - }; + enum ESerializedBoolFormat { + SBF_BOOLEAN, + SBF_STRING + }; - class TJsonWriter + class TJsonWriter : public ::NYson::TYsonConsumerBase { - public: - TJsonWriter( - IOutputStream* output, + public: + TJsonWriter( + IOutputStream* output, ::NYson::EYsonType type = ::NYson::EYsonType::Node, - EJsonFormat format = JF_TEXT, - EJsonAttributesMode attributesMode = JAM_ON_DEMAND, - ESerializedBoolFormat booleanFormat = SBF_STRING); + EJsonFormat format = JF_TEXT, + EJsonAttributesMode attributesMode = JAM_ON_DEMAND, + ESerializedBoolFormat booleanFormat = SBF_STRING); TJsonWriter( IOutputStream* output, @@ -43,47 +43,47 @@ namespace NYT { EJsonAttributesMode attributesMode = JAM_ON_DEMAND, ESerializedBoolFormat booleanFormat = SBF_STRING); - void Flush(); + void Flush(); void OnStringScalar(TStringBuf value) override; - void OnInt64Scalar(i64 value) override; - void OnUint64Scalar(ui64 value) override; - void OnDoubleScalar(double value) override; - void OnBooleanScalar(bool value) override; + void OnInt64Scalar(i64 value) override; + void OnUint64Scalar(ui64 value) override; + void OnDoubleScalar(double value) override; + void OnBooleanScalar(bool value) override; - void OnEntity() override; + void OnEntity() override; - void OnBeginList() override; - void OnListItem() override; - void OnEndList() override; + void OnBeginList() override; + void OnListItem() override; + void OnEndList() override; - void OnBeginMap() override; + void OnBeginMap() override; void OnKeyedItem(TStringBuf key) override; - void OnEndMap() override; + void OnEndMap() override; - void OnBeginAttributes() override; - void OnEndAttributes() override; + void OnBeginAttributes() override; + void OnEndAttributes() override; - private: - THolder<NJson::TJsonWriter> UnderlyingJsonWriter; - NJson::TJsonWriter* JsonWriter; - IOutputStream* Output; + private: + THolder<NJson::TJsonWriter> UnderlyingJsonWriter; + NJson::TJsonWriter* JsonWriter; + IOutputStream* Output; ::NYson::EYsonType Type; - EJsonAttributesMode AttributesMode; - ESerializedBoolFormat BooleanFormat; + EJsonAttributesMode AttributesMode; + ESerializedBoolFormat BooleanFormat; - void WriteStringScalar(const TStringBuf& value); + void WriteStringScalar(const TStringBuf& value); - void EnterNode(); - void LeaveNode(); - bool IsWriteAllowed(); + void EnterNode(); + void LeaveNode(); + bool IsWriteAllowed(); - TVector<bool> HasUnfoldedStructureStack; - int InAttributesBalance; - bool HasAttributes; - int Depth; - }; + TVector<bool> HasUnfoldedStructureStack; + int InAttributesBalance; + bool HasAttributes; + int Depth; + }; - //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// -} +} |