Add new api to symbol lists and docs
[glib.git] / gio / ginputstream.h
blobe9b36f7ea93245f59a289819ec9a96056fbdda34
1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2006-2007 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Author: Alexander Larsson <alexl@redhat.com>
23 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24 #error "Only <gio/gio.h> can be included directly."
25 #endif
27 #ifndef __G_INPUT_STREAM_H__
28 #define __G_INPUT_STREAM_H__
30 #include <gio/giotypes.h>
32 G_BEGIN_DECLS
34 #define G_TYPE_INPUT_STREAM (g_input_stream_get_type ())
35 #define G_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_INPUT_STREAM, GInputStream))
36 #define G_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_INPUT_STREAM, GInputStreamClass))
37 #define G_IS_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_INPUT_STREAM))
38 #define G_IS_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_INPUT_STREAM))
39 #define G_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_INPUT_STREAM, GInputStreamClass))
41 /**
42 * GInputStream:
44 * Base class for streaming input operations.
45 **/
46 typedef struct _GInputStreamClass GInputStreamClass;
47 typedef struct _GInputStreamPrivate GInputStreamPrivate;
49 struct _GInputStream
51 GObject parent_instance;
53 /*< private >*/
54 GInputStreamPrivate *priv;
57 struct _GInputStreamClass
59 GObjectClass parent_class;
61 /* Sync ops: */
63 gssize (* read_fn) (GInputStream *stream,
64 void *buffer,
65 gsize count,
66 GCancellable *cancellable,
67 GError **error);
68 gssize (* skip) (GInputStream *stream,
69 gsize count,
70 GCancellable *cancellable,
71 GError **error);
72 gboolean (* close_fn) (GInputStream *stream,
73 GCancellable *cancellable,
74 GError **error);
76 /* Async ops: (optional in derived classes) */
77 void (* read_async) (GInputStream *stream,
78 void *buffer,
79 gsize count,
80 int io_priority,
81 GCancellable *cancellable,
82 GAsyncReadyCallback callback,
83 gpointer user_data);
84 gssize (* read_finish) (GInputStream *stream,
85 GAsyncResult *result,
86 GError **error);
87 void (* skip_async) (GInputStream *stream,
88 gsize count,
89 int io_priority,
90 GCancellable *cancellable,
91 GAsyncReadyCallback callback,
92 gpointer user_data);
93 gssize (* skip_finish) (GInputStream *stream,
94 GAsyncResult *result,
95 GError **error);
96 void (* close_async) (GInputStream *stream,
97 int io_priority,
98 GCancellable *cancellable,
99 GAsyncReadyCallback callback,
100 gpointer user_data);
101 gboolean (* close_finish) (GInputStream *stream,
102 GAsyncResult *result,
103 GError **error);
105 /*< private >*/
106 /* Padding for future expansion */
107 void (*_g_reserved1) (void);
108 void (*_g_reserved2) (void);
109 void (*_g_reserved3) (void);
110 void (*_g_reserved4) (void);
111 void (*_g_reserved5) (void);
114 GType g_input_stream_get_type (void) G_GNUC_CONST;
116 gssize g_input_stream_read (GInputStream *stream,
117 void *buffer,
118 gsize count,
119 GCancellable *cancellable,
120 GError **error);
121 gboolean g_input_stream_read_all (GInputStream *stream,
122 void *buffer,
123 gsize count,
124 gsize *bytes_read,
125 GCancellable *cancellable,
126 GError **error);
127 GLIB_AVAILABLE_IN_2_34
128 GBytes *g_input_stream_read_bytes (GInputStream *stream,
129 gsize count,
130 GCancellable *cancellable,
131 GError **error);
132 gssize g_input_stream_skip (GInputStream *stream,
133 gsize count,
134 GCancellable *cancellable,
135 GError **error);
136 gboolean g_input_stream_close (GInputStream *stream,
137 GCancellable *cancellable,
138 GError **error);
139 void g_input_stream_read_async (GInputStream *stream,
140 void *buffer,
141 gsize count,
142 int io_priority,
143 GCancellable *cancellable,
144 GAsyncReadyCallback callback,
145 gpointer user_data);
146 gssize g_input_stream_read_finish (GInputStream *stream,
147 GAsyncResult *result,
148 GError **error);
149 GLIB_AVAILABLE_IN_2_34
150 void g_input_stream_read_bytes_async (GInputStream *stream,
151 gsize count,
152 int io_priority,
153 GCancellable *cancellable,
154 GAsyncReadyCallback callback,
155 gpointer user_data);
156 GLIB_AVAILABLE_IN_2_34
157 GBytes *g_input_stream_read_bytes_finish (GInputStream *stream,
158 GAsyncResult *result,
159 GError **error);
160 void g_input_stream_skip_async (GInputStream *stream,
161 gsize count,
162 int io_priority,
163 GCancellable *cancellable,
164 GAsyncReadyCallback callback,
165 gpointer user_data);
166 gssize g_input_stream_skip_finish (GInputStream *stream,
167 GAsyncResult *result,
168 GError **error);
169 void g_input_stream_close_async (GInputStream *stream,
170 int io_priority,
171 GCancellable *cancellable,
172 GAsyncReadyCallback callback,
173 gpointer user_data);
174 gboolean g_input_stream_close_finish (GInputStream *stream,
175 GAsyncResult *result,
176 GError **error);
178 /* For implementations: */
180 gboolean g_input_stream_is_closed (GInputStream *stream);
181 gboolean g_input_stream_has_pending (GInputStream *stream);
182 gboolean g_input_stream_set_pending (GInputStream *stream,
183 GError **error);
184 void g_input_stream_clear_pending (GInputStream *stream);
186 G_END_DECLS
188 #endif /* __G_INPUT_STREAM_H__ */