]> git.tdb.fi Git - libs/datafile.git/blob - source/writer.h
Remove the loaded flag from PackSource 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 "output.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         Output 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         /** Enables output compression.  Once enabled, it won't be possible to
43         disable compression. */
44         void set_compressed();
45
46         /** Sets the precision of floating point numbers in bits.  Depending on the
47         mode not all values may be valid, but any value between 16 and 64 that is
48         divisible by 8 is guaranteed to work. */
49         void set_float_precision(unsigned);
50 };
51
52 } // namespace DataFile
53 } // namespace Msp
54
55 #endif