]> git.tdb.fi Git - libs/datafile.git/blob - source/binaryparser.h
Remove the loaded flag from PackSource files
[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, StatementInfo> Dictionary;
18         typedef std::map<unsigned, std::string> StringMap;
19
20         Dictionary dict;
21         StringMap strings;
22         unsigned float_precision;
23         StatementInfo *cur_info;
24         std::vector<unsigned> sub_remaining;
25
26 public:
27         BinaryParser(Input &i, const std::string &s);
28
29         virtual Statement parse();
30         virtual void process_control_statement(const Statement &);
31
32         virtual const StatementKey *peek(unsigned);
33         virtual bool parse_and_load(unsigned, Loader &, const LoaderAction &);
34
35 private:
36         IntType::Store parse_int();
37         FloatType::Store parse_float();
38         StringType::Store parse_string();
39         BoolType::Store parse_bool();
40         SymbolType::Store parse_symbol();
41 };
42
43 } // namespace DataFile
44 } // namespace Msp
45
46 #endif