BRE12
parser.h
1 #ifndef PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
2 #define PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
3 
4 #if defined(_MSC_VER) || \
5  (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
6  (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
7 #pragma once
8 #endif
9 
10 #include <ios>
11 #include <memory>
12 
13 #include "yaml-cpp/dll.h"
14 #include "yaml-cpp/noncopyable.h"
15 
16 namespace YAML {
17 class EventHandler;
18 class Node;
19 class Scanner;
20 struct Directives;
21 struct Token;
22 
27 class YAML_CPP_API Parser : private noncopyable {
28  public:
30  Parser();
31 
36  explicit Parser(std::istream& in);
37 
38  ~Parser();
39 
41  explicit operator bool() const;
42 
47  void Load(std::istream& in);
48 
55  bool HandleNextDocument(EventHandler& eventHandler);
56 
57  void PrintTokens(std::ostream& out);
58 
59  private:
64  void ParseDirectives();
65 
66  void HandleDirective(const Token& token);
67 
72  void HandleYamlDirective(const Token& token);
73 
78  void HandleTagDirective(const Token& token);
79 
80  private:
81  std::unique_ptr<Scanner> m_pScanner;
82  std::unique_ptr<Directives> m_pDirectives;
83 };
84 }
85 
86 #endif // PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
Definition: eventhandler.h:18
A parser turns a stream of bytes into one stream of "events" per YAML document in the input stream...
Definition: parser.h:27
Definition: noncopyable.h:14
Definition: DrawableObjectLoader.h:10