[kdbus] KDBUS_ITEM_PAYLOAD_OFF items are (once again) relative to msg header
[platform/upstream/glib.git] / gio / gsimpleasyncresult.h
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright (C) 2006-2007 Red Hat, Inc.
4  *
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.
9  *
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.
14  *
15  * You should have received a copy of the GNU Lesser General
16  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
17  *
18  * Author: Alexander Larsson <alexl@redhat.com>
19  */
20
21 #ifndef __G_SIMPLE_ASYNC_RESULT_H__
22 #define __G_SIMPLE_ASYNC_RESULT_H__
23
24 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25 #error "Only <gio/gio.h> can be included directly."
26 #endif
27
28 #include <gio/giotypes.h>
29
30 G_BEGIN_DECLS
31
32 #define G_TYPE_SIMPLE_ASYNC_RESULT         (g_simple_async_result_get_type ())
33 #define G_SIMPLE_ASYNC_RESULT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResult))
34 #define G_SIMPLE_ASYNC_RESULT_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass))
35 #define G_IS_SIMPLE_ASYNC_RESULT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SIMPLE_ASYNC_RESULT))
36 #define G_IS_SIMPLE_ASYNC_RESULT_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_SIMPLE_ASYNC_RESULT))
37 #define G_SIMPLE_ASYNC_RESULT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass))
38
39 /**
40  * GSimpleAsyncResult:
41  *
42  * A simple implementation of #GAsyncResult.
43  **/
44 typedef struct _GSimpleAsyncResultClass   GSimpleAsyncResultClass;
45
46
47 GLIB_AVAILABLE_IN_ALL
48 GType               g_simple_async_result_get_type         (void) G_GNUC_CONST;
49
50 GLIB_AVAILABLE_IN_ALL
51 GSimpleAsyncResult *g_simple_async_result_new              (GObject                 *source_object,
52                                                             GAsyncReadyCallback      callback,
53                                                             gpointer                 user_data,
54                                                             gpointer                 source_tag);
55 GLIB_AVAILABLE_IN_ALL
56 GSimpleAsyncResult *g_simple_async_result_new_error        (GObject                 *source_object,
57                                                             GAsyncReadyCallback      callback,
58                                                             gpointer                 user_data,
59                                                             GQuark                   domain,
60                                                             gint                     code,
61                                                             const char              *format,
62                                                             ...) G_GNUC_PRINTF (6, 7);
63 GLIB_AVAILABLE_IN_ALL
64 GSimpleAsyncResult *g_simple_async_result_new_from_error   (GObject                 *source_object,
65                                                             GAsyncReadyCallback      callback,
66                                                             gpointer                 user_data,
67                                                             const GError            *error);
68 GLIB_AVAILABLE_IN_ALL
69 GSimpleAsyncResult *g_simple_async_result_new_take_error   (GObject                 *source_object,
70                                                             GAsyncReadyCallback      callback,
71                                                             gpointer                 user_data,
72                                                             GError                  *error);
73
74 GLIB_AVAILABLE_IN_ALL
75 void                g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult      *simple,
76                                                                gpointer                 op_res,
77                                                                GDestroyNotify           destroy_op_res);
78 GLIB_AVAILABLE_IN_ALL
79 gpointer            g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult      *simple);
80
81 GLIB_AVAILABLE_IN_ALL
82 void                g_simple_async_result_set_op_res_gssize   (GSimpleAsyncResult      *simple,
83                                                                gssize                   op_res);
84 GLIB_AVAILABLE_IN_ALL
85 gssize              g_simple_async_result_get_op_res_gssize   (GSimpleAsyncResult      *simple);
86
87 GLIB_AVAILABLE_IN_ALL
88 void                g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult      *simple,
89                                                                gboolean                 op_res);
90 GLIB_AVAILABLE_IN_ALL
91 gboolean            g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult      *simple);
92
93
94
95 GLIB_AVAILABLE_IN_2_32
96 void                g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple,
97                                                                  GCancellable       *check_cancellable);
98 GLIB_AVAILABLE_IN_ALL
99 gpointer            g_simple_async_result_get_source_tag   (GSimpleAsyncResult      *simple);
100 GLIB_AVAILABLE_IN_ALL
101 void                g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult      *simple,
102                                                                    gboolean          handle_cancellation);
103 GLIB_AVAILABLE_IN_ALL
104 void                g_simple_async_result_complete         (GSimpleAsyncResult      *simple);
105 GLIB_AVAILABLE_IN_ALL
106 void                g_simple_async_result_complete_in_idle (GSimpleAsyncResult      *simple);
107 GLIB_AVAILABLE_IN_ALL
108 void                g_simple_async_result_run_in_thread    (GSimpleAsyncResult      *simple,
109                                                             GSimpleAsyncThreadFunc   func,
110                                                             int                      io_priority,
111                                                             GCancellable            *cancellable);
112 GLIB_AVAILABLE_IN_ALL
113 void                g_simple_async_result_set_from_error   (GSimpleAsyncResult      *simple,
114                                                             const GError            *error);
115 GLIB_AVAILABLE_IN_ALL
116 void                g_simple_async_result_take_error       (GSimpleAsyncResult      *simple,
117                                                             GError            *error);
118 GLIB_AVAILABLE_IN_ALL
119 gboolean            g_simple_async_result_propagate_error  (GSimpleAsyncResult      *simple,
120                                                             GError                 **dest);
121 GLIB_AVAILABLE_IN_ALL
122 void                g_simple_async_result_set_error        (GSimpleAsyncResult      *simple,
123                                                             GQuark                   domain,
124                                                             gint                     code,
125                                                             const char              *format,
126                                                             ...) G_GNUC_PRINTF (4, 5);
127 GLIB_AVAILABLE_IN_ALL
128 void                g_simple_async_result_set_error_va     (GSimpleAsyncResult      *simple,
129                                                             GQuark                   domain,
130                                                             gint                     code,
131                                                             const char              *format,
132                                                             va_list                  args)
133                                                             G_GNUC_PRINTF(4, 0);
134 GLIB_AVAILABLE_IN_ALL
135 gboolean            g_simple_async_result_is_valid         (GAsyncResult            *result,
136                                                             GObject                 *source,
137                                                             gpointer                 source_tag);
138
139 GLIB_AVAILABLE_IN_ALL
140 void g_simple_async_report_error_in_idle  (GObject            *object,
141                                            GAsyncReadyCallback callback,
142                                            gpointer            user_data,
143                                            GQuark              domain,
144                                            gint                code,
145                                            const char         *format,
146                                            ...) G_GNUC_PRINTF(6, 7);
147 GLIB_AVAILABLE_IN_ALL
148 void g_simple_async_report_gerror_in_idle (GObject            *object,
149                                            GAsyncReadyCallback callback,
150                                            gpointer            user_data,
151                                            const GError       *error);
152 GLIB_AVAILABLE_IN_ALL
153 void g_simple_async_report_take_gerror_in_idle (GObject            *object,
154                                                 GAsyncReadyCallback callback,
155                                                 gpointer            user_data,
156                                                 GError             *error);
157
158 G_END_DECLS
159
160
161
162 #endif /* __G_SIMPLE_ASYNC_RESULT_H__ */