]> git.tdb.fi Git - libs/datafile.git/blob - source/binaryparser.h
Add binary data format
[libs/datafile.git] / source / binaryparser.h
1 /* $Id$
2
3 This file is part of libmspdatafile
4 Copyright © 2007  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_DATAFILE_BINARYPARSER_H_
9 #define MSP_DATAFILE_BINARYPARSER_H_
10
11 #include <map>
12 #include "binarydict.h"
13 #include "parsermode.h"
14
15 namespace Msp {
16 namespace DataFile {
17
18 class BinaryParser: public ParserMode
19 {
20 private:
21         typedef std::map<unsigned, DictEntry> Dictionary;
22         typedef std::map<unsigned, std::string> EnumMap;
23
24         Dictionary dict;
25         EnumMap enums;
26         bool first;
27
28 public:
29         BinaryParser(Input &i, const std::string &s);
30         Statement parse();
31 private:
32         Statement parse_statement();
33         long long parse_int();
34         float parse_float();
35         std::string parse_string();
36         bool parse_bool();
37         std::string parse_enum();
38 };
39
40 } // namespace DataFile
41 } // namespace Msp
42
43 #endif