nodebuilder.h
Go to the documentation of this file.
00001 #ifndef NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
00002 #define NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
00003 
00004 #if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
00005 #pragma once
00006 #endif
00007 
00008 #include "yaml-cpp-pm/eventhandler.h"
00009 #include <map>
00010 #include <memory>
00011 #include <stack>
00012 #include <vector>
00013 
00014 namespace YAML_PM
00015 {
00016         class Node;
00017         
00018         class NodeBuilder: public EventHandler
00019         {
00020         public:
00021                 explicit NodeBuilder(Node& root);
00022                 virtual ~NodeBuilder();
00023 
00024                 virtual void OnDocumentStart(const Mark& mark);
00025                 virtual void OnDocumentEnd();
00026                 
00027                 virtual void OnNull(const Mark& mark, anchor_t anchor);
00028                 virtual void OnAlias(const Mark& mark, anchor_t anchor);
00029                 virtual void OnScalar(const Mark& mark, const std::string& tag, anchor_t anchor, const std::string& value);
00030                 
00031                 virtual void OnSequenceStart(const Mark& mark, const std::string& tag, anchor_t anchor);
00032                 virtual void OnSequenceEnd();
00033                 
00034                 virtual void OnMapStart(const Mark& mark, const std::string& tag, anchor_t anchor);
00035                 virtual void OnMapEnd();
00036                 
00037         private:
00038                 Node& Push(anchor_t anchor);
00039                 Node& Push();
00040                 Node& Top();
00041                 void Pop();
00042 
00043                 void Insert(Node& node);
00044                 void RegisterAnchor(anchor_t anchor, Node& node);
00045                 
00046         private:
00047                 Node& m_root;
00048                 bool m_initializedRoot;
00049                 bool m_finished;
00050                 
00051                 std::stack<Node *> m_stack;
00052                 std::stack<Node *> m_pendingKeys;
00053                 std::stack<bool> m_didPushKey;
00054 
00055                 typedef std::vector<Node *> Anchors;
00056                 Anchors m_anchors;
00057         };
00058 }
00059 
00060 #endif // NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
00061 


upstream_src
Author(s):
autogenerated on Mon Oct 6 2014 10:27:42