]> git.tdb.fi Git - libs/datafile.git/blob - source/binaryparser.h
Restructure control statement processing
[libs/datafile.git] / source / binaryparser.h
1 #ifndef MSP_DATAFILE_BINARYPARSER_H_
2 #define MSP_DATAFILE_BINARYPARSER_H_
3
4 #include <map>
5 #include "parsermode.h"
6 #include "type.h"
7
8 namespace Msp {
9 namespace DataFile {
10
11 /**
12 Parses data in binary format.
13 */
14 class BinaryParser: public ParserMode
15 {
16 private:
17         typedef std::map<int, StatementKey> Dictionary;
18         typedef std::map<unsigned, std::string> StringMap;
19
20         Dictionary dict;
21         StringMap strings;
22         bool first;
23         unsigned float_precision;
24
25 public:
26         BinaryParser(Input &i, const std::string &s);
27
28         virtual Statement parse();
29         virtual void process_control_statement(const Statement &);
30 private:
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