nodebuilder.h
Go to the documentation of this file.
1 #ifndef NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
2 #define NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
3 
4 #if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
5 #pragma once
6 #endif
7 
9 #include <map>
10 #include <memory>
11 #include <stack>
12 #include <vector>
13 
14 namespace YAML_PM
15 {
16  class Node;
17 
18  class NodeBuilder: public EventHandler
19  {
20  public:
21  explicit NodeBuilder(Node& root);
22  virtual ~NodeBuilder();
23 
24  virtual void OnDocumentStart(const Mark& mark);
25  virtual void OnDocumentEnd();
26 
27  virtual void OnNull(const Mark& mark, anchor_t anchor);
28  virtual void OnAlias(const Mark& mark, anchor_t anchor);
29  virtual void OnScalar(const Mark& mark, const std::string& tag, anchor_t anchor, const std::string& value);
30 
31  virtual void OnSequenceStart(const Mark& mark, const std::string& tag, anchor_t anchor);
32  virtual void OnSequenceEnd();
33 
34  virtual void OnMapStart(const Mark& mark, const std::string& tag, anchor_t anchor);
35  virtual void OnMapEnd();
36 
37  private:
38  Node& Push(anchor_t anchor);
39  Node& Push();
40  Node& Top();
41  void Pop();
42 
43  void Insert(Node& node);
44  void RegisterAnchor(anchor_t anchor, Node& node);
45 
46  private:
49  bool m_finished;
50 
51  std::stack<Node *> m_stack;
52  std::stack<Node *> m_pendingKeys;
53  std::stack<bool> m_didPushKey;
54 
55  typedef std::vector<Node *> Anchors;
57  };
58 }
59 
60 #endif // NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
61 
YAML_PM::NodeBuilder::OnMapEnd
virtual void OnMapEnd()
Definition: nodebuilder.cpp:67
YAML_PM::NodeBuilder::m_pendingKeys
std::stack< Node * > m_pendingKeys
Definition: nodebuilder.h:52
YAML_PM::NodeBuilder::Pop
void Pop()
Definition: nodebuilder.cpp:97
YAML_PM::NodeBuilder
Definition: nodebuilder.h:18
YAML_PM::NodeBuilder::Top
Node & Top()
Definition: nodebuilder.cpp:92
YAML_PM
Definition: aliasmanager.h:11
YAML_PM::NodeBuilder::Push
Node & Push()
Definition: nodebuilder.cpp:80
YAML_PM::NodeBuilder::OnAlias
virtual void OnAlias(const Mark &mark, anchor_t anchor)
Definition: nodebuilder.cpp:34
YAML_PM::EventHandler
Definition: eventhandler.h:15
YAML_PM::NodeBuilder::m_finished
bool m_finished
Definition: nodebuilder.h:49
eventhandler.h
testing::internal::string
::std::string string
Definition: gtest.h:1979
YAML_PM::NodeBuilder::m_anchors
Anchors m_anchors
Definition: nodebuilder.h:56
YAML_PM::NodeBuilder::m_root
Node & m_root
Definition: nodebuilder.h:47
YAML_PM::NodeBuilder::~NodeBuilder
virtual ~NodeBuilder()
Definition: nodebuilder.cpp:14
YAML_PM::NodeBuilder::OnNull
virtual void OnNull(const Mark &mark, anchor_t anchor)
Definition: nodebuilder.cpp:27
YAML_PM::NodeBuilder::OnSequenceStart
virtual void OnSequenceStart(const Mark &mark, const std::string &tag, anchor_t anchor)
Definition: nodebuilder.cpp:49
YAML_PM::NodeBuilder::OnSequenceEnd
virtual void OnSequenceEnd()
Definition: nodebuilder.cpp:55
YAML_PM::NodeBuilder::NodeBuilder
NodeBuilder(Node &root)
Definition: nodebuilder.cpp:8
YAML_PM::NodeBuilder::RegisterAnchor
void RegisterAnchor(anchor_t anchor, Node &node)
Definition: nodebuilder.cpp:138
YAML_PM::NodeBuilder::OnDocumentStart
virtual void OnDocumentStart(const Mark &mark)
Definition: nodebuilder.cpp:18
YAML_PM::NodeBuilder::Anchors
std::vector< Node * > Anchors
Definition: nodebuilder.h:55
YAML_PM::Node
Definition: node.h:33
YAML_PM::NodeBuilder::m_stack
std::stack< Node * > m_stack
Definition: nodebuilder.h:51
YAML_PM::NodeBuilder::OnMapStart
virtual void OnMapStart(const Mark &mark, const std::string &tag, anchor_t anchor)
Definition: nodebuilder.cpp:60
YAML_PM::NodeBuilder::m_initializedRoot
bool m_initializedRoot
Definition: nodebuilder.h:48
YAML_PM::Mark
Definition: mark.h:13
YAML_PM::NodeBuilder::Insert
void Insert(Node &node)
Definition: nodebuilder.cpp:110
YAML_PM::NodeBuilder::OnScalar
virtual void OnScalar(const Mark &mark, const std::string &tag, anchor_t anchor, const std::string &value)
Definition: nodebuilder.cpp:41
YAML_PM::NodeBuilder::m_didPushKey
std::stack< bool > m_didPushKey
Definition: nodebuilder.h:53
YAML_PM::anchor_t
std::size_t anchor_t
Definition: anchor.h:12
YAML_PM::NodeBuilder::OnDocumentEnd
virtual void OnDocumentEnd()
Definition: nodebuilder.cpp:22


mp2p_icp
Author(s):
autogenerated on Wed Oct 23 2024 02:45:40