1 /* qdbusmessage.h QDBusMessage object
3 * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
4 * Copyright (C) 2006 Trolltech AS. All rights reserved.
5 * Author: Thiago Macieira <thiago.macieira@trolltech.com>
7 * Licensed under the Academic Free License version 2.1
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.
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.
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 Foundation
21 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #ifndef QDBUSMESSAGE_H
26 #define QDBUSMESSAGE_H
28 #include "qdbusmacros.h"
29 #include "qdbuserror.h"
30 #include <QtCore/qlist.h>
31 #include <QtCore/qvariant.h>
35 class QDBusMessagePrivate;
36 class QDBusConnection;
37 class QDBusConnectionPrivate;
40 class QDBUS_EXPORT QDBusMessage: public QList<QVariant>
42 //friend class QDBusConnection;
43 friend class QDBusConnectionPrivate;
45 enum { DefaultTimeout = -1, NoTimeout = INT_MAX};
46 enum MessageType { InvalidMessage, MethodCallMessage, ReplyMessage,
47 ErrorMessage, SignalMessage };
50 QDBusMessage(const QDBusMessage &other);
53 QDBusMessage &operator=(const QDBusMessage &other);
55 static QDBusMessage signal(const QString &path, const QString &interface,
57 static QDBusMessage methodCall(const QString &destination, const QString &path,
58 const QString &interface, const QString &method);
59 static QDBusMessage methodReply(const QDBusMessage &other);
60 static QDBusMessage error(const QDBusMessage &other, const QString &name,
61 const QString &message = QString());
62 static QDBusMessage error(const QDBusMessage &other, const QDBusError &error);
65 QString interface() const;
67 inline QString member() const { return name(); }
68 inline QString method() const { return name(); }
69 QString service() const;
70 inline QString sender() const { return service(); }
71 MessageType type() const;
74 void setTimeout(int ms);
78 QString signature() const;
79 void setSignature(const QString &signature);
81 QDBusConnection connection() const;
83 int serialNumber() const;
84 int replySerialNumber() const;
85 bool wasRepliedTo() const;
88 DBusMessage *toDBusMessage() const;
89 static QDBusMessage fromDBusMessage(DBusMessage *dmsg, const QDBusConnection &connection);
90 static QDBusMessage fromError(const QDBusError& error);
91 QDBusMessagePrivate *d_ptr;
95 QDebug operator<<(QDebug, const QDBusMessage &);