1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright © 2008, 2009 Codethink Limited
4 * Copyright © 2009 Red Hat, Inc.
6 * SPDX-License-Identifier: LGPL-2.1-or-later
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * See the included COPYING file for more information.
15 * Authors: Ryan Lortie <desrt@desrt.ca>
16 * Alexander Larsson <alexl@redhat.com>
19 #ifndef __G_IO_STREAM_H__
20 #define __G_IO_STREAM_H__
22 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
23 #error "Only <gio/gio.h> can be included directly."
26 #include <gio/ginputstream.h>
27 #include <gio/goutputstream.h>
28 #include <gio/gcancellable.h>
29 #include <gio/gioerror.h>
33 #define G_TYPE_IO_STREAM (g_io_stream_get_type ())
34 #define G_IO_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_IO_STREAM, GIOStream))
35 #define G_IO_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_IO_STREAM, GIOStreamClass))
36 #define G_IS_IO_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_IO_STREAM))
37 #define G_IS_IO_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_IO_STREAM))
38 #define G_IO_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_IO_STREAM, GIOStreamClass))
40 typedef struct _GIOStreamPrivate GIOStreamPrivate;
41 typedef struct _GIOStreamClass GIOStreamClass;
46 * Base class for read-write streams.
50 GObject parent_instance;
53 GIOStreamPrivate *priv;
56 struct _GIOStreamClass
58 GObjectClass parent_class;
60 GInputStream * (*get_input_stream) (GIOStream *stream);
61 GOutputStream * (*get_output_stream) (GIOStream *stream);
63 gboolean (* close_fn) (GIOStream *stream,
64 GCancellable *cancellable,
66 void (* close_async) (GIOStream *stream,
68 GCancellable *cancellable,
69 GAsyncReadyCallback callback,
71 gboolean (* close_finish) (GIOStream *stream,
75 /* Padding for future expansion */
76 void (*_g_reserved1) (void);
77 void (*_g_reserved2) (void);
78 void (*_g_reserved3) (void);
79 void (*_g_reserved4) (void);
80 void (*_g_reserved5) (void);
81 void (*_g_reserved6) (void);
82 void (*_g_reserved7) (void);
83 void (*_g_reserved8) (void);
84 void (*_g_reserved9) (void);
85 void (*_g_reserved10) (void);
89 GType g_io_stream_get_type (void) G_GNUC_CONST;
92 GInputStream * g_io_stream_get_input_stream (GIOStream *stream);
94 GOutputStream *g_io_stream_get_output_stream (GIOStream *stream);
97 void g_io_stream_splice_async (GIOStream *stream1,
99 GIOStreamSpliceFlags flags,
101 GCancellable *cancellable,
102 GAsyncReadyCallback callback,
106 gboolean g_io_stream_splice_finish (GAsyncResult *result,
110 gboolean g_io_stream_close (GIOStream *stream,
111 GCancellable *cancellable,
115 void g_io_stream_close_async (GIOStream *stream,
117 GCancellable *cancellable,
118 GAsyncReadyCallback callback,
121 gboolean g_io_stream_close_finish (GIOStream *stream,
122 GAsyncResult *result,
126 gboolean g_io_stream_is_closed (GIOStream *stream);
128 gboolean g_io_stream_has_pending (GIOStream *stream);
130 gboolean g_io_stream_set_pending (GIOStream *stream,
133 void g_io_stream_clear_pending (GIOStream *stream);
137 #endif /* __G_IO_STREAM_H__ */