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