gerror.h

Go to the documentation of this file.
00001 /* gerror.h - Error reporting system
00002  *
00003  *  Copyright 2000 Red Hat, Inc.
00004  * Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
00005  *
00006  * The Gnome Library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public License as
00008  * published by the Free Software Foundation; either version 2 of the
00009  * License, or (at your option) any later version.
00010  *
00011  * The Gnome Library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with the Gnome Library; see the file COPYING.LIB.  If not,
00018  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019  *   Boston, MA 02111-1307, USA.
00020  */
00021 
00022 #ifndef __G_ERROR_H__
00023 #define __G_ERROR_H__
00024 
00025 #include <_ansi.h>
00026 #include <glib/gquark.h>
00027 
00028 G_BEGIN_DECLS
00029 
00030 typedef struct _GError GError;
00031 
00032 struct _GError
00033 {
00034   GQuark       domain;
00035   gint         code;
00036   gchar       *message;
00037 };
00038 
00039 IMPORT_C GError*  g_error_new           (GQuark         domain,
00040                                 gint           code,
00041                                 const gchar   *format,
00042                                 ...) G_GNUC_PRINTF (3, 4);
00043 
00044 IMPORT_C GError*  g_error_new_literal   (GQuark         domain,
00045                                 gint           code,
00046                                 const gchar   *message);
00047 
00048 IMPORT_C void     g_error_free          (GError        *error);
00049 IMPORT_C GError*  g_error_copy          (const GError  *error);
00050 
00051 IMPORT_C gboolean g_error_matches       (const GError  *error,
00052                                 GQuark         domain,
00053                                 gint           code);
00054 
00055 /* if (err) *err = g_error_new(domain, code, format, ...), also has
00056  * some sanity checks.
00057  */
00058 IMPORT_C void     g_set_error           (GError       **err,
00059                                 GQuark         domain,
00060                                 gint           code,
00061                                 const gchar   *format,
00062                                 ...) G_GNUC_PRINTF (4, 5);
00063 
00064 /* if (dest) *dest = src; also has some sanity checks.
00065  */
00066 IMPORT_C void     g_propagate_error     (GError       **dest,
00067                                 GError        *src);
00068 
00069 /* if (err && *err) { g_error_free(*err); *err = NULL; } */
00070 IMPORT_C void     g_clear_error         (GError       **err);
00071 
00072 
00073 G_END_DECLS
00074 
00075 #endif /* __G_ERROR_H__ */
00076 

Copyright © Nokia Corporation 2001-2008
Back to top