1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright © 2008, 2009 Codethink Limited
4 * Copyright © 2009 Red Hat, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * See the included COPYING file for more information.
13 * Authors: Ryan Lortie <desrt@desrt.ca>
14 * Alexander Larsson <alexl@redhat.com>
17 #ifndef __G_IO_STREAM_H__
18 #define __G_IO_STREAM_H__
20 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
21 #error "Only <gio/gio.h> can be included directly."
24 #include <gio/ginputstream.h>
25 #include <gio/goutputstream.h>
26 #include <gio/gcancellable.h>
27 #include <gio/gioerror.h>
31 #define G_TYPE_IO_STREAM (g_io_stream_get_type ())
32 #define G_IO_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_IO_STREAM, GIOStream))
33 #define G_IO_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_IO_STREAM, GIOStreamClass))
34 #define G_IS_IO_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_IO_STREAM))
35 #define G_IS_IO_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_IO_STREAM))
36 #define G_IO_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_IO_STREAM, GIOStreamClass))
38 typedef struct _GIOStreamPrivate GIOStreamPrivate
;
39 typedef struct _GIOStreamClass GIOStreamClass
;
44 * Base class for read-write streams.
48 GObject parent_instance
;
51 GIOStreamPrivate
*priv
;
54 struct _GIOStreamClass
56 GObjectClass parent_class
;
58 GInputStream
* (*get_input_stream
) (GIOStream
*stream
);
59 GOutputStream
* (*get_output_stream
) (GIOStream
*stream
);
61 gboolean (* close_fn
) (GIOStream
*stream
,
62 GCancellable
*cancellable
,
64 void (* close_async
) (GIOStream
*stream
,
66 GCancellable
*cancellable
,
67 GAsyncReadyCallback callback
,
69 gboolean (* close_finish
) (GIOStream
*stream
,
73 /* Padding for future expansion */
74 void (*_g_reserved1
) (void);
75 void (*_g_reserved2
) (void);
76 void (*_g_reserved3
) (void);
77 void (*_g_reserved4
) (void);
78 void (*_g_reserved5
) (void);
79 void (*_g_reserved6
) (void);
80 void (*_g_reserved7
) (void);
81 void (*_g_reserved8
) (void);
82 void (*_g_reserved9
) (void);
83 void (*_g_reserved10
) (void);
87 GType
g_io_stream_get_type (void) G_GNUC_CONST
;
90 GInputStream
* g_io_stream_get_input_stream (GIOStream
*stream
);
92 GOutputStream
*g_io_stream_get_output_stream (GIOStream
*stream
);
95 void g_io_stream_splice_async (GIOStream
*stream1
,
97 GIOStreamSpliceFlags flags
,
99 GCancellable
*cancellable
,
100 GAsyncReadyCallback callback
,
103 GLIB_AVAILABLE_IN_ALL
104 gboolean
g_io_stream_splice_finish (GAsyncResult
*result
,
107 GLIB_AVAILABLE_IN_ALL
108 gboolean
g_io_stream_close (GIOStream
*stream
,
109 GCancellable
*cancellable
,
112 GLIB_AVAILABLE_IN_ALL
113 void g_io_stream_close_async (GIOStream
*stream
,
115 GCancellable
*cancellable
,
116 GAsyncReadyCallback callback
,
118 GLIB_AVAILABLE_IN_ALL
119 gboolean
g_io_stream_close_finish (GIOStream
*stream
,
120 GAsyncResult
*result
,
123 GLIB_AVAILABLE_IN_ALL
124 gboolean
g_io_stream_is_closed (GIOStream
*stream
);
125 GLIB_AVAILABLE_IN_ALL
126 gboolean
g_io_stream_has_pending (GIOStream
*stream
);
127 GLIB_AVAILABLE_IN_ALL
128 gboolean
g_io_stream_set_pending (GIOStream
*stream
,
130 GLIB_AVAILABLE_IN_ALL
131 void g_io_stream_clear_pending (GIOStream
*stream
);
135 #endif /* __G_IO_STREAM_H__ */