]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/binarywriter.h
Some more code reformatting
[libs/datafile.git] / source / binarywriter.h
index cf8f9fcaa016c35bfedb9172a6c0c76c940b00d5..db89a5e15fae4a14c10a7bd1b76deedcf3c8b967 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of libmspdatafile
-Copyright © 2006  Mikko Rasa, Mikkosoft Productions
+Copyright © 2007-2008, 2010  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
@@ -15,23 +15,26 @@ Distributed under the LGPL
 namespace Msp {
 namespace DataFile {
 
+/**
+Writes data in binary format.
+*/
 class BinaryWriter: public WriterMode
 {
 private:
        typedef std::map<DictEntry, unsigned> Dictionary;
-       typedef std::map<std::string, unsigned> EnumMap;
+       typedef std::map<std::string, unsigned> StringMap;
 
        Dictionary dict;
-       unsigned next_st_id;
-       EnumMap enums;
-       unsigned next_enum_id;
+       unsigned next_kwd_id;
+       StringMap strings;
+       unsigned next_str_id;
 
 public:
-       BinaryWriter(std::ostream &o);
-       void write(const Statement &st);
+       BinaryWriter(IO::Base &o);
+
+       virtual 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);