/src/qtbase/src/dbus/qdbuspendingcall.h
Line | Count | Source |
1 | | // Copyright (C) 2016 The Qt Company Ltd. |
2 | | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | | // Qt-Security score:significant reason:default |
4 | | |
5 | | #ifndef QDBUSPENDINGCALL_H |
6 | | #define QDBUSPENDINGCALL_H |
7 | | |
8 | | #include <QtDBus/qtdbusglobal.h> |
9 | | #include <QtDBus/qdbusmessage.h> |
10 | | #include <QtCore/qobject.h> |
11 | | #include <QtCore/qshareddata.h> |
12 | | |
13 | | #ifndef QT_NO_DBUS |
14 | | |
15 | | class tst_QDBusPendingReply; |
16 | | |
17 | | QT_BEGIN_NAMESPACE |
18 | | |
19 | | |
20 | | class QDBusConnection; |
21 | | class QDBusError; |
22 | | class QDBusPendingCallWatcher; |
23 | | |
24 | | class QDBusPendingCallPrivate; |
25 | | |
26 | | QT_DECLARE_QESDP_SPECIALIZATION_DTOR(QDBusPendingCallPrivate) |
27 | | |
28 | | class Q_DBUS_EXPORT QDBusPendingCall |
29 | | { |
30 | | public: |
31 | | QDBusPendingCall(const QDBusPendingCall &other); |
32 | | QDBusPendingCall(QDBusPendingCall &&other) noexcept = default; |
33 | | ~QDBusPendingCall(); |
34 | 0 | QDBusPendingCall &operator=(QDBusPendingCall &&other) noexcept { swap(other); return *this; } |
35 | | QDBusPendingCall &operator=(const QDBusPendingCall &other); |
36 | | |
37 | 0 | void swap(QDBusPendingCall &other) noexcept { d.swap(other.d); } |
38 | | |
39 | | #ifndef Q_QDOC |
40 | | // pretend that they aren't here |
41 | | bool isFinished() const; |
42 | | void waitForFinished(); |
43 | | |
44 | | bool isError() const; |
45 | | bool isValid() const; |
46 | | QDBusError error() const; |
47 | | QDBusMessage reply() const; |
48 | | #endif |
49 | | |
50 | | static QDBusPendingCall fromError(const QDBusError &error); |
51 | | static QDBusPendingCall fromCompletedCall(const QDBusMessage &message); |
52 | | |
53 | | protected: |
54 | | QExplicitlySharedDataPointer<QDBusPendingCallPrivate> d; |
55 | | friend class QDBusPendingCallPrivate; |
56 | | friend class QDBusPendingCallWatcher; |
57 | | friend class QDBusConnection; |
58 | | |
59 | | QDBusPendingCall(QDBusPendingCallPrivate *dd); |
60 | | |
61 | | private: |
62 | | QDBusPendingCall(); // not defined |
63 | | |
64 | | friend class ::tst_QDBusPendingReply; |
65 | | }; |
66 | | |
67 | 0 | Q_DECLARE_SHARED(QDBusPendingCall) |
68 | 0 |
|
69 | 0 | class Q_DBUS_EXPORT QDBusPendingCallWatcher: public QObject, public QDBusPendingCall |
70 | 0 | { |
71 | | Q_OBJECT |
72 | | public: |
73 | | explicit QDBusPendingCallWatcher(const QDBusPendingCall &call, QObject *parent = nullptr); |
74 | | ~QDBusPendingCallWatcher(); |
75 | | |
76 | | #ifdef Q_QDOC |
77 | | // trick qdoc into thinking this method is here |
78 | | bool isFinished() const; |
79 | | #endif |
80 | | void waitForFinished(); // non-virtual override |
81 | | |
82 | | Q_SIGNALS: |
83 | | void finished(QDBusPendingCallWatcher *self = nullptr); |
84 | | }; |
85 | | |
86 | | QT_END_NAMESPACE |
87 | | |
88 | | #endif // QT_NO_DBUS |
89 | | #endif |