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