OLD | NEW |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 2005--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 2005--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 6 LilyPond is free software: you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
8 the Free Software Foundation, either version 3 of the License, or | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
11 LilyPond is distributed in the hope that it will be useful, | 11 LilyPond is distributed in the hope that it will be useful, |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 GNU General Public License for more details. | 14 GNU General Public License for more details. |
15 | 15 |
16 You should have received a copy of the GNU General Public License | 16 You should have received a copy of the GNU General Public License |
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>. | 17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>. |
18 */ | 18 */ |
19 | 19 |
20 #ifndef MEMORY_STREAM_HH | 20 #ifndef MEMORY_STREAM_HH |
21 #define MEMORY_STREAM_HH | 21 #define MEMORY_STREAM_HH |
22 | 22 |
23 #include <cstdio> | 23 #include <cstdio> |
24 #include <unistd.h> | 24 #include <unistd.h> |
25 using namespace std; | |
26 | 25 |
27 #include "libc-extension.hh" | 26 #include "libc-extension.hh" |
28 #include "file-cookie.hh" | 27 #include "file-cookie.hh" |
29 | 28 |
30 class Memory_out_stream | 29 class Memory_out_stream |
31 { | 30 { |
32 char *buffer_; | 31 char *buffer_; |
33 ssize_t size_; | 32 ssize_t size_; |
34 int buffer_blocks_; | 33 int buffer_blocks_; |
35 FILE *file_; | 34 FILE *file_; |
36 | 35 |
37 static lily_cookie_io_functions_t functions_; | 36 static lily_cookie_io_functions_t functions_; |
38 static const int block_size_; | 37 static const int block_size_; |
39 | 38 |
40 public: | 39 public: |
41 static ssize_t reader (void *, char *, size_t); | 40 static ssize_t reader (void *, char *, size_t); |
42 static ssize_t writer (void *, char const *, size_t); | 41 static ssize_t writer (void *, char const *, size_t); |
43 static ssize_t seeker (void *, off64_t *, size_t); | 42 static ssize_t seeker (void *, off64_t *, size_t); |
44 static ssize_t cleaner (void *); | 43 static ssize_t cleaner (void *); |
45 | 44 |
46 Memory_out_stream (); | 45 Memory_out_stream (); |
47 ~Memory_out_stream (); | 46 ~Memory_out_stream (); |
48 FILE *get_file () const; | 47 FILE *get_file () const; |
49 char const *get_string () const; | 48 char const *get_string () const; |
50 ssize_t get_length () const; | 49 ssize_t get_length () const; |
51 }; | 50 }; |
52 | 51 |
53 #endif /* MEMORY_STREAM_HH */ | 52 #endif /* MEMORY_STREAM_HH */ |
OLD | NEW |