]> git.tdb.fi Git - libs/datafile.git/blob - source/writer.h
Drop copyright and license notices from source files
[libs/datafile.git] / source / writer.h
1 #ifndef MSP_DATAFILE_WRITER_H_
2 #define MSP_DATAFILE_WRITER_H_
3
4 #include <map>
5 #include <msp/io/base.h>
6 #include "binarydict.h"
7
8 namespace Msp {
9 namespace DataFile {
10
11 class Statement;
12 class WriterMode;
13
14 /**
15 Frontend for writing data.
16 */
17 class Writer
18 {
19 private:
20         IO::Base &out;
21         WriterMode *mode;
22         bool binary;
23
24 public:
25         Writer(IO::Base &o);
26         ~Writer();
27
28         /**
29         Writes a statement to the output.  This function always writes a complete
30         statement, so it's not possible to add substatements later.
31         */
32         void write(const Statement &st);
33
34         /**
35         Sets binary or text mode.  While it is possible to enter and exit binary
36         mode multiple times, doing so produces sub-optimal output.
37
38         @param  b  true for binary mode, false for text
39         */
40         void set_binary(bool b);
41 };
42
43 } // namespace DataFile
44 } // namespace Msp
45
46 #endif