gspawn: Make error codes on Windows more specific
[glib.git] / gio / giostream.h
blob5dbe0e6e6c4fba492e287c09e09b96cfc1d99ffc
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."
22 #endif
24 #include <gio/ginputstream.h>
25 #include <gio/goutputstream.h>
26 #include <gio/gcancellable.h>
27 #include <gio/gioerror.h>
29 G_BEGIN_DECLS
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;
41 /**
42 * GIOStream:
44 * Base class for read-write streams.
45 **/
46 struct _GIOStream
48 GObject parent_instance;
50 /*< private >*/
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,
63 GError **error);
64 void (* close_async) (GIOStream *stream,
65 int io_priority,
66 GCancellable *cancellable,
67 GAsyncReadyCallback callback,
68 gpointer user_data);
69 gboolean (* close_finish) (GIOStream *stream,
70 GAsyncResult *result,
71 GError **error);
72 /*< private >*/
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);
86 GLIB_AVAILABLE_IN_ALL
87 GType g_io_stream_get_type (void) G_GNUC_CONST;
89 GLIB_AVAILABLE_IN_ALL
90 GInputStream * g_io_stream_get_input_stream (GIOStream *stream);
91 GLIB_AVAILABLE_IN_ALL
92 GOutputStream *g_io_stream_get_output_stream (GIOStream *stream);
94 GLIB_AVAILABLE_IN_ALL
95 void g_io_stream_splice_async (GIOStream *stream1,
96 GIOStream *stream2,
97 GIOStreamSpliceFlags flags,
98 int io_priority,
99 GCancellable *cancellable,
100 GAsyncReadyCallback callback,
101 gpointer user_data);
103 GLIB_AVAILABLE_IN_ALL
104 gboolean g_io_stream_splice_finish (GAsyncResult *result,
105 GError **error);
107 GLIB_AVAILABLE_IN_ALL
108 gboolean g_io_stream_close (GIOStream *stream,
109 GCancellable *cancellable,
110 GError **error);
112 GLIB_AVAILABLE_IN_ALL
113 void g_io_stream_close_async (GIOStream *stream,
114 int io_priority,
115 GCancellable *cancellable,
116 GAsyncReadyCallback callback,
117 gpointer user_data);
118 GLIB_AVAILABLE_IN_ALL
119 gboolean g_io_stream_close_finish (GIOStream *stream,
120 GAsyncResult *result,
121 GError **error);
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,
129 GError **error);
130 GLIB_AVAILABLE_IN_ALL
131 void g_io_stream_clear_pending (GIOStream *stream);
133 G_END_DECLS
135 #endif /* __G_IO_STREAM_H__ */