1 /* -*- mode: C++; set-fill-width: 100 -*-
3 * Copyright (C) 2006 Trolltech AS. All rights reserved.
4 * Author: Thiago Macieira <thiago.macieira@trolltech.com>
6 * Licensed under the Academic Free License version 2.1
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program 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
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation
20 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 // This file is not part of the public API. This header file may
29 // change from version to version without notice, or even be
36 #ifndef QDBUSABSTRACTADAPTORPRIVATE_H
37 #define QDBUSABSTRACTADAPTORPRIVATE_H
39 #include <QtCore/qobject.h>
40 #include <QtCore/qmap.h>
41 #include <QtCore/qhash.h>
42 #include <QtCore/qreadwritelock.h>
43 #include <QtCore/qvariant.h>
44 #include <QtCore/qvector.h>
46 #define QCLASSINFO_DBUS_INTERFACE "D-Bus Interface"
47 #define QCLASSINFO_DBUS_INTROSPECTION "D-Bus Introspection"
49 class QDBusAbstractAdaptor;
50 class QDBusAdaptorConnector;
51 class QDBusAdaptorManager;
52 class QDBusConnectionPrivate;
54 #if QT_VERSION < 0x040200
55 /* mirrored in qobject_p.h, DON'T CHANGE without prior warning */
56 struct QSignalSpyCallbackSet
58 typedef void (*BeginCallback)(QObject *caller, int method_index, void **argv);
59 typedef void (*EndCallback)(QObject *caller, int method_index);
60 BeginCallback signal_begin_callback,
62 EndCallback signal_end_callback,
66 # error Qt 4.2.0 is supposed to have a better solution!
70 class QDBusAbstractAdaptorPrivate
75 static QString retrieveIntrospectionXml(QDBusAbstractAdaptor *adaptor);
76 static void saveIntrospectionXml(QDBusAbstractAdaptor *adaptor, const QString &xml);
79 class QDBusAdaptorConnector: public QObject
86 QDBusAbstractAdaptor *adaptor;
87 const QMetaObject *metaObject;
89 inline bool operator<(const AdaptorData &other) const
90 { return interface < other.interface; }
91 inline bool operator<(const QString &other) const
92 { return interface < other; }
94 typedef QVector<AdaptorData> AdaptorMap;
97 explicit QDBusAdaptorConnector(QObject *parent);
98 ~QDBusAdaptorConnector();
100 void addAdaptor(QDBusAbstractAdaptor *adaptor);
101 void relay(QObject *sender);
108 void relaySignal(QObject *obj, const char *interface, const char *name, const QVariantList &args);
110 public: // member variables
112 bool waitingForPolish : 1;
116 const QMetaObject *senderMetaObject;
118 public: // static members
119 static void signalBeginCallback(QObject *caller, int method_index, void **argv);
120 static void signalEndCallback(QObject *caller, int method_index);
124 extern QDBusAdaptorConnector *qDBusFindAdaptorConnector(QObject *object);
125 extern QDBusAdaptorConnector *qDBusCreateAdaptorConnector(QObject *object);
127 #endif // QDBUSABSTRACTADAPTORPRIVATE_H