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;
56  Anchors m_anchors;
57  };
58 }
59 
60 #endif // NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
61 
virtual void OnDocumentEnd()
Definition: nodebuilder.cpp:22
virtual void OnMapEnd()
Definition: nodebuilder.cpp:67
std::size_t anchor_t
Definition: anchor.h:12
virtual void OnAlias(const Mark &mark, anchor_t anchor)
Definition: nodebuilder.cpp:34
::std::string string
Definition: gtest.h:1979
virtual void OnSequenceStart(const Mark &mark, const std::string &tag, anchor_t anchor)
Definition: nodebuilder.cpp:49
virtual void OnNull(const Mark &mark, anchor_t anchor)
Definition: nodebuilder.cpp:27
virtual void OnDocumentStart(const Mark &mark)
Definition: nodebuilder.cpp:18
std::vector< Node * > Anchors
Definition: nodebuilder.h:55
virtual void OnSequenceEnd()
Definition: nodebuilder.cpp:55
NodeBuilder(Node &root)
Definition: nodebuilder.cpp:8
void RegisterAnchor(anchor_t anchor, Node &node)
virtual void OnScalar(const Mark &mark, const std::string &tag, anchor_t anchor, const std::string &value)
Definition: nodebuilder.cpp:41
virtual void OnMapStart(const Mark &mark, const std::string &tag, anchor_t anchor)
Definition: nodebuilder.cpp:60
std::stack< Node * > m_stack
Definition: nodebuilder.h:51
std::stack< Node * > m_pendingKeys
Definition: nodebuilder.h:52
std::stack< bool > m_didPushKey
Definition: nodebuilder.h:53
void Insert(Node &node)


libpointmatcher
Author(s):
autogenerated on Sat May 27 2023 02:38:02