]> git.localhorst.tv Git - blank.git/blob - src/io/TokenStreamReader.hpp
split chunk stuff
[blank.git] / src / io / TokenStreamReader.hpp
1 #ifndef BLANK_IO_TOKENSTREAMREADER_HPP_
2 #define BLANK_IO_TOKENSTREAMREADER_HPP_
3
4 #include "Token.hpp"
5 #include "Tokenizer.hpp"
6
7 #include <iosfwd>
8 #include <string>
9 #include <glm/glm.hpp>
10
11
12 namespace blank {
13
14 class TokenStreamReader {
15
16 public:
17         TokenStreamReader(std::istream &);
18
19         bool HasMore();
20         const Token &Next();
21         const Token &Peek();
22
23         void Skip(Token::Type);
24
25         void ReadBoolean(bool &);
26         void ReadIdentifier(std::string &);
27         void ReadNumber(float &);
28         void ReadNumber(int &);
29         void ReadNumber(unsigned long &);
30         void ReadString(std::string &);
31
32         void ReadVec(glm::vec2 &);
33         void ReadVec(glm::vec3 &);
34         void ReadVec(glm::vec4 &);
35
36         void ReadVec(glm::ivec2 &);
37         void ReadVec(glm::ivec3 &);
38         void ReadVec(glm::ivec4 &);
39
40         bool GetBool();
41         float GetFloat();
42         int GetInt();
43         unsigned long GetULong();
44
45 private:
46         void Assert(Token::Type);
47         Token::Type GetType() const noexcept;
48         const std::string &GetValue() const noexcept;
49
50         Tokenizer in;
51         bool cached;
52
53 };
54
55 }
56
57 #endif