aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/json
diff options
context:
space:
mode:
authorluckybug <luckybug@yandex-team.ru>2022-02-10 16:50:27 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:27 +0300
commitb455da0978714a8b8dd026fc564b36dea5948f79 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/json
parenta6d369648d0e4e2d446acfd469aced762d3c0492 (diff)
downloadydb-b455da0978714a8b8dd026fc564b36dea5948f79.tar.gz
Restoring authorship annotation for <luckybug@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/json')
-rw-r--r--library/cpp/json/ut/json_saveload_ut.cpp68
-rw-r--r--library/cpp/json/ut/ya.make2
-rw-r--r--library/cpp/json/writer/json_value.cpp128
-rw-r--r--library/cpp/json/writer/json_value.h6
4 files changed, 102 insertions, 102 deletions
diff --git a/library/cpp/json/ut/json_saveload_ut.cpp b/library/cpp/json/ut/json_saveload_ut.cpp
index 7ffe0668dd..b480a80fe4 100644
--- a/library/cpp/json/ut/json_saveload_ut.cpp
+++ b/library/cpp/json/ut/json_saveload_ut.cpp
@@ -1,36 +1,36 @@
#include <library/cpp/json/json_value.h>
-
+
#include <library/cpp/testing/unittest/registar.h>
-#include <util/stream/buffer.h>
-#include <util/generic/buffer.h>
-#include <util/ysaveload.h>
-
-Y_UNIT_TEST_SUITE(JsonSaveLoad) {
- Y_UNIT_TEST(Serialize) {
-
- NJson::TJsonValue expected;
-
- expected["ui64"] = ui64(1);
- expected["i64"] = i64(2);
- expected["double"] = 2.0;
- expected["string"] = "text";
- expected["map"] = expected;
- expected["array"].SetType(NJson::JSON_ARRAY).GetArraySafe().emplace_back(expected);
- expected["null"].SetType(NJson::JSON_NULL);
- expected["undefined"].SetType(NJson::JSON_UNDEFINED);
-
- TBuffer buffer;
- {
- TBufferOutput output(buffer);
- ::Save(&output, expected);
- }
-
- NJson::TJsonValue load;
- {
- TBufferInput input(buffer);
- ::Load(&input, load);
- }
-
- UNIT_ASSERT_EQUAL_C(expected, load, "expected: " << expected << ", got: " << load);
- }
-}
+#include <util/stream/buffer.h>
+#include <util/generic/buffer.h>
+#include <util/ysaveload.h>
+
+Y_UNIT_TEST_SUITE(JsonSaveLoad) {
+ Y_UNIT_TEST(Serialize) {
+
+ NJson::TJsonValue expected;
+
+ expected["ui64"] = ui64(1);
+ expected["i64"] = i64(2);
+ expected["double"] = 2.0;
+ expected["string"] = "text";
+ expected["map"] = expected;
+ expected["array"].SetType(NJson::JSON_ARRAY).GetArraySafe().emplace_back(expected);
+ expected["null"].SetType(NJson::JSON_NULL);
+ expected["undefined"].SetType(NJson::JSON_UNDEFINED);
+
+ TBuffer buffer;
+ {
+ TBufferOutput output(buffer);
+ ::Save(&output, expected);
+ }
+
+ NJson::TJsonValue load;
+ {
+ TBufferInput input(buffer);
+ ::Load(&input, load);
+ }
+
+ UNIT_ASSERT_EQUAL_C(expected, load, "expected: " << expected << ", got: " << load);
+ }
+}
diff --git a/library/cpp/json/ut/ya.make b/library/cpp/json/ut/ya.make
index 401ca6bc4d..8e0362d84b 100644
--- a/library/cpp/json/ut/ya.make
+++ b/library/cpp/json/ut/ya.make
@@ -11,7 +11,7 @@ SRCS(
json_reader_ut.cpp
json_prettifier_ut.cpp
json_writer_ut.cpp
- json_saveload_ut.cpp
+ json_saveload_ut.cpp
)
END()
diff --git a/library/cpp/json/writer/json_value.cpp b/library/cpp/json/writer/json_value.cpp
index 7fd7344489..c61e8d1dc4 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 1ce89a9370..3f0f50bc4c 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: