]> git.tdb.fi Git - libs/datafile.git/blob - source/binaryparser.h
b10d7b8791916a8e5ce37257c88da1b33603f6bd
[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<int, 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         IntType::Store parse_int();
32         FloatType::Store parse_float();
33         StringType::Store parse_string();
34         BoolType::Store parse_bool();
35         SymbolType::Store parse_symbol();
36 };
37
38 } // namespace DataFile
39 } // namespace Msp
40
41 #endif