X-Git-Url: http://git.tdb.fi/?p=libs%2Fdatafile.git;a=blobdiff_plain;f=source%2Fbinarywriter.h;h=2f67bbd24e43bad9403865a8488098ed82d703a9;hp=db89a5e15fae4a14c10a7bd1b76deedcf3c8b967;hb=19179a622c1de88de5ed7047643eec79f285bf2a;hpb=215e719d0ef85f748898660d15d01e77ac551de9 diff --git a/source/binarywriter.h b/source/binarywriter.h index db89a5e..2f67bbd 100644 --- a/source/binarywriter.h +++ b/source/binarywriter.h @@ -1,15 +1,9 @@ -/* $Id$ - -This file is part of libmspdatafile -Copyright © 2007-2008, 2010 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #ifndef MSP_DATAFILE_BINARYWRITER_H_ #define MSP_DATAFILE_BINARYWRITER_H_ #include #include "binarydict.h" +#include "type.h" #include "writermode.h" namespace Msp { @@ -21,25 +15,27 @@ Writes data in binary format. class BinaryWriter: public WriterMode { private: - typedef std::map Dictionary; + typedef std::map Dictionary; typedef std::map StringMap; Dictionary dict; unsigned next_kwd_id; StringMap strings; unsigned next_str_id; + unsigned float_precision; public: BinaryWriter(IO::Base &o); + virtual void set_float_precision(unsigned); virtual void write(const Statement &st); private: void write_(const Statement &st); void collect_keywords(const Statement &st); - void write_int(long long n); - void write_string(const std::string &s); - void write_float(float f); - void write_enum(const std::string &e); + void write_int(IntType::Store n); + void write_string(const StringType::Store &s); + void write_float(FloatType::Store f); + void write_symbol(const SymbolType::Store &s); }; } // namespace DataFile