]> git.localhorst.tv Git - l2e.git/blob - src/loader/Interpreter.h
started an interpreter for parsed sources
[l2e.git] / src / loader / Interpreter.h
1 /*
2  * Interpreter.h
3  *
4  *  Created on: Aug 26, 2012
5  *      Author: holy
6  */
7
8 #ifndef LOADER_INTERPRETER_H_
9 #define LOADER_INTERPRETER_H_
10
11 #include <map>
12 #include <stdexcept>
13 #include <string>
14 #include <vector>
15
16 namespace battle {
17         class Monster;
18 }
19
20 namespace loader {
21
22 class Definition;
23 class ParsedSource;
24 class PropertyList;
25
26 class Interpreter {
27
28 public:
29         class Error: public std::runtime_error {
30         public:
31                 Error(const std::string &msg) : std::runtime_error("interpreter error: " + msg) { }
32         };
33
34 public:
35         Interpreter(const ParsedSource &source) : source(source) { }
36         ~Interpreter() { }
37 private:
38         Interpreter(const Interpreter &);
39         Interpreter &operator =(const Interpreter &);
40
41 public:
42         void ReadSource();
43
44 private:
45         void ReadLiteral(const Definition &);
46         void ReadObject(const Definition &);
47
48         void ReadMonster(battle::Monster &, const PropertyList &);
49
50 private:
51         const ParsedSource &source;
52         std::vector<battle::Monster> monsters;
53
54 };
55
56 }
57
58 #endif /* LOADER_INTERPRETER_H_ */