X-Git-Url: http://git.tdb.fi/?p=libs%2Fdatafile.git;a=blobdiff_plain;f=source%2Fwriter.cpp;h=60914090f742acaa97b90f1f1f9c58fd03756523;hp=0da77bc0304dc471f24a368399c86cfbcabff391;hb=19179a622c1de88de5ed7047643eec79f285bf2a;hpb=6dd94a7fe90c6467024685fbac769067ddb74688 diff --git a/source/writer.cpp b/source/writer.cpp index 0da77bc..6091409 100644 --- a/source/writer.cpp +++ b/source/writer.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of libmspdatafile -Copyright © 2006 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include "binarywriter.h" #include "statement.h" #include "textwriter.h" @@ -21,6 +14,11 @@ Writer::Writer(IO::Base &o): binary(false) { } +Writer::~Writer() +{ + delete mode; +} + void Writer::write(const Statement &st) { mode->write(st); @@ -31,21 +29,26 @@ 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_float_precision(unsigned fp) +{ + mode->set_float_precision(fp); } } // namespace DataFile