/* 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 .
*/
#include
#include
#include
_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& 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& 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& 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 create_sized(const Glib::RefPtr& 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