X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fwriter.h;h=5f32786f443b443f15c33d996ed070d10fb0461d;hb=e14c01b5775dd2e324b16ff49498db9b9113c523;hp=e62e8bce2851313d6a9cb10e4df86531920dbd4e;hpb=6dd94a7fe90c6467024685fbac769067ddb74688;p=libs%2Fdatafile.git diff --git a/source/writer.h b/source/writer.h index e62e8bc..5f32786 100644 --- a/source/writer.h +++ b/source/writer.h @@ -1,35 +1,30 @@ -/* $Id$ - -This file is part of libmspdatafile -Copyright © 2006 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #ifndef MSP_DATAFILE_WRITER_H_ #define MSP_DATAFILE_WRITER_H_ #include +#include #include -#include "binarydict.h" +#include "output.h" namespace Msp { namespace DataFile { -class Statement; +struct Statement; class WriterMode; /** Frontend for writing data. */ -class Writer +class Writer: private NonCopyable { private: - IO::Base &out; - WriterMode *mode; - bool binary; + Output out; + WriterMode *mode = nullptr; + bool binary = false; public: Writer(IO::Base &o); + ~Writer(); /** Writes a statement to the output. This function always writes a complete @@ -44,6 +39,15 @@ public: @param b true for binary mode, false for text */ void set_binary(bool b); + + /** Enables output compression. Once enabled, it won't be possible to + disable compression. */ + void set_compressed(); + + /** Sets the precision of floating point numbers in bits. Depending on the + mode not all values may be valid, but any value between 16 and 64 that is + divisible by 8 is guaranteed to work. */ + void set_float_precision(unsigned); }; } // namespace DataFile