]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/memory-stream.hh
* flower
[lilypond.git] / flower / include / memory-stream.hh
1 /*
2   memory-stream.hh -- declare Memory_out_stream
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef MEMORY_STREAM_HH
10 #define MEMORY_STREAM_HH
11
12 #include <stdio.h>
13 #include <unistd.h>
14
15 #include "libc-extension.hh"
16
17 class Memory_out_stream
18 {
19   char *buffer_;
20   ssize_t size_;
21   int buffer_blocks_;
22   FILE *file_;
23
24   static cookie_io_functions_t functions_;
25   static const int block_size_;
26
27 public:
28   static ssize_t reader (void *, char *, size_t);
29   static ssize_t writer (void *, char const *, size_t);
30   static int seeker (void *, off64_t *, int);
31   static int cleaner (void *);
32
33   Memory_out_stream ();
34   ~Memory_out_stream ();
35   FILE *get_file () const;
36   char const *get_string () const;
37   ssize_t get_length () const;
38 };
39
40 #endif /* MEMORY_STREAM_HH */