]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/writer.cpp
Cosmetic changes
[libs/datafile.git] / source / writer.cpp
index bfd0edac784227efa21b8f30b7dd72e5bcdc3325..bb3ff5e9a413cae4eeff64748d0257aacc357b29 100644 (file)
@@ -1,10 +1,4 @@
-/* $Id$
-
-This file is part of libmspdatafile
-Copyright © 2006  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
+#include <msp/io/zlibcompressed.h>
 #include "binarywriter.h"
 #include "statement.h"
 #include "textwriter.h"
@@ -17,8 +11,7 @@ namespace DataFile {
 
 Writer::Writer(IO::Base &o):
        out(o),
-       mode(new TextWriter(out)),
-       binary(false)
+       mode(new TextWriter(out))
 { }
 
 Writer::~Writer()
@@ -36,21 +29,35 @@ void Writer::set_binary(bool b)
        if(b==binary)
                return;
 
-       binary=b;
+       binary = b;
 
        Statement st;
        if(binary)
-               st.keyword="__bin";
+               st.keyword = "__bin";
        else
-               st.keyword="__text";
+               st.keyword = "__text";
 
        mode->write(st);
 
        delete mode;
        if(binary)
-               mode=new BinaryWriter(out);
+               mode = new BinaryWriter(out);
        else
-               mode=new TextWriter(out);
+               mode = new TextWriter(out);
+}
+
+void Writer::set_compressed()
+{
+       Statement st;
+       st.keyword = "__z";
+       mode->write(st);
+
+       out.set_compressed();
+}
+
+void Writer::set_float_precision(unsigned fp)
+{
+       mode->set_float_precision(fp);
 }
 
 } // namespace DataFile