Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qdbusintegrator_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2016 Intel Corporation.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5//
6// W A R N I N G
7// -------------
8//
9// This file is not part of the public API. This header file may
10// change from version to version without notice, or even be
11// removed.
12//
13// We mean it.
14//
15//
16
17#ifndef QDBUSINTEGRATOR_P_H
18#define QDBUSINTEGRATOR_P_H
19
20#include <QtDBus/private/qtdbusglobal_p.h>
21#include "qdbus_symbols_p.h"
22
23#include "qcoreevent.h"
24#include "qeventloop.h"
25#include "qobject.h"
26#include "private/qobject_p.h"
27#include "qlist.h"
28#include "qpointer.h"
29#include "qsemaphore.h"
30
31#include "qdbusconnection.h"
32#include "qdbusmessage.h"
33#include "qdbusconnection_p.h"
34
35#ifndef QT_NO_DBUS
36
38
40class QDBusMessage;
41
42// Really private structs used by qdbusintegrator.cpp
43// Things that aren't used by any other file
44
46{
47 struct Data
48 {
50 QList<QMetaType> metaTypes;
51
52 void swap(Data &other) noexcept
53 {
54 qSwap(slotIdx, other.slotIdx);
55 qSwap(metaTypes, other.metaTypes);
56 }
57 };
58
59 struct Key
60 {
62 QDBusConnection::RegisterOptions flags;
63
64 friend bool operator==(const Key &lhs, const Key &rhs) noexcept
65 {
66 return lhs.memberWithSignature == rhs.memberWithSignature && lhs.flags == rhs.flags;
67 }
68
69 friend size_t qHash(const QDBusSlotCache::Key &key, size_t seed = 0) noexcept
70 {
71 return qHashMulti(seed, key.memberWithSignature, key.flags);
72 }
73 };
74
75 using Hash = QHash<Key, Data>;
76
78
79 void swap(QDBusSlotCache &other) noexcept { qSwap(hash, other.hash); }
80};
81Q_DECLARE_SHARED(QDBusSlotCache::Data)
82Q_DECLARE_SHARED(QDBusSlotCache)
83
85{
86public:
88 const QDBusMessage &msg, const QList<QMetaType> &types)
89 : QAbstractMetaCallEvent(sender, -1), connection(c), message(msg), metaTypes(types), id(id)
90 {
91 }
92
93 void placeMetaCall(QObject *object) override
94 {
95 QDBusConnectionPrivate::d(connection)->deliverCall(object, message, metaTypes, id);
96 }
97
98private:
99 QDBusConnection connection; // just for refcounting
101 QList<QMetaType> metaTypes;
102 int id;
103};
104
106{
107public:
110 int p, const QDBusMessage &m, QSemaphore *s = nullptr)
111 : QAbstractMetaCallEvent(sender, -1, s), connection(c), node(n),
112 pathStartPos(p), message(m), handled(false)
113 { }
114 ~QDBusActivateObjectEvent() override;
115
116 void placeMetaCall(QObject *) override;
117
118private:
119 QDBusConnection connection; // just for refcounting
121 int pathStartPos;
123 bool handled;
124};
125
127{
128public:
129 typedef void (*Hook)(const QDBusMessage&);
133 ~QDBusSpyCallEvent() override;
134 void placeMetaCall(QObject *) override;
135 static inline void invokeSpyHooks(const QDBusMessage &msg);
136
137 QDBusConnection conn; // keeps the refcount in QDBusConnectionPrivate up
139};
140
142
144
145#endif // QT_NO_DBUS
146#endif
const QObject * sender() const
Definition qobject_p.h:357
void placeMetaCall(QObject *) override
QDBusActivateObjectEvent(const QDBusConnection &c, QObject *sender, const QDBusConnectionPrivate::ObjectTreeNode &n, int p, const QDBusMessage &m, QSemaphore *s=nullptr)
QDBusCallDeliveryEvent(const QDBusConnection &c, int id, QObject *sender, const QDBusMessage &msg, const QList< QMetaType > &types)
void placeMetaCall(QObject *object) override
static QDBusConnectionPrivate * d(const QDBusConnection &q)
\inmodule QtDBus
\inmodule QtDBus
QDBusConnection conn
~QDBusSpyCallEvent() override
QDBusSpyCallEvent(QDBusConnectionPrivate *cp, const QDBusConnection &c, const QDBusMessage &msg)
void placeMetaCall(QObject *) override
static void invokeSpyHooks(const QDBusMessage &msg)
void(* Hook)(const QDBusMessage &)
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore
Definition qsemaphore.h:18
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
DBusConnection * connection
constexpr QtPrivate::QHashMultiReturnType< T... > qHashMulti(size_t seed, const T &... args) noexcept(std::conjunction_v< QtPrivate::QNothrowHashable< T >... >)
#define QT_DECL_METATYPE_EXTERN(TYPE, EXPORT)
Definition qmetatype.h:1388
const GLfloat * m
GLuint64 key
GLsizei GLenum GLenum * types
GLenum GLuint id
[7]
GLuint GLsizei const GLchar * message
GLfloat n
GLdouble s
[6]
Definition qopenglext.h:235
const GLubyte * c
GLfloat GLfloat p
[1]
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
QT_BEGIN_NAMESPACE constexpr void qSwap(T &value1, T &value2) noexcept(std::is_nothrow_swappable_v< T >)
Definition qswap.h:20
QSharedPointer< T > other(t)
[5]
void swap(Data &other) noexcept
QList< QMetaType > metaTypes
friend bool operator==(const Key &lhs, const Key &rhs) noexcept
QDBusConnection::RegisterOptions flags
friend size_t qHash(const QDBusSlotCache::Key &key, size_t seed=0) noexcept
void swap(QDBusSlotCache &other) noexcept