X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbinaryparser.h;h=dfb0de995c7092dd60c9ebc19d6d636b408de84b;hb=b39ce68f12c30eedb272b65fe78baec5864d89ca;hp=560703c66ddb337791a98b7e72d8dc1c81262169;hpb=27630d44298cb67e075c166f4421288cc8ca117e;p=libs%2Fdatafile.git diff --git a/source/binaryparser.h b/source/binaryparser.h index 560703c..dfb0de9 100644 --- a/source/binaryparser.h +++ b/source/binaryparser.h @@ -1,40 +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 -#include "binarydict.h" #include "parsermode.h" +#include "type.h" namespace Msp { namespace DataFile { +/** +Parses data in binary format. +*/ class BinaryParser: public ParserMode { private: - typedef std::map Dictionary; - typedef std::map EnumMap; + typedef std::map Dictionary; + typedef std::map StringMap; Dictionary dict; - EnumMap enums; - bool first; + StringMap strings; + unsigned float_precision; + StatementInfo *cur_info; + std::vector sub_remaining; public: BinaryParser(Input &i, const std::string &s); - Statement parse(); + + virtual Statement parse(); + virtual void process_control_statement(const Statement &); + + virtual const StatementKey *peek(unsigned); + virtual bool parse_and_load(unsigned, Loader &, const LoaderAction &); + private: - Statement parse_statement(); - long long parse_int(); - float parse_float(); - std::string parse_string(); - bool parse_bool(); - std::string parse_enum(); + IntType::Store parse_int(); + FloatType::Store parse_float(); + StringType::Store parse_string(); + BoolType::Store parse_bool(); + SymbolType::Store parse_symbol(); }; } // namespace DataFile