aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/json
diff options
context:
space:
mode:
authorivanmorozov <ivanmorozov@yandex-team.ru>2022-02-10 16:47:33 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:33 +0300
commitcba5d9a444e2cfe105f55ccda66cd21d50440017 (patch)
tree79983e83d1a91aebeb1999338090eec69e24cc33 /library/cpp/json
parenteb540cc7a103419462d0cc870ca403966e2194c6 (diff)
downloadydb-cba5d9a444e2cfe105f55ccda66cd21d50440017.tar.gz
Restoring authorship annotation for <ivanmorozov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/json')
-rw-r--r--library/cpp/json/json_writer.cpp12
-rw-r--r--library/cpp/json/json_writer.h2
-rw-r--r--library/cpp/json/writer/json_value.cpp18
-rw-r--r--library/cpp/json/writer/json_value.h10
-rw-r--r--library/cpp/json/writer/json_value_ut.cpp32
5 files changed, 37 insertions, 37 deletions
diff --git a/library/cpp/json/json_writer.cpp b/library/cpp/json/json_writer.cpp
index 3d058bae36..a6345e0943 100644
--- a/library/cpp/json/json_writer.cpp
+++ b/library/cpp/json/json_writer.cpp
@@ -118,22 +118,22 @@ namespace NJson {
Buf.WriteJsonValue(v, SortKeys, FloatToStringMode, DoubleNDigits);
}
- void TJsonWriter::Write(const TJsonValue& v) {
- Buf.WriteJsonValue(&v, SortKeys, FloatToStringMode, DoubleNDigits);
- }
-
+ void TJsonWriter::Write(const TJsonValue& v) {
+ Buf.WriteJsonValue(&v, SortKeys, FloatToStringMode, DoubleNDigits);
+ }
+
TString WriteJson(const TJsonValue* value, bool formatOutput, bool sortkeys, bool validateUtf8) {
TStringStream ss;
WriteJson(&ss, value, formatOutput, sortkeys, validateUtf8);
return ss.Str();
}
-
+
TString WriteJson(const TJsonValue& value, bool formatOutput, bool sortkeys, bool validateUtf8) {
TStringStream ss;
WriteJson(&ss, &value, formatOutput, sortkeys, validateUtf8);
return ss.Str();
}
-
+
void WriteJson(IOutputStream* out, const TJsonValue* val, bool formatOutput, bool sortkeys, bool validateUtf8) {
TJsonWriter w(out, formatOutput, sortkeys, validateUtf8);
w.Write(val);
diff --git a/library/cpp/json/json_writer.h b/library/cpp/json/json_writer.h
index c7f5c9499a..71b5e4d1d0 100644
--- a/library/cpp/json/json_writer.h
+++ b/library/cpp/json/json_writer.h
@@ -85,7 +85,7 @@ namespace NJson {
void Write(double value);
void Write(bool value);
void Write(const TJsonValue* value);
- void Write(const TJsonValue& value);
+ void Write(const TJsonValue& value);
// must use all variations of integer types since long
// and long long are different types but with same size
diff --git a/library/cpp/json/writer/json_value.cpp b/library/cpp/json/writer/json_value.cpp
index c61e8d1dc4..fe9ae61505 100644
--- a/library/cpp/json/writer/json_value.cpp
+++ b/library/cpp/json/writer/json_value.cpp
@@ -9,7 +9,7 @@
#include <util/stream/output.h>
#include <util/string/cast.h>
#include <util/string/type.h>
-#include <util/string/vector.h>
+#include <util/string/vector.h>
#include <util/system/yassert.h>
#include <util/ysaveload.h>
#include <util/generic/bt_exception.h>
@@ -850,7 +850,7 @@ namespace NJson {
}
return currentJson;
- }
+ }
} // anonymous namespace
bool TJsonValue::GetValueByPath(const TStringBuf path, TJsonValue& result, char delimiter) const {
@@ -860,8 +860,8 @@ namespace NJson {
return true;
}
return false;
- }
-
+ }
+
bool TJsonValue::SetValueByPath(const TStringBuf path, const TJsonValue& value, char delimiter) {
TJsonValue* const ptr = GetValuePtrByPath<true>(this, path, delimiter);
if (ptr) {
@@ -886,12 +886,12 @@ namespace NJson {
TJsonValue* TJsonValue::GetValueByPath(const TStringBuf key, char delim) noexcept {
return GetValuePtrByPath<false>(this, key, delim);
- }
+ }
void TJsonValue::DoScan(const TString& path, TJsonValue* parent, IScanCallback& callback) {
if (!callback.Do(path, parent, *this)) {
return;
- }
+ }
if (Type == JSON_MAP) {
for (auto&& i : *Value.Map) {
@@ -901,9 +901,9 @@ namespace NJson {
for (ui32 i = 0; i < Value.Array->size(); ++i) {
(*Value.Array)[i].DoScan(TString::Join(path, "[", ToString(i), "]"), this, callback);
}
- }
- }
-
+ }
+ }
+
void TJsonValue::Scan(IScanCallback& callback) {
DoScan("", nullptr, callback);
}
diff --git a/library/cpp/json/writer/json_value.h b/library/cpp/json/writer/json_value.h
index 3f0f50bc4c..b41712c5d6 100644
--- a/library/cpp/json/writer/json_value.h
+++ b/library/cpp/json/writer/json_value.h
@@ -27,13 +27,13 @@ namespace NJson {
class IScanCallback {
public:
virtual ~IScanCallback() = default;
-
+
virtual bool Do(const TString& path, TJsonValue* parent, TJsonValue& value) = 0;
};
-
+
class TJsonValue {
void Clear() noexcept;
-
+
public:
typedef THashMap<TString, TJsonValue> TMapType;
typedef TDeque<TJsonValue> TArray;
@@ -96,7 +96,7 @@ namespace NJson {
// returns NULL on failure
const TJsonValue* GetValueByPath(TStringBuf path, char delimiter = '.') const noexcept;
TJsonValue* GetValueByPath(TStringBuf path, char delimiter = '.') noexcept;
-
+
void EraseValue(TStringBuf key);
void EraseValue(size_t index);
@@ -178,7 +178,7 @@ namespace NJson {
/// Non-robust comparison.
bool operator==(const TJsonValue& rhs) const;
-
+
bool operator!=(const TJsonValue& rhs) const {
return !(*this == rhs);
}
diff --git a/library/cpp/json/writer/json_value_ut.cpp b/library/cpp/json/writer/json_value_ut.cpp
index dc7f6affdf..40000bd68a 100644
--- a/library/cpp/json/writer/json_value_ut.cpp
+++ b/library/cpp/json/writer/json_value_ut.cpp
@@ -234,22 +234,22 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {
}
Y_UNIT_TEST(GetValueByPathTest) {
- {
- TJsonValue lhs;
- TJsonValue first;
- TJsonValue second;
- TJsonValue last;
- first.InsertValue("e", "f");
- second.InsertValue("c", first);
- last.InsertValue("a", second);
- lhs.InsertValue("l", last);
-
- TJsonValue result;
+ {
+ TJsonValue lhs;
+ TJsonValue first;
+ TJsonValue second;
+ TJsonValue last;
+ first.InsertValue("e", "f");
+ second.InsertValue("c", first);
+ last.InsertValue("a", second);
+ lhs.InsertValue("l", last);
+
+ TJsonValue result;
UNIT_ASSERT(lhs.GetValueByPath("l/a/c/e", result, '/'));
- UNIT_ASSERT(result.GetStringRobust() == "f");
+ UNIT_ASSERT(result.GetStringRobust() == "f");
UNIT_ASSERT(!lhs.GetValueByPath("l/a/c/se", result, '/'));
UNIT_ASSERT(lhs.GetValueByPath("l/a/c", result, '/'));
- UNIT_ASSERT(result.GetStringRobust() == "{\"e\":\"f\"}");
+ UNIT_ASSERT(result.GetStringRobust() == "{\"e\":\"f\"}");
// faster TStringBuf version
UNIT_ASSERT_EQUAL(*lhs.GetValueByPath("l", '/'), last);
@@ -282,9 +282,9 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {
UNIT_ASSERT(lhs.SetValueByPath("l/a/c/se", "h", '/'));
UNIT_ASSERT(lhs.GetValueByPath("l/a/c/se", result, '/'));
UNIT_ASSERT(result.GetStringRobust() == "h");
- }
- }
-
+ }
+ }
+
Y_UNIT_TEST(GetValueByPathConstTest) {
TJsonValue lhs;
TJsonValue first;