1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/* Copyright (C) 2008 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include <giomm/filteroutputstream.h>
#include <giomm/seekable.h>
#include <glibmm/object.h>
_DEFS(giomm,gio)
_PINCLUDE(giomm/private/filteroutputstream_p.h)
namespace Gio
{
/** The buffered output stream implements FilterOutputStream and provides for buffered writes.
* By default, BufferedOutputStream's buffer size is set at 4 kilobytes, but you
* can specify this to the constructor.
*
* To get the size of a buffer within a buffered input stream, use get_buffer_size().
* To change the size of a buffered output stream's buffer, use set_buffer_size().
* Note that the buffer's size cannot be reduced below the size of the data within the buffer.
*
* @ingroup Streams
*
* @newin{2,16}
*/
class GIOMM_API BufferedOutputStream : public Gio::FilterOutputStream, public Gio::Seekable
{
_CLASS_GOBJECT(BufferedOutputStream, GBufferedOutputStream, G_BUFFERED_OUTPUT_STREAM, Gio::FilterOutputStream, GFilterOutputStream, , , GIOMM_API)
_IMPLEMENTS_INTERFACE(Seekable)
protected:
_WRAP_CTOR(BufferedOutputStream(const Glib::RefPtr<OutputStream>& base_stream), g_buffered_output_stream_new)
//Note that we rename the size parameter to buffer_size because that is the actual name of the property.
_WRAP_CTOR(BufferedOutputStream(const Glib::RefPtr<OutputStream>& base_stream, gsize buffer_size), g_buffered_output_stream_new_sized)
public:
/** Creates a new buffered output stream for a base stream.
*
* @param base_stream An InputStream.
* @result an OutputStream for the given base stream.
*/
_WRAP_CREATE(const Glib::RefPtr<OutputStream>& base_stream)
/** Creates a new buffered output stream with a given buffer size.
*
* @param base_stream An InputStream.
* @param buffer_size A size.
* @result an OutputStream with an internal buffer set to size.
*/
static Glib::RefPtr<BufferedOutputStream> create_sized(const Glib::RefPtr<OutputStream>& base_stream, gsize buffer_size);
_WRAP_METHOD(gsize get_buffer_size() const, g_buffered_output_stream_get_buffer_size)
_WRAP_METHOD(void set_buffer_size(gsize size), g_buffered_output_stream_set_buffer_size)
_WRAP_METHOD(void set_auto_grow(bool auto_grow=true), g_buffered_output_stream_set_auto_grow)
_WRAP_METHOD(bool get_auto_grow() const, g_buffered_output_stream_get_auto_grow)
_WRAP_PROPERTY("buffer-size", guint)
_WRAP_PROPERTY("auto-grow", bool)
};
} // namespace Gio
|