]> git.tdb.fi Git - libs/datafile.git/blob - source/binaryparser.h
Use the functions from maputils.h in various places
[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
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<unsigned, DictEntry> Dictionary;
18         typedef std::map<unsigned, std::string> StringMap;
19
20         Dictionary dict;
21         StringMap strings;
22         bool first;
23
24 public:
25         BinaryParser(Input &i, const std::string &s);
26
27         virtual Statement parse();
28 private:
29         Statement parse_statement();
30         long long parse_int();
31         float parse_float();
32         std::string parse_string();
33         bool parse_bool();
34         std::string parse_enum();
35 };
36
37 } // namespace DataFile
38 } // namespace Msp
39
40 #endif