dbus-errors.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
  2. /* dbus-errors.h Error reporting
  3. *
  4. * Copyright (C) 2002 Red Hat Inc.
  5. * Copyright (C) 2003 CodeFactory AB
  6. *
  7. * Licensed under the Academic Free License version 2.1
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. */
  24. #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
  25. #error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
  26. #endif
  27. #ifndef DBUS_ERROR_H
  28. #define DBUS_ERROR_H
  29. #include <dbus/dbus-macros.h>
  30. #include <dbus/dbus-types.h>
  31. #include <dbus/dbus-protocol.h>
  32. DBUS_BEGIN_DECLS
  33. /**
  34. * @addtogroup DBusErrors
  35. * @{
  36. */
  37. /** Mostly-opaque type representing an error that occurred */
  38. typedef struct DBusError DBusError;
  39. /**
  40. * Object representing an exception.
  41. */
  42. struct DBusError
  43. {
  44. const char *name; /**< public error name field */
  45. const char *message; /**< public error message field */
  46. unsigned int dummy1 : 1; /**< placeholder */
  47. unsigned int dummy2 : 1; /**< placeholder */
  48. unsigned int dummy3 : 1; /**< placeholder */
  49. unsigned int dummy4 : 1; /**< placeholder */
  50. unsigned int dummy5 : 1; /**< placeholder */
  51. void *padding1; /**< placeholder */
  52. };
  53. #define DBUS_ERROR_INIT { NULL, NULL, TRUE, 0, 0, 0, 0, NULL }
  54. DBUS_EXPORT
  55. void dbus_error_init (DBusError *error);
  56. DBUS_EXPORT
  57. void dbus_error_free (DBusError *error);
  58. DBUS_EXPORT
  59. void dbus_set_error (DBusError *error,
  60. const char *name,
  61. const char *message,
  62. ...) _DBUS_GNUC_PRINTF (3, 4);
  63. DBUS_EXPORT
  64. void dbus_set_error_const (DBusError *error,
  65. const char *name,
  66. const char *message);
  67. DBUS_EXPORT
  68. void dbus_move_error (DBusError *src,
  69. DBusError *dest);
  70. DBUS_EXPORT
  71. dbus_bool_t dbus_error_has_name (const DBusError *error,
  72. const char *name);
  73. DBUS_EXPORT
  74. dbus_bool_t dbus_error_is_set (const DBusError *error);
  75. /** @} */
  76. DBUS_END_DECLS
  77. #endif /* DBUS_ERROR_H */