-/* $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"
binary(false)
{ }
+Writer::~Writer()
+{
+ delete mode;
+}
+
void Writer::write(const Statement &st)
{
mode->write(st);
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