--- /dev/null
+/* $Id$
+
+This file is part of libmspdatafile
+Copyright © 2006 Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#ifndef MSP_DATAFILE_BINARYWRITER_H_
+#define MSP_DATAFILE_BINARYWRITER_H_
+
+#include <map>
+#include "binarydict.h"
+#include "writermode.h"
+
+namespace Msp {
+namespace DataFile {
+
+class BinaryWriter: public WriterMode
+{
+private:
+ typedef std::map<DictEntry, unsigned> Dictionary;
+ typedef std::map<std::string, unsigned> EnumMap;
+
+ Dictionary dict;
+ unsigned next_st_id;
+ EnumMap enums;
+ unsigned next_enum_id;
+
+public:
+ BinaryWriter(std::ostream &o);
+ void write(const Statement &st);
+private:
+ void write_(const Statement &st);
+ DictEntry create_entry(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);
+};
+
+} // namespace DataFile
+} // namespace Msp
+
+#endif