X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fwriter.h;h=73471ac594b1f7ee7d523df3c9f2aa054cac5eb1;hb=14d7dc66003ae52f8c4c25bf241b2a12264aacb2;hp=756e19a22c41668cea43fb5387944b90b84a4721;hpb=27630d44298cb67e075c166f4421288cc8ca117e;p=libs%2Fdatafile.git diff --git a/source/writer.h b/source/writer.h index 756e19a..73471ac 100644 --- a/source/writer.h +++ b/source/writer.h @@ -9,7 +9,7 @@ Distributed under the LGPL #define MSP_DATAFILE_WRITER_H_ #include -#include +#include #include "binarydict.h" namespace Msp { @@ -18,17 +18,33 @@ namespace DataFile { class Statement; class WriterMode; +/** +Frontend for writing data. +*/ class Writer { private: - std::ostream &out; + IO::Base &out; WriterMode *mode; bool binary; public: - Writer(std::ostream &); - void write(const Statement &); - void set_binary(bool); + Writer(IO::Base &o); + ~Writer(); + + /** + Writes a statement to the output. This function always writes a complete + statement, so it's not possible to add substatements later. + */ + void write(const Statement &st); + + /** + Sets binary or text mode. While it is possible to enter and exit binary + mode multiple times, doing so produces sub-optimal output. + + @param b true for binary mode, false for text + */ + void set_binary(bool b); }; } // namespace DataFile