blob: 7122a607867c63cbcc26aedbac2624746624904f [file] [log] [blame]
Emeric Vigier2f625822012-08-06 11:09:52 -04001/*
2 *
3 * D-Bus++ - C++ bindings for D-Bus
4 *
5 * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
6 *
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24
25#ifndef __DBUSXX_INTERNALERROR_H
26#define __DBUSXX_INTERNALERROR_H
27
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31
32#include <dbus-c++/error.h>
33
34#include <dbus/dbus.h>
35
36namespace DBus
37{
38
39struct DXXAPI InternalError
40{
41 DBusError error;
42
43 InternalError()
44 {
45 dbus_error_init(&error);
46 }
47
48 explicit InternalError(DBusError *e)
49 {
50 dbus_error_init(&error);
51 dbus_move_error(e, &error);
52 }
53
54 InternalError(const InternalError &ie)
55 {
56 dbus_error_init(&error);
57 dbus_move_error(const_cast<DBusError *>(&(ie.error)), &error);
58 }
59
60 ~InternalError()
61 {
62 dbus_error_free(&error);
63 }
64
65 operator DBusError *()
66 {
67 return &error;
68 }
69
70 operator bool()
71 {
72 return dbus_error_is_set(&error);
73 }
74};
75
76} /* namespace DBus */
77
78#endif//__DBUSXX_INTERNALERROR_H