chiark / gitweb /
Infra: Rudimentary setup system.
[clg] / gio / alien / g_callback_output_stream.h
1 #ifndef __G_CALLBACK_OUTPUT_STREAM_H__
2 #define __G_CALLBACK_OUTPUT_STREAM_H__
3
4 #include <gio/gio.h>
5
6 G_BEGIN_DECLS
7
8 #define G_TYPE_CALLBACK_OUTPUT_STREAM         (g_callback_output_stream_get_type ())
9 #define G_CALLBACK_OUTPUT_STREAM(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_CALLBACK_OUTPUT_STREAM, GCallbackOutputStream))
10 #define G_CALLBACK_OUTPUT_STREAM_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_CALLBACK_OUTPUT_STREAM, GCallbackOutputStreamClass))
11 #define G_IS_CALLBACK_OUTPUT_STREAM(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_CALLBACK_OUTPUT_STREAM))
12 #define G_IS_CALLBACK_OUTPUT_STREAM_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_CALLBACK_OUTPUT_STREAM))
13 #define G_CALLBACK_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_CALLBACK_OUTPUT_STREAM, GCallbackOutputStreamClass))
14
15
16 typedef struct _GCallbackOutputStream         GCallbackOutputStream;
17 typedef struct _GCallbackOutputStreamClass    GCallbackOutputStreamClass;
18 typedef struct _GCallbackOutputStreamPrivate  GCallbackOutputStreamPrivate;
19
20 struct _GCallbackOutputStream
21 {
22   GOutputStream parent_instance;
23
24   /*< private >*/
25   GCallbackOutputStreamPrivate *priv;
26 };
27
28 struct _GCallbackOutputStreamClass
29 {
30   GOutputStreamClass parent_class;
31 };
32
33 GType g_callback_output_stream_get_type (void) G_GNUC_CONST;
34
35 typedef gssize (*GCallbackOutputStreamWriteFunc) (const void *buffer,
36                                                   gsize count,
37                                                   GCancellable *cancellable,
38                                                   GError **error,
39                                                   gpointer data);
40
41 typedef gboolean (*GCallbackOutputStreamFlushFunc) (GCancellable *cancellable,
42                                                     GError **error,
43                                                     gpointer data);
44
45 typedef gboolean (*GCallbackOutputStreamCloseFunc) (GCancellable *cancellable,
46                                                     GError **error,
47                                                     gpointer data);
48
49
50 GOutputStream*
51 g_callback_output_stream_new (GCallbackOutputStreamWriteFunc read_func,
52                               GCallbackOutputStreamFlushFunc flush_func,
53                               GCallbackOutputStreamCloseFunc close_func,
54                               gpointer user_data);
55
56 G_END_DECLS
57
58 #endif /* __G_CALLBACK_OUTPUT_STREAM_H__ */