]> git.tdb.fi Git - libs/datafile.git/blob - source/binaryparser.h
4f33d954602d3c5454f1cd8d8729a2d674cc6a3e
[libs/datafile.git] / source / binaryparser.h
1 #ifndef MSP_DATAFILE_BINARYPARSER_H_
2 #define MSP_DATAFILE_BINARYPARSER_H_
3
4 #include <map>
5 #include "binarydict.h"
6 #include "parsermode.h"
7 #include "type.h"
8
9 namespace Msp {
10 namespace DataFile {
11
12 /**
13 Parses data in binary format.
14 */
15 class BinaryParser: public ParserMode
16 {
17 private:
18         typedef std::map<unsigned, DictEntry> Dictionary;
19         typedef std::map<unsigned, std::string> StringMap;
20
21         Dictionary dict;
22         StringMap strings;
23         bool first;
24
25 public:
26         BinaryParser(Input &i, const std::string &s);
27
28         virtual Statement parse();
29 private:
30         Statement parse_statement();
31         long long parse_int();
32         float parse_float();
33         std::string parse_string();
34         bool parse_bool();
35         Symbol parse_symbol();
36 };
37
38 } // namespace DataFile
39 } // namespace Msp
40
41 #endif