]> git.tdb.fi Git - libs/datafile.git/blob - source/binaryparser.h
Move newline eating out of BinaryParser
[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         unsigned float_precision;
23
24 public:
25         BinaryParser(Input &i, const std::string &s);
26
27         virtual Statement parse();
28         virtual void process_control_statement(const Statement &);
29 private:
30         IntType::Store parse_int();
31         FloatType::Store parse_float();
32         StringType::Store parse_string();
33         BoolType::Store parse_bool();
34         SymbolType::Store parse_symbol();
35 };
36
37 } // namespace DataFile
38 } // namespace Msp
39
40 #endif