blob: 13d2b5e4f5ec5387956b7da78512071ee422df21 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#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 OnBeginList(ui64 reserveSize);
void OnListItem() override;
void OnEndList() override;
void OnBeginMap() override;
void OnBeginMap(ui64 reserveSize);
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
|