1 | /* GIO - GLib Input, Output and Streaming Library |
2 | * |
3 | * Copyright © 2008, 2009 Codethink Limited |
4 | * Copyright © 2009 Red Hat, Inc. |
5 | * |
6 | * SPDX-License-Identifier: LGPL-2.1-or-later |
7 | * |
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. |
12 | * |
13 | * See the included COPYING file for more information. |
14 | * |
15 | * Authors: Ryan Lortie <desrt@desrt.ca> |
16 | * Alexander Larsson <alexl@redhat.com> |
17 | */ |
18 | |
19 | #ifndef __G_IO_STREAM_H__ |
20 | #define __G_IO_STREAM_H__ |
21 | |
22 | #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) |
23 | #error "Only <gio/gio.h> can be included directly." |
24 | #endif |
25 | |
26 | #include <gio/ginputstream.h> |
27 | #include <gio/goutputstream.h> |
28 | #include <gio/gcancellable.h> |
29 | #include <gio/gioerror.h> |
30 | |
31 | G_BEGIN_DECLS |
32 | |
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)) |
39 | |
40 | typedef struct _GIOStreamPrivate GIOStreamPrivate; |
41 | typedef struct _GIOStreamClass GIOStreamClass; |
42 | |
43 | struct _GIOStream |
44 | { |
45 | GObject parent_instance; |
46 | |
47 | /*< private >*/ |
48 | GIOStreamPrivate *priv; |
49 | }; |
50 | |
51 | struct _GIOStreamClass |
52 | { |
53 | GObjectClass parent_class; |
54 | |
55 | GInputStream * (*get_input_stream) (GIOStream *stream); |
56 | GOutputStream * (*get_output_stream) (GIOStream *stream); |
57 | |
58 | gboolean (* close_fn) (GIOStream *stream, |
59 | GCancellable *cancellable, |
60 | GError **error); |
61 | void (* close_async) (GIOStream *stream, |
62 | int io_priority, |
63 | GCancellable *cancellable, |
64 | GAsyncReadyCallback callback, |
65 | gpointer user_data); |
66 | gboolean (* close_finish) (GIOStream *stream, |
67 | GAsyncResult *result, |
68 | GError **error); |
69 | /*< private >*/ |
70 | /* Padding for future expansion */ |
71 | void (*_g_reserved1) (void); |
72 | void (*_g_reserved2) (void); |
73 | void (*_g_reserved3) (void); |
74 | void (*_g_reserved4) (void); |
75 | void (*_g_reserved5) (void); |
76 | void (*_g_reserved6) (void); |
77 | void (*_g_reserved7) (void); |
78 | void (*_g_reserved8) (void); |
79 | void (*_g_reserved9) (void); |
80 | void (*_g_reserved10) (void); |
81 | }; |
82 | |
83 | GIO_AVAILABLE_IN_ALL |
84 | GType g_io_stream_get_type (void) G_GNUC_CONST; |
85 | |
86 | GIO_AVAILABLE_IN_ALL |
87 | GInputStream * g_io_stream_get_input_stream (GIOStream *stream); |
88 | GIO_AVAILABLE_IN_ALL |
89 | GOutputStream *g_io_stream_get_output_stream (GIOStream *stream); |
90 | |
91 | GIO_AVAILABLE_IN_ALL |
92 | void g_io_stream_splice_async (GIOStream *stream1, |
93 | GIOStream *stream2, |
94 | GIOStreamSpliceFlags flags, |
95 | int io_priority, |
96 | GCancellable *cancellable, |
97 | GAsyncReadyCallback callback, |
98 | gpointer user_data); |
99 | |
100 | GIO_AVAILABLE_IN_ALL |
101 | gboolean g_io_stream_splice_finish (GAsyncResult *result, |
102 | GError **error); |
103 | |
104 | GIO_AVAILABLE_IN_ALL |
105 | gboolean g_io_stream_close (GIOStream *stream, |
106 | GCancellable *cancellable, |
107 | GError **error); |
108 | |
109 | GIO_AVAILABLE_IN_ALL |
110 | void g_io_stream_close_async (GIOStream *stream, |
111 | int io_priority, |
112 | GCancellable *cancellable, |
113 | GAsyncReadyCallback callback, |
114 | gpointer user_data); |
115 | GIO_AVAILABLE_IN_ALL |
116 | gboolean g_io_stream_close_finish (GIOStream *stream, |
117 | GAsyncResult *result, |
118 | GError **error); |
119 | |
120 | GIO_AVAILABLE_IN_ALL |
121 | gboolean g_io_stream_is_closed (GIOStream *stream); |
122 | GIO_AVAILABLE_IN_ALL |
123 | gboolean g_io_stream_has_pending (GIOStream *stream); |
124 | GIO_AVAILABLE_IN_ALL |
125 | gboolean g_io_stream_set_pending (GIOStream *stream, |
126 | GError **error); |
127 | GIO_AVAILABLE_IN_ALL |
128 | void g_io_stream_clear_pending (GIOStream *stream); |
129 | |
130 | G_END_DECLS |
131 | |
132 | #endif /* __G_IO_STREAM_H__ */ |
133 | |