summaryrefslogtreecommitdiff
path: root/gio/src/simpleiostream.hg
blob: af5714d97fa4d254961a75290a9c380ef4cd12de (plain)
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
/* Copyright (C) 2015 The giomm 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/iostream.h>

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

namespace Gio
{
/** A wrapper around an input and an output stream.
 *
 * SimpleIOStream creates an IOStream from an arbitrary InputStream and
 * OutputStream. This allows any pair of input and output streams to be used
 * with IOStream methods.
 *
 * This is useful when you obtained an InputStream and an OutputStream
 * by other means, for instance creating them with platform specific methods
 * such as Gio::UnixInputStream::create(), and you want
 * to take advantage of the methods provided by IOStream.
 *
 * @ingroup Streams
 *
 * @newin{2,46}
 */
class GIOMM_API SimpleIOStream : public Gio::IOStream
{
  _CLASS_GOBJECT(SimpleIOStream, GSimpleIOStream, G_SIMPLE_IO_STREAM, Gio::IOStream, GIOStream, , , GIOMM_API)

protected:
  /** Creates a new SimpleIOStream wrapping @a input_stream and @a output_stream.
   *
   * @see IOStream
   *
   * @newin{2,46}
   *
   * @param input_stream An InputStream.
   * @param output_stream An OutputStream.
   * @returns A new SimpleIOStream instance.
	 */
  _WRAP_CTOR(SimpleIOStream(const Glib::RefPtr<InputStream>& input_stream, const Glib::RefPtr<OutputStream>& output_stream), g_simple_io_stream_new)

public:
  /** Creates a new SimpleIOStream wrapping @a input_stream and @a output_stream.
   *
   * @see IOStream
   *
   * @newin{2,46}
   *
   * @param input_stream An InputStream.
   * @param output_stream An OutputStream.
   * @returns A new SimpleIOStream instance.
	 */
  _WRAP_CREATE(const Glib::RefPtr<InputStream>& input_stream, const Glib::RefPtr<OutputStream>& output_stream)

  _WRAP_PROPERTY("input-stream", Glib::RefPtr<InputStream>, newin "2,46")
  _WRAP_PROPERTY("output-stream", Glib::RefPtr<OutputStream>, newin "2,46")

  // SimpleIOStream has no methods other than create(), signals nor vfuncs.
};

} // namespace Gio