aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yson/node/node_builder.h
diff options
context:
space:
mode:
authorDevtools Arcadia <arcadia-devtools@yandex-team.ru>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /library/cpp/yson/node/node_builder.h
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/cpp/yson/node/node_builder.h')
-rw-r--r--library/cpp/yson/node/node_builder.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/library/cpp/yson/node/node_builder.h b/library/cpp/yson/node/node_builder.h
new file mode 100644
index 0000000000..69800016e0
--- /dev/null
+++ b/library/cpp/yson/node/node_builder.h
@@ -0,0 +1,46 @@
+#pragma once
+
+#include "node.h"
+
+#include <library/cpp/json/json_reader.h>
+
+#include <library/cpp/yson/consumer.h>
+
+#include <util/generic/stack.h>
+
+namespace NYT {
+
+////////////////////////////////////////////////////////////////////////////////
+
+class TNodeBuilder
+ : public ::NYson::TYsonConsumerBase
+{
+public:
+ TNodeBuilder(TNode* node);
+
+ void OnStringScalar(TStringBuf) override;
+ void OnInt64Scalar(i64) override;
+ void OnUint64Scalar(ui64) override;
+ void OnDoubleScalar(double) override;
+ void OnBooleanScalar(bool) override;
+ void OnEntity() override;
+ void OnBeginList() override;
+ void OnListItem() override;
+ void OnEndList() override;
+ void OnBeginMap() override;
+ void OnKeyedItem(TStringBuf) override;
+ void OnEndMap() override;
+ void OnBeginAttributes() override;
+ void OnEndAttributes() override;
+ void OnNode(TNode node);
+
+private:
+ TStack<TNode*> Stack_;
+
+private:
+ inline void AddNode(TNode node, bool pop);
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
+} // namespace NYT