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 #ifndef __G_INPUT_STREAM_H__
24 #define __G_INPUT_STREAM_H__
26 #include <glib-object.h>
27 #include <gio/gioerror.h>
28 #include <gio/gcancellable.h>
29 #include <gio/gasyncresult.h>
33 #define G_TYPE_INPUT_STREAM (g_input_stream_get_type ())
34 #define G_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_INPUT_STREAM, GInputStream))
35 #define G_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_INPUT_STREAM, GInputStreamClass))
36 #define G_IS_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_INPUT_STREAM))
37 #define G_IS_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_INPUT_STREAM))
38 #define G_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_INPUT_STREAM, GInputStreamClass))
40 typedef struct _GInputStream GInputStream;
41 typedef struct _GInputStreamClass GInputStreamClass;
42 typedef struct _GInputStreamPrivate GInputStreamPrivate;
49 GInputStreamPrivate *priv;
52 struct _GInputStreamClass
54 GObjectClass parent_class;
58 gssize (* read) (GInputStream *stream,
61 GCancellable *cancellable,
63 gssize (* skip) (GInputStream *stream,
65 GCancellable *cancellable,
67 gboolean (* close) (GInputStream *stream,
68 GCancellable *cancellable,
71 /* Async ops: (optional in derived classes) */
72 void (* read_async) (GInputStream *stream,
76 GCancellable *cancellable,
77 GAsyncReadyCallback callback,
79 gssize (* read_finish) (GInputStream *stream,
82 void (* skip_async) (GInputStream *stream,
85 GCancellable *cancellable,
86 GAsyncReadyCallback callback,
88 gssize (* skip_finish) (GInputStream *stream,
91 void (* close_async) (GInputStream *stream,
93 GCancellable *cancellable,
94 GAsyncReadyCallback callback,
96 gboolean (* close_finish)(GInputStream *stream,
100 /* Padding for future expansion */
101 void (*_g_reserved1) (void);
102 void (*_g_reserved2) (void);
103 void (*_g_reserved3) (void);
104 void (*_g_reserved4) (void);
105 void (*_g_reserved5) (void);
108 GType g_input_stream_get_type (void) G_GNUC_CONST;
110 gssize g_input_stream_read (GInputStream *stream,
113 GCancellable *cancellable,
115 gboolean g_input_stream_read_all (GInputStream *stream,
119 GCancellable *cancellable,
121 gssize g_input_stream_skip (GInputStream *stream,
123 GCancellable *cancellable,
125 gboolean g_input_stream_close (GInputStream *stream,
126 GCancellable *cancellable,
128 void g_input_stream_read_async (GInputStream *stream,
132 GCancellable *cancellable,
133 GAsyncReadyCallback callback,
135 gssize g_input_stream_read_finish (GInputStream *stream,
136 GAsyncResult *result,
138 void g_input_stream_skip_async (GInputStream *stream,
141 GCancellable *cancellable,
142 GAsyncReadyCallback callback,
144 gssize g_input_stream_skip_finish (GInputStream *stream,
145 GAsyncResult *result,
147 void g_input_stream_close_async (GInputStream *stream,
149 GCancellable *cancellable,
150 GAsyncReadyCallback callback,
152 gboolean g_input_stream_close_finish (GInputStream *stream,
153 GAsyncResult *result,
156 /* For implementations: */
158 gboolean g_input_stream_is_closed (GInputStream *stream);
159 gboolean g_input_stream_has_pending (GInputStream *stream);
160 void g_input_stream_set_pending (GInputStream *stream,
165 #endif /* __G_INPUT_STREAM_H__ */