Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | static void copyArgument(void *to, int id, const QVariant &arg) | - |
11 | { | - |
12 | if (id == arg.userType()) { evaluated: id == arg.userType() yes Evaluation Count:12 | yes Evaluation Count:4 |
| 4-12 |
13 | switch (id) { | - |
14 | case QVariant::Bool: | - |
15 | *reinterpret_cast<bool *>(to) = arg.toBool(); | - |
16 | return; | 0 |
17 | | - |
18 | case QMetaType::UChar: | - |
19 | *reinterpret_cast<uchar *>(to) = arg.value<uchar>(); | - |
20 | return; | 0 |
21 | | - |
22 | case QMetaType::Short: | - |
23 | *reinterpret_cast<short *>(to) = arg.value<short>(); | - |
24 | return; | 0 |
25 | | - |
26 | case QMetaType::UShort: | - |
27 | *reinterpret_cast<ushort *>(to) = arg.value<ushort>(); | - |
28 | return; | 0 |
29 | | - |
30 | case QVariant::Int: | - |
31 | *reinterpret_cast<int *>(to) = arg.toInt(); | - |
32 | return; | 0 |
33 | | - |
34 | case QVariant::UInt: | - |
35 | *reinterpret_cast<uint *>(to) = arg.toUInt(); | - |
36 | return; | 0 |
37 | | - |
38 | case QVariant::LongLong: | - |
39 | *reinterpret_cast<qlonglong *>(to) = arg.toLongLong(); | - |
40 | return; | 0 |
41 | | - |
42 | case QVariant::ULongLong: | - |
43 | *reinterpret_cast<qulonglong *>(to) = arg.toULongLong(); | - |
44 | return; | 0 |
45 | | - |
46 | case QVariant::Double: | - |
47 | *reinterpret_cast<double *>(to) = arg.toDouble(); | - |
48 | return; | 0 |
49 | | - |
50 | case QVariant::String: | - |
51 | *reinterpret_cast<QString *>(to) = arg.toString(); | - |
52 | return; | 0 |
53 | | - |
54 | case QVariant::ByteArray: | - |
55 | *reinterpret_cast<QByteArray *>(to) = arg.toByteArray(); | - |
56 | return; | 0 |
57 | | - |
58 | case QVariant::StringList: | - |
59 | *reinterpret_cast<QStringList *>(to) = arg.toStringList(); | - |
60 | return; | 0 |
61 | } | - |
62 | | - |
63 | if (id == QDBusMetaTypeId::variant()) { partially evaluated: id == QDBusMetaTypeId::variant() yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
64 | *reinterpret_cast<QDBusVariant *>(to) = arg.value<QDBusVariant>(); | - |
65 | return; executed: return; Execution Count:12 | 12 |
66 | } else if (id == QDBusMetaTypeId::objectpath()) { never evaluated: id == QDBusMetaTypeId::objectpath() | 0 |
67 | *reinterpret_cast<QDBusObjectPath *>(to) = arg.value<QDBusObjectPath>(); | - |
68 | return; | 0 |
69 | } else if (id == QDBusMetaTypeId::signature()) { never evaluated: id == QDBusMetaTypeId::signature() | 0 |
70 | *reinterpret_cast<QDBusSignature *>(to) = arg.value<QDBusSignature>(); | - |
71 | return; | 0 |
72 | } | - |
73 | | - |
74 | | - |
75 | | - |
76 | QMessageLogger("qdbusinterface.cpp", 122, __PRETTY_FUNCTION__).fatal("Found a decoded basic type in a D-Bus reply that shouldn't be there"); | - |
77 | } | 0 |
78 | | - |
79 | | - |
80 | if (arg.userType() != QDBusMetaTypeId::argument()) { partially evaluated: arg.userType() != QDBusMetaTypeId::argument() no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
81 | | - |
82 | | - |
83 | return; | 0 |
84 | } | - |
85 | | - |
86 | | - |
87 | const char *userSignature = QDBusMetaType::typeToSignature(id); | - |
88 | if (!userSignature || !*userSignature) { partially evaluated: !userSignature no Evaluation Count:0 | yes Evaluation Count:4 |
partially evaluated: !*userSignature no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
89 | | - |
90 | | - |
91 | return; | 0 |
92 | } | - |
93 | | - |
94 | | - |
95 | QDBusArgument dbarg = arg.value<QDBusArgument>(); | - |
96 | if (dbarg.currentSignature() != QLatin1String(userSignature)) { partially evaluated: dbarg.currentSignature() != QLatin1String(userSignature) no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
97 | | - |
98 | | - |
99 | return; | 0 |
100 | } | - |
101 | | - |
102 | | - |
103 | QDBusMetaType::demarshall(dbarg, id, to); | - |
104 | } executed: } Execution Count:4 | 4 |
105 | | - |
106 | QDBusInterfacePrivate::QDBusInterfacePrivate(const QString &serv, const QString &p, | - |
107 | const QString &iface, const QDBusConnection &con) | - |
108 | : QDBusAbstractInterfacePrivate(serv, p, iface, con, true), metaObject(0) | - |
109 | { | - |
110 | | - |
111 | if (connection.isConnected()) { evaluated: connection.isConnected() yes Evaluation Count:128 | yes Evaluation Count:4 |
| 4-128 |
112 | metaObject = connectionPrivate()->findMetaObject(service, path, interface, lastError); | - |
113 | | - |
114 | if (!metaObject) { evaluated: !metaObject yes Evaluation Count:40 | yes Evaluation Count:88 |
| 40-88 |
115 | | - |
116 | | - |
117 | | - |
118 | | - |
119 | if (!lastError.isValid()) partially evaluated: !lastError.isValid() no Evaluation Count:0 | yes Evaluation Count:40 |
| 0-40 |
120 | lastError = QDBusError(QDBusError::InternalError, QLatin1String("Unknown error")); never executed: lastError = QDBusError(QDBusError::InternalError, QLatin1String("Unknown error")); | 0 |
121 | } executed: } Execution Count:40 | 40 |
122 | } executed: } Execution Count:128 | 128 |
123 | } executed: } Execution Count:132 | 132 |
124 | | - |
125 | QDBusInterfacePrivate::~QDBusInterfacePrivate() | - |
126 | { | - |
127 | if (metaObject && !metaObject->cached) evaluated: metaObject yes Evaluation Count:88 | yes Evaluation Count:44 |
evaluated: !metaObject->cached yes Evaluation Count:40 | yes Evaluation Count:48 |
| 40-88 |
128 | delete metaObject; executed: delete metaObject; Execution Count:40 | 40 |
129 | } executed: } Execution Count:132 | 132 |
130 | QDBusInterface::QDBusInterface(const QString &service, const QString &path, const QString &interface, | - |
131 | const QDBusConnection &connection, QObject *parent) | - |
132 | : QDBusAbstractInterface(*new QDBusInterfacePrivate(service, path, interface, connection), | - |
133 | parent) | - |
134 | { | - |
135 | } executed: } Execution Count:132 | 132 |
136 | | - |
137 | | - |
138 | | - |
139 | | - |
140 | QDBusInterface::~QDBusInterface() | - |
141 | { | - |
142 | | - |
143 | } | - |
144 | | - |
145 | | - |
146 | | - |
147 | | - |
148 | | - |
149 | const QMetaObject *QDBusInterface::metaObject() const | - |
150 | { | - |
151 | return d_func()->metaObject ? d_func()->metaObject : &QDBusAbstractInterface::staticMetaObject; | - |
152 | } | - |
153 | | - |
154 | | - |
155 | | - |
156 | | - |
157 | | - |
158 | void *QDBusInterface::qt_metacast(const char *_clname) | - |
159 | { | - |
160 | if (!_clname) return 0; | - |
161 | if (!strcmp(_clname, "QDBusInterface")) | - |
162 | return static_cast<void*>(const_cast<QDBusInterface*>(this)); | - |
163 | if (d_func()->interface.toLatin1() == _clname) | - |
164 | return static_cast<void*>(const_cast<QDBusInterface*>(this)); | - |
165 | return QDBusAbstractInterface::qt_metacast(_clname); | - |
166 | } | - |
167 | | - |
168 | | - |
169 | | - |
170 | | - |
171 | | - |
172 | int QDBusInterface::qt_metacall(QMetaObject::Call _c, int _id, void **_a) | - |
173 | { | - |
174 | _id = QDBusAbstractInterface::qt_metacall(_c, _id, _a); | - |
175 | if (_id < 0 || !d_func()->isValid || !d_func()->metaObject) | - |
176 | return _id; | - |
177 | return d_func()->metacall(_c, _id, _a); | - |
178 | } | - |
179 | | - |
180 | int QDBusInterfacePrivate::metacall(QMetaObject::Call c, int id, void **argv) | - |
181 | { | - |
182 | QDBusInterface * const q = q_func(); | - |
183 | | - |
184 | if (c == QMetaObject::InvokeMetaMethod) { partially evaluated: c == QMetaObject::InvokeMetaMethod yes Evaluation Count:28 | no Evaluation Count:0 |
| 0-28 |
185 | int offset = metaObject->methodOffset(); | - |
186 | QMetaMethod mm = metaObject->method(id + offset); | - |
187 | | - |
188 | if (mm.methodType() == QMetaMethod::Signal) { evaluated: mm.methodType() == QMetaMethod::Signal yes Evaluation Count:12 | yes Evaluation Count:16 |
| 12-16 |
189 | | - |
190 | QMetaObject::activate(q, metaObject, id, argv); | - |
191 | | - |
192 | } else if (mm.methodType() == QMetaMethod::Slot || mm.methodType() == QMetaMethod::Method) { executed: } Execution Count:12 partially evaluated: mm.methodType() == QMetaMethod::Slot yes Evaluation Count:16 | no Evaluation Count:0 |
never evaluated: mm.methodType() == QMetaMethod::Method | 0-16 |
193 | | - |
194 | | - |
195 | QString methodName = QString::fromLatin1(mm.name()); | - |
196 | const int *inputTypes = metaObject->inputTypesForMethod(id); | - |
197 | int inputTypesCount = *inputTypes; | - |
198 | | - |
199 | | - |
200 | QVariantList args; | - |
201 | int i = 1; | - |
202 | for ( ; i <= inputTypesCount; ++i) evaluated: i <= inputTypesCount yes Evaluation Count:20 | yes Evaluation Count:16 |
| 16-20 |
203 | args << QVariant(inputTypes[i], argv[i]); executed: args << QVariant(inputTypes[i], argv[i]); Execution Count:20 | 20 |
204 | | - |
205 | | - |
206 | QDBusMessage reply = q->callWithArgumentList(QDBus::Block, methodName, args); | - |
207 | | - |
208 | if (reply.type() == QDBusMessage::ReplyMessage) { partially evaluated: reply.type() == QDBusMessage::ReplyMessage yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
209 | | - |
210 | args = reply.arguments(); | - |
211 | QVariantList::ConstIterator it = args.constBegin(); | - |
212 | const int *outputTypes = metaObject->outputTypesForMethod(id); | - |
213 | int outputTypesCount = *outputTypes++; | - |
214 | | - |
215 | if (mm.returnType() != QMetaType::UnknownType && mm.returnType() != QMetaType::Void) { partially evaluated: mm.returnType() != QMetaType::UnknownType yes Evaluation Count:16 | no Evaluation Count:0 |
partially evaluated: mm.returnType() != QMetaType::Void yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
216 | | - |
217 | if (argv[0] && it != args.constEnd()) evaluated: argv[0] yes Evaluation Count:12 | yes Evaluation Count:4 |
partially evaluated: it != args.constEnd() yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
218 | copyArgument(argv[0], *outputTypes++, *it); executed: copyArgument(argv[0], *outputTypes++, *it); Execution Count:12 | 12 |
219 | | - |
220 | | - |
221 | --outputTypesCount; | - |
222 | ++it; | - |
223 | } executed: } Execution Count:16 | 16 |
224 | | - |
225 | for (int j = 0; j < outputTypesCount && it != args.constEnd(); ++i, ++j, ++it) { evaluated: j < outputTypesCount yes Evaluation Count:4 | yes Evaluation Count:16 |
partially evaluated: it != args.constEnd() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-16 |
226 | copyArgument(argv[i], outputTypes[j], *it); | - |
227 | } executed: } Execution Count:4 | 4 |
228 | } executed: } Execution Count:16 | 16 |
229 | | - |
230 | | - |
231 | lastError = QDBusError(reply); | - |
232 | return -1; executed: return -1; Execution Count:16 | 16 |
233 | } | - |
234 | } | - |
235 | return id; executed: return id; Execution Count:12 | 12 |
236 | } | - |
237 | | - |
238 | | - |
239 | | - |
| | |