Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtDBus module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 2.1 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | #include "qdbusabstractinterface.h" | - |
43 | #include "qdbusabstractinterface_p.h" | - |
44 | | - |
45 | #include <qthread.h> | - |
46 | | - |
47 | #include "qdbusargument.h" | - |
48 | #include "qdbuspendingcall.h" | - |
49 | #include "qdbusmessage_p.h" | - |
50 | #include "qdbusmetaobject_p.h" | - |
51 | #include "qdbusmetatype_p.h" | - |
52 | #include "qdbusutil_p.h" | - |
53 | | - |
54 | #include <qdebug.h> | - |
55 | | - |
56 | #ifndef QT_NO_DBUS | - |
57 | | - |
58 | QT_BEGIN_NAMESPACE | - |
59 | | - |
60 | static QDBusError checkIfValid(const QString &service, const QString &path, | - |
61 | const QString &interface, bool isDynamic, bool isPeer) | - |
62 | { | - |
63 | // We should be throwing exceptions here... oh well | - |
64 | QDBusError error; executed (the execution status of this line is deduced): QDBusError error; | - |
65 | | - |
66 | // dynamic interfaces (QDBusInterface) can have empty interfaces, but not service and object paths | - |
67 | // non-dynamic is the opposite: service and object paths can be empty, but not the interface | - |
68 | if (!isDynamic) { evaluated: !isDynamic yes Evaluation Count:132 | yes Evaluation Count:132 |
| 132 |
69 | // use assertion here because this should never happen, at all | - |
70 | Q_ASSERT_X(!interface.isEmpty(), "QDBusAbstractInterface", "Interface name cannot be empty"); executed (the execution status of this line is deduced): qt_noop(); | - |
71 | } executed: } Execution Count:132 | 132 |
72 | if (!QDBusUtil::checkBusName(service, (isDynamic && !isPeer) ? QDBusUtil::EmptyNotAllowed : QDBusUtil::EmptyAllowed, &error)) evaluated: !QDBusUtil::checkBusName(service, (isDynamic && !isPeer) ? QDBusUtil::EmptyNotAllowed : QDBusUtil::EmptyAllowed, &error) yes Evaluation Count:7 | yes Evaluation Count:257 |
| 7-257 |
73 | return error; executed: return error; Execution Count:7 | 7 |
74 | if (!QDBusUtil::checkObjectPath(path, isDynamic ? QDBusUtil::EmptyNotAllowed : QDBusUtil::EmptyAllowed, &error)) evaluated: !QDBusUtil::checkObjectPath(path, isDynamic ? QDBusUtil::EmptyNotAllowed : QDBusUtil::EmptyAllowed, &error) yes Evaluation Count:15 | yes Evaluation Count:242 |
| 15-242 |
75 | return error; executed: return error; Execution Count:15 | 15 |
76 | if (!QDBusUtil::checkInterfaceName(interface, QDBusUtil::EmptyAllowed, &error)) partially evaluated: !QDBusUtil::checkInterfaceName(interface, QDBusUtil::EmptyAllowed, &error) no Evaluation Count:0 | yes Evaluation Count:242 |
| 0-242 |
77 | return error; never executed: return error; | 0 |
78 | | - |
79 | // no error | - |
80 | return QDBusError(); executed: return QDBusError(); Execution Count:242 | 242 |
81 | } | - |
82 | | - |
83 | QDBusAbstractInterfacePrivate::QDBusAbstractInterfacePrivate(const QString &serv, | - |
84 | const QString &p, | - |
85 | const QString &iface, | - |
86 | const QDBusConnection& con, | - |
87 | bool isDynamic) | - |
88 | : connection(con), service(serv), path(p), interface(iface), | - |
89 | lastError(checkIfValid(serv, p, iface, isDynamic, (connectionPrivate() && | - |
90 | connectionPrivate()->mode == QDBusConnectionPrivate::PeerMode))), | - |
91 | timeout(-1), | - |
92 | isValid(!lastError.isValid()) | - |
93 | { | - |
94 | if (!isValid) evaluated: !isValid yes Evaluation Count:22 | yes Evaluation Count:242 |
| 22-242 |
95 | return; executed: return; Execution Count:22 | 22 |
96 | | - |
97 | if (!connection.isConnected()) { evaluated: !connection.isConnected() yes Evaluation Count:5 | yes Evaluation Count:237 |
| 5-237 |
98 | lastError = QDBusError(QDBusError::Disconnected, executed (the execution status of this line is deduced): lastError = QDBusError(QDBusError::Disconnected, | - |
99 | QLatin1String("Not connected to D-Bus server")); executed (the execution status of this line is deduced): QLatin1String("Not connected to D-Bus server")); | - |
100 | } else if (!service.isEmpty()) { executed: } Execution Count:5 evaluated: !service.isEmpty() yes Evaluation Count:139 | yes Evaluation Count:98 |
| 5-139 |
101 | currentOwner = connectionPrivate()->getNameOwner(service); // verify the name owner executed (the execution status of this line is deduced): currentOwner = connectionPrivate()->getNameOwner(service); | - |
102 | if (currentOwner.isEmpty()) { evaluated: currentOwner.isEmpty() yes Evaluation Count:4 | yes Evaluation Count:135 |
| 4-135 |
103 | lastError = connectionPrivate()->lastError; executed (the execution status of this line is deduced): lastError = connectionPrivate()->lastError; | - |
104 | } executed: } Execution Count:4 | 4 |
105 | } executed: } Execution Count:139 | 139 |
106 | } | - |
107 | | - |
108 | bool QDBusAbstractInterfacePrivate::canMakeCalls() const | - |
109 | { | - |
110 | // recheck only if we have a wildcard (i.e. empty) service or path | - |
111 | // if any are empty, set the error message according to QDBusUtil | - |
112 | if (service.isEmpty() && connectionPrivate()->mode != QDBusConnectionPrivate::PeerMode) evaluated: service.isEmpty() yes Evaluation Count:114 | yes Evaluation Count:1019 |
evaluated: connectionPrivate()->mode != QDBusConnectionPrivate::PeerMode yes Evaluation Count:12 | yes Evaluation Count:102 |
| 12-1019 |
113 | return QDBusUtil::checkBusName(service, QDBusUtil::EmptyNotAllowed, &lastError); executed: return QDBusUtil::checkBusName(service, QDBusUtil::EmptyNotAllowed, &lastError); Execution Count:12 | 12 |
114 | if (path.isEmpty()) evaluated: path.isEmpty() yes Evaluation Count:12 | yes Evaluation Count:1109 |
| 12-1109 |
115 | return QDBusUtil::checkObjectPath(path, QDBusUtil::EmptyNotAllowed, &lastError); executed: return QDBusUtil::checkObjectPath(path, QDBusUtil::EmptyNotAllowed, &lastError); Execution Count:12 | 12 |
116 | return true; executed: return true; Execution Count:1109 | 1109 |
117 | } | - |
118 | | - |
119 | void QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, QVariant &where) const | - |
120 | { | - |
121 | if (!isValid || !canMakeCalls()) { // can't make calls evaluated: !isValid yes Evaluation Count:6 | yes Evaluation Count:25 |
evaluated: !canMakeCalls() yes Evaluation Count:8 | yes Evaluation Count:17 |
| 6-25 |
122 | where.clear(); executed (the execution status of this line is deduced): where.clear(); | - |
123 | return; executed: return; Execution Count:14 | 14 |
124 | } | - |
125 | | - |
126 | // is this metatype registered? | - |
127 | const char *expectedSignature = ""; executed (the execution status of this line is deduced): const char *expectedSignature = ""; | - |
128 | if (int(mp.type()) != QMetaType::QVariant) { partially evaluated: int(mp.type()) != QMetaType::QVariant yes Evaluation Count:17 | no Evaluation Count:0 |
| 0-17 |
129 | expectedSignature = QDBusMetaType::typeToSignature(where.userType()); executed (the execution status of this line is deduced): expectedSignature = QDBusMetaType::typeToSignature(where.userType()); | - |
130 | if (expectedSignature == 0) { partially evaluated: expectedSignature == 0 no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
131 | qWarning("QDBusAbstractInterface: type %s must be registered with Qt D-Bus before it can be " never executed (the execution status of this line is deduced): QMessageLogger("qdbusabstractinterface.cpp", 131, __PRETTY_FUNCTION__).warning("QDBusAbstractInterface: type %s must be registered with Qt D-Bus before it can be " | - |
132 | "used to read property %s.%s", never executed (the execution status of this line is deduced): "used to read property %s.%s", | - |
133 | mp.typeName(), qPrintable(interface), mp.name()); never executed (the execution status of this line is deduced): mp.typeName(), QString(interface).toLocal8Bit().constData(), mp.name()); | - |
134 | lastError = QDBusError(QDBusError::Failed, never executed (the execution status of this line is deduced): lastError = QDBusError(QDBusError::Failed, | - |
135 | QString::fromLatin1("Unregistered type %1 cannot be handled") never executed (the execution status of this line is deduced): QString::fromLatin1("Unregistered type %1 cannot be handled") | - |
136 | .arg(QLatin1String(mp.typeName()))); never executed (the execution status of this line is deduced): .arg(QLatin1String(mp.typeName()))); | - |
137 | where.clear(); never executed (the execution status of this line is deduced): where.clear(); | - |
138 | return; | 0 |
139 | } | - |
140 | } executed: } Execution Count:17 | 17 |
141 | | - |
142 | // try to read this property | - |
143 | QDBusMessage msg = QDBusMessage::createMethodCall(service, path, executed (the execution status of this line is deduced): QDBusMessage msg = QDBusMessage::createMethodCall(service, path, | - |
144 | QLatin1String(DBUS_INTERFACE_PROPERTIES), executed (the execution status of this line is deduced): QLatin1String("org.freedesktop.DBus.Properties"), | - |
145 | QLatin1String("Get")); executed (the execution status of this line is deduced): QLatin1String("Get")); | - |
146 | QDBusMessagePrivate::setParametersValidated(msg, true); executed (the execution status of this line is deduced): QDBusMessagePrivate::setParametersValidated(msg, true); | - |
147 | msg << interface << QString::fromUtf8(mp.name()); executed (the execution status of this line is deduced): msg << interface << QString::fromUtf8(mp.name()); | - |
148 | QDBusMessage reply = connection.call(msg, QDBus::Block, timeout); executed (the execution status of this line is deduced): QDBusMessage reply = connection.call(msg, QDBus::Block, timeout); | - |
149 | | - |
150 | if (reply.type() != QDBusMessage::ReplyMessage) { evaluated: reply.type() != QDBusMessage::ReplyMessage yes Evaluation Count:1 | yes Evaluation Count:16 |
| 1-16 |
151 | lastError = QDBusError(reply); executed (the execution status of this line is deduced): lastError = QDBusError(reply); | - |
152 | where.clear(); executed (the execution status of this line is deduced): where.clear(); | - |
153 | return; executed: return; Execution Count:1 | 1 |
154 | } | - |
155 | if (reply.signature() != QLatin1String("v")) { partially evaluated: reply.signature() != QLatin1String("v") no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
156 | QString errmsg = QLatin1String("Invalid signature `%1' in return from call to " never executed (the execution status of this line is deduced): QString errmsg = QLatin1String("Invalid signature `%1' in return from call to " | - |
157 | DBUS_INTERFACE_PROPERTIES); never executed (the execution status of this line is deduced): "org.freedesktop.DBus.Properties"); | - |
158 | lastError = QDBusError(QDBusError::InvalidSignature, errmsg.arg(reply.signature())); never executed (the execution status of this line is deduced): lastError = QDBusError(QDBusError::InvalidSignature, errmsg.arg(reply.signature())); | - |
159 | where.clear(); never executed (the execution status of this line is deduced): where.clear(); | - |
160 | return; | 0 |
161 | } | - |
162 | | - |
163 | QByteArray foundSignature; executed (the execution status of this line is deduced): QByteArray foundSignature; | - |
164 | const char *foundType = 0; executed (the execution status of this line is deduced): const char *foundType = 0; | - |
165 | QVariant value = qvariant_cast<QDBusVariant>(reply.arguments().at(0)).variant(); executed (the execution status of this line is deduced): QVariant value = qvariant_cast<QDBusVariant>(reply.arguments().at(0)).variant(); | - |
166 | | - |
167 | if (value.userType() == where.userType() || mp.userType() == QMetaType::QVariant evaluated: value.userType() == where.userType() yes Evaluation Count:10 | yes Evaluation Count:6 |
partially evaluated: mp.userType() == QMetaType::QVariant no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-10 |
168 | || (expectedSignature[0] == 'v' && expectedSignature[1] == '\0')) { partially evaluated: expectedSignature[0] == 'v' no Evaluation Count:0 | yes Evaluation Count:6 |
never evaluated: expectedSignature[1] == '\0' | 0-6 |
169 | // simple match | - |
170 | where = value; executed (the execution status of this line is deduced): where = value; | - |
171 | return; executed: return; Execution Count:10 | 10 |
172 | } | - |
173 | | - |
174 | if (value.userType() == qMetaTypeId<QDBusArgument>()) { partially evaluated: value.userType() == qMetaTypeId<QDBusArgument>() yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
175 | QDBusArgument arg = qvariant_cast<QDBusArgument>(value); executed (the execution status of this line is deduced): QDBusArgument arg = qvariant_cast<QDBusArgument>(value); | - |
176 | | - |
177 | foundType = "user type"; executed (the execution status of this line is deduced): foundType = "user type"; | - |
178 | foundSignature = arg.currentSignature().toLatin1(); executed (the execution status of this line is deduced): foundSignature = arg.currentSignature().toLatin1(); | - |
179 | if (foundSignature == expectedSignature) { partially evaluated: foundSignature == expectedSignature yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
180 | // signatures match, we can demarshall | - |
181 | QDBusMetaType::demarshall(arg, where.userType(), where.data()); executed (the execution status of this line is deduced): QDBusMetaType::demarshall(arg, where.userType(), where.data()); | - |
182 | return; executed: return; Execution Count:6 | 6 |
183 | } | - |
184 | } else { | 0 |
185 | foundType = value.typeName(); never executed (the execution status of this line is deduced): foundType = value.typeName(); | - |
186 | foundSignature = QDBusMetaType::typeToSignature(value.userType()); never executed (the execution status of this line is deduced): foundSignature = QDBusMetaType::typeToSignature(value.userType()); | - |
187 | } | 0 |
188 | | - |
189 | // there was an error... | - |
190 | QString errmsg = QLatin1String("Unexpected `%1' (%2) when retrieving property `%3.%4' " never executed (the execution status of this line is deduced): QString errmsg = QLatin1String("Unexpected `%1' (%2) when retrieving property `%3.%4' " | - |
191 | "(expected type `%5' (%6))"); never executed (the execution status of this line is deduced): "(expected type `%5' (%6))"); | - |
192 | lastError = QDBusError(QDBusError::InvalidSignature, never executed (the execution status of this line is deduced): lastError = QDBusError(QDBusError::InvalidSignature, | - |
193 | errmsg.arg(QString::fromLatin1(foundType), never executed (the execution status of this line is deduced): errmsg.arg(QString::fromLatin1(foundType), | - |
194 | QString::fromLatin1(foundSignature), never executed (the execution status of this line is deduced): QString::fromLatin1(foundSignature), | - |
195 | interface, never executed (the execution status of this line is deduced): interface, | - |
196 | QString::fromUtf8(mp.name()), never executed (the execution status of this line is deduced): QString::fromUtf8(mp.name()), | - |
197 | QString::fromLatin1(mp.typeName()), never executed (the execution status of this line is deduced): QString::fromLatin1(mp.typeName()), | - |
198 | QString::fromLatin1(expectedSignature))); never executed (the execution status of this line is deduced): QString::fromLatin1(expectedSignature))); | - |
199 | where.clear(); never executed (the execution status of this line is deduced): where.clear(); | - |
200 | return; | 0 |
201 | } | - |
202 | | - |
203 | bool QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const QVariant &value) | - |
204 | { | - |
205 | if (!isValid || !canMakeCalls()) // can't make calls evaluated: !isValid yes Evaluation Count:6 | yes Evaluation Count:24 |
evaluated: !canMakeCalls() yes Evaluation Count:8 | yes Evaluation Count:16 |
| 6-24 |
206 | return false; executed: return false; Execution Count:14 | 14 |
207 | | - |
208 | // send the value | - |
209 | QDBusMessage msg = QDBusMessage::createMethodCall(service, path, executed (the execution status of this line is deduced): QDBusMessage msg = QDBusMessage::createMethodCall(service, path, | - |
210 | QLatin1String(DBUS_INTERFACE_PROPERTIES), executed (the execution status of this line is deduced): QLatin1String("org.freedesktop.DBus.Properties"), | - |
211 | QLatin1String("Set")); executed (the execution status of this line is deduced): QLatin1String("Set")); | - |
212 | QDBusMessagePrivate::setParametersValidated(msg, true); executed (the execution status of this line is deduced): QDBusMessagePrivate::setParametersValidated(msg, true); | - |
213 | msg << interface << QString::fromUtf8(mp.name()) << QVariant::fromValue(QDBusVariant(value)); executed (the execution status of this line is deduced): msg << interface << QString::fromUtf8(mp.name()) << QVariant::fromValue(QDBusVariant(value)); | - |
214 | QDBusMessage reply = connection.call(msg, QDBus::Block, timeout); executed (the execution status of this line is deduced): QDBusMessage reply = connection.call(msg, QDBus::Block, timeout); | - |
215 | | - |
216 | if (reply.type() != QDBusMessage::ReplyMessage) { partially evaluated: reply.type() != QDBusMessage::ReplyMessage no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
217 | lastError = QDBusError(reply); never executed (the execution status of this line is deduced): lastError = QDBusError(reply); | - |
218 | return false; never executed: return false; | 0 |
219 | } | - |
220 | return true; executed: return true; Execution Count:16 | 16 |
221 | } | - |
222 | | - |
223 | void QDBusAbstractInterfacePrivate::_q_serviceOwnerChanged(const QString &name, | - |
224 | const QString &oldOwner, | - |
225 | const QString &newOwner) | - |
226 | { | - |
227 | Q_UNUSED(oldOwner); executed (the execution status of this line is deduced): (void)oldOwner;; | - |
228 | //qDebug() << "QDBusAbstractInterfacePrivate serviceOwnerChanged" << name << oldOwner << newOwner; | - |
229 | if (name == service) { partially evaluated: name == service yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
230 | currentOwner = newOwner; executed (the execution status of this line is deduced): currentOwner = newOwner; | - |
231 | } executed: } Execution Count:2 | 2 |
232 | } executed: } Execution Count:2 | 2 |
233 | | - |
234 | QDBusAbstractInterfaceBase::QDBusAbstractInterfaceBase(QDBusAbstractInterfacePrivate &d, QObject *parent) | - |
235 | : QObject(d, parent) | - |
236 | { | - |
237 | } executed: } Execution Count:264 | 264 |
238 | | - |
239 | int QDBusAbstractInterfaceBase::qt_metacall(QMetaObject::Call _c, int _id, void **_a) | - |
240 | { | - |
241 | int saved_id = _id; | - |
242 | _id = QObject::qt_metacall(_c, _id, _a); | - |
243 | if (_id < 0) | - |
244 | return _id; | - |
245 | | - |
246 | if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty) { | - |
247 | QMetaProperty mp = metaObject()->property(saved_id); | - |
248 | int &status = *reinterpret_cast<int *>(_a[2]); | - |
249 | QVariant &variant = *reinterpret_cast<QVariant *>(_a[1]); | - |
250 | | - |
251 | if (_c == QMetaObject::WriteProperty) { | - |
252 | status = d_func()->setProperty(mp, variant) ? 1 : 0; | - |
253 | } else { | - |
254 | d_func()->property(mp, variant); | - |
255 | status = variant.isValid() ? 1 : 0; | - |
256 | } | - |
257 | _id = -1; | - |
258 | } | - |
259 | return _id; | - |
260 | } | - |
261 | | - |
262 | /*! | - |
263 | \class QDBusAbstractInterface | - |
264 | \inmodule QtDBus | - |
265 | \since 4.2 | - |
266 | | - |
267 | \brief The QDBusAbstractInterface class is the base class for all D-Bus interfaces in the Qt D-Bus binding, allowing access to remote interfaces | - |
268 | | - |
269 | Generated-code classes also derive from QDBusAbstractInterface, | - |
270 | all methods described here are also valid for generated-code | - |
271 | classes. In addition to those described here, generated-code | - |
272 | classes provide member functions for the remote methods, which | - |
273 | allow for compile-time checking of the correct parameters and | - |
274 | return values, as well as property type-matching and signal | - |
275 | parameter-matching. | - |
276 | | - |
277 | \sa {qdbusxml2cpp.html}{The QDBus compiler}, QDBusInterface | - |
278 | */ | - |
279 | | - |
280 | /*! | - |
281 | \internal | - |
282 | This is the constructor called from QDBusInterface::QDBusInterface. | - |
283 | */ | - |
284 | QDBusAbstractInterface::QDBusAbstractInterface(QDBusAbstractInterfacePrivate &d, QObject *parent) | - |
285 | : QDBusAbstractInterfaceBase(d, parent) | - |
286 | { | - |
287 | // keep track of the service owner | - |
288 | if (d.isValid && evaluated: d.isValid yes Evaluation Count:131 | yes Evaluation Count:1 |
| 1-131 |
289 | d.connection.isConnected() evaluated: d.connection.isConnected() yes Evaluation Count:128 | yes Evaluation Count:3 |
| 3-128 |
290 | && !d.service.isEmpty() evaluated: !d.service.isEmpty() yes Evaluation Count:80 | yes Evaluation Count:48 |
| 48-80 |
291 | && !d.service.startsWith(QLatin1Char(':'))) evaluated: !d.service.startsWith(QLatin1Char(':')) yes Evaluation Count:4 | yes Evaluation Count:76 |
| 4-76 |
292 | d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service executed: d_func()->connection.connect(QLatin1String("org.freedesktop.DBus"), QString(), QLatin1String("org.freedesktop.DBus"), QLatin1String("NameOwnerChanged"), QStringList() << d.service, QString(), this, "1""_q_serviceOwnerChanged(QString,QString,QString)"); Execution Count:4 | 4 |
293 | QString(), // path executed: d_func()->connection.connect(QLatin1String("org.freedesktop.DBus"), QString(), QLatin1String("org.freedesktop.DBus"), QLatin1String("NameOwnerChanged"), QStringList() << d.service, QString(), this, "1""_q_serviceOwnerChanged(QString,QString,QString)"); Execution Count:4 | 4 |
294 | QLatin1String(DBUS_INTERFACE_DBUS), // interface executed: d_func()->connection.connect(QLatin1String("org.freedesktop.DBus"), QString(), QLatin1String("org.freedesktop.DBus"), QLatin1String("NameOwnerChanged"), QStringList() << d.service, QString(), this, "1""_q_serviceOwnerChanged(QString,QString,QString)"); Execution Count:4 | 4 |
295 | QLatin1String("NameOwnerChanged"), executed: d_func()->connection.connect(QLatin1String("org.freedesktop.DBus"), QString(), QLatin1String("org.freedesktop.DBus"), QLatin1String("NameOwnerChanged"), QStringList() << d.service, QString(), this, "1""_q_serviceOwnerChanged(QString,QString,QString)"); Execution Count:4 | 4 |
296 | QStringList() << d.service, executed: d_func()->connection.connect(QLatin1String("org.freedesktop.DBus"), QString(), QLatin1String("org.freedesktop.DBus"), QLatin1String("NameOwnerChanged"), QStringList() << d.service, QString(), this, "1""_q_serviceOwnerChanged(QString,QString,QString)"); Execution Count:4 | 4 |
297 | QString(), // signature executed: d_func()->connection.connect(QLatin1String("org.freedesktop.DBus"), QString(), QLatin1String("org.freedesktop.DBus"), QLatin1String("NameOwnerChanged"), QStringList() << d.service, QString(), this, "1""_q_serviceOwnerChanged(QString,QString,QString)"); Execution Count:4 | 4 |
298 | this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); executed: d_func()->connection.connect(QLatin1String("org.freedesktop.DBus"), QString(), QLatin1String("org.freedesktop.DBus"), QLatin1String("NameOwnerChanged"), QStringList() << d.service, QString(), this, "1""_q_serviceOwnerChanged(QString,QString,QString)"); Execution Count:4 | 4 |
299 | } executed: } Execution Count:132 | 132 |
300 | | - |
301 | /*! | - |
302 | \internal | - |
303 | This is the constructor called from static classes derived from | - |
304 | QDBusAbstractInterface (i.e., those generated by dbusxml2cpp). | - |
305 | */ | - |
306 | QDBusAbstractInterface::QDBusAbstractInterface(const QString &service, const QString &path, | - |
307 | const char *interface, const QDBusConnection &con, | - |
308 | QObject *parent) | - |
309 | : QDBusAbstractInterfaceBase(*new QDBusAbstractInterfacePrivate(service, path, QString::fromLatin1(interface), | - |
310 | con, false), parent) | - |
311 | { | - |
312 | // keep track of the service owner | - |
313 | if (d_func()->isValid && evaluated: d_func()->isValid yes Evaluation Count:111 | yes Evaluation Count:21 |
| 21-111 |
314 | d_func()->connection.isConnected() evaluated: d_func()->connection.isConnected() yes Evaluation Count:109 | yes Evaluation Count:2 |
| 2-109 |
315 | && !service.isEmpty() evaluated: !service.isEmpty() yes Evaluation Count:59 | yes Evaluation Count:50 |
| 50-59 |
316 | && !service.startsWith(QLatin1Char(':'))) evaluated: !service.startsWith(QLatin1Char(':')) yes Evaluation Count:26 | yes Evaluation Count:33 |
| 26-33 |
317 | d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service executed: d_func()->connection.connect(QLatin1String("org.freedesktop.DBus"), QString(), QLatin1String("org.freedesktop.DBus"), QLatin1String("NameOwnerChanged"), QStringList() << service, QString(), this, "1""_q_serviceOwnerChanged(QString,QString,QString)"); Execution Count:26 | 26 |
318 | QString(), // path executed: d_func()->connection.connect(QLatin1String("org.freedesktop.DBus"), QString(), QLatin1String("org.freedesktop.DBus"), QLatin1String("NameOwnerChanged"), QStringList() << service, QString(), this, "1""_q_serviceOwnerChanged(QString,QString,QString)"); Execution Count:26 | 26 |
319 | QLatin1String(DBUS_INTERFACE_DBUS), // interface executed: d_func()->connection.connect(QLatin1String("org.freedesktop.DBus"), QString(), QLatin1String("org.freedesktop.DBus"), QLatin1String("NameOwnerChanged"), QStringList() << service, QString(), this, "1""_q_serviceOwnerChanged(QString,QString,QString)"); Execution Count:26 | 26 |
320 | QLatin1String("NameOwnerChanged"), executed: d_func()->connection.connect(QLatin1String("org.freedesktop.DBus"), QString(), QLatin1String("org.freedesktop.DBus"), QLatin1String("NameOwnerChanged"), QStringList() << service, QString(), this, "1""_q_serviceOwnerChanged(QString,QString,QString)"); Execution Count:26 | 26 |
321 | QStringList() << service, executed: d_func()->connection.connect(QLatin1String("org.freedesktop.DBus"), QString(), QLatin1String("org.freedesktop.DBus"), QLatin1String("NameOwnerChanged"), QStringList() << service, QString(), this, "1""_q_serviceOwnerChanged(QString,QString,QString)"); Execution Count:26 | 26 |
322 | QString(), //signature executed: d_func()->connection.connect(QLatin1String("org.freedesktop.DBus"), QString(), QLatin1String("org.freedesktop.DBus"), QLatin1String("NameOwnerChanged"), QStringList() << service, QString(), this, "1""_q_serviceOwnerChanged(QString,QString,QString)"); Execution Count:26 | 26 |
323 | this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); executed: d_func()->connection.connect(QLatin1String("org.freedesktop.DBus"), QString(), QLatin1String("org.freedesktop.DBus"), QLatin1String("NameOwnerChanged"), QStringList() << service, QString(), this, "1""_q_serviceOwnerChanged(QString,QString,QString)"); Execution Count:26 | 26 |
324 | } executed: } Execution Count:132 | 132 |
325 | | - |
326 | /*! | - |
327 | Releases this object's resources. | - |
328 | */ | - |
329 | QDBusAbstractInterface::~QDBusAbstractInterface() | - |
330 | { | - |
331 | } | - |
332 | | - |
333 | /*! | - |
334 | Returns true if this is a valid reference to a remote object. It returns false if | - |
335 | there was an error during the creation of this interface (for instance, if the remote | - |
336 | application does not exist). | - |
337 | | - |
338 | Note: when dealing with remote objects, it is not always possible to determine if it | - |
339 | exists when creating a QDBusInterface. | - |
340 | */ | - |
341 | bool QDBusAbstractInterface::isValid() const | - |
342 | { | - |
343 | return !d_func()->currentOwner.isEmpty(); executed: return !d_func()->currentOwner.isEmpty(); Execution Count:43 | 43 |
344 | } | - |
345 | | - |
346 | /*! | - |
347 | Returns the connection this interface is assocated with. | - |
348 | */ | - |
349 | QDBusConnection QDBusAbstractInterface::connection() const | - |
350 | { | - |
351 | return d_func()->connection; executed: return d_func()->connection; Execution Count:1 | 1 |
352 | } | - |
353 | | - |
354 | /*! | - |
355 | Returns the name of the service this interface is associated with. | - |
356 | */ | - |
357 | QString QDBusAbstractInterface::service() const | - |
358 | { | - |
359 | return d_func()->service; executed: return d_func()->service; Execution Count:1076 | 1076 |
360 | } | - |
361 | | - |
362 | /*! | - |
363 | Returns the object path that this interface is associated with. | - |
364 | */ | - |
365 | QString QDBusAbstractInterface::path() const | - |
366 | { | - |
367 | return d_func()->path; executed: return d_func()->path; Execution Count:1076 | 1076 |
368 | } | - |
369 | | - |
370 | /*! | - |
371 | Returns the name of this interface. | - |
372 | */ | - |
373 | QString QDBusAbstractInterface::interface() const | - |
374 | { | - |
375 | return d_func()->interface; executed: return d_func()->interface; Execution Count:1076 | 1076 |
376 | } | - |
377 | | - |
378 | /*! | - |
379 | Returns the error the last operation produced, or an invalid error if the last operation did not | - |
380 | produce an error. | - |
381 | */ | - |
382 | QDBusError QDBusAbstractInterface::lastError() const | - |
383 | { | - |
384 | return d_func()->lastError; executed: return d_func()->lastError; Execution Count:47 | 47 |
385 | } | - |
386 | | - |
387 | /*! | - |
388 | Sets the timeout in milliseconds for all future DBus calls to \a timeout. | - |
389 | -1 means the default DBus timeout (usually 25 seconds). | - |
390 | | - |
391 | \since 4.8 | - |
392 | */ | - |
393 | void QDBusAbstractInterface::setTimeout(int timeout) | - |
394 | { | - |
395 | d_func()->timeout = timeout; executed (the execution status of this line is deduced): d_func()->timeout = timeout; | - |
396 | } executed: } Execution Count:3 | 3 |
397 | | - |
398 | /*! | - |
399 | Returns the current value of the timeout in milliseconds. | - |
400 | -1 means the default DBus timeout (usually 25 seconds). | - |
401 | | - |
402 | \since 4.8 | - |
403 | */ | - |
404 | int QDBusAbstractInterface::timeout() const | - |
405 | { | - |
406 | return d_func()->timeout; never executed: return d_func()->timeout; | 0 |
407 | } | - |
408 | | - |
409 | /*! | - |
410 | Places a call to the remote method specified by \a method on this interface, using \a args as | - |
411 | arguments. This function returns the message that was received as a reply, which can be a normal | - |
412 | QDBusMessage::ReplyMessage (indicating success) or QDBusMessage::ErrorMessage (if the call | - |
413 | failed). The \a mode parameter specifies how this call should be placed. | - |
414 | | - |
415 | If the call succeeds, lastError() will be cleared; otherwise, it will contain the error this | - |
416 | call produced. | - |
417 | | - |
418 | Normally, you should place calls using call(). | - |
419 | | - |
420 | \warning If you use \c UseEventLoop, your code must be prepared to deal with any reentrancy: | - |
421 | other method calls and signals may be delivered before this function returns, as well | - |
422 | as other Qt queued signals and events. | - |
423 | | - |
424 | \threadsafe | - |
425 | */ | - |
426 | QDBusMessage QDBusAbstractInterface::callWithArgumentList(QDBus::CallMode mode, | - |
427 | const QString& method, | - |
428 | const QList<QVariant>& args) | - |
429 | { | - |
430 | Q_D(QDBusAbstractInterface); executed (the execution status of this line is deduced): QDBusAbstractInterfacePrivate * const d = d_func(); | - |
431 | | - |
432 | if (!d->isValid || !d->canMakeCalls()) partially evaluated: !d->isValid no Evaluation Count:0 | yes Evaluation Count:1015 |
partially evaluated: !d->canMakeCalls() no Evaluation Count:0 | yes Evaluation Count:1015 |
| 0-1015 |
433 | return QDBusMessage::createError(d->lastError); never executed: return QDBusMessage::createError(d->lastError); | 0 |
434 | | - |
435 | QString m = method; executed (the execution status of this line is deduced): QString m = method; | - |
436 | // split out the signature from the method | - |
437 | int pos = method.indexOf(QLatin1Char('.')); executed (the execution status of this line is deduced): int pos = method.indexOf(QLatin1Char('.')); | - |
438 | if (pos != -1) evaluated: pos != -1 yes Evaluation Count:4 | yes Evaluation Count:1011 |
| 4-1011 |
439 | m.truncate(pos); executed: m.truncate(pos); Execution Count:4 | 4 |
440 | | - |
441 | if (mode == QDBus::AutoDetect) { evaluated: mode == QDBus::AutoDetect yes Evaluation Count:805 | yes Evaluation Count:210 |
| 210-805 |
442 | // determine if this a sync or async call | - |
443 | mode = QDBus::Block; executed (the execution status of this line is deduced): mode = QDBus::Block; | - |
444 | const QMetaObject *mo = metaObject(); executed (the execution status of this line is deduced): const QMetaObject *mo = metaObject(); | - |
445 | QByteArray match = m.toLatin1(); executed (the execution status of this line is deduced): QByteArray match = m.toLatin1(); | - |
446 | | - |
447 | for (int i = staticMetaObject.methodCount(); i < mo->methodCount(); ++i) { evaluated: i < mo->methodCount() yes Evaluation Count:13395 | yes Evaluation Count:776 |
| 776-13395 |
448 | QMetaMethod mm = mo->method(i); executed (the execution status of this line is deduced): QMetaMethod mm = mo->method(i); | - |
449 | if (mm.name() == match) { evaluated: mm.name() == match yes Evaluation Count:29 | yes Evaluation Count:13366 |
| 29-13366 |
450 | // found a method with the same name as what we're looking for | - |
451 | // hopefully, nobody is overloading asynchronous and synchronous methods with | - |
452 | // the same name | - |
453 | | - |
454 | QList<QByteArray> tags = QByteArray(mm.tag()).split(' '); executed (the execution status of this line is deduced): QList<QByteArray> tags = QByteArray(mm.tag()).split(' '); | - |
455 | if (tags.contains("Q_NOREPLY")) partially evaluated: tags.contains("Q_NOREPLY") no Evaluation Count:0 | yes Evaluation Count:29 |
| 0-29 |
456 | mode = QDBus::NoBlock; never executed: mode = QDBus::NoBlock; | 0 |
457 | | - |
458 | break; executed: break; Execution Count:29 | 29 |
459 | } | - |
460 | } executed: } Execution Count:13366 | 13366 |
461 | } executed: } Execution Count:805 | 805 |
462 | | - |
463 | // qDebug() << "QDBusAbstractInterface" << "Service" << service() << "Path:" << path(); | - |
464 | QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), m); executed (the execution status of this line is deduced): QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), m); | - |
465 | QDBusMessagePrivate::setParametersValidated(msg, true); executed (the execution status of this line is deduced): QDBusMessagePrivate::setParametersValidated(msg, true); | - |
466 | msg.setArguments(args); executed (the execution status of this line is deduced): msg.setArguments(args); | - |
467 | | - |
468 | QDBusMessage reply = d->connection.call(msg, mode, d->timeout); executed (the execution status of this line is deduced): QDBusMessage reply = d->connection.call(msg, mode, d->timeout); | - |
469 | if (thread() == QThread::currentThread()) evaluated: thread() == QThread::currentThread() yes Evaluation Count:1013 | yes Evaluation Count:2 |
| 2-1013 |
470 | d->lastError = QDBusError(reply); // will clear if reply isn't an error executed: d->lastError = QDBusError(reply); Execution Count:1013 | 1013 |
471 | | - |
472 | // ensure that there is at least one element | - |
473 | if (reply.arguments().isEmpty()) evaluated: reply.arguments().isEmpty() yes Evaluation Count:90 | yes Evaluation Count:925 |
| 90-925 |
474 | reply << QVariant(); executed: reply << QVariant(); Execution Count:90 | 90 |
475 | | - |
476 | return reply; executed: return reply; Execution Count:1015 | 1015 |
477 | } | - |
478 | | - |
479 | /*! | - |
480 | \since 4.5 | - |
481 | Places a call to the remote method specified by \a method on this | - |
482 | interface, using \a args as arguments. This function returns a | - |
483 | QDBusPendingCall object that can be used to track the status of the | - |
484 | reply and access its contents once it has arrived. | - |
485 | | - |
486 | Normally, you should place calls using asyncCall(). | - |
487 | | - |
488 | \threadsafe | - |
489 | */ | - |
490 | QDBusPendingCall QDBusAbstractInterface::asyncCallWithArgumentList(const QString& method, | - |
491 | const QList<QVariant>& args) | - |
492 | { | - |
493 | Q_D(QDBusAbstractInterface); executed (the execution status of this line is deduced): QDBusAbstractInterfacePrivate * const d = d_func(); | - |
494 | | - |
495 | if (!d->isValid || !d->canMakeCalls()) evaluated: !d->isValid yes Evaluation Count:6 | yes Evaluation Count:63 |
evaluated: !d->canMakeCalls() yes Evaluation Count:8 | yes Evaluation Count:55 |
| 6-63 |
496 | return QDBusPendingCall::fromError(d->lastError); executed: return QDBusPendingCall::fromError(d->lastError); Execution Count:14 | 14 |
497 | | - |
498 | QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), method); executed (the execution status of this line is deduced): QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), method); | - |
499 | QDBusMessagePrivate::setParametersValidated(msg, true); executed (the execution status of this line is deduced): QDBusMessagePrivate::setParametersValidated(msg, true); | - |
500 | msg.setArguments(args); executed (the execution status of this line is deduced): msg.setArguments(args); | - |
501 | return d->connection.asyncCall(msg, d->timeout); executed: return d->connection.asyncCall(msg, d->timeout); Execution Count:55 | 55 |
502 | } | - |
503 | | - |
504 | /*! | - |
505 | Places a call to the remote method specified by \a method | - |
506 | on this interface, using \a args as arguments. This function | - |
507 | returns immediately after queueing the call. The reply from | - |
508 | the remote function is delivered to the \a returnMethod on | - |
509 | object \a receiver. If an error occurs, the \a errorMethod | - |
510 | on object \a receiver is called instead. | - |
511 | | - |
512 | This function returns true if the queueing succeeds. It does | - |
513 | not indicate that the executed call succeeded. If it fails, | - |
514 | the \a errorMethod is called. If the queueing failed, this | - |
515 | function returns false and no slot will be called. | - |
516 | | - |
517 | The \a returnMethod must have as its parameters the types returned | - |
518 | by the function call. Optionally, it may have a QDBusMessage | - |
519 | parameter as its last or only parameter. The \a errorMethod must | - |
520 | have a QDBusError as its only parameter. | - |
521 | | - |
522 | \since 4.3 | - |
523 | \sa QDBusError, QDBusMessage | - |
524 | */ | - |
525 | bool QDBusAbstractInterface::callWithCallback(const QString &method, | - |
526 | const QList<QVariant> &args, | - |
527 | QObject *receiver, | - |
528 | const char *returnMethod, | - |
529 | const char *errorMethod) | - |
530 | { | - |
531 | Q_D(QDBusAbstractInterface); executed (the execution status of this line is deduced): QDBusAbstractInterfacePrivate * const d = d_func(); | - |
532 | | - |
533 | if (!d->isValid || !d->canMakeCalls()) partially evaluated: !d->isValid no Evaluation Count:0 | yes Evaluation Count:6 |
partially evaluated: !d->canMakeCalls() no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
534 | return false; never executed: return false; | 0 |
535 | | - |
536 | QDBusMessage msg = QDBusMessage::createMethodCall(service(), executed (the execution status of this line is deduced): QDBusMessage msg = QDBusMessage::createMethodCall(service(), | - |
537 | path(), executed (the execution status of this line is deduced): path(), | - |
538 | interface(), executed (the execution status of this line is deduced): interface(), | - |
539 | method); executed (the execution status of this line is deduced): method); | - |
540 | QDBusMessagePrivate::setParametersValidated(msg, true); executed (the execution status of this line is deduced): QDBusMessagePrivate::setParametersValidated(msg, true); | - |
541 | msg.setArguments(args); executed (the execution status of this line is deduced): msg.setArguments(args); | - |
542 | | - |
543 | d->lastError = QDBusError(); executed (the execution status of this line is deduced): d->lastError = QDBusError(); | - |
544 | return d->connection.callWithCallback(msg, executed: return d->connection.callWithCallback(msg, receiver, returnMethod, errorMethod, d->timeout); Execution Count:6 | 6 |
545 | receiver, executed: return d->connection.callWithCallback(msg, receiver, returnMethod, errorMethod, d->timeout); Execution Count:6 | 6 |
546 | returnMethod, executed: return d->connection.callWithCallback(msg, receiver, returnMethod, errorMethod, d->timeout); Execution Count:6 | 6 |
547 | errorMethod, executed: return d->connection.callWithCallback(msg, receiver, returnMethod, errorMethod, d->timeout); Execution Count:6 | 6 |
548 | d->timeout); executed: return d->connection.callWithCallback(msg, receiver, returnMethod, errorMethod, d->timeout); Execution Count:6 | 6 |
549 | } | - |
550 | | - |
551 | /*! | - |
552 | \overload | - |
553 | | - |
554 | This function is deprecated. Please use the overloaded version. | - |
555 | | - |
556 | Places a call to the remote method specified by \a method | - |
557 | on this interface, using \a args as arguments. This function | - |
558 | returns immediately after queueing the call. The reply from | - |
559 | the remote function or any errors emitted by it are delivered | - |
560 | to the \a slot slot on object \a receiver. | - |
561 | | - |
562 | This function returns true if the queueing succeeded: it does | - |
563 | not indicate that the call succeeded. If it failed, the slot | - |
564 | will be called with an error message. lastError() will not be | - |
565 | set under those circumstances. | - |
566 | | - |
567 | \sa QDBusError, QDBusMessage | - |
568 | */ | - |
569 | bool QDBusAbstractInterface::callWithCallback(const QString &method, | - |
570 | const QList<QVariant> &args, | - |
571 | QObject *receiver, | - |
572 | const char *slot) | - |
573 | { | - |
574 | return callWithCallback(method, args, receiver, slot, 0); executed: return callWithCallback(method, args, receiver, slot, 0); Execution Count:5 | 5 |
575 | } | - |
576 | | - |
577 | /*! | - |
578 | \internal | - |
579 | Catch signal connections. | - |
580 | */ | - |
581 | void QDBusAbstractInterface::connectNotify(const QMetaMethod &signal) | - |
582 | { | - |
583 | // someone connecting to one of our signals | - |
584 | Q_D(QDBusAbstractInterface); executed (the execution status of this line is deduced): QDBusAbstractInterfacePrivate * const d = d_func(); | - |
585 | if (!d->isValid) partially evaluated: !d->isValid no Evaluation Count:0 | yes Evaluation Count:109 |
| 0-109 |
586 | return; | 0 |
587 | | - |
588 | // we end up recursing here, so optimize away | - |
589 | static const QMetaMethod destroyedSignal = QMetaMethod::fromSignal(&QDBusAbstractInterface::destroyed); | - |
590 | if (signal == destroyedSignal) evaluated: signal == destroyedSignal yes Evaluation Count:55 | yes Evaluation Count:54 |
| 54-55 |
591 | return; executed: return; Execution Count:55 | 55 |
592 | | - |
593 | QDBusConnectionPrivate *conn = d->connectionPrivate(); executed (the execution status of this line is deduced): QDBusConnectionPrivate *conn = d->connectionPrivate(); | - |
594 | if (conn) { partially evaluated: conn yes Evaluation Count:54 | no Evaluation Count:0 |
| 0-54 |
595 | conn->connectRelay(d->service, d->path, d->interface, executed (the execution status of this line is deduced): conn->connectRelay(d->service, d->path, d->interface, | - |
596 | this, signal); executed (the execution status of this line is deduced): this, signal); | - |
597 | } executed: } Execution Count:54 | 54 |
598 | } executed: } Execution Count:54 | 54 |
599 | | - |
600 | /*! | - |
601 | \internal | - |
602 | Catch signal disconnections. | - |
603 | */ | - |
604 | void QDBusAbstractInterface::disconnectNotify(const QMetaMethod &signal) | - |
605 | { | - |
606 | // someone disconnecting from one of our signals | - |
607 | Q_D(QDBusAbstractInterface); executed (the execution status of this line is deduced): QDBusAbstractInterfacePrivate * const d = d_func(); | - |
608 | if (!d->isValid) partially evaluated: !d->isValid no Evaluation Count:0 | yes Evaluation Count:33 |
| 0-33 |
609 | return; | 0 |
610 | | - |
611 | QDBusConnectionPrivate *conn = d->connectionPrivate(); executed (the execution status of this line is deduced): QDBusConnectionPrivate *conn = d->connectionPrivate(); | - |
612 | if (conn) partially evaluated: conn yes Evaluation Count:33 | no Evaluation Count:0 |
| 0-33 |
613 | conn->disconnectRelay(d->service, d->path, d->interface, executed: conn->disconnectRelay(d->service, d->path, d->interface, this, signal); Execution Count:33 | 33 |
614 | this, signal); executed: conn->disconnectRelay(d->service, d->path, d->interface, this, signal); Execution Count:33 | 33 |
615 | } executed: } Execution Count:33 | 33 |
616 | | - |
617 | /*! | - |
618 | \internal | - |
619 | Get the value of the property \a propname. | - |
620 | */ | - |
621 | QVariant QDBusAbstractInterface::internalPropGet(const char *propname) const | - |
622 | { | - |
623 | // assume this property exists and is readable | - |
624 | // we're only called from generated code anyways | - |
625 | | - |
626 | return property(propname); never executed: return property(propname); | 0 |
627 | } | - |
628 | | - |
629 | /*! | - |
630 | \internal | - |
631 | Set the value of the property \a propname to \a value. | - |
632 | */ | - |
633 | void QDBusAbstractInterface::internalPropSet(const char *propname, const QVariant &value) | - |
634 | { | - |
635 | setProperty(propname, value); never executed (the execution status of this line is deduced): setProperty(propname, value); | - |
636 | } | 0 |
637 | | - |
638 | /*! | - |
639 | Calls the method \a method on this interface and passes the parameters to this function to the | - |
640 | method. | - |
641 | | - |
642 | The parameters to \c call are passed on to the remote function via D-Bus as input | - |
643 | arguments. Output arguments are returned in the QDBusMessage reply. If the reply is an error | - |
644 | reply, lastError() will also be set to the contents of the error message. | - |
645 | | - |
646 | This function can be used with up to 8 parameters, passed in arguments \a arg1, \a arg2, | - |
647 | \a arg3, \a arg4, \a arg5, \a arg6, \a arg7 and \a arg8. If you need more than 8 | - |
648 | parameters or if you have a variable number of parameters to be passed, use | - |
649 | callWithArgumentList(). | - |
650 | | - |
651 | It can be used the following way: | - |
652 | | - |
653 | \snippet code/src_qdbus_qdbusabstractinterface.cpp 0 | - |
654 | | - |
655 | This example illustrates function calling with 0, 1 and 2 parameters and illustrates different | - |
656 | parameter types passed in each (the first call to \c "ProcessWorkUnicode" will contain one | - |
657 | Unicode string, the second call to \c "ProcessWork" will contain one string and one byte array). | - |
658 | */ | - |
659 | QDBusMessage QDBusAbstractInterface::call(const QString &method, const QVariant &arg1, | - |
660 | const QVariant &arg2, | - |
661 | const QVariant &arg3, | - |
662 | const QVariant &arg4, | - |
663 | const QVariant &arg5, | - |
664 | const QVariant &arg6, | - |
665 | const QVariant &arg7, | - |
666 | const QVariant &arg8) | - |
667 | { | - |
668 | return call(QDBus::AutoDetect, method, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); executed: return call(QDBus::AutoDetect, method, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); Execution Count:58 | 58 |
669 | } | - |
670 | | - |
671 | /*! | - |
672 | \overload | - |
673 | | - |
674 | Calls the method \a method on this interface and passes the | - |
675 | parameters to this function to the method. If \a mode is \c | - |
676 | NoWaitForReply, then this function will return immediately after | - |
677 | placing the call, without waiting for a reply from the remote | - |
678 | method. Otherwise, \a mode indicates whether this function should | - |
679 | activate the Qt Event Loop while waiting for the reply to arrive. | - |
680 | | - |
681 | This function can be used with up to 8 parameters, passed in arguments \a arg1, \a arg2, | - |
682 | \a arg3, \a arg4, \a arg5, \a arg6, \a arg7 and \a arg8. If you need more than 8 | - |
683 | parameters or if you have a variable number of parameters to be passed, use | - |
684 | callWithArgumentList(). | - |
685 | | - |
686 | If this function reenters the Qt event loop in order to wait for the | - |
687 | reply, it will exclude user input. During the wait, it may deliver | - |
688 | signals and other method calls to your application. Therefore, it | - |
689 | must be prepared to handle a reentrancy whenever a call is placed | - |
690 | with call(). | - |
691 | */ | - |
692 | QDBusMessage QDBusAbstractInterface::call(QDBus::CallMode mode, const QString &method, | - |
693 | const QVariant &arg1, | - |
694 | const QVariant &arg2, | - |
695 | const QVariant &arg3, | - |
696 | const QVariant &arg4, | - |
697 | const QVariant &arg5, | - |
698 | const QVariant &arg6, | - |
699 | const QVariant &arg7, | - |
700 | const QVariant &arg8) | - |
701 | { | - |
702 | QList<QVariant> argList; executed (the execution status of this line is deduced): QList<QVariant> argList; | - |
703 | int count = 0 + arg1.isValid() + arg2.isValid() + arg3.isValid() + arg4.isValid() + executed (the execution status of this line is deduced): int count = 0 + arg1.isValid() + arg2.isValid() + arg3.isValid() + arg4.isValid() + | - |
704 | arg5.isValid() + arg6.isValid() + arg7.isValid() + arg8.isValid(); executed (the execution status of this line is deduced): arg5.isValid() + arg6.isValid() + arg7.isValid() + arg8.isValid(); | - |
705 | | - |
706 | switch (count) { | - |
707 | case 8: | - |
708 | argList.prepend(arg8); never executed (the execution status of this line is deduced): argList.prepend(arg8); | - |
709 | case 7: code before this statement never executed: case 7: | 0 |
710 | argList.prepend(arg7); never executed (the execution status of this line is deduced): argList.prepend(arg7); | - |
711 | case 6: code before this statement never executed: case 6: | 0 |
712 | argList.prepend(arg6); never executed (the execution status of this line is deduced): argList.prepend(arg6); | - |
713 | case 5: code before this statement never executed: case 5: | 0 |
714 | argList.prepend(arg5); never executed (the execution status of this line is deduced): argList.prepend(arg5); | - |
715 | case 4: code before this statement never executed: case 4: | 0 |
716 | argList.prepend(arg4); never executed (the execution status of this line is deduced): argList.prepend(arg4); | - |
717 | case 3: code before this statement never executed: case 3: | 0 |
718 | argList.prepend(arg3); executed (the execution status of this line is deduced): argList.prepend(arg3); | - |
719 | case 2: code before this statement executed: case 2: Execution Count:12 | 12 |
720 | argList.prepend(arg2); executed (the execution status of this line is deduced): argList.prepend(arg2); | - |
721 | case 1: code before this statement executed: case 1: Execution Count:59 | 59 |
722 | argList.prepend(arg1); executed (the execution status of this line is deduced): argList.prepend(arg1); | - |
723 | } executed: } Execution Count:101 | 101 |
724 | | - |
725 | return callWithArgumentList(mode, method, argList); executed: return callWithArgumentList(mode, method, argList); Execution Count:232 | 232 |
726 | } | - |
727 | | - |
728 | | - |
729 | /*! | - |
730 | \since 4.5 | - |
731 | Calls the method \a method on this interface and passes the parameters to this function to the | - |
732 | method. | - |
733 | | - |
734 | The parameters to \c call are passed on to the remote function via D-Bus as input | - |
735 | arguments. The returned QDBusPendingCall object can be used to find out information about | - |
736 | the reply. | - |
737 | | - |
738 | This function can be used with up to 8 parameters, passed in arguments \a arg1, \a arg2, | - |
739 | \a arg3, \a arg4, \a arg5, \a arg6, \a arg7 and \a arg8. If you need more than 8 | - |
740 | parameters or if you have a variable number of parameters to be passed, use | - |
741 | asyncCallWithArgumentList(). | - |
742 | | - |
743 | It can be used the following way: | - |
744 | | - |
745 | \snippet code/src_qdbus_qdbusabstractinterface.cpp 1 | - |
746 | | - |
747 | This example illustrates function calling with 0, 1 and 2 parameters and illustrates different | - |
748 | parameter types passed in each (the first call to \c "ProcessWorkUnicode" will contain one | - |
749 | Unicode string, the second call to \c "ProcessWork" will contain one string and one byte array). | - |
750 | */ | - |
751 | QDBusPendingCall QDBusAbstractInterface::asyncCall(const QString &method, const QVariant &arg1, | - |
752 | const QVariant &arg2, | - |
753 | const QVariant &arg3, | - |
754 | const QVariant &arg4, | - |
755 | const QVariant &arg5, | - |
756 | const QVariant &arg6, | - |
757 | const QVariant &arg7, | - |
758 | const QVariant &arg8) | - |
759 | { | - |
760 | QList<QVariant> argList; executed (the execution status of this line is deduced): QList<QVariant> argList; | - |
761 | int count = 0 + arg1.isValid() + arg2.isValid() + arg3.isValid() + arg4.isValid() + executed (the execution status of this line is deduced): int count = 0 + arg1.isValid() + arg2.isValid() + arg3.isValid() + arg4.isValid() + | - |
762 | arg5.isValid() + arg6.isValid() + arg7.isValid() + arg8.isValid(); executed (the execution status of this line is deduced): arg5.isValid() + arg6.isValid() + arg7.isValid() + arg8.isValid(); | - |
763 | | - |
764 | switch (count) { | - |
765 | case 8: | - |
766 | argList.prepend(arg8); never executed (the execution status of this line is deduced): argList.prepend(arg8); | - |
767 | case 7: code before this statement never executed: case 7: | 0 |
768 | argList.prepend(arg7); never executed (the execution status of this line is deduced): argList.prepend(arg7); | - |
769 | case 6: code before this statement never executed: case 6: | 0 |
770 | argList.prepend(arg6); never executed (the execution status of this line is deduced): argList.prepend(arg6); | - |
771 | case 5: code before this statement never executed: case 5: | 0 |
772 | argList.prepend(arg5); never executed (the execution status of this line is deduced): argList.prepend(arg5); | - |
773 | case 4: code before this statement never executed: case 4: | 0 |
774 | argList.prepend(arg4); never executed (the execution status of this line is deduced): argList.prepend(arg4); | - |
775 | case 3: code before this statement never executed: case 3: | 0 |
776 | argList.prepend(arg3); never executed (the execution status of this line is deduced): argList.prepend(arg3); | - |
777 | case 2: code before this statement never executed: case 2: | 0 |
778 | argList.prepend(arg2); never executed (the execution status of this line is deduced): argList.prepend(arg2); | - |
779 | case 1: code before this statement never executed: case 1: | 0 |
780 | argList.prepend(arg1); never executed (the execution status of this line is deduced): argList.prepend(arg1); | - |
781 | } | 0 |
782 | | - |
783 | return asyncCallWithArgumentList(method, argList); executed: return asyncCallWithArgumentList(method, argList); Execution Count:39 | 39 |
784 | } | - |
785 | | - |
786 | /*! | - |
787 | \internal | - |
788 | */ | - |
789 | QDBusMessage QDBusAbstractInterface::internalConstCall(QDBus::CallMode mode, | - |
790 | const QString &method, | - |
791 | const QList<QVariant> &args) const | - |
792 | { | - |
793 | // ### move the code here, and make the other functions call this | - |
794 | return const_cast<QDBusAbstractInterface*>(this)->callWithArgumentList(mode, method, args); executed: return const_cast<QDBusAbstractInterface*>(this)->callWithArgumentList(mode, method, args); Execution Count:747 | 747 |
795 | } | - |
796 | | - |
797 | QT_END_NAMESPACE | - |
798 | | - |
799 | #endif // QT_NO_DBUS | - |
800 | | - |
801 | #include "moc_qdbusabstractinterface.cpp" | - |
802 | | - |
| | |