GSettings: fix check for delaying backend subscription
[platform/upstream/glib.git] / gio / giostream.h
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright © 2008, 2009 Codethink Limited
4  * Copyright © 2009 Red Hat, Inc.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published
8  * by the Free Software Foundation; either version 2 of the licence or (at
9  * your option) any later version.
10  *
11  * See the included COPYING file for more information.
12  *
13  * Authors: Ryan Lortie <desrt@desrt.ca>
14  *          Alexander Larsson <alexl@redhat.com>
15  */
16
17 #ifndef __G_IO_STREAM_H__
18 #define __G_IO_STREAM_H__
19
20 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
21 #error "Only <gio/gio.h> can be included directly."
22 #endif
23
24 #include <gio/ginputstream.h>
25 #include <gio/goutputstream.h>
26 #include <gio/gcancellable.h>
27 #include <gio/gioerror.h>
28
29 G_BEGIN_DECLS
30
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))
37
38 typedef struct _GIOStreamPrivate                            GIOStreamPrivate;
39 typedef struct _GIOStreamClass                              GIOStreamClass;
40
41 /**
42  * GIOStream:
43  *
44  * Base class for read-write streams.
45  **/
46 struct _GIOStream
47 {
48   GObject parent_instance;
49
50   /*< private >*/
51   GIOStreamPrivate *priv;
52 };
53
54 struct _GIOStreamClass
55 {
56   GObjectClass parent_class;
57
58   GInputStream *  (*get_input_stream)  (GIOStream *stream);
59   GOutputStream * (*get_output_stream) (GIOStream *stream);
60
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);
84 };
85
86 GLIB_AVAILABLE_IN_ALL
87 GType          g_io_stream_get_type          (void)  G_GNUC_CONST;
88
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);
93
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);
102
103 GLIB_AVAILABLE_IN_ALL
104 gboolean       g_io_stream_splice_finish     (GAsyncResult         *result,
105                                               GError              **error);
106
107 GLIB_AVAILABLE_IN_ALL
108 gboolean       g_io_stream_close             (GIOStream            *stream,
109                                               GCancellable         *cancellable,
110                                               GError              **error);
111
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);
122
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);
132
133 G_END_DECLS
134
135 #endif /* __G_IO_STREAM_H__ */