]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/binaryparser.h
Add binary data format
[libs/datafile.git] / source / binaryparser.h
diff --git a/source/binaryparser.h b/source/binaryparser.h
new file mode 100644 (file)
index 0000000..560703c
--- /dev/null
@@ -0,0 +1,43 @@
+/* $Id$
+
+This file is part of libmspdatafile
+Copyright © 2007  Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#ifndef MSP_DATAFILE_BINARYPARSER_H_
+#define MSP_DATAFILE_BINARYPARSER_H_
+
+#include <map>
+#include "binarydict.h"
+#include "parsermode.h"
+
+namespace Msp {
+namespace DataFile {
+
+class BinaryParser: public ParserMode
+{
+private:
+       typedef std::map<unsigned, DictEntry> Dictionary;
+       typedef std::map<unsigned, std::string> EnumMap;
+
+       Dictionary dict;
+       EnumMap enums;
+       bool first;
+
+public:
+       BinaryParser(Input &i, const std::string &s);
+       Statement parse();
+private:
+       Statement parse_statement();
+       long long parse_int();
+       float parse_float();
+       std::string parse_string();
+       bool parse_bool();
+       std::string parse_enum();
+};
+
+} // namespace DataFile
+} // namespace Msp
+
+#endif