aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/json/json_writer.h
diff options
context:
space:
mode:
authoraligus <aligus@yandex-team.ru>2022-02-10 16:49:24 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:24 +0300
commitc2bb7445128368226bd179d54d6a238c9fd3065e (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/json/json_writer.h
parent3f79772915172a9f5407c1a815806a8c8ba67c60 (diff)
downloadydb-c2bb7445128368226bd179d54d6a238c9fd3065e.tar.gz
Restoring authorship annotation for <aligus@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/json/json_writer.h')
-rw-r--r--library/cpp/json/json_writer.h36
1 files changed, 18 insertions, 18 deletions
diff --git a/library/cpp/json/json_writer.h b/library/cpp/json/json_writer.h
index 0b5b1039c1..c7f5c9499a 100644
--- a/library/cpp/json/json_writer.h
+++ b/library/cpp/json/json_writer.h
@@ -1,17 +1,17 @@
-#pragma once
-
+#pragma once
+
// Deprecated. Use library/cpp/json/writer in new code.
#include "json_value.h"
#include <library/cpp/json/writer/json.h>
-#include <util/stream/output.h>
-#include <util/generic/hash.h>
+#include <util/stream/output.h>
+#include <util/generic/hash.h>
#include <util/generic/maybe.h>
-#include <util/generic/strbuf.h>
-
-namespace NJson {
+#include <util/generic/strbuf.h>
+
+namespace NJson {
struct TJsonWriterConfig {
constexpr static ui32 DefaultDoubleNDigits = 10;
constexpr static ui32 DefaultFloatNDigits = 6;
@@ -19,7 +19,7 @@ namespace NJson {
inline TJsonWriterConfig& SetUnbuffered(bool v) noexcept {
Unbuffered = v;
-
+
return *this;
}
@@ -61,25 +61,25 @@ namespace NJson {
TJsonWriter(IOutputStream* out, bool formatOutput, bool sortkeys = false, bool validateUtf8 = true);
TJsonWriter(IOutputStream* out, const TJsonWriterConfig& config, bool DontFlushInDestructor = false);
~TJsonWriter();
-
+
void Flush();
-
+
void OpenMap();
void OpenMap(const TStringBuf& key) {
Buf.WriteKey(key);
OpenMap();
}
void CloseMap();
-
+
void OpenArray();
void OpenArray(const TStringBuf& key) {
Buf.WriteKey(key);
OpenArray();
}
void CloseArray();
-
+
void WriteNull();
-
+
void Write(const TStringBuf& value);
void Write(float value);
void Write(double value);
@@ -109,7 +109,7 @@ namespace NJson {
void Write(unsigned short value) {
Write((unsigned long long)value);
}
-
+
void Write(const unsigned char* value) {
Write((const char*)value);
}
@@ -122,12 +122,12 @@ namespace NJson {
void Write(const std::string& value) {
Write(TStringBuf(value));
}
-
+
// write raw json without checks
void UnsafeWrite(const TStringBuf& value) {
Buf.UnsafeWriteValue(value);
}
-
+
template <typename T>
void Write(const TStringBuf& key, const T& value) {
Buf.WriteKey(key);
@@ -139,7 +139,7 @@ namespace NJson {
Buf.WriteKey(key);
UnsafeWrite(value);
}
-
+
void WriteNull(const TStringBuf& key) {
Buf.WriteKey(key);
WriteNull();
@@ -193,4 +193,4 @@ namespace NJson {
TString WriteJson(const TJsonValue*, bool formatOutput = true, bool sortkeys = false, bool validateUtf8 = false);
TString WriteJson(const TJsonValue&, bool formatOutput = true, bool sortkeys = false, bool validateUtf8 = false);
void WriteJson(IOutputStream*, const TJsonValue*, const TJsonWriterConfig& config);
-}
+}