diff options
author | luckybug <luckybug@yandex-team.ru> | 2022-02-10 16:50:26 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:26 +0300 |
commit | a6d369648d0e4e2d446acfd469aced762d3c0492 (patch) | |
tree | a4a12fa83066f49578432d73b5cc9e01aff081f3 /library/cpp/json/writer | |
parent | 74b68813c7dbee6e7538883986e9657eb0593d86 (diff) | |
download | ydb-a6d369648d0e4e2d446acfd469aced762d3c0492.tar.gz |
Restoring authorship annotation for <luckybug@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/json/writer')
-rw-r--r-- | library/cpp/json/writer/json_value.cpp | 128 | ||||
-rw-r--r-- | library/cpp/json/writer/json_value.h | 6 |
2 files changed, 67 insertions, 67 deletions
diff --git a/library/cpp/json/writer/json_value.cpp b/library/cpp/json/writer/json_value.cpp index c61e8d1dc4..7fd7344489 100644 --- a/library/cpp/json/writer/json_value.cpp +++ b/library/cpp/json/writer/json_value.cpp @@ -11,8 +11,8 @@ #include <util/string/type.h> #include <util/string/vector.h> #include <util/system/yassert.h> -#include <util/ysaveload.h> -#include <util/generic/bt_exception.h> +#include <util/ysaveload.h> +#include <util/generic/bt_exception.h> static bool AreJsonMapsEqual(const NJson::TJsonValue& lhs, const NJson::TJsonValue& rhs) { @@ -989,68 +989,68 @@ namespace NJson { tmp.SwapWithUndefined(rhs); } - void TJsonValue::Save(IOutputStream* s) const { - ::Save(s, static_cast<ui8>(Type)); - switch (Type) { - case JSON_UNDEFINED:break; - case JSON_NULL:break; - case JSON_BOOLEAN: - ::Save(s, Value.Boolean); - break; - case JSON_INTEGER: - ::Save(s, Value.Integer); - break; - case JSON_UINTEGER: - ::Save(s, Value.UInteger); - break; - case JSON_DOUBLE: - ::Save(s, Value.Double); - break; - case JSON_STRING: - ::Save(s, Value.String); - break; - case JSON_MAP: - ::Save(s, *Value.Map); - break; - case JSON_ARRAY: - ::Save(s, *Value.Array); - break; - } - } - - void TJsonValue::Load(IInputStream* s) { - { - ui8 loadedType = {}; - ::Load(s, loadedType); - SetType(static_cast<EJsonValueType>(loadedType)); - } - switch (Type) { - case JSON_UNDEFINED:break; - case JSON_NULL:break; - case JSON_BOOLEAN: - ::Load(s, Value.Boolean); - break; - case JSON_INTEGER: - ::Load(s, Value.Integer); - break; - case JSON_UINTEGER: - ::Load(s, Value.UInteger); - break; - case JSON_DOUBLE: - ::Load(s, Value.Double); - break; - case JSON_STRING: - ::Load(s, Value.String); - break; - case JSON_MAP: - ::Load(s, *Value.Map); - break; - case JSON_ARRAY: - ::Load(s, *Value.Array); - break; - } - } - + void TJsonValue::Save(IOutputStream* s) const { + ::Save(s, static_cast<ui8>(Type)); + switch (Type) { + case JSON_UNDEFINED:break; + case JSON_NULL:break; + case JSON_BOOLEAN: + ::Save(s, Value.Boolean); + break; + case JSON_INTEGER: + ::Save(s, Value.Integer); + break; + case JSON_UINTEGER: + ::Save(s, Value.UInteger); + break; + case JSON_DOUBLE: + ::Save(s, Value.Double); + break; + case JSON_STRING: + ::Save(s, Value.String); + break; + case JSON_MAP: + ::Save(s, *Value.Map); + break; + case JSON_ARRAY: + ::Save(s, *Value.Array); + break; + } + } + + void TJsonValue::Load(IInputStream* s) { + { + ui8 loadedType = {}; + ::Load(s, loadedType); + SetType(static_cast<EJsonValueType>(loadedType)); + } + switch (Type) { + case JSON_UNDEFINED:break; + case JSON_NULL:break; + case JSON_BOOLEAN: + ::Load(s, Value.Boolean); + break; + case JSON_INTEGER: + ::Load(s, Value.Integer); + break; + case JSON_UINTEGER: + ::Load(s, Value.UInteger); + break; + case JSON_DOUBLE: + ::Load(s, Value.Double); + break; + case JSON_STRING: + ::Load(s, Value.String); + break; + case JSON_MAP: + ::Load(s, *Value.Map); + break; + case JSON_ARRAY: + ::Load(s, *Value.Array); + break; + } + } + //**************************************************************** bool GetMapPointer(const TJsonValue& jv, const size_t index, const TJsonValue::TMapType** value) { diff --git a/library/cpp/json/writer/json_value.h b/library/cpp/json/writer/json_value.h index 3f0f50bc4c..1ce89a9370 100644 --- a/library/cpp/json/writer/json_value.h +++ b/library/cpp/json/writer/json_value.h @@ -186,11 +186,11 @@ namespace NJson { void Swap(TJsonValue& rhs) noexcept; // save using util/ysaveload.h serialization (not to JSON stream) - void Save(IOutputStream* s) const; + void Save(IOutputStream* s) const; // load using util/ysaveload.h serialization (not as JSON stream) - void Load(IInputStream* s); - + void Load(IInputStream* s); + static const TJsonValue UNDEFINED; private: |