/* Copyright (C) 2007 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, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <giomm/filteroutputstream.h>
#include <giomm/seekable.h>
#include <giomm/enums.h>

_DEFS(giomm,gio)
_PINCLUDE(giomm/private/filteroutputstream_p.h)

namespace Gio
{

/**
 * An implementation of FilterOutputStream that allows for high-level data
 * manipulation of arbitrary data (including binary operations).
 *
 * @ingroup Streams
 *
 * @newin{2,16}
 */
class DataOutputStream : public Gio::FilterOutputStream, public Gio::Seekable
{
  _CLASS_GOBJECT(DataOutputStream, GDataOutputStream, G_DATA_OUTPUT_STREAM, Gio::FilterOutputStream, GFilterOutputStream)
  _IMPLEMENTS_INTERFACE(Seekable)

protected:
  _WRAP_CTOR(DataOutputStream(const Glib::RefPtr<OutputStream>& base_stream), g_data_output_stream_new)

public:

  _WRAP_CREATE(const Glib::RefPtr<OutputStream>& base_stream)

  _WRAP_METHOD(void set_byte_order(DataStreamByteOrder order), g_data_output_stream_set_byte_order)
  _WRAP_METHOD(DataStreamByteOrder get_byte_order() const, g_data_output_stream_get_byte_order)

  _WRAP_METHOD(bool put_byte(guchar data, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_byte, errthrow)

  _WRAP_METHOD(bool put_int16(gint16 data, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_int16, errthrow)

  _WRAP_METHOD(bool put_uint16(guint16 data, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_uint16, errthrow)

  _WRAP_METHOD(bool put_int32(gint32 data, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_int32, errthrow)

  _WRAP_METHOD(bool put_uint32(guint32 data, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_uint32, errthrow)

  _WRAP_METHOD(bool put_int64(gint64 data, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_int64, errthrow)

  _WRAP_METHOD(bool put_uint64(guint64 data, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_uint64, errthrow)

  _WRAP_METHOD(bool put_string(std::string str, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_string, errthrow)

  _WRAP_PROPERTY("byte-order", DataStreamByteOrder)
};

} // namespace Gio
