Go to the documentation of this file.00001 #ifndef EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
00002 #define EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
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 <stack>
00010
00011 namespace YAML_PM
00012 {
00013 class Emitter;
00014
00015 class EmitFromEvents: public EventHandler
00016 {
00017 public:
00018 EmitFromEvents(Emitter& emitter);
00019
00020 virtual void OnDocumentStart(const Mark& mark);
00021 virtual void OnDocumentEnd();
00022
00023 virtual void OnNull(const Mark& mark, anchor_t anchor);
00024 virtual void OnAlias(const Mark& mark, anchor_t anchor);
00025 virtual void OnScalar(const Mark& mark, const std::string& tag, anchor_t anchor, const std::string& value);
00026
00027 virtual void OnSequenceStart(const Mark& mark, const std::string& tag, anchor_t anchor);
00028 virtual void OnSequenceEnd();
00029
00030 virtual void OnMapStart(const Mark& mark, const std::string& tag, anchor_t anchor);
00031 virtual void OnMapEnd();
00032
00033 private:
00034 void BeginNode();
00035 void EmitProps(const std::string& tag, anchor_t anchor);
00036
00037 private:
00038 Emitter& m_emitter;
00039
00040 struct State { enum value { WaitingForSequenceEntry, WaitingForKey, WaitingForValue }; };
00041 std::stack<State::value> m_stateStack;
00042 };
00043 }
00044
00045 #endif // EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM