From 9393d6b459d02a8508750a846bf97a69e48c97e2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 6 Mar 2006 14:29:39 +0000 Subject: 2006-03-06 Thiago Macieira * qt/*: * dbus/qdbus.h: Sync with KDE Subversion revision 516237. This represents the first feature-complete version of the Qt4 bindings since I took ove maintainership. --- qt/qdbusconnection_p.h | 79 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 18 deletions(-) (limited to 'qt/qdbusconnection_p.h') diff --git a/qt/qdbusconnection_p.h b/qt/qdbusconnection_p.h index cd2e48e2..7904a843 100644 --- a/qt/qdbusconnection_p.h +++ b/qt/qdbusconnection_p.h @@ -40,13 +40,14 @@ #include "qdbuserror.h" #include -#include +#include #include +#include #include #include +#include #include -#include -#include +#include #include @@ -79,16 +80,38 @@ public: struct SignalHook { + inline SignalHook() : obj(0), midx(-1) { } QString interface, name, signature; - QPointer obj; + QObject* obj; int midx; QList params; }; - struct ObjectData + struct ObjectTreeNode { - QPointer obj; + struct Data + { + QString name; + ObjectTreeNode *node; + + inline bool operator<(const QString &other) const + { return name < other; } + }; + + inline ObjectTreeNode() : obj(0), flags(0) { } + inline ~ObjectTreeNode() { clear(); } + inline void clear() + { + foreach (const Data &entry, children) { + entry.node->clear(); + delete entry.node; + } + children.clear(); + } + + QObject* obj; int flags; + QVector children; }; public: @@ -96,11 +119,9 @@ public: typedef QMultiHash WatcherHash; typedef QHash TimeoutHash; typedef QMultiHash SignalHookHash; - typedef QHash ObjectDataHash; - typedef QHash ObjectHookHash; typedef QHash > KnownInterfacesHash; typedef QHash KnownObjectsHash; - + public: // public methods QDBusConnectionPrivate(QObject *parent = 0); @@ -113,11 +134,13 @@ public: void closeConnection(); void timerEvent(QTimerEvent *e); - bool handleSignal(const QString &path, const QDBusMessage &msg); bool send(const QDBusMessage &message) const; int sendWithReplyAsync(const QDBusMessage &message, QObject *receiver, const char *method) const; + void connectSignal(const QString &key, const SignalHook &hook); + void registerObject(const ObjectTreeNode *node); + bool handleSignal(const QString &path, const QDBusMessage &msg); bool handleSignal(const QDBusMessage &msg); bool handleObjectCall(const QDBusMessage &message); bool handleError(); @@ -127,13 +150,14 @@ public: QSharedDataPointer findInterface(const QString& name); QDBusIntrospection::Object* findObject(const QString& service, const QString& path); - - bool activateReply(QObject *object, int idx, const QList& metaTypes, - const QDBusMessage &msg); + bool activateSignal(const SignalHook& hook, const QDBusMessage &msg); bool activateCall(QObject* object, int flags, const QDBusMessage &msg); - bool activateAdaptor(QObject *object, int flags, const QDBusMessage &msg); - bool activateObject(const ObjectData& data, const QDBusMessage &msg); + bool activateObject(const ObjectTreeNode *node, const QDBusMessage &msg); + bool activateInternalFilters(const ObjectTreeNode *node, const QDBusMessage &msg); + + void postCallDeliveryEvent(CallDeliveryEvent *data); + CallDeliveryEvent *postedCallDeliveryEvent(); void deliverCall(const CallDeliveryEvent &data) const; protected: @@ -144,14 +168,17 @@ public slots: void socketRead(int); void socketWrite(int); void objectDestroyed(QObject *o); + void relaySignal(QObject *obj, const char *interface, const char *name, const QVariantList &args); public: // public member variables + QString name; // this connection's name + DBusError error; QDBusError lastError; QAtomic ref; - QMutex mutex; + QReadWriteLock lock; ConnectionMode mode; DBusConnection *connection; DBusServer *server; @@ -159,9 +186,13 @@ public: WatcherHash watchers; TimeoutHash timeouts; SignalHookHash signalHooks; - ObjectHookHash objectHooks; QList pendingTimeouts; + ObjectTreeNode rootNode; + + QMutex callDeliveryMutex; + CallDeliveryEvent *callDeliveryState; // protected by the callDeliveryMutex mutex + public: // public mutable member variables mutable KnownInterfacesHash knownInterfaces; @@ -182,6 +213,18 @@ public: public slots: void reply(const QDBusMessage &msg); -}; +}; + +extern int qDBusParametersForMethod(const QByteArray &sig, QList& metaTypes); +extern int qDBusNameToTypeId(const char *name); +extern bool qDBusCheckAsyncTag(const char *tag); + +// in qdbusinternalfilters.cpp +extern void qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode *node, + const QDBusMessage &msg); +extern void qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode *node, + const QDBusMessage &msg); +extern void qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode *node, + const QDBusMessage &msg); #endif -- cgit