You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

99 lines
3.5 KiB

  1. /* gerror.h - Error reporting system
  2. *
  3. * Copyright 2000 Red Hat, Inc.
  4. *
  5. * The Gnome Library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public License as
  7. * published by the Free Software Foundation; either version 2 of the
  8. * License, or (at your option) any later version.
  9. *
  10. * The Gnome 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.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with the Gnome Library; see the file COPYING.LIB. If not,
  17. * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  18. * Boston, MA 02111-1307, USA.
  19. */
  20. #if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
  21. #error "Only <glib.h> can be included directly."
  22. #endif
  23. #ifndef __G_ERROR_H__
  24. #define __G_ERROR_H__
  25. #include <stdarg.h>
  26. #include <glib/gquark.h>
  27. G_BEGIN_DECLS
  28. typedef struct _GError GError;
  29. struct _GError
  30. {
  31. GQuark domain;
  32. gint code;
  33. gchar *message;
  34. };
  35. GError* g_error_new (GQuark domain,
  36. gint code,
  37. const gchar *format,
  38. ...) G_GNUC_PRINTF (3, 4);
  39. GError* g_error_new_literal (GQuark domain,
  40. gint code,
  41. const gchar *message);
  42. GError* g_error_new_valist (GQuark domain,
  43. gint code,
  44. const gchar *format,
  45. va_list args);
  46. void g_error_free (GError *error);
  47. GError* g_error_copy (const GError *error);
  48. gboolean g_error_matches (const GError *error,
  49. GQuark domain,
  50. gint code);
  51. /* if (err) *err = g_error_new(domain, code, format, ...), also has
  52. * some sanity checks.
  53. */
  54. void g_set_error (GError **err,
  55. GQuark domain,
  56. gint code,
  57. const gchar *format,
  58. ...) G_GNUC_PRINTF (4, 5);
  59. void g_set_error_literal (GError **err,
  60. GQuark domain,
  61. gint code,
  62. const gchar *message);
  63. /* if (dest) *dest = src; also has some sanity checks.
  64. */
  65. void g_propagate_error (GError **dest,
  66. GError *src);
  67. /* if (err && *err) { g_error_free(*err); *err = NULL; } */
  68. void g_clear_error (GError **err);
  69. /* if (err) prefix the formatted string to the ->message */
  70. void g_prefix_error (GError **err,
  71. const gchar *format,
  72. ...) G_GNUC_PRINTF (2, 3);
  73. /* g_propagate_error then g_error_prefix on dest */
  74. void g_propagate_prefixed_error (GError **dest,
  75. GError *src,
  76. const gchar *format,
  77. ...) G_GNUC_PRINTF (3, 4);
  78. G_END_DECLS
  79. #endif /* __G_ERROR_H__ */