aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yson/json
diff options
context:
space:
mode:
authorelshiko <elshiko@yandex-team.ru>2022-02-10 16:49:20 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:20 +0300
commitdbb5d0d21c8cfc3d59e0f6d3b6f4ab06b58561f1 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/yson/json
parent455ab915435b70e433ed91eee2ca84f03122d6cb (diff)
downloadydb-dbb5d0d21c8cfc3d59e0f6d3b6f4ab06b58561f1.tar.gz
Restoring authorship annotation for <elshiko@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yson/json')
-rw-r--r--library/cpp/yson/json/yson2json_adapter.cpp126
-rw-r--r--library/cpp/yson/json/yson2json_adapter.h56
2 files changed, 91 insertions, 91 deletions
diff --git a/library/cpp/yson/json/yson2json_adapter.cpp b/library/cpp/yson/json/yson2json_adapter.cpp
index 58d9bf7fdb..b5e7c49d4d 100644
--- a/library/cpp/yson/json/yson2json_adapter.cpp
+++ b/library/cpp/yson/json/yson2json_adapter.cpp
@@ -1,82 +1,82 @@
-#include "yson2json_adapter.h"
-
-namespace NYT {
+#include "yson2json_adapter.h"
+
+namespace NYT {
TYson2JsonCallbacksAdapter::TYson2JsonCallbacksAdapter(::NYson::TYsonConsumerBase* impl, bool throwException)
- : NJson::TJsonCallbacks(throwException)
+ : NJson::TJsonCallbacks(throwException)
, Impl_(impl)
- {
- }
-
- bool TYson2JsonCallbacksAdapter::OnNull() {
- WrapIfListItem();
+ {
+ }
+
+ bool TYson2JsonCallbacksAdapter::OnNull() {
+ WrapIfListItem();
Impl_->OnEntity();
- return true;
- }
-
- bool TYson2JsonCallbacksAdapter::OnBoolean(bool val) {
- WrapIfListItem();
+ return true;
+ }
+
+ bool TYson2JsonCallbacksAdapter::OnBoolean(bool val) {
+ WrapIfListItem();
Impl_->OnBooleanScalar(val);
- return true;
- }
-
- bool TYson2JsonCallbacksAdapter::OnInteger(long long val) {
- WrapIfListItem();
+ return true;
+ }
+
+ bool TYson2JsonCallbacksAdapter::OnInteger(long long val) {
+ WrapIfListItem();
Impl_->OnInt64Scalar(val);
- return true;
- }
-
- bool TYson2JsonCallbacksAdapter::OnUInteger(unsigned long long val) {
- WrapIfListItem();
+ return true;
+ }
+
+ bool TYson2JsonCallbacksAdapter::OnUInteger(unsigned long long val) {
+ WrapIfListItem();
Impl_->OnUint64Scalar(val);
- return true;
- }
-
- bool TYson2JsonCallbacksAdapter::OnString(const TStringBuf& val) {
- WrapIfListItem();
+ return true;
+ }
+
+ bool TYson2JsonCallbacksAdapter::OnString(const TStringBuf& val) {
+ WrapIfListItem();
Impl_->OnStringScalar(val);
- return true;
- }
-
- bool TYson2JsonCallbacksAdapter::OnDouble(double val) {
- WrapIfListItem();
+ return true;
+ }
+
+ bool TYson2JsonCallbacksAdapter::OnDouble(double val) {
+ WrapIfListItem();
Impl_->OnDoubleScalar(val);
- return true;
- }
-
- bool TYson2JsonCallbacksAdapter::OnOpenArray() {
- WrapIfListItem();
+ return true;
+ }
+
+ bool TYson2JsonCallbacksAdapter::OnOpenArray() {
+ WrapIfListItem();
State_.ContextStack.push(true);
Impl_->OnBeginList();
- return true;
- }
-
- bool TYson2JsonCallbacksAdapter::OnCloseArray() {
+ return true;
+ }
+
+ bool TYson2JsonCallbacksAdapter::OnCloseArray() {
State_.ContextStack.pop();
Impl_->OnEndList();
- return true;
- }
-
- bool TYson2JsonCallbacksAdapter::OnOpenMap() {
- WrapIfListItem();
+ return true;
+ }
+
+ bool TYson2JsonCallbacksAdapter::OnOpenMap() {
+ WrapIfListItem();
State_.ContextStack.push(false);
Impl_->OnBeginMap();
- return true;
- }
-
- bool TYson2JsonCallbacksAdapter::OnCloseMap() {
+ return true;
+ }
+
+ bool TYson2JsonCallbacksAdapter::OnCloseMap() {
State_.ContextStack.pop();
Impl_->OnEndMap();
- return true;
- }
-
- bool TYson2JsonCallbacksAdapter::OnMapKey(const TStringBuf& val) {
+ return true;
+ }
+
+ bool TYson2JsonCallbacksAdapter::OnMapKey(const TStringBuf& val) {
Impl_->OnKeyedItem(val);
- return true;
- }
-
- void TYson2JsonCallbacksAdapter::WrapIfListItem() {
+ return true;
+ }
+
+ void TYson2JsonCallbacksAdapter::WrapIfListItem() {
if (!State_.ContextStack.empty() && State_.ContextStack.top()) {
Impl_->OnListItem();
- }
- }
-}
+ }
+ }
+}
diff --git a/library/cpp/yson/json/yson2json_adapter.h b/library/cpp/yson/json/yson2json_adapter.h
index 9b42386732..da1bf5ba70 100644
--- a/library/cpp/yson/json/yson2json_adapter.h
+++ b/library/cpp/yson/json/yson2json_adapter.h
@@ -1,15 +1,15 @@
-#pragma once
-
+#pragma once
+
#include <library/cpp/yson/consumer.h>
-
+
#include <library/cpp/json/json_reader.h>
-
-#include <util/generic/stack.h>
-
-namespace NYT {
- class TYson2JsonCallbacksAdapter
- : public NJson::TJsonCallbacks {
- public:
+
+#include <util/generic/stack.h>
+
+namespace NYT {
+ class TYson2JsonCallbacksAdapter
+ : public NJson::TJsonCallbacks {
+ public:
class TState {
private:
// Stores current context stack
@@ -22,19 +22,19 @@ namespace NYT {
public:
TYson2JsonCallbacksAdapter(::NYson::TYsonConsumerBase* impl, bool throwException = false);
-
- bool OnNull() override;
- bool OnBoolean(bool val) override;
- bool OnInteger(long long val) override;
- bool OnUInteger(unsigned long long val) override;
- bool OnString(const TStringBuf& val) override;
- bool OnDouble(double val) override;
- bool OnOpenArray() override;
- bool OnCloseArray() override;
- bool OnOpenMap() override;
- bool OnCloseMap() override;
- bool OnMapKey(const TStringBuf& val) override;
-
+
+ bool OnNull() override;
+ bool OnBoolean(bool val) override;
+ bool OnInteger(long long val) override;
+ bool OnUInteger(unsigned long long val) override;
+ bool OnString(const TStringBuf& val) override;
+ bool OnDouble(double val) override;
+ bool OnOpenArray() override;
+ bool OnCloseArray() override;
+ bool OnOpenMap() override;
+ bool OnCloseMap() override;
+ bool OnMapKey(const TStringBuf& val) override;
+
TState State() const {
return State_;
}
@@ -43,11 +43,11 @@ namespace NYT {
State_ = state;
}
- private:
- void WrapIfListItem();
-
- private:
+ private:
+ void WrapIfListItem();
+
+ private:
::NYson::TYsonConsumerBase* Impl_;
TState State_;
- };
+ };
}