1 gerror.h |
1 /* gerror.h - Error reporting system |
|
2 * |
|
3 * Copyright 2000 Red Hat, Inc. |
|
4 * Portions copyright (c) 2006 Nokia Corporation. All rights reserved. |
|
5 * |
|
6 * The Gnome Library is free software; you can redistribute it and/or |
|
7 * modify it under the terms of the GNU Lesser General Public License as |
|
8 * published by the Free Software Foundation; either version 2 of the |
|
9 * License, or (at your option) any later version. |
|
10 * |
|
11 * The Gnome Library is distributed in the hope that it will be useful, |
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 * Lesser General Public License for more details. |
|
15 * |
|
16 * You should have received a copy of the GNU Lesser General Public |
|
17 * License along with the Gnome Library; see the file COPYING.LIB. If not, |
|
18 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
19 * Boston, MA 02111-1307, USA. |
|
20 */ |
|
21 |
|
22 #ifndef __G_ERROR_H__ |
|
23 #define __G_ERROR_H__ |
|
24 |
|
25 #include <_ansi.h> |
|
26 #include <glib/gquark.h> |
|
27 |
|
28 G_BEGIN_DECLS |
|
29 |
|
30 typedef struct _GError GError; |
|
31 |
|
32 struct _GError |
|
33 { |
|
34 GQuark domain; |
|
35 gint code; |
|
36 gchar *message; |
|
37 }; |
|
38 |
|
39 IMPORT_C GError* g_error_new (GQuark domain, |
|
40 gint code, |
|
41 const gchar *format, |
|
42 ...) G_GNUC_PRINTF (3, 4); |
|
43 |
|
44 IMPORT_C GError* g_error_new_literal (GQuark domain, |
|
45 gint code, |
|
46 const gchar *message); |
|
47 |
|
48 IMPORT_C void g_error_free (GError *error); |
|
49 IMPORT_C GError* g_error_copy (const GError *error); |
|
50 |
|
51 IMPORT_C gboolean g_error_matches (const GError *error, |
|
52 GQuark domain, |
|
53 gint code); |
|
54 |
|
55 /* if (err) *err = g_error_new(domain, code, format, ...), also has |
|
56 * some sanity checks. |
|
57 */ |
|
58 IMPORT_C void g_set_error (GError **err, |
|
59 GQuark domain, |
|
60 gint code, |
|
61 const gchar *format, |
|
62 ...) G_GNUC_PRINTF (4, 5); |
|
63 |
|
64 /* if (dest) *dest = src; also has some sanity checks. |
|
65 */ |
|
66 IMPORT_C void g_propagate_error (GError **dest, |
|
67 GError *src); |
|
68 |
|
69 /* if (err && *err) { g_error_free(*err); *err = NULL; } */ |
|
70 IMPORT_C void g_clear_error (GError **err); |
|
71 |
|
72 |
|
73 G_END_DECLS |
|
74 |
|
75 #endif /* __G_ERROR_H__ */ |
|
76 |