Check for overflow when allocating RcBox
[glib.git] / gio / gsimpleasyncresult.h
blob8daa91d400180f26aa245afdc8908aa08b18f370
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.1 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, see <http://www.gnu.org/licenses/>.
18 * Author: Alexander Larsson <alexl@redhat.com>
21 #ifndef __G_SIMPLE_ASYNC_RESULT_H__
22 #define __G_SIMPLE_ASYNC_RESULT_H__
24 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25 #error "Only <gio/gio.h> can be included directly."
26 #endif
28 #include <gio/giotypes.h>
30 G_BEGIN_DECLS
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))
39 /**
40 * GSimpleAsyncResult:
42 * A simple implementation of #GAsyncResult.
43 **/
44 typedef struct _GSimpleAsyncResultClass GSimpleAsyncResultClass;
47 GLIB_AVAILABLE_IN_ALL
48 GType g_simple_async_result_get_type (void) G_GNUC_CONST;
50 GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
51 GSimpleAsyncResult *g_simple_async_result_new (GObject *source_object,
52 GAsyncReadyCallback callback,
53 gpointer user_data,
54 gpointer source_tag);
55 GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
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_DEPRECATED_IN_2_46_FOR(g_task_new)
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_DEPRECATED_IN_2_46_FOR(g_task_new)
69 GSimpleAsyncResult *g_simple_async_result_new_take_error (GObject *source_object,
70 GAsyncReadyCallback callback,
71 gpointer user_data,
72 GError *error);
74 GLIB_DEPRECATED_IN_2_46
75 void g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
76 gpointer op_res,
77 GDestroyNotify destroy_op_res);
78 GLIB_DEPRECATED_IN_2_46
79 gpointer g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple);
81 GLIB_DEPRECATED_IN_2_46
82 void g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
83 gssize op_res);
84 GLIB_DEPRECATED_IN_2_46
85 gssize g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple);
87 GLIB_DEPRECATED_IN_2_46
88 void g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
89 gboolean op_res);
90 GLIB_DEPRECATED_IN_2_46
91 gboolean g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple);
95 GLIB_AVAILABLE_IN_2_32 /* Also deprecated, but can't mark something both AVAILABLE and DEPRECATED */
96 void g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple,
97 GCancellable *check_cancellable);
98 GLIB_DEPRECATED_IN_2_46
99 gpointer g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple);
100 GLIB_DEPRECATED_IN_2_46
101 void g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple,
102 gboolean handle_cancellation);
103 GLIB_DEPRECATED_IN_2_46
104 void g_simple_async_result_complete (GSimpleAsyncResult *simple);
105 GLIB_DEPRECATED_IN_2_46
106 void g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple);
107 GLIB_DEPRECATED_IN_2_46
108 void g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
109 GSimpleAsyncThreadFunc func,
110 int io_priority,
111 GCancellable *cancellable);
112 GLIB_DEPRECATED_IN_2_46
113 void g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
114 const GError *error);
115 GLIB_DEPRECATED_IN_2_46
116 void g_simple_async_result_take_error (GSimpleAsyncResult *simple,
117 GError *error);
118 GLIB_DEPRECATED_IN_2_46
119 gboolean g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
120 GError **dest);
121 GLIB_DEPRECATED_IN_2_46
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_DEPRECATED_IN_2_46
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_DEPRECATED_IN_2_46
135 gboolean g_simple_async_result_is_valid (GAsyncResult *result,
136 GObject *source,
137 gpointer source_tag);
139 GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error)
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_DEPRECATED_IN_2_46_FOR(g_task_report_error)
148 void g_simple_async_report_gerror_in_idle (GObject *object,
149 GAsyncReadyCallback callback,
150 gpointer user_data,
151 const GError *error);
152 GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error)
153 void g_simple_async_report_take_gerror_in_idle (GObject *object,
154 GAsyncReadyCallback callback,
155 gpointer user_data,
156 GError *error);
158 G_END_DECLS
162 #endif /* __G_SIMPLE_ASYNC_RESULT_H__ */