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 QtCore 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 "qmetaobject.h" | - |
43 | #include "qmetatype.h" | - |
44 | #include "qobject.h" | - |
45 | | - |
46 | #include <qcoreapplication.h> | - |
47 | #include <qcoreevent.h> | - |
48 | #include <qdatastream.h> | - |
49 | #include <qstringlist.h> | - |
50 | #include <qthread.h> | - |
51 | #include <qvariant.h> | - |
52 | #include <qhash.h> | - |
53 | #include <qdebug.h> | - |
54 | #include <qsemaphore.h> | - |
55 | | - |
56 | #include "private/qobject_p.h" | - |
57 | #include "private/qmetaobject_p.h" | - |
58 | | - |
59 | // for normalizeTypeInternal | - |
60 | #include "private/qmetaobject_moc_p.h" | - |
61 | | - |
62 | #include <ctype.h> | - |
63 | | - |
64 | QT_BEGIN_NAMESPACE | - |
65 | | - |
66 | /*! | - |
67 | \class QMetaObject | - |
68 | \inmodule QtCore | - |
69 | | - |
70 | \brief The QMetaObject class contains meta-information about Qt | - |
71 | objects. | - |
72 | | - |
73 | \ingroup objectmodel | - |
74 | | - |
75 | The Qt \l{Meta-Object System} in Qt is responsible for the | - |
76 | signals and slots inter-object communication mechanism, runtime | - |
77 | type information, and the Qt property system. A single | - |
78 | QMetaObject instance is created for each QObject subclass that is | - |
79 | used in an application, and this instance stores all the | - |
80 | meta-information for the QObject subclass. This object is | - |
81 | available as QObject::metaObject(). | - |
82 | | - |
83 | This class is not normally required for application programming, | - |
84 | but it is useful if you write meta-applications, such as scripting | - |
85 | engines or GUI builders. | - |
86 | | - |
87 | The functions you are most likely to find useful are these: | - |
88 | \list | - |
89 | \li className() returns the name of a class. | - |
90 | \li superClass() returns the superclass's meta-object. | - |
91 | \li method() and methodCount() provide information | - |
92 | about a class's meta-methods (signals, slots and other | - |
93 | \l{Q_INVOKABLE}{invokable} member functions). | - |
94 | \li enumerator() and enumeratorCount() and provide information about | - |
95 | a class's enumerators. | - |
96 | \li propertyCount() and property() provide information about a | - |
97 | class's properties. | - |
98 | \li constructor() and constructorCount() provide information | - |
99 | about a class's meta-constructors. | - |
100 | \endlist | - |
101 | | - |
102 | The index functions indexOfConstructor(), indexOfMethod(), | - |
103 | indexOfEnumerator(), and indexOfProperty() map names of constructors, | - |
104 | member functions, enumerators, or properties to indexes in the | - |
105 | meta-object. For example, Qt uses indexOfMethod() internally when you | - |
106 | connect a signal to a slot. | - |
107 | | - |
108 | Classes can also have a list of \e{name}--\e{value} pairs of | - |
109 | additional class information, stored in QMetaClassInfo objects. | - |
110 | The number of pairs is returned by classInfoCount(), single pairs | - |
111 | are returned by classInfo(), and you can search for pairs with | - |
112 | indexOfClassInfo(). | - |
113 | | - |
114 | \sa QMetaClassInfo, QMetaEnum, QMetaMethod, QMetaProperty, QMetaType, | - |
115 | {Meta-Object System} | - |
116 | */ | - |
117 | | - |
118 | /*! | - |
119 | \enum QMetaObject::Call | - |
120 | | - |
121 | \internal | - |
122 | | - |
123 | \value InvokeSlot | - |
124 | \value EmitSignal | - |
125 | \value ReadProperty | - |
126 | \value WriteProperty | - |
127 | \value ResetProperty | - |
128 | \value QueryPropertyDesignable | - |
129 | \value QueryPropertyScriptable | - |
130 | \value QueryPropertyStored | - |
131 | \value QueryPropertyEditable | - |
132 | \value QueryPropertyUser | - |
133 | \value CreateInstance | - |
134 | */ | - |
135 | | - |
136 | /*! | - |
137 | \enum QMetaMethod::Access | - |
138 | | - |
139 | This enum describes the access level of a method, following the conventions used in C++. | - |
140 | | - |
141 | \value Private | - |
142 | \value Protected | - |
143 | \value Public | - |
144 | */ | - |
145 | | - |
146 | static inline const QMetaObjectPrivate *priv(const uint* data) | - |
147 | { return reinterpret_cast<const QMetaObjectPrivate*>(data); } executed: return reinterpret_cast<const QMetaObjectPrivate*>(data); Execution Count:98354676 | 98354676 |
148 | | - |
149 | static inline const QByteArray stringData(const QMetaObject *mo, int index) | - |
150 | { | - |
151 | Q_ASSERT(priv(mo->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
152 | const QByteArrayDataPtr data = { const_cast<QByteArrayData*>(&mo->d.stringdata[index]) }; executed (the execution status of this line is deduced): const QByteArrayDataPtr data = { const_cast<QByteArrayData*>(&mo->d.stringdata[index]) }; | - |
153 | Q_ASSERT(data.ptr->ref.isStatic()); executed (the execution status of this line is deduced): qt_noop(); | - |
154 | Q_ASSERT(data.ptr->alloc == 0); executed (the execution status of this line is deduced): qt_noop(); | - |
155 | Q_ASSERT(data.ptr->capacityReserved == 0); executed (the execution status of this line is deduced): qt_noop(); | - |
156 | Q_ASSERT(data.ptr->size >= 0); executed (the execution status of this line is deduced): qt_noop(); | - |
157 | return data; executed: return data; Execution Count:21792416 | 21792416 |
158 | } | - |
159 | | - |
160 | static inline const char *rawStringData(const QMetaObject *mo, int index) | - |
161 | { | - |
162 | return stringData(mo, index).data(); executed: return stringData(mo, index).data(); Execution Count:2961532 | 2961532 |
163 | } | - |
164 | | - |
165 | static inline int stringSize(const QMetaObject *mo, int index) | - |
166 | { | - |
167 | return stringData(mo, index).size(); executed: return stringData(mo, index).size(); Execution Count:39 | 39 |
168 | } | - |
169 | | - |
170 | static inline QByteArray typeNameFromTypeInfo(const QMetaObject *mo, uint typeInfo) | - |
171 | { | - |
172 | if (typeInfo & IsUnresolvedType) { evaluated: typeInfo & IsUnresolvedType yes Evaluation Count:114492 | yes Evaluation Count:19478 |
| 19478-114492 |
173 | return stringData(mo, typeInfo & TypeNameIndexMask); executed: return stringData(mo, typeInfo & TypeNameIndexMask); Execution Count:114492 | 114492 |
174 | } else { | - |
175 | // ### Use the QMetaType::typeName() that returns QByteArray | - |
176 | const char *t = QMetaType::typeName(typeInfo); executed (the execution status of this line is deduced): const char *t = QMetaType::typeName(typeInfo); | - |
177 | return QByteArray::fromRawData(t, qstrlen(t)); executed: return QByteArray::fromRawData(t, qstrlen(t)); Execution Count:19478 | 19478 |
178 | } | - |
179 | } | - |
180 | | - |
181 | static inline const char *rawTypeNameFromTypeInfo(const QMetaObject *mo, uint typeInfo) | - |
182 | { | - |
183 | return typeNameFromTypeInfo(mo, typeInfo).constData(); executed: return typeNameFromTypeInfo(mo, typeInfo).constData(); Execution Count:882 | 882 |
184 | } | - |
185 | | - |
186 | static inline int typeFromTypeInfo(const QMetaObject *mo, uint typeInfo) | - |
187 | { | - |
188 | if (!(typeInfo & IsUnresolvedType)) evaluated: !(typeInfo & IsUnresolvedType) yes Evaluation Count:1058055 | yes Evaluation Count:87112 |
| 87112-1058055 |
189 | return typeInfo; executed: return typeInfo; Execution Count:1058054 | 1058054 |
190 | return QMetaType::type(stringData(mo, typeInfo & TypeNameIndexMask)); executed: return QMetaType::type(stringData(mo, typeInfo & TypeNameIndexMask)); Execution Count:87112 | 87112 |
191 | } | - |
192 | | - |
193 | class QMetaMethodPrivate : public QMetaMethod | - |
194 | { | - |
195 | public: | - |
196 | static const QMetaMethodPrivate *get(const QMetaMethod *q) | - |
197 | { return static_cast<const QMetaMethodPrivate *>(q); } executed: return static_cast<const QMetaMethodPrivate *>(q); Execution Count:513169 | 513169 |
198 | | - |
199 | inline QByteArray signature() const; | - |
200 | inline QByteArray name() const; | - |
201 | inline int typesDataIndex() const; | - |
202 | inline const char *rawReturnTypeName() const; | - |
203 | inline int returnType() const; | - |
204 | inline int parameterCount() const; | - |
205 | inline int parametersDataIndex() const; | - |
206 | inline uint parameterTypeInfo(int index) const; | - |
207 | inline int parameterType(int index) const; | - |
208 | inline void getParameterTypes(int *types) const; | - |
209 | inline QList<QByteArray> parameterTypes() const; | - |
210 | inline QList<QByteArray> parameterNames() const; | - |
211 | inline QByteArray tag() const; | - |
212 | inline int ownMethodIndex() const; | - |
213 | | - |
214 | private: | - |
215 | QMetaMethodPrivate(); | - |
216 | }; | - |
217 | | - |
218 | /*! | - |
219 | \since 4.5 | - |
220 | | - |
221 | Constructs a new instance of this class. You can pass up to ten arguments | - |
222 | (\a val0, \a val1, \a val2, \a val3, \a val4, \a val5, \a val6, \a val7, | - |
223 | \a val8, and \a val9) to the constructor. Returns the new object, or 0 if | - |
224 | no suitable constructor is available. | - |
225 | | - |
226 | Note that only constructors that are declared with the Q_INVOKABLE | - |
227 | modifier are made available through the meta-object system. | - |
228 | | - |
229 | \sa Q_ARG(), constructor() | - |
230 | */ | - |
231 | QObject *QMetaObject::newInstance(QGenericArgument val0, | - |
232 | QGenericArgument val1, | - |
233 | QGenericArgument val2, | - |
234 | QGenericArgument val3, | - |
235 | QGenericArgument val4, | - |
236 | QGenericArgument val5, | - |
237 | QGenericArgument val6, | - |
238 | QGenericArgument val7, | - |
239 | QGenericArgument val8, | - |
240 | QGenericArgument val9) const | - |
241 | { | - |
242 | QByteArray constructorName = className(); executed (the execution status of this line is deduced): QByteArray constructorName = className(); | - |
243 | { | - |
244 | int idx = constructorName.lastIndexOf(':'); executed (the execution status of this line is deduced): int idx = constructorName.lastIndexOf(':'); | - |
245 | if (idx != -1) evaluated: idx != -1 yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
246 | constructorName.remove(0, idx+1); // remove qualified part executed: constructorName.remove(0, idx+1); Execution Count:1 | 1 |
247 | } | - |
248 | QVarLengthArray<char, 512> sig; executed (the execution status of this line is deduced): QVarLengthArray<char, 512> sig; | - |
249 | sig.append(constructorName.constData(), constructorName.length()); executed (the execution status of this line is deduced): sig.append(constructorName.constData(), constructorName.length()); | - |
250 | sig.append('('); executed (the execution status of this line is deduced): sig.append('('); | - |
251 | | - |
252 | enum { MaximumParamCount = 10 }; executed (the execution status of this line is deduced): enum { MaximumParamCount = 10 }; | - |
253 | const char *typeNames[] = {val0.name(), val1.name(), val2.name(), val3.name(), val4.name(), executed (the execution status of this line is deduced): const char *typeNames[] = {val0.name(), val1.name(), val2.name(), val3.name(), val4.name(), | - |
254 | val5.name(), val6.name(), val7.name(), val8.name(), val9.name()}; executed (the execution status of this line is deduced): val5.name(), val6.name(), val7.name(), val8.name(), val9.name()}; | - |
255 | | - |
256 | int paramCount; executed (the execution status of this line is deduced): int paramCount; | - |
257 | for (paramCount = 0; paramCount < MaximumParamCount; ++paramCount) { partially evaluated: paramCount < MaximumParamCount yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
258 | int len = qstrlen(typeNames[paramCount]); executed (the execution status of this line is deduced): int len = qstrlen(typeNames[paramCount]); | - |
259 | if (len <= 0) evaluated: len <= 0 yes Evaluation Count:5 | yes Evaluation Count:3 |
| 3-5 |
260 | break; executed: break; Execution Count:5 | 5 |
261 | sig.append(typeNames[paramCount], len); executed (the execution status of this line is deduced): sig.append(typeNames[paramCount], len); | - |
262 | sig.append(','); executed (the execution status of this line is deduced): sig.append(','); | - |
263 | } executed: } Execution Count:3 | 3 |
264 | if (paramCount == 0) evaluated: paramCount == 0 yes Evaluation Count:2 | yes Evaluation Count:3 |
| 2-3 |
265 | sig.append(')'); // no parameters executed: sig.append(')'); Execution Count:2 | 2 |
266 | else | - |
267 | sig[sig.size() - 1] = ')'; executed: sig[sig.size() - 1] = ')'; Execution Count:3 | 3 |
268 | sig.append('\0'); executed (the execution status of this line is deduced): sig.append('\0'); | - |
269 | | - |
270 | int idx = indexOfConstructor(sig.constData()); executed (the execution status of this line is deduced): int idx = indexOfConstructor(sig.constData()); | - |
271 | if (idx < 0) { evaluated: idx < 0 yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
272 | QByteArray norm = QMetaObject::normalizedSignature(sig.constData()); executed (the execution status of this line is deduced): QByteArray norm = QMetaObject::normalizedSignature(sig.constData()); | - |
273 | idx = indexOfConstructor(norm.constData()); executed (the execution status of this line is deduced): idx = indexOfConstructor(norm.constData()); | - |
274 | } executed: } Execution Count:1 | 1 |
275 | if (idx < 0) evaluated: idx < 0 yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
276 | return 0; executed: return 0; Execution Count:1 | 1 |
277 | | - |
278 | QObject *returnValue = 0; executed (the execution status of this line is deduced): QObject *returnValue = 0; | - |
279 | void *param[] = {&returnValue, val0.data(), val1.data(), val2.data(), val3.data(), val4.data(), executed (the execution status of this line is deduced): void *param[] = {&returnValue, val0.data(), val1.data(), val2.data(), val3.data(), val4.data(), | - |
280 | val5.data(), val6.data(), val7.data(), val8.data(), val9.data()}; executed (the execution status of this line is deduced): val5.data(), val6.data(), val7.data(), val8.data(), val9.data()}; | - |
281 | | - |
282 | if (static_metacall(CreateInstance, idx, param) >= 0) partially evaluated: static_metacall(CreateInstance, idx, param) >= 0 no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
283 | return 0; never executed: return 0; | 0 |
284 | return returnValue; executed: return returnValue; Execution Count:4 | 4 |
285 | } | - |
286 | | - |
287 | /*! | - |
288 | \internal | - |
289 | */ | - |
290 | int QMetaObject::static_metacall(Call cl, int idx, void **argv) const | - |
291 | { | - |
292 | Q_ASSERT(priv(d.data)->revision >= 6); executed (the execution status of this line is deduced): qt_noop(); | - |
293 | if (!d.static_metacall) evaluated: !d.static_metacall yes Evaluation Count:3 | yes Evaluation Count:5531 |
| 3-5531 |
294 | return 0; executed: return 0; Execution Count:3 | 3 |
295 | d.static_metacall(0, cl, idx, argv); executed (the execution status of this line is deduced): d.static_metacall(0, cl, idx, argv); | - |
296 | return -1; executed: return -1; Execution Count:5531 | 5531 |
297 | } | - |
298 | | - |
299 | /*! | - |
300 | \internal | - |
301 | */ | - |
302 | int QMetaObject::metacall(QObject *object, Call cl, int idx, void **argv) | - |
303 | { | - |
304 | if (object->d_ptr->metaObject) partially evaluated: object->d_ptr->metaObject no Evaluation Count:0 | yes Evaluation Count:20113 |
| 0-20113 |
305 | return object->d_ptr->metaObject->metaCall(object, cl, idx, argv); never executed: return object->d_ptr->metaObject->metaCall(object, cl, idx, argv); | 0 |
306 | else | - |
307 | return object->qt_metacall(cl, idx, argv); executed: return object->qt_metacall(cl, idx, argv); Execution Count:20113 | 20113 |
308 | } | - |
309 | | - |
310 | /*! | - |
311 | Returns the class name. | - |
312 | | - |
313 | \sa superClass() | - |
314 | */ | - |
315 | const char *QMetaObject::className() const | - |
316 | { | - |
317 | return rawStringData(this, 0); | - |
318 | } | - |
319 | | - |
320 | /*! | - |
321 | \fn QMetaObject *QMetaObject::superClass() const | - |
322 | | - |
323 | Returns the meta-object of the superclass, or 0 if there is no | - |
324 | such object. | - |
325 | | - |
326 | \sa className() | - |
327 | */ | - |
328 | | - |
329 | /*! | - |
330 | \internal | - |
331 | | - |
332 | Returns \a obj if object \a obj inherits from this | - |
333 | meta-object; otherwise returns 0. | - |
334 | */ | - |
335 | QObject *QMetaObject::cast(QObject *obj) const | - |
336 | { | - |
337 | if (obj) { evaluated: obj yes Evaluation Count:1774741 | yes Evaluation Count:116722 |
| 116722-1774741 |
338 | const QMetaObject *m = obj->metaObject(); executed (the execution status of this line is deduced): const QMetaObject *m = obj->metaObject(); | - |
339 | do { | - |
340 | if (m == this) evaluated: m == this yes Evaluation Count:1483220 | yes Evaluation Count:974589 |
| 974589-1483220 |
341 | return obj; executed: return obj; Execution Count:1483210 | 1483210 |
342 | } while ((m = m->d.superdata)); executed: } Execution Count:974589 evaluated: (m = m->d.superdata) yes Evaluation Count:683077 | yes Evaluation Count:291512 |
| 291512-974589 |
343 | } executed: } Execution Count:291512 | 291512 |
344 | return 0; executed: return 0; Execution Count:408234 | 408234 |
345 | } | - |
346 | | - |
347 | /*! | - |
348 | \internal | - |
349 | | - |
350 | Returns \a obj if object \a obj inherits from this | - |
351 | meta-object; otherwise returns 0. | - |
352 | */ | - |
353 | const QObject *QMetaObject::cast(const QObject *obj) const | - |
354 | { | - |
355 | if (obj) { evaluated: obj yes Evaluation Count:191231 | yes Evaluation Count:9554 |
| 9554-191231 |
356 | const QMetaObject *m = obj->metaObject(); executed (the execution status of this line is deduced): const QMetaObject *m = obj->metaObject(); | - |
357 | do { | - |
358 | if (m == this) evaluated: m == this yes Evaluation Count:48258 | yes Evaluation Count:566541 |
| 48258-566541 |
359 | return obj; executed: return obj; Execution Count:48258 | 48258 |
360 | } while ((m = m->d.superdata)); executed: } Execution Count:566541 evaluated: (m = m->d.superdata) yes Evaluation Count:423568 | yes Evaluation Count:142973 |
| 142973-566541 |
361 | } executed: } Execution Count:142973 | 142973 |
362 | return 0; executed: return 0; Execution Count:152527 | 152527 |
363 | } | - |
364 | | - |
365 | #ifndef QT_NO_TRANSLATION | - |
366 | /*! | - |
367 | \internal | - |
368 | */ | - |
369 | QString QMetaObject::tr(const char *s, const char *c, int n) const | - |
370 | { | - |
371 | return QCoreApplication::translate(rawStringData(this, 0), s, c, n); | - |
372 | } | - |
373 | #endif // QT_NO_TRANSLATION | - |
374 | | - |
375 | /*! | - |
376 | Returns the method offset for this class; i.e. the index position | - |
377 | of this class's first member function. | - |
378 | | - |
379 | The offset is the sum of all the methods in the class's | - |
380 | superclasses (which is always positive since QObject has the | - |
381 | deleteLater() slot and a destroyed() signal). | - |
382 | | - |
383 | \sa method(), methodCount(), indexOfMethod() | - |
384 | */ | - |
385 | int QMetaObject::methodOffset() const | - |
386 | { | - |
387 | int offset = 0; executed (the execution status of this line is deduced): int offset = 0; | - |
388 | const QMetaObject *m = d.superdata; executed (the execution status of this line is deduced): const QMetaObject *m = d.superdata; | - |
389 | while (m) { evaluated: m yes Evaluation Count:27706052 | yes Evaluation Count:10269247 |
| 10269247-27706052 |
390 | offset += priv(m->d.data)->methodCount; executed (the execution status of this line is deduced): offset += priv(m->d.data)->methodCount; | - |
391 | m = m->d.superdata; executed (the execution status of this line is deduced): m = m->d.superdata; | - |
392 | } executed: } Execution Count:27707220 | 27707220 |
393 | return offset; executed: return offset; Execution Count:10267844 | 10267844 |
394 | } | - |
395 | | - |
396 | | - |
397 | /*! | - |
398 | Returns the enumerator offset for this class; i.e. the index | - |
399 | position of this class's first enumerator. | - |
400 | | - |
401 | If the class has no superclasses with enumerators, the offset is | - |
402 | 0; otherwise the offset is the sum of all the enumerators in the | - |
403 | class's superclasses. | - |
404 | | - |
405 | \sa enumerator(), enumeratorCount(), indexOfEnumerator() | - |
406 | */ | - |
407 | int QMetaObject::enumeratorOffset() const | - |
408 | { | - |
409 | int offset = 0; executed (the execution status of this line is deduced): int offset = 0; | - |
410 | const QMetaObject *m = d.superdata; executed (the execution status of this line is deduced): const QMetaObject *m = d.superdata; | - |
411 | while (m) { evaluated: m yes Evaluation Count:7847 | yes Evaluation Count:5751 |
| 5751-7847 |
412 | offset += priv(m->d.data)->enumeratorCount; executed (the execution status of this line is deduced): offset += priv(m->d.data)->enumeratorCount; | - |
413 | m = m->d.superdata; executed (the execution status of this line is deduced): m = m->d.superdata; | - |
414 | } executed: } Execution Count:7847 | 7847 |
415 | return offset; executed: return offset; Execution Count:5751 | 5751 |
416 | } | - |
417 | | - |
418 | /*! | - |
419 | Returns the property offset for this class; i.e. the index | - |
420 | position of this class's first property. | - |
421 | | - |
422 | The offset is the sum of all the properties in the class's | - |
423 | superclasses (which is always positive since QObject has the | - |
424 | name() property). | - |
425 | | - |
426 | \sa property(), propertyCount(), indexOfProperty() | - |
427 | */ | - |
428 | int QMetaObject::propertyOffset() const | - |
429 | { | - |
430 | int offset = 0; executed (the execution status of this line is deduced): int offset = 0; | - |
431 | const QMetaObject *m = d.superdata; executed (the execution status of this line is deduced): const QMetaObject *m = d.superdata; | - |
432 | while (m) { evaluated: m yes Evaluation Count:88704 | yes Evaluation Count:47530 |
| 47530-88704 |
433 | offset += priv(m->d.data)->propertyCount; executed (the execution status of this line is deduced): offset += priv(m->d.data)->propertyCount; | - |
434 | m = m->d.superdata; executed (the execution status of this line is deduced): m = m->d.superdata; | - |
435 | } executed: } Execution Count:88704 | 88704 |
436 | return offset; executed: return offset; Execution Count:47530 | 47530 |
437 | } | - |
438 | | - |
439 | /*! | - |
440 | Returns the class information offset for this class; i.e. the | - |
441 | index position of this class's first class information item. | - |
442 | | - |
443 | If the class has no superclasses with class information, the | - |
444 | offset is 0; otherwise the offset is the sum of all the class | - |
445 | information items in the class's superclasses. | - |
446 | | - |
447 | \sa classInfo(), classInfoCount(), indexOfClassInfo() | - |
448 | */ | - |
449 | int QMetaObject::classInfoOffset() const | - |
450 | { | - |
451 | int offset = 0; executed (the execution status of this line is deduced): int offset = 0; | - |
452 | const QMetaObject *m = d.superdata; executed (the execution status of this line is deduced): const QMetaObject *m = d.superdata; | - |
453 | while (m) { evaluated: m yes Evaluation Count:1612 | yes Evaluation Count:972 |
| 972-1612 |
454 | offset += priv(m->d.data)->classInfoCount; executed (the execution status of this line is deduced): offset += priv(m->d.data)->classInfoCount; | - |
455 | m = m->d.superdata; executed (the execution status of this line is deduced): m = m->d.superdata; | - |
456 | } executed: } Execution Count:1612 | 1612 |
457 | return offset; executed: return offset; Execution Count:972 | 972 |
458 | } | - |
459 | | - |
460 | /*! | - |
461 | \since 4.5 | - |
462 | | - |
463 | Returns the number of constructors in this class. | - |
464 | | - |
465 | \sa constructor(), indexOfConstructor() | - |
466 | */ | - |
467 | int QMetaObject::constructorCount() const | - |
468 | { | - |
469 | Q_ASSERT(priv(d.data)->revision >= 2); executed (the execution status of this line is deduced): qt_noop(); | - |
470 | return priv(d.data)->constructorCount; executed: return priv(d.data)->constructorCount; Execution Count:38 | 38 |
471 | } | - |
472 | | - |
473 | /*! | - |
474 | Returns the number of methods in this class, including the number of | - |
475 | methods provided by each base class. These include signals and slots | - |
476 | as well as normal member functions. | - |
477 | | - |
478 | Use code like the following to obtain a QStringList containing the methods | - |
479 | specific to a given class: | - |
480 | | - |
481 | \snippet code/src_corelib_kernel_qmetaobject.cpp methodCount | - |
482 | | - |
483 | \sa method(), methodOffset(), indexOfMethod() | - |
484 | */ | - |
485 | int QMetaObject::methodCount() const | - |
486 | { | - |
487 | int n = priv(d.data)->methodCount; executed (the execution status of this line is deduced): int n = priv(d.data)->methodCount; | - |
488 | const QMetaObject *m = d.superdata; executed (the execution status of this line is deduced): const QMetaObject *m = d.superdata; | - |
489 | while (m) { evaluated: m yes Evaluation Count:252372 | yes Evaluation Count:383020 |
| 252372-383020 |
490 | n += priv(m->d.data)->methodCount; executed (the execution status of this line is deduced): n += priv(m->d.data)->methodCount; | - |
491 | m = m->d.superdata; executed (the execution status of this line is deduced): m = m->d.superdata; | - |
492 | } executed: } Execution Count:252372 | 252372 |
493 | return n; executed: return n; Execution Count:383020 | 383020 |
494 | } | - |
495 | | - |
496 | /*! | - |
497 | Returns the number of enumerators in this class. | - |
498 | | - |
499 | \sa enumerator(), enumeratorOffset(), indexOfEnumerator() | - |
500 | */ | - |
501 | int QMetaObject::enumeratorCount() const | - |
502 | { | - |
503 | int n = priv(d.data)->enumeratorCount; executed (the execution status of this line is deduced): int n = priv(d.data)->enumeratorCount; | - |
504 | const QMetaObject *m = d.superdata; executed (the execution status of this line is deduced): const QMetaObject *m = d.superdata; | - |
505 | while (m) { evaluated: m yes Evaluation Count:137 | yes Evaluation Count:84 |
| 84-137 |
506 | n += priv(m->d.data)->enumeratorCount; executed (the execution status of this line is deduced): n += priv(m->d.data)->enumeratorCount; | - |
507 | m = m->d.superdata; executed (the execution status of this line is deduced): m = m->d.superdata; | - |
508 | } executed: } Execution Count:137 | 137 |
509 | return n; executed: return n; Execution Count:84 | 84 |
510 | } | - |
511 | | - |
512 | /*! | - |
513 | Returns the number of properties in this class, including the number of | - |
514 | properties provided by each base class. | - |
515 | | - |
516 | Use code like the following to obtain a QStringList containing the properties | - |
517 | specific to a given class: | - |
518 | | - |
519 | \snippet code/src_corelib_kernel_qmetaobject.cpp propertyCount | - |
520 | | - |
521 | \sa property(), propertyOffset(), indexOfProperty() | - |
522 | */ | - |
523 | int QMetaObject::propertyCount() const | - |
524 | { | - |
525 | int n = priv(d.data)->propertyCount; executed (the execution status of this line is deduced): int n = priv(d.data)->propertyCount; | - |
526 | const QMetaObject *m = d.superdata; executed (the execution status of this line is deduced): const QMetaObject *m = d.superdata; | - |
527 | while (m) { evaluated: m yes Evaluation Count:1326 | yes Evaluation Count:704 |
| 704-1326 |
528 | n += priv(m->d.data)->propertyCount; executed (the execution status of this line is deduced): n += priv(m->d.data)->propertyCount; | - |
529 | m = m->d.superdata; executed (the execution status of this line is deduced): m = m->d.superdata; | - |
530 | } executed: } Execution Count:1326 | 1326 |
531 | return n; executed: return n; Execution Count:704 | 704 |
532 | } | - |
533 | | - |
534 | /*! | - |
535 | Returns the number of items of class information in this class. | - |
536 | | - |
537 | \sa classInfo(), classInfoOffset(), indexOfClassInfo() | - |
538 | */ | - |
539 | int QMetaObject::classInfoCount() const | - |
540 | { | - |
541 | int n = priv(d.data)->classInfoCount; executed (the execution status of this line is deduced): int n = priv(d.data)->classInfoCount; | - |
542 | const QMetaObject *m = d.superdata; executed (the execution status of this line is deduced): const QMetaObject *m = d.superdata; | - |
543 | while (m) { evaluated: m yes Evaluation Count:137 | yes Evaluation Count:84 |
| 84-137 |
544 | n += priv(m->d.data)->classInfoCount; executed (the execution status of this line is deduced): n += priv(m->d.data)->classInfoCount; | - |
545 | m = m->d.superdata; executed (the execution status of this line is deduced): m = m->d.superdata; | - |
546 | } executed: } Execution Count:137 | 137 |
547 | return n; executed: return n; Execution Count:84 | 84 |
548 | } | - |
549 | | - |
550 | // Returns true if the method defined by the given meta-object&handle | - |
551 | // matches the given name, argument count and argument types, otherwise | - |
552 | // returns false. | - |
553 | static bool methodMatch(const QMetaObject *m, int handle, | - |
554 | const QByteArray &name, int argc, | - |
555 | const QArgumentType *types) | - |
556 | { | - |
557 | Q_ASSERT(priv(m->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
558 | if (int(m->d.data[handle + 1]) != argc) evaluated: int(m->d.data[handle + 1]) != argc yes Evaluation Count:13938467 | yes Evaluation Count:18580597 |
| 13938467-18580597 |
559 | return false; executed: return false; Execution Count:13938477 | 13938477 |
560 | | - |
561 | if (stringData(m, m->d.data[handle]) != name) evaluated: stringData(m, m->d.data[handle]) != name yes Evaluation Count:17445134 | yes Evaluation Count:1135870 |
| 1135870-17445134 |
562 | return false; executed: return false; Execution Count:17445138 | 17445138 |
563 | | - |
564 | int paramsIndex = m->d.data[handle + 2] + 1; executed (the execution status of this line is deduced): int paramsIndex = m->d.data[handle + 2] + 1; | - |
565 | for (int i = 0; i < argc; ++i) { evaluated: i < argc yes Evaluation Count:1246653 | yes Evaluation Count:1135224 |
| 1135224-1246653 |
566 | uint typeInfo = m->d.data[paramsIndex + i]; executed (the execution status of this line is deduced): uint typeInfo = m->d.data[paramsIndex + i]; | - |
567 | if (types[i].type()) { evaluated: types[i].type() yes Evaluation Count:1134686 | yes Evaluation Count:111966 |
| 111966-1134686 |
568 | if (types[i].type() != typeFromTypeInfo(m, typeInfo)) evaluated: types[i].type() != typeFromTypeInfo(m, typeInfo) yes Evaluation Count:551 | yes Evaluation Count:1134142 |
| 551-1134142 |
569 | return false; executed: return false; Execution Count:551 | 551 |
570 | } else { executed: } Execution Count:1134141 | 1134141 |
571 | if (types[i].name() != typeNameFromTypeInfo(m, typeInfo)) evaluated: types[i].name() != typeNameFromTypeInfo(m, typeInfo) yes Evaluation Count:101 | yes Evaluation Count:111864 |
| 101-111864 |
572 | return false; executed: return false; Execution Count:101 | 101 |
573 | } executed: } Execution Count:111864 | 111864 |
574 | } | - |
575 | | - |
576 | return true; executed: return true; Execution Count:1135223 | 1135223 |
577 | } | - |
578 | | - |
579 | /** | - |
580 | * \internal | - |
581 | * helper function for indexOf{Method,Slot,Signal}, returns the relative index of the method within | - |
582 | * the baseObject | - |
583 | * \a MethodType might be MethodSignal or MethodSlot, or 0 to match everything. | - |
584 | */ | - |
585 | template<int MethodType> | - |
586 | static inline int indexOfMethodRelative(const QMetaObject **baseObject, | - |
587 | const QByteArray &name, int argc, | - |
588 | const QArgumentType *types) | - |
589 | { | - |
590 | for (const QMetaObject *m = *baseObject; m; m = m->d.superdata) { evaluated: m yes Evaluation Count:3449721 | yes Evaluation Count:494988 |
| 494988-3449721 |
591 | Q_ASSERT(priv(m->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
592 | int i = (MethodType == MethodSignal) evaluated: (MethodType == MethodSignal) yes Evaluation Count:1030325 | yes Evaluation Count:2419502 |
| 1030325-2419502 |
593 | ? (priv(m->d.data)->signalCount - 1) : (priv(m->d.data)->methodCount - 1); executed (the execution status of this line is deduced): ? (priv(m->d.data)->signalCount - 1) : (priv(m->d.data)->methodCount - 1); | - |
594 | const int end = (MethodType == MethodSlot) evaluated: (MethodType == MethodSlot) yes Evaluation Count:1948545 | yes Evaluation Count:1501265 |
| 1501265-1948545 |
595 | ? (priv(m->d.data)->signalCount) : 0; executed (the execution status of this line is deduced): ? (priv(m->d.data)->signalCount) : 0; | - |
596 | | - |
597 | for (; i >= end; --i) { evaluated: i >= end yes Evaluation Count:32517506 | yes Evaluation Count:2314533 |
| 2314533-32517506 |
598 | int handle = priv(m->d.data)->methodData + 5*i; executed (the execution status of this line is deduced): int handle = priv(m->d.data)->methodData + 5*i; | - |
599 | if (methodMatch(m, handle, name, argc, types)) { evaluated: methodMatch(m, handle, name, argc, types) yes Evaluation Count:1135206 | yes Evaluation Count:31382870 |
| 1135206-31382870 |
600 | *baseObject = m; executed (the execution status of this line is deduced): *baseObject = m; | - |
601 | return i; executed: return i; Execution Count:1135208 | 1135208 |
602 | } | - |
603 | } executed: } Execution Count:31382681 | 31382681 |
604 | } executed: } Execution Count:2314535 | 2314535 |
605 | return -1; executed: return -1; Execution Count:494987 | 494987 |
606 | } | - |
607 | | - |
608 | | - |
609 | /*! | - |
610 | \since 4.5 | - |
611 | | - |
612 | Finds \a constructor and returns its index; otherwise returns -1. | - |
613 | | - |
614 | Note that the \a constructor has to be in normalized form, as returned | - |
615 | by normalizedSignature(). | - |
616 | | - |
617 | \sa constructor(), constructorCount(), normalizedSignature() | - |
618 | */ | - |
619 | int QMetaObject::indexOfConstructor(const char *constructor) const | - |
620 | { | - |
621 | Q_ASSERT(priv(d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
622 | QArgumentTypeArray types; executed (the execution status of this line is deduced): QArgumentTypeArray types; | - |
623 | QByteArray name = QMetaObjectPrivate::decodeMethodSignature(constructor, types); executed (the execution status of this line is deduced): QByteArray name = QMetaObjectPrivate::decodeMethodSignature(constructor, types); | - |
624 | return QMetaObjectPrivate::indexOfConstructor(this, name, types.size(), types.constData()); executed: return QMetaObjectPrivate::indexOfConstructor(this, name, types.size(), types.constData()); Execution Count:16 | 16 |
625 | } | - |
626 | | - |
627 | /*! | - |
628 | Finds \a method and returns its index; otherwise returns -1. | - |
629 | | - |
630 | Note that the \a method has to be in normalized form, as returned | - |
631 | by normalizedSignature(). | - |
632 | | - |
633 | \sa method(), methodCount(), methodOffset(), normalizedSignature() | - |
634 | */ | - |
635 | int QMetaObject::indexOfMethod(const char *method) const | - |
636 | { | - |
637 | const QMetaObject *m = this; executed (the execution status of this line is deduced): const QMetaObject *m = this; | - |
638 | int i; executed (the execution status of this line is deduced): int i; | - |
639 | Q_ASSERT(priv(m->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
640 | QArgumentTypeArray types; executed (the execution status of this line is deduced): QArgumentTypeArray types; | - |
641 | QByteArray name = QMetaObjectPrivate::decodeMethodSignature(method, types); executed (the execution status of this line is deduced): QByteArray name = QMetaObjectPrivate::decodeMethodSignature(method, types); | - |
642 | i = indexOfMethodRelative<0>(&m, name, types.size(), types.constData()); executed (the execution status of this line is deduced): i = indexOfMethodRelative<0>(&m, name, types.size(), types.constData()); | - |
643 | if (i >= 0) evaluated: i >= 0 yes Evaluation Count:221348 | yes Evaluation Count:66922 |
| 66922-221348 |
644 | i += m->methodOffset(); executed: i += m->methodOffset(); Execution Count:221348 | 221348 |
645 | return i; executed: return i; Execution Count:288270 | 288270 |
646 | } | - |
647 | | - |
648 | // Parses a string of comma-separated types into QArgumentTypes. | - |
649 | // No normalization of the type names is performed. | - |
650 | static void argumentTypesFromString(const char *str, const char *end, | - |
651 | QArgumentTypeArray &types) | - |
652 | { | - |
653 | Q_ASSERT(str <= end); executed (the execution status of this line is deduced): qt_noop(); | - |
654 | while (str != end) { evaluated: str != end yes Evaluation Count:1245806 | yes Evaluation Count:1201992 |
| 1201992-1245806 |
655 | if (!types.isEmpty()) evaluated: !types.isEmpty() yes Evaluation Count:615432 | yes Evaluation Count:630374 |
| 615432-630374 |
656 | ++str; // Skip comma executed: ++str; Execution Count:615432 | 615432 |
657 | const char *begin = str; executed (the execution status of this line is deduced): const char *begin = str; | - |
658 | int level = 0; executed (the execution status of this line is deduced): int level = 0; | - |
659 | while (str != end && (level > 0 || *str != ',')) { evaluated: str != end yes Evaluation Count:10556921 | yes Evaluation Count:630363 |
evaluated: level > 0 yes Evaluation Count:583179 | yes Evaluation Count:9973882 |
evaluated: *str != ',' yes Evaluation Count:9358490 | yes Evaluation Count:615427 |
| 583179-10556921 |
660 | if (*str == '<') evaluated: *str == '<' yes Evaluation Count:40010 | yes Evaluation Count:9901510 |
| 40010-9901510 |
661 | ++level; executed: ++level; Execution Count:40010 | 40010 |
662 | else if (*str == '>') evaluated: *str == '>' yes Evaluation Count:40009 | yes Evaluation Count:9861508 |
| 40009-9861508 |
663 | --level; executed: --level; Execution Count:40009 | 40009 |
664 | ++str; executed (the execution status of this line is deduced): ++str; | - |
665 | } executed: } Execution Count:9941505 | 9941505 |
666 | types += QArgumentType(QByteArray(begin, str - begin)); executed (the execution status of this line is deduced): types += QArgumentType(QByteArray(begin, str - begin)); | - |
667 | } executed: } Execution Count:1245805 | 1245805 |
668 | } executed: } Execution Count:1201988 | 1201988 |
669 | | - |
670 | // Given a method \a signature (e.g. "foo(int,double)"), this function | - |
671 | // populates the argument \a types array and returns the method name. | - |
672 | QByteArray QMetaObjectPrivate::decodeMethodSignature( | - |
673 | const char *signature, QArgumentTypeArray &types) | - |
674 | { | - |
675 | Q_ASSERT(signature != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
676 | const char *lparens = strchr(signature, '('); executed (the execution status of this line is deduced): const char *lparens = strchr(signature, '('); | - |
677 | if (!lparens) partially evaluated: !lparens no Evaluation Count:0 | yes Evaluation Count:1201999 |
| 0-1201999 |
678 | return QByteArray(); never executed: return QByteArray(); | 0 |
679 | const char *rparens = strchr(lparens + 1, ')'); executed (the execution status of this line is deduced): const char *rparens = strchr(lparens + 1, ')'); | - |
680 | if (!rparens || *(rparens+1)) partially evaluated: !rparens no Evaluation Count:0 | yes Evaluation Count:1201995 |
evaluated: *(rparens+1) yes Evaluation Count:4 | yes Evaluation Count:1202002 |
| 0-1202002 |
681 | return QByteArray(); executed: return QByteArray(); Execution Count:4 | 4 |
682 | int nameLength = lparens - signature; executed (the execution status of this line is deduced): int nameLength = lparens - signature; | - |
683 | argumentTypesFromString(lparens + 1, rparens, types); executed (the execution status of this line is deduced): argumentTypesFromString(lparens + 1, rparens, types); | - |
684 | return QByteArray::fromRawData(signature, nameLength); executed: return QByteArray::fromRawData(signature, nameLength); Execution Count:1201991 | 1201991 |
685 | } | - |
686 | | - |
687 | /*! | - |
688 | Finds \a signal and returns its index; otherwise returns -1. | - |
689 | | - |
690 | This is the same as indexOfMethod(), except that it will return | - |
691 | -1 if the method exists but isn't a signal. | - |
692 | | - |
693 | Note that the \a signal has to be in normalized form, as returned | - |
694 | by normalizedSignature(). | - |
695 | | - |
696 | \sa indexOfMethod(), normalizedSignature(), method(), methodCount(), methodOffset() | - |
697 | */ | - |
698 | int QMetaObject::indexOfSignal(const char *signal) const | - |
699 | { | - |
700 | const QMetaObject *m = this; executed (the execution status of this line is deduced): const QMetaObject *m = this; | - |
701 | int i; executed (the execution status of this line is deduced): int i; | - |
702 | Q_ASSERT(priv(m->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
703 | QArgumentTypeArray types; executed (the execution status of this line is deduced): QArgumentTypeArray types; | - |
704 | QByteArray name = QMetaObjectPrivate::decodeMethodSignature(signal, types); executed (the execution status of this line is deduced): QByteArray name = QMetaObjectPrivate::decodeMethodSignature(signal, types); | - |
705 | i = QMetaObjectPrivate::indexOfSignalRelative(&m, name, types.size(), types.constData()); executed (the execution status of this line is deduced): i = QMetaObjectPrivate::indexOfSignalRelative(&m, name, types.size(), types.constData()); | - |
706 | if (i >= 0) evaluated: i >= 0 yes Evaluation Count:100244 | yes Evaluation Count:142 |
| 142-100244 |
707 | i += m->methodOffset(); executed: i += m->methodOffset(); Execution Count:100244 | 100244 |
708 | return i; executed: return i; Execution Count:100386 | 100386 |
709 | } | - |
710 | | - |
711 | /*! | - |
712 | \internal | - |
713 | Same as QMetaObject::indexOfSignal, but the result is the local offset to the base object. | - |
714 | | - |
715 | \a baseObject will be adjusted to the enclosing QMetaObject, or 0 if the signal is not found | - |
716 | */ | - |
717 | int QMetaObjectPrivate::indexOfSignalRelative(const QMetaObject **baseObject, | - |
718 | const QByteArray &name, int argc, | - |
719 | const QArgumentType *types) | - |
720 | { | - |
721 | int i = indexOfMethodRelative<MethodSignal>(baseObject, name, argc, types); executed (the execution status of this line is deduced): int i = indexOfMethodRelative<MethodSignal>(baseObject, name, argc, types); | - |
722 | #ifndef QT_NO_DEBUG | - |
723 | const QMetaObject *m = *baseObject; | - |
724 | if (i >= 0 && m && m->d.superdata) { | - |
725 | int conflict = indexOfMethod(m->d.superdata, name, argc, types); | - |
726 | if (conflict >= 0) { | - |
727 | QMetaMethod conflictMethod = m->d.superdata->method(conflict); | - |
728 | qWarning("QMetaObject::indexOfSignal: signal %s from %s redefined in %s", | - |
729 | conflictMethod.methodSignature().constData(), | - |
730 | rawStringData(m->d.superdata, 0), rawStringData(m, 0)); | - |
731 | } | - |
732 | } | - |
733 | #endif | - |
734 | return i; executed: return i; Execution Count:556958 | 556958 |
735 | } | - |
736 | | - |
737 | /*! | - |
738 | Finds \a slot and returns its index; otherwise returns -1. | - |
739 | | - |
740 | This is the same as indexOfMethod(), except that it will return | - |
741 | -1 if the method exists but isn't a slot. | - |
742 | | - |
743 | \sa indexOfMethod(), method(), methodCount(), methodOffset() | - |
744 | */ | - |
745 | int QMetaObject::indexOfSlot(const char *slot) const | - |
746 | { | - |
747 | const QMetaObject *m = this; executed (the execution status of this line is deduced): const QMetaObject *m = this; | - |
748 | int i; executed (the execution status of this line is deduced): int i; | - |
749 | Q_ASSERT(priv(m->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
750 | QArgumentTypeArray types; executed (the execution status of this line is deduced): QArgumentTypeArray types; | - |
751 | QByteArray name = QMetaObjectPrivate::decodeMethodSignature(slot, types); executed (the execution status of this line is deduced): QByteArray name = QMetaObjectPrivate::decodeMethodSignature(slot, types); | - |
752 | i = QMetaObjectPrivate::indexOfSlotRelative(&m, name, types.size(), types.constData()); executed (the execution status of this line is deduced): i = QMetaObjectPrivate::indexOfSlotRelative(&m, name, types.size(), types.constData()); | - |
753 | if (i >= 0) evaluated: i >= 0 yes Evaluation Count:1971 | yes Evaluation Count:4 |
| 4-1971 |
754 | i += m->methodOffset(); executed: i += m->methodOffset(); Execution Count:1971 | 1971 |
755 | return i; executed: return i; Execution Count:1975 | 1975 |
756 | } | - |
757 | | - |
758 | // same as indexOfSignalRelative but for slots. | - |
759 | int QMetaObjectPrivate::indexOfSlotRelative(const QMetaObject **m, | - |
760 | const QByteArray &name, int argc, | - |
761 | const QArgumentType *types) | - |
762 | { | - |
763 | return indexOfMethodRelative<MethodSlot>(m, name, argc, types); executed: return indexOfMethodRelative<MethodSlot>(m, name, argc, types); Execution Count:738536 | 738536 |
764 | } | - |
765 | | - |
766 | int QMetaObjectPrivate::indexOfSignal(const QMetaObject *m, const QByteArray &name, | - |
767 | int argc, const QArgumentType *types) | - |
768 | { | - |
769 | int i = indexOfSignalRelative(&m, name, argc, types); never executed (the execution status of this line is deduced): int i = indexOfSignalRelative(&m, name, argc, types); | - |
770 | if (i >= 0) | 0 |
771 | i += m->methodOffset(); never executed: i += m->methodOffset(); | 0 |
772 | return i; never executed: return i; | 0 |
773 | } | - |
774 | | - |
775 | int QMetaObjectPrivate::indexOfSlot(const QMetaObject *m, const QByteArray &name, | - |
776 | int argc, const QArgumentType *types) | - |
777 | { | - |
778 | int i = indexOfSlotRelative(&m, name, argc, types); never executed (the execution status of this line is deduced): int i = indexOfSlotRelative(&m, name, argc, types); | - |
779 | if (i >= 0) | 0 |
780 | i += m->methodOffset(); never executed: i += m->methodOffset(); | 0 |
781 | return i; never executed: return i; | 0 |
782 | } | - |
783 | | - |
784 | int QMetaObjectPrivate::indexOfMethod(const QMetaObject *m, const QByteArray &name, | - |
785 | int argc, const QArgumentType *types) | - |
786 | { | - |
787 | int i = indexOfMethodRelative<0>(&m, name, argc, types); executed (the execution status of this line is deduced): int i = indexOfMethodRelative<0>(&m, name, argc, types); | - |
788 | if (i >= 0) evaluated: i >= 0 yes Evaluation Count:23440 | yes Evaluation Count:23008 |
| 23008-23440 |
789 | i += m->methodOffset(); executed: i += m->methodOffset(); Execution Count:23440 | 23440 |
790 | return i; executed: return i; Execution Count:46448 | 46448 |
791 | } | - |
792 | | - |
793 | int QMetaObjectPrivate::indexOfConstructor(const QMetaObject *m, const QByteArray &name, | - |
794 | int argc, const QArgumentType *types) | - |
795 | { | - |
796 | for (int i = priv(m->d.data)->constructorCount-1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:51 | yes Evaluation Count:2 |
| 2-51 |
797 | int handle = priv(m->d.data)->constructorData + 5*i; executed (the execution status of this line is deduced): int handle = priv(m->d.data)->constructorData + 5*i; | - |
798 | if (methodMatch(m, handle, name, argc, types)) evaluated: methodMatch(m, handle, name, argc, types) yes Evaluation Count:14 | yes Evaluation Count:37 |
| 14-37 |
799 | return i; executed: return i; Execution Count:14 | 14 |
800 | } executed: } Execution Count:37 | 37 |
801 | return -1; executed: return -1; Execution Count:2 | 2 |
802 | } | - |
803 | | - |
804 | /*! | - |
805 | \internal | - |
806 | \since 5.0 | - |
807 | | - |
808 | Returns the signal offset for the class \a m; i.e., the index position | - |
809 | of the class's first signal. | - |
810 | | - |
811 | Similar to QMetaObject::methodOffset(), but non-signal methods are | - |
812 | excluded. | - |
813 | */ | - |
814 | int QMetaObjectPrivate::signalOffset(const QMetaObject *m) | - |
815 | { | - |
816 | Q_ASSERT(m != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
817 | int offset = 0; executed (the execution status of this line is deduced): int offset = 0; | - |
818 | for (m = m->d.superdata; m; m = m->d.superdata) evaluated: m yes Evaluation Count:29400047 | yes Evaluation Count:21889642 |
| 21889642-29400047 |
819 | offset += priv(m->d.data)->signalCount; executed: offset += priv(m->d.data)->signalCount; Execution Count:29400047 | 29400047 |
820 | return offset; executed: return offset; Execution Count:21889669 | 21889669 |
821 | } | - |
822 | | - |
823 | /*! | - |
824 | \internal | - |
825 | \since 5.0 | - |
826 | | - |
827 | Returns the number of signals for the class \a m, including the signals | - |
828 | for the base class. | - |
829 | | - |
830 | Similar to QMetaObject::methodCount(), but non-signal methods are | - |
831 | excluded. | - |
832 | */ | - |
833 | int QMetaObjectPrivate::absoluteSignalCount(const QMetaObject *m) | - |
834 | { | - |
835 | Q_ASSERT(m != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
836 | int n = priv(m->d.data)->signalCount; executed (the execution status of this line is deduced): int n = priv(m->d.data)->signalCount; | - |
837 | for (m = m->d.superdata; m; m = m->d.superdata) evaluated: m yes Evaluation Count:9 | yes Evaluation Count:10 |
| 9-10 |
838 | n += priv(m->d.data)->signalCount; executed: n += priv(m->d.data)->signalCount; Execution Count:9 | 9 |
839 | return n; executed: return n; Execution Count:10 | 10 |
840 | } | - |
841 | | - |
842 | /*! | - |
843 | \internal | - |
844 | \since 5.0 | - |
845 | | - |
846 | Returns the index of the signal method \a m. | - |
847 | | - |
848 | Similar to QMetaMethod::methodIndex(), but non-signal methods are | - |
849 | excluded. | - |
850 | */ | - |
851 | int QMetaObjectPrivate::signalIndex(const QMetaMethod &m) | - |
852 | { | - |
853 | if (!m.mobj) partially evaluated: !m.mobj no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
854 | return -1; never executed: return -1; | 0 |
855 | return QMetaMethodPrivate::get(&m)->ownMethodIndex() + signalOffset(m.mobj); executed: return QMetaMethodPrivate::get(&m)->ownMethodIndex() + signalOffset(m.mobj); Execution Count:14 | 14 |
856 | } | - |
857 | | - |
858 | /*! | - |
859 | \internal | - |
860 | \since 5.0 | - |
861 | | - |
862 | Returns the signal for the given meta-object \a m at \a signal_index. | - |
863 | | - |
864 | It it different from QMetaObject::method(); the index should not include | - |
865 | non-signal methods. | - |
866 | */ | - |
867 | QMetaMethod QMetaObjectPrivate::signal(const QMetaObject *m, int signal_index) | - |
868 | { | - |
869 | QMetaMethod result; executed (the execution status of this line is deduced): QMetaMethod result; | - |
870 | if (signal_index < 0) evaluated: signal_index < 0 yes Evaluation Count:1814 | yes Evaluation Count:869032 |
| 1814-869032 |
871 | return result; executed: return result; Execution Count:1814 | 1814 |
872 | Q_ASSERT(m != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
873 | int i = signal_index; executed (the execution status of this line is deduced): int i = signal_index; | - |
874 | i -= signalOffset(m); executed (the execution status of this line is deduced): i -= signalOffset(m); | - |
875 | if (i < 0 && m->d.superdata) evaluated: i < 0 yes Evaluation Count:120458 | yes Evaluation Count:748568 |
partially evaluated: m->d.superdata yes Evaluation Count:120458 | no Evaluation Count:0 |
| 0-748568 |
876 | return signal(m->d.superdata, signal_index); executed: return signal(m->d.superdata, signal_index); Execution Count:120458 | 120458 |
877 | | - |
878 | if (i >= 0 && i < priv(m->d.data)->signalCount) { partially evaluated: i >= 0 yes Evaluation Count:748568 | no Evaluation Count:0 |
evaluated: i < priv(m->d.data)->signalCount yes Evaluation Count:748266 | yes Evaluation Count:298 |
| 0-748568 |
879 | result.mobj = m; executed (the execution status of this line is deduced): result.mobj = m; | - |
880 | result.handle = priv(m->d.data)->methodData + 5*i; executed (the execution status of this line is deduced): result.handle = priv(m->d.data)->methodData + 5*i; | - |
881 | } executed: } Execution Count:748266 | 748266 |
882 | return result; executed: return result; Execution Count:748564 | 748564 |
883 | } | - |
884 | | - |
885 | /*! | - |
886 | \internal | - |
887 | | - |
888 | Returns true if the \a signalTypes and \a methodTypes are | - |
889 | compatible; otherwise returns false. | - |
890 | */ | - |
891 | bool QMetaObjectPrivate::checkConnectArgs(int signalArgc, const QArgumentType *signalTypes, | - |
892 | int methodArgc, const QArgumentType *methodTypes) | - |
893 | { | - |
894 | if (signalArgc < methodArgc) partially evaluated: signalArgc < methodArgc no Evaluation Count:0 | yes Evaluation Count:380473 |
| 0-380473 |
895 | return false; never executed: return false; | 0 |
896 | for (int i = 0; i < methodArgc; ++i) { evaluated: i < methodArgc yes Evaluation Count:419729 | yes Evaluation Count:380474 |
| 380474-419729 |
897 | if (signalTypes[i] != methodTypes[i]) evaluated: signalTypes[i] != methodTypes[i] yes Evaluation Count:1 | yes Evaluation Count:419728 |
| 1-419728 |
898 | return false; executed: return false; Execution Count:1 | 1 |
899 | } executed: } Execution Count:419728 | 419728 |
900 | return true; executed: return true; Execution Count:380473 | 380473 |
901 | } | - |
902 | | - |
903 | /*! | - |
904 | \internal | - |
905 | | - |
906 | Returns true if the \a signal and \a method arguments are | - |
907 | compatible; otherwise returns false. | - |
908 | */ | - |
909 | bool QMetaObjectPrivate::checkConnectArgs(const QMetaMethodPrivate *signal, | - |
910 | const QMetaMethodPrivate *method) | - |
911 | { | - |
912 | if (signal->methodType() != QMetaMethod::Signal) never evaluated: signal->methodType() != QMetaMethod::Signal | 0 |
913 | return false; never executed: return false; | 0 |
914 | if (signal->parameterCount() < method->parameterCount()) never evaluated: signal->parameterCount() < method->parameterCount() | 0 |
915 | return false; never executed: return false; | 0 |
916 | const QMetaObject *smeta = signal->enclosingMetaObject(); never executed (the execution status of this line is deduced): const QMetaObject *smeta = signal->enclosingMetaObject(); | - |
917 | const QMetaObject *rmeta = method->enclosingMetaObject(); never executed (the execution status of this line is deduced): const QMetaObject *rmeta = method->enclosingMetaObject(); | - |
918 | for (int i = 0; i < method->parameterCount(); ++i) { never evaluated: i < method->parameterCount() | 0 |
919 | uint sourceTypeInfo = signal->parameterTypeInfo(i); never executed (the execution status of this line is deduced): uint sourceTypeInfo = signal->parameterTypeInfo(i); | - |
920 | uint targetTypeInfo = method->parameterTypeInfo(i); never executed (the execution status of this line is deduced): uint targetTypeInfo = method->parameterTypeInfo(i); | - |
921 | if ((sourceTypeInfo & IsUnresolvedType) never evaluated: (sourceTypeInfo & IsUnresolvedType) | 0 |
922 | || (targetTypeInfo & IsUnresolvedType)) { never evaluated: (targetTypeInfo & IsUnresolvedType) | 0 |
923 | QByteArray sourceName = typeNameFromTypeInfo(smeta, sourceTypeInfo); never executed (the execution status of this line is deduced): QByteArray sourceName = typeNameFromTypeInfo(smeta, sourceTypeInfo); | - |
924 | QByteArray targetName = typeNameFromTypeInfo(rmeta, targetTypeInfo); never executed (the execution status of this line is deduced): QByteArray targetName = typeNameFromTypeInfo(rmeta, targetTypeInfo); | - |
925 | if (sourceName != targetName) never evaluated: sourceName != targetName | 0 |
926 | return false; never executed: return false; | 0 |
927 | } else { | 0 |
928 | int sourceType = typeFromTypeInfo(smeta, sourceTypeInfo); never executed (the execution status of this line is deduced): int sourceType = typeFromTypeInfo(smeta, sourceTypeInfo); | - |
929 | int targetType = typeFromTypeInfo(rmeta, targetTypeInfo); never executed (the execution status of this line is deduced): int targetType = typeFromTypeInfo(rmeta, targetTypeInfo); | - |
930 | if (sourceType != targetType) never evaluated: sourceType != targetType | 0 |
931 | return false; never executed: return false; | 0 |
932 | } | 0 |
933 | } | - |
934 | return true; never executed: return true; | 0 |
935 | } | - |
936 | | - |
937 | static const QMetaObject *QMetaObject_findMetaObject(const QMetaObject *self, const char *name) | - |
938 | { | - |
939 | while (self) { partially evaluated: self yes Evaluation Count:86 | no Evaluation Count:0 |
| 0-86 |
940 | if (strcmp(rawStringData(self, 0), name) == 0) evaluated: strcmp(rawStringData(self, 0), name) == 0 yes Evaluation Count:80 | yes Evaluation Count:6 |
| 6-80 |
941 | return self; executed: return self; Execution Count:80 | 80 |
942 | if (self->d.relatedMetaObjects) { partially evaluated: self->d.relatedMetaObjects yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
943 | Q_ASSERT(priv(self->d.data)->revision >= 2); executed (the execution status of this line is deduced): qt_noop(); | - |
944 | const QMetaObject **e = self->d.relatedMetaObjects; executed (the execution status of this line is deduced): const QMetaObject **e = self->d.relatedMetaObjects; | - |
945 | if (e) { partially evaluated: e yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
946 | while (*e) { partially evaluated: *e yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
947 | if (const QMetaObject *m =QMetaObject_findMetaObject((*e), name)) partially evaluated: const QMetaObject *m =QMetaObject_findMetaObject((*e), name) yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
948 | return m; executed: return m; Execution Count:6 | 6 |
949 | ++e; never executed (the execution status of this line is deduced): ++e; | - |
950 | } | 0 |
951 | } | 0 |
952 | } | 0 |
953 | self = self->d.superdata; never executed (the execution status of this line is deduced): self = self->d.superdata; | - |
954 | } | 0 |
955 | return self; never executed: return self; | 0 |
956 | } | - |
957 | | - |
958 | /*! | - |
959 | Finds enumerator \a name and returns its index; otherwise returns | - |
960 | -1. | - |
961 | | - |
962 | \sa enumerator(), enumeratorCount(), enumeratorOffset() | - |
963 | */ | - |
964 | int QMetaObject::indexOfEnumerator(const char *name) const | - |
965 | { | - |
966 | const QMetaObject *m = this; executed (the execution status of this line is deduced): const QMetaObject *m = this; | - |
967 | while (m) { evaluated: m yes Evaluation Count:3736 | yes Evaluation Count:600 |
| 600-3736 |
968 | const QMetaObjectPrivate *d = priv(m->d.data); executed (the execution status of this line is deduced): const QMetaObjectPrivate *d = priv(m->d.data); | - |
969 | for (int i = d->enumeratorCount - 1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:15673 | yes Evaluation Count:1734 |
| 1734-15673 |
970 | const char *prop = rawStringData(m, m->d.data[d->enumeratorData + 4*i]); executed (the execution status of this line is deduced): const char *prop = rawStringData(m, m->d.data[d->enumeratorData + 4*i]); | - |
971 | if (name[0] == prop[0] && strcmp(name + 1, prop + 1) == 0) { evaluated: name[0] == prop[0] yes Evaluation Count:2900 | yes Evaluation Count:12773 |
evaluated: strcmp(name + 1, prop + 1) == 0 yes Evaluation Count:2002 | yes Evaluation Count:898 |
| 898-12773 |
972 | i += m->enumeratorOffset(); executed (the execution status of this line is deduced): i += m->enumeratorOffset(); | - |
973 | return i; executed: return i; Execution Count:2002 | 2002 |
974 | } | - |
975 | } executed: } Execution Count:13671 | 13671 |
976 | m = m->d.superdata; executed (the execution status of this line is deduced): m = m->d.superdata; | - |
977 | } executed: } Execution Count:1734 | 1734 |
978 | return -1; executed: return -1; Execution Count:600 | 600 |
979 | } | - |
980 | | - |
981 | /*! | - |
982 | Finds property \a name and returns its index; otherwise returns | - |
983 | -1. | - |
984 | | - |
985 | \sa property(), propertyCount(), propertyOffset() | - |
986 | */ | - |
987 | int QMetaObject::indexOfProperty(const char *name) const | - |
988 | { | - |
989 | const QMetaObject *m = this; executed (the execution status of this line is deduced): const QMetaObject *m = this; | - |
990 | while (m) { evaluated: m yes Evaluation Count:99793 | yes Evaluation Count:24386 |
| 24386-99793 |
991 | const QMetaObjectPrivate *d = priv(m->d.data); executed (the execution status of this line is deduced): const QMetaObjectPrivate *d = priv(m->d.data); | - |
992 | for (int i = d->propertyCount-1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:1115498 | yes Evaluation Count:89954 |
| 89954-1115498 |
993 | const char *prop = rawStringData(m, m->d.data[d->propertyData + 3*i]); executed (the execution status of this line is deduced): const char *prop = rawStringData(m, m->d.data[d->propertyData + 3*i]); | - |
994 | if (name[0] == prop[0] && strcmp(name + 1, prop + 1) == 0) { evaluated: name[0] == prop[0] yes Evaluation Count:17288 | yes Evaluation Count:1098210 |
evaluated: strcmp(name + 1, prop + 1) == 0 yes Evaluation Count:9839 | yes Evaluation Count:7449 |
| 7449-1098210 |
995 | i += m->propertyOffset(); executed (the execution status of this line is deduced): i += m->propertyOffset(); | - |
996 | return i; executed: return i; Execution Count:9839 | 9839 |
997 | } | - |
998 | } executed: } Execution Count:1105659 | 1105659 |
999 | m = m->d.superdata; executed (the execution status of this line is deduced): m = m->d.superdata; | - |
1000 | } executed: } Execution Count:89954 | 89954 |
1001 | | - |
1002 | Q_ASSERT(priv(this->d.data)->revision >= 3); executed (the execution status of this line is deduced): qt_noop(); | - |
1003 | if (priv(this->d.data)->flags & DynamicMetaObject) { partially evaluated: priv(this->d.data)->flags & DynamicMetaObject no Evaluation Count:0 | yes Evaluation Count:24386 |
| 0-24386 |
1004 | QAbstractDynamicMetaObject *me = never executed (the execution status of this line is deduced): QAbstractDynamicMetaObject *me = | - |
1005 | const_cast<QAbstractDynamicMetaObject *>(static_cast<const QAbstractDynamicMetaObject *>(this)); never executed (the execution status of this line is deduced): const_cast<QAbstractDynamicMetaObject *>(static_cast<const QAbstractDynamicMetaObject *>(this)); | - |
1006 | | - |
1007 | return me->createProperty(name, 0); never executed: return me->createProperty(name, 0); | 0 |
1008 | } | - |
1009 | | - |
1010 | return -1; executed: return -1; Execution Count:24386 | 24386 |
1011 | } | - |
1012 | | - |
1013 | /*! | - |
1014 | Finds class information item \a name and returns its index; | - |
1015 | otherwise returns -1. | - |
1016 | | - |
1017 | \sa classInfo(), classInfoCount(), classInfoOffset() | - |
1018 | */ | - |
1019 | int QMetaObject::indexOfClassInfo(const char *name) const | - |
1020 | { | - |
1021 | int i = -1; executed (the execution status of this line is deduced): int i = -1; | - |
1022 | const QMetaObject *m = this; executed (the execution status of this line is deduced): const QMetaObject *m = this; | - |
1023 | while (m && i < 0) { evaluated: m yes Evaluation Count:1036 | yes Evaluation Count:121 |
evaluated: i < 0 yes Evaluation Count:666 | yes Evaluation Count:370 |
| 121-1036 |
1024 | for (i = priv(m->d.data)->classInfoCount-1; i >= 0; --i) evaluated: i >= 0 yes Evaluation Count:444 | yes Evaluation Count:296 |
| 296-444 |
1025 | if (strcmp(name, rawStringData(m, m->d.data[priv(m->d.data)->classInfoData + 2*i])) == 0) { evaluated: strcmp(name, rawStringData(m, m->d.data[priv(m->d.data)->classInfoData + 2*i])) == 0 yes Evaluation Count:370 | yes Evaluation Count:74 |
| 74-370 |
1026 | i += m->classInfoOffset(); executed (the execution status of this line is deduced): i += m->classInfoOffset(); | - |
1027 | break; executed: break; Execution Count:370 | 370 |
1028 | } | - |
1029 | m = m->d.superdata; executed (the execution status of this line is deduced): m = m->d.superdata; | - |
1030 | } executed: } Execution Count:666 | 666 |
1031 | return i; executed: return i; Execution Count:491 | 491 |
1032 | } | - |
1033 | | - |
1034 | /*! | - |
1035 | \since 4.5 | - |
1036 | | - |
1037 | Returns the meta-data for the constructor with the given \a index. | - |
1038 | | - |
1039 | \sa constructorCount(), newInstance() | - |
1040 | */ | - |
1041 | QMetaMethod QMetaObject::constructor(int index) const | - |
1042 | { | - |
1043 | int i = index; executed (the execution status of this line is deduced): int i = index; | - |
1044 | QMetaMethod result; executed (the execution status of this line is deduced): QMetaMethod result; | - |
1045 | Q_ASSERT(priv(d.data)->revision >= 2); executed (the execution status of this line is deduced): qt_noop(); | - |
1046 | if (i >= 0 && i < priv(d.data)->constructorCount) { partially evaluated: i >= 0 yes Evaluation Count:102 | no Evaluation Count:0 |
partially evaluated: i < priv(d.data)->constructorCount yes Evaluation Count:102 | no Evaluation Count:0 |
| 0-102 |
1047 | result.mobj = this; executed (the execution status of this line is deduced): result.mobj = this; | - |
1048 | result.handle = priv(d.data)->constructorData + 5*i; executed (the execution status of this line is deduced): result.handle = priv(d.data)->constructorData + 5*i; | - |
1049 | } executed: } Execution Count:102 | 102 |
1050 | return result; executed: return result; Execution Count:102 | 102 |
1051 | } | - |
1052 | | - |
1053 | /*! | - |
1054 | Returns the meta-data for the method with the given \a index. | - |
1055 | | - |
1056 | \sa methodCount(), methodOffset(), indexOfMethod() | - |
1057 | */ | - |
1058 | QMetaMethod QMetaObject::method(int index) const | - |
1059 | { | - |
1060 | int i = index; executed (the execution status of this line is deduced): int i = index; | - |
1061 | i -= methodOffset(); executed (the execution status of this line is deduced): i -= methodOffset(); | - |
1062 | if (i < 0 && d.superdata) evaluated: i < 0 yes Evaluation Count:128554 | yes Evaluation Count:368980 |
evaluated: d.superdata yes Evaluation Count:128551 | yes Evaluation Count:3 |
| 3-368980 |
1063 | return d.superdata->method(index); executed: return d.superdata->method(index); Execution Count:128551 | 128551 |
1064 | | - |
1065 | QMetaMethod result; executed (the execution status of this line is deduced): QMetaMethod result; | - |
1066 | if (i >= 0 && i < priv(d.data)->methodCount) { evaluated: i >= 0 yes Evaluation Count:368980 | yes Evaluation Count:3 |
evaluated: i < priv(d.data)->methodCount yes Evaluation Count:368975 | yes Evaluation Count:4 |
| 3-368980 |
1067 | result.mobj = this; executed (the execution status of this line is deduced): result.mobj = this; | - |
1068 | result.handle = priv(d.data)->methodData + 5*i; executed (the execution status of this line is deduced): result.handle = priv(d.data)->methodData + 5*i; | - |
1069 | } executed: } Execution Count:368975 | 368975 |
1070 | return result; executed: return result; Execution Count:368982 | 368982 |
1071 | } | - |
1072 | | - |
1073 | /*! | - |
1074 | Returns the meta-data for the enumerator with the given \a index. | - |
1075 | | - |
1076 | \sa enumeratorCount(), enumeratorOffset(), indexOfEnumerator() | - |
1077 | */ | - |
1078 | QMetaEnum QMetaObject::enumerator(int index) const | - |
1079 | { | - |
1080 | int i = index; executed (the execution status of this line is deduced): int i = index; | - |
1081 | i -= enumeratorOffset(); executed (the execution status of this line is deduced): i -= enumeratorOffset(); | - |
1082 | if (i < 0 && d.superdata) evaluated: i < 0 yes Evaluation Count:1730 | yes Evaluation Count:2015 |
evaluated: d.superdata yes Evaluation Count:1132 | yes Evaluation Count:598 |
| 598-2015 |
1083 | return d.superdata->enumerator(index); executed: return d.superdata->enumerator(index); Execution Count:1132 | 1132 |
1084 | | - |
1085 | QMetaEnum result; executed (the execution status of this line is deduced): QMetaEnum result; | - |
1086 | if (i >= 0 && i < priv(d.data)->enumeratorCount) { evaluated: i >= 0 yes Evaluation Count:2015 | yes Evaluation Count:598 |
partially evaluated: i < priv(d.data)->enumeratorCount yes Evaluation Count:2015 | no Evaluation Count:0 |
| 0-2015 |
1087 | result.mobj = this; executed (the execution status of this line is deduced): result.mobj = this; | - |
1088 | result.handle = priv(d.data)->enumeratorData + 4*i; executed (the execution status of this line is deduced): result.handle = priv(d.data)->enumeratorData + 4*i; | - |
1089 | } executed: } Execution Count:2015 | 2015 |
1090 | return result; executed: return result; Execution Count:2613 | 2613 |
1091 | } | - |
1092 | | - |
1093 | /*! | - |
1094 | Returns the meta-data for the property with the given \a index. | - |
1095 | If no such property exists, a null QMetaProperty is returned. | - |
1096 | | - |
1097 | \sa propertyCount(), propertyOffset(), indexOfProperty() | - |
1098 | */ | - |
1099 | QMetaProperty QMetaObject::property(int index) const | - |
1100 | { | - |
1101 | int i = index; executed (the execution status of this line is deduced): int i = index; | - |
1102 | i -= propertyOffset(); executed (the execution status of this line is deduced): i -= propertyOffset(); | - |
1103 | if (i < 0 && d.superdata) evaluated: i < 0 yes Evaluation Count:14459 | yes Evaluation Count:13968 |
partially evaluated: d.superdata yes Evaluation Count:14459 | no Evaluation Count:0 |
| 0-14459 |
1104 | return d.superdata->property(index); executed: return d.superdata->property(index); Execution Count:14459 | 14459 |
1105 | | - |
1106 | QMetaProperty result; executed (the execution status of this line is deduced): QMetaProperty result; | - |
1107 | if (i >= 0 && i < priv(d.data)->propertyCount) { partially evaluated: i >= 0 yes Evaluation Count:13968 | no Evaluation Count:0 |
partially evaluated: i < priv(d.data)->propertyCount yes Evaluation Count:13968 | no Evaluation Count:0 |
| 0-13968 |
1108 | int handle = priv(d.data)->propertyData + 3*i; executed (the execution status of this line is deduced): int handle = priv(d.data)->propertyData + 3*i; | - |
1109 | int flags = d.data[handle + 2]; executed (the execution status of this line is deduced): int flags = d.data[handle + 2]; | - |
1110 | result.mobj = this; executed (the execution status of this line is deduced): result.mobj = this; | - |
1111 | result.handle = handle; executed (the execution status of this line is deduced): result.handle = handle; | - |
1112 | result.idx = i; executed (the execution status of this line is deduced): result.idx = i; | - |
1113 | | - |
1114 | if (flags & EnumOrFlag) { evaluated: flags & EnumOrFlag yes Evaluation Count:780 | yes Evaluation Count:13188 |
| 780-13188 |
1115 | const char *type = rawTypeNameFromTypeInfo(this, d.data[handle + 1]); executed (the execution status of this line is deduced): const char *type = rawTypeNameFromTypeInfo(this, d.data[handle + 1]); | - |
1116 | result.menum = enumerator(indexOfEnumerator(type)); executed (the execution status of this line is deduced): result.menum = enumerator(indexOfEnumerator(type)); | - |
1117 | if (!result.menum.isValid()) { evaluated: !result.menum.isValid() yes Evaluation Count:524 | yes Evaluation Count:256 |
| 256-524 |
1118 | const char *enum_name = type; executed (the execution status of this line is deduced): const char *enum_name = type; | - |
1119 | const char *scope_name = rawStringData(this, 0); executed (the execution status of this line is deduced): const char *scope_name = rawStringData(this, 0); | - |
1120 | char *scope_buffer = 0; executed (the execution status of this line is deduced): char *scope_buffer = 0; | - |
1121 | | - |
1122 | const char *colon = strrchr(enum_name, ':'); executed (the execution status of this line is deduced): const char *colon = strrchr(enum_name, ':'); | - |
1123 | // ':' will always appear in pairs | - |
1124 | Q_ASSERT(colon <= enum_name || *(colon-1) == ':'); executed (the execution status of this line is deduced): qt_noop(); | - |
1125 | if (colon > enum_name) { evaluated: colon > enum_name yes Evaluation Count:450 | yes Evaluation Count:74 |
| 74-450 |
1126 | int len = colon-enum_name-1; executed (the execution status of this line is deduced): int len = colon-enum_name-1; | - |
1127 | scope_buffer = (char *)malloc(len+1); executed (the execution status of this line is deduced): scope_buffer = (char *)malloc(len+1); | - |
1128 | memcpy(scope_buffer, enum_name, len); executed (the execution status of this line is deduced): memcpy(scope_buffer, enum_name, len); | - |
1129 | scope_buffer[len] = '\0'; executed (the execution status of this line is deduced): scope_buffer[len] = '\0'; | - |
1130 | scope_name = scope_buffer; executed (the execution status of this line is deduced): scope_name = scope_buffer; | - |
1131 | enum_name = colon+1; executed (the execution status of this line is deduced): enum_name = colon+1; | - |
1132 | } executed: } Execution Count:450 | 450 |
1133 | | - |
1134 | const QMetaObject *scope = 0; executed (the execution status of this line is deduced): const QMetaObject *scope = 0; | - |
1135 | if (qstrcmp(scope_name, "Qt") == 0) evaluated: qstrcmp(scope_name, "Qt") == 0 yes Evaluation Count:444 | yes Evaluation Count:80 |
| 80-444 |
1136 | scope = &QObject::staticQtMetaObject; executed: scope = &QObject::staticQtMetaObject; Execution Count:444 | 444 |
1137 | else | - |
1138 | scope = QMetaObject_findMetaObject(this, scope_name); executed: scope = QMetaObject_findMetaObject(this, scope_name); Execution Count:80 | 80 |
1139 | if (scope) partially evaluated: scope yes Evaluation Count:524 | no Evaluation Count:0 |
| 0-524 |
1140 | result.menum = scope->enumerator(scope->indexOfEnumerator(enum_name)); executed: result.menum = scope->enumerator(scope->indexOfEnumerator(enum_name)); Execution Count:524 | 524 |
1141 | if (scope_buffer) evaluated: scope_buffer yes Evaluation Count:450 | yes Evaluation Count:74 |
| 74-450 |
1142 | free(scope_buffer); executed: free(scope_buffer); Execution Count:450 | 450 |
1143 | } executed: } Execution Count:524 | 524 |
1144 | } executed: } Execution Count:780 | 780 |
1145 | } executed: } Execution Count:13968 | 13968 |
1146 | return result; executed: return result; Execution Count:13968 | 13968 |
1147 | } | - |
1148 | | - |
1149 | /*! | - |
1150 | \since 4.2 | - |
1151 | | - |
1152 | Returns the property that has the \c USER flag set to true. | - |
1153 | | - |
1154 | \sa QMetaProperty::isUser() | - |
1155 | */ | - |
1156 | QMetaProperty QMetaObject::userProperty() const | - |
1157 | { | - |
1158 | const int propCount = propertyCount(); executed (the execution status of this line is deduced): const int propCount = propertyCount(); | - |
1159 | for (int i = propCount - 1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:3834 | yes Evaluation Count:3 |
| 3-3834 |
1160 | const QMetaProperty prop = property(i); executed (the execution status of this line is deduced): const QMetaProperty prop = property(i); | - |
1161 | if (prop.isUser()) evaluated: prop.isUser() yes Evaluation Count:248 | yes Evaluation Count:3586 |
| 248-3586 |
1162 | return prop; executed: return prop; Execution Count:248 | 248 |
1163 | } executed: } Execution Count:3586 | 3586 |
1164 | return QMetaProperty(); executed: return QMetaProperty(); Execution Count:3 | 3 |
1165 | } | - |
1166 | | - |
1167 | /*! | - |
1168 | Returns the meta-data for the item of class information with the | - |
1169 | given \a index. | - |
1170 | | - |
1171 | Example: | - |
1172 | | - |
1173 | \snippet code/src_corelib_kernel_qmetaobject.cpp 0 | - |
1174 | | - |
1175 | \sa classInfoCount(), classInfoOffset(), indexOfClassInfo() | - |
1176 | */ | - |
1177 | QMetaClassInfo QMetaObject::classInfo(int index) const | - |
1178 | { | - |
1179 | int i = index; executed (the execution status of this line is deduced): int i = index; | - |
1180 | i -= classInfoOffset(); executed (the execution status of this line is deduced): i -= classInfoOffset(); | - |
1181 | if (i < 0 && d.superdata) evaluated: i < 0 yes Evaluation Count:1 | yes Evaluation Count:389 |
partially evaluated: d.superdata yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-389 |
1182 | return d.superdata->classInfo(index); executed: return d.superdata->classInfo(index); Execution Count:1 | 1 |
1183 | | - |
1184 | QMetaClassInfo result; executed (the execution status of this line is deduced): QMetaClassInfo result; | - |
1185 | if (i >= 0 && i < priv(d.data)->classInfoCount) { partially evaluated: i >= 0 yes Evaluation Count:389 | no Evaluation Count:0 |
partially evaluated: i < priv(d.data)->classInfoCount yes Evaluation Count:389 | no Evaluation Count:0 |
| 0-389 |
1186 | result.mobj = this; executed (the execution status of this line is deduced): result.mobj = this; | - |
1187 | result.handle = priv(d.data)->classInfoData + 2*i; executed (the execution status of this line is deduced): result.handle = priv(d.data)->classInfoData + 2*i; | - |
1188 | } executed: } Execution Count:389 | 389 |
1189 | return result; executed: return result; Execution Count:389 | 389 |
1190 | } | - |
1191 | | - |
1192 | /*! | - |
1193 | Returns true if the \a signal and \a method arguments are | - |
1194 | compatible; otherwise returns false. | - |
1195 | | - |
1196 | Both \a signal and \a method are expected to be normalized. | - |
1197 | | - |
1198 | \sa normalizedSignature() | - |
1199 | */ | - |
1200 | bool QMetaObject::checkConnectArgs(const char *signal, const char *method) | - |
1201 | { | - |
1202 | const char *s1 = signal; executed (the execution status of this line is deduced): const char *s1 = signal; | - |
1203 | const char *s2 = method; executed (the execution status of this line is deduced): const char *s2 = method; | - |
1204 | while (*s1++ != '(') { } // scan to first '(' executed: } Execution Count:161 evaluated: *s1++ != '(' yes Evaluation Count:161 | yes Evaluation Count:23 |
| 23-161 |
1205 | while (*s2++ != '(') { } executed: } Execution Count:115 evaluated: *s2++ != '(' yes Evaluation Count:115 | yes Evaluation Count:23 |
| 23-115 |
1206 | if (*s2 == ')' || qstrcmp(s1,s2) == 0) // method has no args or partially evaluated: *s2 == ')' yes Evaluation Count:23 | no Evaluation Count:0 |
never evaluated: qstrcmp(s1,s2) == 0 | 0-23 |
1207 | return true; // exact match executed: return true; Execution Count:23 | 23 |
1208 | int s1len = qstrlen(s1); never executed (the execution status of this line is deduced): int s1len = qstrlen(s1); | - |
1209 | int s2len = qstrlen(s2); never executed (the execution status of this line is deduced): int s2len = qstrlen(s2); | - |
1210 | if (s2len < s1len && strncmp(s1,s2,s2len-1)==0 && s1[s2len-1]==',') never evaluated: s2len < s1len never evaluated: strncmp(s1,s2,s2len-1)==0 never evaluated: s1[s2len-1]==',' | 0 |
1211 | return true; // method has less args never executed: return true; | 0 |
1212 | return false; never executed: return false; | 0 |
1213 | } | - |
1214 | | - |
1215 | /*! | - |
1216 | \since 5.0 | - |
1217 | \overload | - |
1218 | | - |
1219 | Returns true if the \a signal and \a method arguments are | - |
1220 | compatible; otherwise returns false. | - |
1221 | */ | - |
1222 | bool QMetaObject::checkConnectArgs(const QMetaMethod &signal, | - |
1223 | const QMetaMethod &method) | - |
1224 | { | - |
1225 | return QMetaObjectPrivate::checkConnectArgs( never executed: return QMetaObjectPrivate::checkConnectArgs( QMetaMethodPrivate::get(&signal), QMetaMethodPrivate::get(&method)); | 0 |
1226 | QMetaMethodPrivate::get(&signal), never executed: return QMetaObjectPrivate::checkConnectArgs( QMetaMethodPrivate::get(&signal), QMetaMethodPrivate::get(&method)); | 0 |
1227 | QMetaMethodPrivate::get(&method)); never executed: return QMetaObjectPrivate::checkConnectArgs( QMetaMethodPrivate::get(&signal), QMetaMethodPrivate::get(&method)); | 0 |
1228 | } | - |
1229 | | - |
1230 | static void qRemoveWhitespace(const char *s, char *d) | - |
1231 | { | - |
1232 | char last = 0; executed (the execution status of this line is deduced): char last = 0; | - |
1233 | while (*s && is_space(*s)) partially evaluated: *s yes Evaluation Count:454325 | no Evaluation Count:0 |
evaluated: is_space(*s) yes Evaluation Count:10 | yes Evaluation Count:454316 |
| 0-454325 |
1234 | s++; executed: s++; Execution Count:10 | 10 |
1235 | while (*s) { evaluated: *s yes Evaluation Count:456311 | yes Evaluation Count:454304 |
| 454304-456311 |
1236 | while (*s && !is_space(*s)) evaluated: *s yes Evaluation Count:12877919 | yes Evaluation Count:454292 |
evaluated: !is_space(*s) yes Evaluation Count:12875921 | yes Evaluation Count:2001 |
| 2001-12877919 |
1237 | last = *d++ = *s++; executed: last = *d++ = *s++; Execution Count:12875923 | 12875923 |
1238 | while (*s && is_space(*s)) evaluated: *s yes Evaluation Count:3998 | yes Evaluation Count:454302 |
evaluated: is_space(*s) yes Evaluation Count:2008 | yes Evaluation Count:1990 |
| 1990-454302 |
1239 | s++; executed: s++; Execution Count:2008 | 2008 |
1240 | if (*s && ((is_ident_char(*s) && is_ident_char(last)) evaluated: *s yes Evaluation Count:1990 | yes Evaluation Count:454305 |
evaluated: is_ident_char(*s) yes Evaluation Count:696 | yes Evaluation Count:1294 |
evaluated: is_ident_char(last) yes Evaluation Count:547 | yes Evaluation Count:149 |
| 149-454305 |
1241 | || ((*s == ':') && (last == '<')))) { evaluated: (*s == ':') yes Evaluation Count:1 | yes Evaluation Count:1442 |
partially evaluated: (last == '<') yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1442 |
1242 | last = *d++ = ' '; executed (the execution status of this line is deduced): last = *d++ = ' '; | - |
1243 | } executed: } Execution Count:548 | 548 |
1244 | } executed: } Execution Count:456296 | 456296 |
1245 | *d = '\0'; executed (the execution status of this line is deduced): *d = '\0'; | - |
1246 | } executed: } Execution Count:454304 | 454304 |
1247 | | - |
1248 | static char *qNormalizeType(char *d, int &templdepth, QByteArray &result) | - |
1249 | { | - |
1250 | const char *t = d; executed (the execution status of this line is deduced): const char *t = d; | - |
1251 | while (*d && (templdepth evaluated: *d yes Evaluation Count:5313745 | yes Evaluation Count:16815 |
evaluated: templdepth yes Evaluation Count:307103 | yes Evaluation Count:5006688 |
| 16815-5313745 |
1252 | || (*d != ',' && *d != ')'))) { evaluated: *d != ',' yes Evaluation Count:4726853 | yes Evaluation Count:279862 |
evaluated: *d != ')' yes Evaluation Count:4289411 | yes Evaluation Count:437489 |
| 279862-4726853 |
1253 | if (*d == '<') evaluated: *d == '<' yes Evaluation Count:20902 | yes Evaluation Count:4575554 |
| 20902-4575554 |
1254 | ++templdepth; executed: ++templdepth; Execution Count:20902 | 20902 |
1255 | if (*d == '>') evaluated: *d == '>' yes Evaluation Count:20902 | yes Evaluation Count:4575573 |
| 20902-4575573 |
1256 | --templdepth; executed: --templdepth; Execution Count:20902 | 20902 |
1257 | ++d; executed (the execution status of this line is deduced): ++d; | - |
1258 | } executed: } Execution Count:4596465 | 4596465 |
1259 | // "void" should only be removed if this is part of a signature that has | - |
1260 | // an explicit void argument; e.g., "void foo(void)" --> "void foo()" | - |
1261 | if (strncmp("void)", t, d - t + 1) != 0) evaluated: strncmp("void)", t, d - t + 1) != 0 yes Evaluation Count:734133 | yes Evaluation Count:29 |
| 29-734133 |
1262 | result += normalizeTypeInternal(t, d); executed: result += normalizeTypeInternal(t, d); Execution Count:734127 | 734127 |
1263 | | - |
1264 | return d; executed: return d; Execution Count:734203 | 734203 |
1265 | } | - |
1266 | | - |
1267 | | - |
1268 | /*! | - |
1269 | \since 4.2 | - |
1270 | | - |
1271 | Normalizes a \a type. | - |
1272 | | - |
1273 | See QMetaObject::normalizedSignature() for a description on how | - |
1274 | Qt normalizes. | - |
1275 | | - |
1276 | Example: | - |
1277 | | - |
1278 | \snippet code/src_corelib_kernel_qmetaobject.cpp 1 | - |
1279 | | - |
1280 | \sa normalizedSignature() | - |
1281 | */ | - |
1282 | QByteArray QMetaObject::normalizedType(const char *type) | - |
1283 | { | - |
1284 | QByteArray result; executed (the execution status of this line is deduced): QByteArray result; | - |
1285 | | - |
1286 | if (!type || !*type) partially evaluated: !type no Evaluation Count:0 | yes Evaluation Count:16878 |
evaluated: !*type yes Evaluation Count:35 | yes Evaluation Count:16839 |
| 0-16878 |
1287 | return result; executed: return result; Execution Count:35 | 35 |
1288 | | - |
1289 | QVarLengthArray<char> stackbuf(qstrlen(type) + 1); executed (the execution status of this line is deduced): QVarLengthArray<char> stackbuf(qstrlen(type) + 1); | - |
1290 | qRemoveWhitespace(type, stackbuf.data()); executed (the execution status of this line is deduced): qRemoveWhitespace(type, stackbuf.data()); | - |
1291 | int templdepth = 0; executed (the execution status of this line is deduced): int templdepth = 0; | - |
1292 | qNormalizeType(stackbuf.data(), templdepth, result); executed (the execution status of this line is deduced): qNormalizeType(stackbuf.data(), templdepth, result); | - |
1293 | | - |
1294 | return result; executed: return result; Execution Count:16853 | 16853 |
1295 | } | - |
1296 | | - |
1297 | /*! | - |
1298 | Normalizes the signature of the given \a method. | - |
1299 | | - |
1300 | Qt uses normalized signatures to decide whether two given signals | - |
1301 | and slots are compatible. Normalization reduces whitespace to a | - |
1302 | minimum, moves 'const' to the front where appropriate, removes | - |
1303 | 'const' from value types and replaces const references with | - |
1304 | values. | - |
1305 | | - |
1306 | \sa checkConnectArgs(), normalizedType() | - |
1307 | */ | - |
1308 | QByteArray QMetaObject::normalizedSignature(const char *method) | - |
1309 | { | - |
1310 | QByteArray result; executed (the execution status of this line is deduced): QByteArray result; | - |
1311 | if (!method || !*method) partially evaluated: !method no Evaluation Count:0 | yes Evaluation Count:437470 |
partially evaluated: !*method no Evaluation Count:0 | yes Evaluation Count:437470 |
| 0-437470 |
1312 | return result; never executed: return result; | 0 |
1313 | int len = int(strlen(method)); executed (the execution status of this line is deduced): int len = int(strlen(method)); | - |
1314 | QVarLengthArray<char> stackbuf(len + 1); executed (the execution status of this line is deduced): QVarLengthArray<char> stackbuf(len + 1); | - |
1315 | char *d = stackbuf.data(); executed (the execution status of this line is deduced): char *d = stackbuf.data(); | - |
1316 | qRemoveWhitespace(method, d); executed (the execution status of this line is deduced): qRemoveWhitespace(method, d); | - |
1317 | | - |
1318 | result.reserve(len); executed (the execution status of this line is deduced): result.reserve(len); | - |
1319 | | - |
1320 | int argdepth = 0; executed (the execution status of this line is deduced): int argdepth = 0; | - |
1321 | int templdepth = 0; executed (the execution status of this line is deduced): int templdepth = 0; | - |
1322 | while (*d) { evaluated: *d yes Evaluation Count:8279076 | yes Evaluation Count:437480 |
| 437480-8279076 |
1323 | if (argdepth == 1) { evaluated: argdepth == 1 yes Evaluation Count:717348 | yes Evaluation Count:7561877 |
| 717348-7561877 |
1324 | d = qNormalizeType(d, templdepth, result); executed (the execution status of this line is deduced): d = qNormalizeType(d, templdepth, result); | - |
1325 | if (!*d) //most likely an invalid signature. evaluated: !*d yes Evaluation Count:1 | yes Evaluation Count:717348 |
| 1-717348 |
1326 | break; executed: break; Execution Count:1 | 1 |
1327 | } executed: } Execution Count:717348 | 717348 |
1328 | if (*d == '(') evaluated: *d == '(' yes Evaluation Count:437489 | yes Evaluation Count:7841742 |
| 437489-7841742 |
1329 | ++argdepth; executed: ++argdepth; Execution Count:437487 | 437487 |
1330 | if (*d == ')') evaluated: *d == ')' yes Evaluation Count:437495 | yes Evaluation Count:7841714 |
| 437495-7841714 |
1331 | --argdepth; executed: --argdepth; Execution Count:437493 | 437493 |
1332 | result += *d++; executed (the execution status of this line is deduced): result += *d++; | - |
1333 | } executed: } Execution Count:8279024 | 8279024 |
1334 | | - |
1335 | return result; executed: return result; Execution Count:437482 | 437482 |
1336 | } | - |
1337 | | - |
1338 | enum { MaximumParamCount = 11 }; // up to 10 arguments + 1 return value | - |
1339 | | - |
1340 | /*! | - |
1341 | Invokes the \a member (a signal or a slot name) on the object \a | - |
1342 | obj. Returns true if the member could be invoked. Returns false | - |
1343 | if there is no such member or the parameters did not match. | - |
1344 | | - |
1345 | The invocation can be either synchronous or asynchronous, | - |
1346 | depending on \a type: | - |
1347 | | - |
1348 | \list | - |
1349 | \li If \a type is Qt::DirectConnection, the member will be invoked immediately. | - |
1350 | | - |
1351 | \li If \a type is Qt::QueuedConnection, | - |
1352 | a QEvent will be sent and the member is invoked as soon as the application | - |
1353 | enters the main event loop. | - |
1354 | | - |
1355 | \li If \a type is Qt::BlockingQueuedConnection, the method will be invoked in | - |
1356 | the same way as for Qt::QueuedConnection, except that the current thread | - |
1357 | will block until the event is delivered. Using this connection type to | - |
1358 | communicate between objects in the same thread will lead to deadlocks. | - |
1359 | | - |
1360 | \li If \a type is Qt::AutoConnection, the member is invoked | - |
1361 | synchronously if \a obj lives in the same thread as the | - |
1362 | caller; otherwise it will invoke the member asynchronously. | - |
1363 | \endlist | - |
1364 | | - |
1365 | The return value of the \a member function call is placed in \a | - |
1366 | ret. If the invocation is asynchronous, the return value cannot | - |
1367 | be evaluated. You can pass up to ten arguments (\a val0, \a val1, | - |
1368 | \a val2, \a val3, \a val4, \a val5, \a val6, \a val7, \a val8, | - |
1369 | and \a val9) to the \a member function. | - |
1370 | | - |
1371 | QGenericArgument and QGenericReturnArgument are internal | - |
1372 | helper classes. Because signals and slots can be dynamically | - |
1373 | invoked, you must enclose the arguments using the Q_ARG() and | - |
1374 | Q_RETURN_ARG() macros. Q_ARG() takes a type name and a | - |
1375 | const reference of that type; Q_RETURN_ARG() takes a type name | - |
1376 | and a non-const reference. | - |
1377 | | - |
1378 | You only need to pass the name of the signal or slot to this function, | - |
1379 | not the entire signature. For example, to asynchronously invoke | - |
1380 | the \l{QThread::quit()}{quit()} slot on a | - |
1381 | QThread, use the following code: | - |
1382 | | - |
1383 | \snippet code/src_corelib_kernel_qmetaobject.cpp 2 | - |
1384 | | - |
1385 | With asynchronous method invocations, the parameters must be of | - |
1386 | types that are known to Qt's meta-object system, because Qt needs | - |
1387 | to copy the arguments to store them in an event behind the | - |
1388 | scenes. If you try to use a queued connection and get the error | - |
1389 | message | - |
1390 | | - |
1391 | \snippet code/src_corelib_kernel_qmetaobject.cpp 3 | - |
1392 | | - |
1393 | call qRegisterMetaType() to register the data type before you | - |
1394 | call invokeMethod(). | - |
1395 | | - |
1396 | To synchronously invoke the \c compute(QString, int, double) slot on | - |
1397 | some arbitrary object \c obj retrieve its return value: | - |
1398 | | - |
1399 | \snippet code/src_corelib_kernel_qmetaobject.cpp 4 | - |
1400 | | - |
1401 | If the "compute" slot does not take exactly one QString, one int | - |
1402 | and one double in the specified order, the call will fail. | - |
1403 | | - |
1404 | \sa Q_ARG(), Q_RETURN_ARG(), qRegisterMetaType(), QMetaMethod::invoke() | - |
1405 | */ | - |
1406 | bool QMetaObject::invokeMethod(QObject *obj, | - |
1407 | const char *member, | - |
1408 | Qt::ConnectionType type, | - |
1409 | QGenericReturnArgument ret, | - |
1410 | QGenericArgument val0, | - |
1411 | QGenericArgument val1, | - |
1412 | QGenericArgument val2, | - |
1413 | QGenericArgument val3, | - |
1414 | QGenericArgument val4, | - |
1415 | QGenericArgument val5, | - |
1416 | QGenericArgument val6, | - |
1417 | QGenericArgument val7, | - |
1418 | QGenericArgument val8, | - |
1419 | QGenericArgument val9) | - |
1420 | { | - |
1421 | if (!obj) evaluated: !obj yes Evaluation Count:2 | yes Evaluation Count:140630 |
| 2-140630 |
1422 | return false; executed: return false; Execution Count:2 | 2 |
1423 | | - |
1424 | QVarLengthArray<char, 512> sig; executed (the execution status of this line is deduced): QVarLengthArray<char, 512> sig; | - |
1425 | int len = qstrlen(member); executed (the execution status of this line is deduced): int len = qstrlen(member); | - |
1426 | if (len <= 0) evaluated: len <= 0 yes Evaluation Count:1 | yes Evaluation Count:140629 |
| 1-140629 |
1427 | return false; executed: return false; Execution Count:1 | 1 |
1428 | sig.append(member, len); executed (the execution status of this line is deduced): sig.append(member, len); | - |
1429 | sig.append('('); executed (the execution status of this line is deduced): sig.append('('); | - |
1430 | | - |
1431 | const char *typeNames[] = {ret.name(), val0.name(), val1.name(), val2.name(), val3.name(), executed (the execution status of this line is deduced): const char *typeNames[] = {ret.name(), val0.name(), val1.name(), val2.name(), val3.name(), | - |
1432 | val4.name(), val5.name(), val6.name(), val7.name(), val8.name(), executed (the execution status of this line is deduced): val4.name(), val5.name(), val6.name(), val7.name(), val8.name(), | - |
1433 | val9.name()}; executed (the execution status of this line is deduced): val9.name()}; | - |
1434 | | - |
1435 | int paramCount; executed (the execution status of this line is deduced): int paramCount; | - |
1436 | for (paramCount = 1; paramCount < MaximumParamCount; ++paramCount) { partially evaluated: paramCount < MaximumParamCount yes Evaluation Count:161950 | no Evaluation Count:0 |
| 0-161950 |
1437 | len = qstrlen(typeNames[paramCount]); executed (the execution status of this line is deduced): len = qstrlen(typeNames[paramCount]); | - |
1438 | if (len <= 0) evaluated: len <= 0 yes Evaluation Count:140629 | yes Evaluation Count:21321 |
| 21321-140629 |
1439 | break; executed: break; Execution Count:140629 | 140629 |
1440 | sig.append(typeNames[paramCount], len); executed (the execution status of this line is deduced): sig.append(typeNames[paramCount], len); | - |
1441 | sig.append(','); executed (the execution status of this line is deduced): sig.append(','); | - |
1442 | } executed: } Execution Count:21321 | 21321 |
1443 | if (paramCount == 1) evaluated: paramCount == 1 yes Evaluation Count:119470 | yes Evaluation Count:21159 |
| 21159-119470 |
1444 | sig.append(')'); // no parameters executed: sig.append(')'); Execution Count:119470 | 119470 |
1445 | else | - |
1446 | sig[sig.size() - 1] = ')'; executed: sig[sig.size() - 1] = ')'; Execution Count:21159 | 21159 |
1447 | sig.append('\0'); executed (the execution status of this line is deduced): sig.append('\0'); | - |
1448 | | - |
1449 | const QMetaObject *meta = obj->metaObject(); executed (the execution status of this line is deduced): const QMetaObject *meta = obj->metaObject(); | - |
1450 | int idx = meta->indexOfMethod(sig.constData()); executed (the execution status of this line is deduced): int idx = meta->indexOfMethod(sig.constData()); | - |
1451 | if (idx < 0) { evaluated: idx < 0 yes Evaluation Count:12 | yes Evaluation Count:140617 |
| 12-140617 |
1452 | QByteArray norm = QMetaObject::normalizedSignature(sig.constData()); executed (the execution status of this line is deduced): QByteArray norm = QMetaObject::normalizedSignature(sig.constData()); | - |
1453 | idx = meta->indexOfMethod(norm.constData()); executed (the execution status of this line is deduced): idx = meta->indexOfMethod(norm.constData()); | - |
1454 | } executed: } Execution Count:12 | 12 |
1455 | | - |
1456 | if (idx < 0 || idx >= meta->methodCount()) { evaluated: idx < 0 yes Evaluation Count:10 | yes Evaluation Count:140619 |
partially evaluated: idx >= meta->methodCount() no Evaluation Count:0 | yes Evaluation Count:140619 |
| 0-140619 |
1457 | qWarning("QMetaObject::invokeMethod: No such method %s::%s", executed (the execution status of this line is deduced): QMessageLogger("kernel/qmetaobject.cpp", 1457, __PRETTY_FUNCTION__).warning("QMetaObject::invokeMethod: No such method %s::%s", | - |
1458 | meta->className(), sig.constData()); executed (the execution status of this line is deduced): meta->className(), sig.constData()); | - |
1459 | return false; executed: return false; Execution Count:10 | 10 |
1460 | } | - |
1461 | QMetaMethod method = meta->method(idx); executed (the execution status of this line is deduced): QMetaMethod method = meta->method(idx); | - |
1462 | return method.invoke(obj, type, ret, executed: return method.invoke(obj, type, ret, val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); Execution Count:140619 | 140619 |
1463 | val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); executed: return method.invoke(obj, type, ret, val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); Execution Count:140619 | 140619 |
1464 | } | - |
1465 | | - |
1466 | /*! \fn bool QMetaObject::invokeMethod(QObject *obj, const char *member, | - |
1467 | QGenericReturnArgument ret, | - |
1468 | QGenericArgument val0 = QGenericArgument(0), | - |
1469 | QGenericArgument val1 = QGenericArgument(), | - |
1470 | QGenericArgument val2 = QGenericArgument(), | - |
1471 | QGenericArgument val3 = QGenericArgument(), | - |
1472 | QGenericArgument val4 = QGenericArgument(), | - |
1473 | QGenericArgument val5 = QGenericArgument(), | - |
1474 | QGenericArgument val6 = QGenericArgument(), | - |
1475 | QGenericArgument val7 = QGenericArgument(), | - |
1476 | QGenericArgument val8 = QGenericArgument(), | - |
1477 | QGenericArgument val9 = QGenericArgument()); | - |
1478 | \overload invokeMethod() | - |
1479 | | - |
1480 | This overload always invokes the member using the connection type Qt::AutoConnection. | - |
1481 | */ | - |
1482 | | - |
1483 | /*! \fn bool QMetaObject::invokeMethod(QObject *obj, const char *member, | - |
1484 | Qt::ConnectionType type, | - |
1485 | QGenericArgument val0 = QGenericArgument(0), | - |
1486 | QGenericArgument val1 = QGenericArgument(), | - |
1487 | QGenericArgument val2 = QGenericArgument(), | - |
1488 | QGenericArgument val3 = QGenericArgument(), | - |
1489 | QGenericArgument val4 = QGenericArgument(), | - |
1490 | QGenericArgument val5 = QGenericArgument(), | - |
1491 | QGenericArgument val6 = QGenericArgument(), | - |
1492 | QGenericArgument val7 = QGenericArgument(), | - |
1493 | QGenericArgument val8 = QGenericArgument(), | - |
1494 | QGenericArgument val9 = QGenericArgument()) | - |
1495 | | - |
1496 | \overload invokeMethod() | - |
1497 | | - |
1498 | This overload can be used if the return value of the member is of no interest. | - |
1499 | */ | - |
1500 | | - |
1501 | /*! | - |
1502 | \fn bool QMetaObject::invokeMethod(QObject *obj, const char *member, | - |
1503 | QGenericArgument val0 = QGenericArgument(0), | - |
1504 | QGenericArgument val1 = QGenericArgument(), | - |
1505 | QGenericArgument val2 = QGenericArgument(), | - |
1506 | QGenericArgument val3 = QGenericArgument(), | - |
1507 | QGenericArgument val4 = QGenericArgument(), | - |
1508 | QGenericArgument val5 = QGenericArgument(), | - |
1509 | QGenericArgument val6 = QGenericArgument(), | - |
1510 | QGenericArgument val7 = QGenericArgument(), | - |
1511 | QGenericArgument val8 = QGenericArgument(), | - |
1512 | QGenericArgument val9 = QGenericArgument()) | - |
1513 | | - |
1514 | \overload invokeMethod() | - |
1515 | | - |
1516 | This overload invokes the member using the connection type Qt::AutoConnection and | - |
1517 | ignores return values. | - |
1518 | */ | - |
1519 | | - |
1520 | /*! | - |
1521 | \class QMetaMethod | - |
1522 | \inmodule QtCore | - |
1523 | | - |
1524 | \brief The QMetaMethod class provides meta-data about a member | - |
1525 | function. | - |
1526 | | - |
1527 | \ingroup objectmodel | - |
1528 | | - |
1529 | A QMetaMethod has a methodType(), a methodSignature(), a list of | - |
1530 | parameterTypes() and parameterNames(), a return typeName(), a | - |
1531 | tag(), and an access() specifier. You can use invoke() to invoke | - |
1532 | the method on an arbitrary QObject. | - |
1533 | | - |
1534 | \sa QMetaObject, QMetaEnum, QMetaProperty, {Qt's Property System} | - |
1535 | */ | - |
1536 | | - |
1537 | /*! | - |
1538 | \enum QMetaMethod::Attributes | - |
1539 | | - |
1540 | \internal | - |
1541 | | - |
1542 | \value Compatibility | - |
1543 | \value Cloned | - |
1544 | \value Scriptable | - |
1545 | */ | - |
1546 | | - |
1547 | /*! | - |
1548 | \fn bool QMetaMethod::isValid() const | - |
1549 | \since 5.0 | - |
1550 | | - |
1551 | Returns true if this method is valid (can be introspected and | - |
1552 | invoked), otherwise returns false. | - |
1553 | */ | - |
1554 | | - |
1555 | /*! \fn bool operator==(const QMetaMethod &m1, const QMetaMethod &m2) | - |
1556 | \since 5.0 | - |
1557 | \relates QMetaMethod | - |
1558 | \overload | - |
1559 | | - |
1560 | Returns true if method \a m1 is equal to method \a m2, | - |
1561 | otherwise returns false. | - |
1562 | */ | - |
1563 | | - |
1564 | /*! \fn bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2) | - |
1565 | \since 5.0 | - |
1566 | \relates QMetaMethod | - |
1567 | \overload | - |
1568 | | - |
1569 | Returns true if method \a m1 is not equal to method \a m2, | - |
1570 | otherwise returns false. | - |
1571 | */ | - |
1572 | | - |
1573 | /*! | - |
1574 | \fn const QMetaObject *QMetaMethod::enclosingMetaObject() const | - |
1575 | \internal | - |
1576 | */ | - |
1577 | | - |
1578 | /*! | - |
1579 | \enum QMetaMethod::MethodType | - |
1580 | | - |
1581 | \value Method The function is a plain member function. | - |
1582 | \value Signal The function is a signal. | - |
1583 | \value Slot The function is a slot. | - |
1584 | \value Constructor The function is a constructor. | - |
1585 | */ | - |
1586 | | - |
1587 | /*! | - |
1588 | \fn QMetaMethod::QMetaMethod() | - |
1589 | \internal | - |
1590 | */ | - |
1591 | | - |
1592 | QByteArray QMetaMethodPrivate::signature() const | - |
1593 | { | - |
1594 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
1595 | QByteArray result; executed (the execution status of this line is deduced): QByteArray result; | - |
1596 | result.reserve(256); executed (the execution status of this line is deduced): result.reserve(256); | - |
1597 | result += name(); executed (the execution status of this line is deduced): result += name(); | - |
1598 | result += '('; executed (the execution status of this line is deduced): result += '('; | - |
1599 | QList<QByteArray> argTypes = parameterTypes(); executed (the execution status of this line is deduced): QList<QByteArray> argTypes = parameterTypes(); | - |
1600 | for (int i = 0; i < argTypes.size(); ++i) { evaluated: i < argTypes.size() yes Evaluation Count:7092 | yes Evaluation Count:20487 |
| 7092-20487 |
1601 | if (i) evaluated: i yes Evaluation Count:566 | yes Evaluation Count:6526 |
| 566-6526 |
1602 | result += ','; executed: result += ','; Execution Count:566 | 566 |
1603 | result += argTypes.at(i); executed (the execution status of this line is deduced): result += argTypes.at(i); | - |
1604 | } executed: } Execution Count:7092 | 7092 |
1605 | result += ')'; executed (the execution status of this line is deduced): result += ')'; | - |
1606 | return result; executed: return result; Execution Count:20487 | 20487 |
1607 | } | - |
1608 | | - |
1609 | QByteArray QMetaMethodPrivate::name() const | - |
1610 | { | - |
1611 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
1612 | return stringData(mobj, mobj->d.data[handle]); executed: return stringData(mobj, mobj->d.data[handle]); Execution Count:46868 | 46868 |
1613 | } | - |
1614 | | - |
1615 | int QMetaMethodPrivate::typesDataIndex() const | - |
1616 | { | - |
1617 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
1618 | return mobj->d.data[handle + 2]; executed: return mobj->d.data[handle + 2]; Execution Count:41887 | 41887 |
1619 | } | - |
1620 | | - |
1621 | const char *QMetaMethodPrivate::rawReturnTypeName() const | - |
1622 | { | - |
1623 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
1624 | uint typeInfo = mobj->d.data[typesDataIndex()]; executed (the execution status of this line is deduced): uint typeInfo = mobj->d.data[typesDataIndex()]; | - |
1625 | if (typeInfo & IsUnresolvedType) evaluated: typeInfo & IsUnresolvedType yes Evaluation Count:31 | yes Evaluation Count:377 |
| 31-377 |
1626 | return rawStringData(mobj, typeInfo & TypeNameIndexMask); executed: return rawStringData(mobj, typeInfo & TypeNameIndexMask); Execution Count:31 | 31 |
1627 | else | - |
1628 | return QMetaType::typeName(typeInfo); executed: return QMetaType::typeName(typeInfo); Execution Count:377 | 377 |
1629 | } | - |
1630 | | - |
1631 | int QMetaMethodPrivate::returnType() const | - |
1632 | { | - |
1633 | return parameterType(-1); executed: return parameterType(-1); Execution Count:9917 | 9917 |
1634 | } | - |
1635 | | - |
1636 | int QMetaMethodPrivate::parameterCount() const | - |
1637 | { | - |
1638 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
1639 | return mobj->d.data[handle + 1]; executed: return mobj->d.data[handle + 1]; Execution Count:257823 | 257823 |
1640 | } | - |
1641 | | - |
1642 | int QMetaMethodPrivate::parametersDataIndex() const | - |
1643 | { | - |
1644 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
1645 | return typesDataIndex() + 1; executed: return typesDataIndex() + 1; Execution Count:41479 | 41479 |
1646 | } | - |
1647 | | - |
1648 | uint QMetaMethodPrivate::parameterTypeInfo(int index) const | - |
1649 | { | - |
1650 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
1651 | return mobj->d.data[parametersDataIndex() + index]; executed: return mobj->d.data[parametersDataIndex() + index]; Execution Count:10081 | 10081 |
1652 | } | - |
1653 | | - |
1654 | int QMetaMethodPrivate::parameterType(int index) const | - |
1655 | { | - |
1656 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
1657 | return typeFromTypeInfo(mobj, parameterTypeInfo(index)); executed: return typeFromTypeInfo(mobj, parameterTypeInfo(index)); Execution Count:10081 | 10081 |
1658 | } | - |
1659 | | - |
1660 | void QMetaMethodPrivate::getParameterTypes(int *types) const | - |
1661 | { | - |
1662 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
1663 | int dataIndex = parametersDataIndex(); executed (the execution status of this line is deduced): int dataIndex = parametersDataIndex(); | - |
1664 | int argc = parameterCount(); executed (the execution status of this line is deduced): int argc = parameterCount(); | - |
1665 | for (int i = 0; i < argc; ++i) { evaluated: i < argc yes Evaluation Count:80 | yes Evaluation Count:42 |
| 42-80 |
1666 | int id = typeFromTypeInfo(mobj, mobj->d.data[dataIndex++]); executed (the execution status of this line is deduced): int id = typeFromTypeInfo(mobj, mobj->d.data[dataIndex++]); | - |
1667 | *(types++) = id; executed (the execution status of this line is deduced): *(types++) = id; | - |
1668 | } executed: } Execution Count:80 | 80 |
1669 | } executed: } Execution Count:42 | 42 |
1670 | | - |
1671 | QList<QByteArray> QMetaMethodPrivate::parameterTypes() const | - |
1672 | { | - |
1673 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
1674 | QList<QByteArray> list; executed (the execution status of this line is deduced): QList<QByteArray> list; | - |
1675 | int argc = parameterCount(); executed (the execution status of this line is deduced): int argc = parameterCount(); | - |
1676 | int paramsIndex = parametersDataIndex(); executed (the execution status of this line is deduced): int paramsIndex = parametersDataIndex(); | - |
1677 | for (int i = 0; i < argc; ++i) evaluated: i < argc yes Evaluation Count:21122 | yes Evaluation Count:30218 |
| 21122-30218 |
1678 | list += typeNameFromTypeInfo(mobj, mobj->d.data[paramsIndex + i]); executed: list += typeNameFromTypeInfo(mobj, mobj->d.data[paramsIndex + i]); Execution Count:21122 | 21122 |
1679 | return list; executed: return list; Execution Count:30218 | 30218 |
1680 | } | - |
1681 | | - |
1682 | QList<QByteArray> QMetaMethodPrivate::parameterNames() const | - |
1683 | { | - |
1684 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
1685 | QList<QByteArray> list; executed (the execution status of this line is deduced): QList<QByteArray> list; | - |
1686 | int argc = parameterCount(); executed (the execution status of this line is deduced): int argc = parameterCount(); | - |
1687 | int namesIndex = parametersDataIndex() + argc; executed (the execution status of this line is deduced): int namesIndex = parametersDataIndex() + argc; | - |
1688 | for (int i = 0; i < argc; ++i) evaluated: i < argc yes Evaluation Count:666 | yes Evaluation Count:1138 |
| 666-1138 |
1689 | list += stringData(mobj, mobj->d.data[namesIndex + i]); executed: list += stringData(mobj, mobj->d.data[namesIndex + i]); Execution Count:666 | 666 |
1690 | return list; executed: return list; Execution Count:1138 | 1138 |
1691 | } | - |
1692 | | - |
1693 | QByteArray QMetaMethodPrivate::tag() const | - |
1694 | { | - |
1695 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
1696 | return stringData(mobj, mobj->d.data[handle + 3]); executed: return stringData(mobj, mobj->d.data[handle + 3]); Execution Count:1334 | 1334 |
1697 | } | - |
1698 | | - |
1699 | int QMetaMethodPrivate::ownMethodIndex() const | - |
1700 | { | - |
1701 | // recompute the methodIndex by reversing the arithmetic in QMetaObject::property() | - |
1702 | return (handle - priv(mobj->d.data)->methodData) / 5; executed: return (handle - priv(mobj->d.data)->methodData) / 5; Execution Count:217142 | 217142 |
1703 | } | - |
1704 | | - |
1705 | /*! | - |
1706 | \since 5.0 | - |
1707 | | - |
1708 | Returns the signature of this method (e.g., | - |
1709 | \c{setValue(double)}). | - |
1710 | | - |
1711 | \sa parameterTypes(), parameterNames() | - |
1712 | */ | - |
1713 | QByteArray QMetaMethod::methodSignature() const | - |
1714 | { | - |
1715 | if (!mobj) evaluated: !mobj yes Evaluation Count:2 | yes Evaluation Count:20487 |
| 2-20487 |
1716 | return QByteArray(); executed: return QByteArray(); Execution Count:2 | 2 |
1717 | return QMetaMethodPrivate::get(this)->signature(); executed: return QMetaMethodPrivate::get(this)->signature(); Execution Count:20487 | 20487 |
1718 | } | - |
1719 | | - |
1720 | /*! | - |
1721 | \since 5.0 | - |
1722 | | - |
1723 | Returns the name of this method. | - |
1724 | | - |
1725 | \sa methodSignature(), parameterCount() | - |
1726 | */ | - |
1727 | QByteArray QMetaMethod::name() const | - |
1728 | { | - |
1729 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:26381 |
| 0-26381 |
1730 | return QByteArray(); never executed: return QByteArray(); | 0 |
1731 | return QMetaMethodPrivate::get(this)->name(); executed: return QMetaMethodPrivate::get(this)->name(); Execution Count:26381 | 26381 |
1732 | } | - |
1733 | | - |
1734 | /*! | - |
1735 | \since 5.0 | - |
1736 | | - |
1737 | Returns the return type of this method. | - |
1738 | | - |
1739 | The return value is one of the types that are registered | - |
1740 | with QMetaType, or QMetaType::UnknownType if the type is not registered. | - |
1741 | | - |
1742 | \sa parameterType(), QMetaType, typeName() | - |
1743 | */ | - |
1744 | int QMetaMethod::returnType() const | - |
1745 | { | - |
1746 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:9917 |
| 0-9917 |
1747 | return QMetaType::UnknownType; never executed: return QMetaType::UnknownType; | 0 |
1748 | return QMetaMethodPrivate::get(this)->returnType(); executed: return QMetaMethodPrivate::get(this)->returnType(); Execution Count:9917 | 9917 |
1749 | } | - |
1750 | | - |
1751 | /*! | - |
1752 | \since 5.0 | - |
1753 | | - |
1754 | Returns the number of parameters of this method. | - |
1755 | | - |
1756 | \sa parameterType(), parameterNames() | - |
1757 | */ | - |
1758 | int QMetaMethod::parameterCount() const | - |
1759 | { | - |
1760 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:9439 |
| 0-9439 |
1761 | return 0; never executed: return 0; | 0 |
1762 | return QMetaMethodPrivate::get(this)->parameterCount(); executed: return QMetaMethodPrivate::get(this)->parameterCount(); Execution Count:9439 | 9439 |
1763 | } | - |
1764 | | - |
1765 | /*! | - |
1766 | \since 5.0 | - |
1767 | | - |
1768 | Returns the type of the parameter at the given \a index. | - |
1769 | | - |
1770 | The return value is one of the types that are registered | - |
1771 | with QMetaType, or QMetaType::UnknownType if the type is not registered. | - |
1772 | | - |
1773 | \sa parameterCount(), returnType(), QMetaType | - |
1774 | */ | - |
1775 | int QMetaMethod::parameterType(int index) const | - |
1776 | { | - |
1777 | if (!mobj || index < 0) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:248 |
evaluated: index < 0 yes Evaluation Count:42 | yes Evaluation Count:206 |
| 0-248 |
1778 | return QMetaType::UnknownType; executed: return QMetaType::UnknownType; Execution Count:42 | 42 |
1779 | if (index >= QMetaMethodPrivate::get(this)->parameterCount()) evaluated: index >= QMetaMethodPrivate::get(this)->parameterCount() yes Evaluation Count:42 | yes Evaluation Count:164 |
| 42-164 |
1780 | return QMetaType::UnknownType; executed: return QMetaType::UnknownType; Execution Count:42 | 42 |
1781 | | - |
1782 | int type = QMetaMethodPrivate::get(this)->parameterType(index); executed (the execution status of this line is deduced): int type = QMetaMethodPrivate::get(this)->parameterType(index); | - |
1783 | if (type != QMetaType::UnknownType) evaluated: type != QMetaType::UnknownType yes Evaluation Count:154 | yes Evaluation Count:10 |
| 10-154 |
1784 | return type; executed: return type; Execution Count:154 | 154 |
1785 | | - |
1786 | void *argv[] = { &type, &index }; executed (the execution status of this line is deduced): void *argv[] = { &type, &index }; | - |
1787 | mobj->static_metacall(QMetaObject::RegisterMethodArgumentMetaType, QMetaMethodPrivate::get(this)->ownMethodIndex(), argv); executed (the execution status of this line is deduced): mobj->static_metacall(QMetaObject::RegisterMethodArgumentMetaType, QMetaMethodPrivate::get(this)->ownMethodIndex(), argv); | - |
1788 | if (type != -1) evaluated: type != -1 yes Evaluation Count:6 | yes Evaluation Count:4 |
| 4-6 |
1789 | return type; executed: return type; Execution Count:6 | 6 |
1790 | return QMetaType::UnknownType; executed: return QMetaType::UnknownType; Execution Count:4 | 4 |
1791 | } | - |
1792 | | - |
1793 | /*! | - |
1794 | \since 5.0 | - |
1795 | \internal | - |
1796 | | - |
1797 | Gets the parameter \a types of this method. The storage | - |
1798 | for \a types must be able to hold parameterCount() items. | - |
1799 | | - |
1800 | \sa parameterCount(), returnType(), parameterType() | - |
1801 | */ | - |
1802 | void QMetaMethod::getParameterTypes(int *types) const | - |
1803 | { | - |
1804 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:42 |
| 0-42 |
1805 | return; | 0 |
1806 | QMetaMethodPrivate::get(this)->getParameterTypes(types); executed (the execution status of this line is deduced): QMetaMethodPrivate::get(this)->getParameterTypes(types); | - |
1807 | } executed: } Execution Count:42 | 42 |
1808 | | - |
1809 | /*! | - |
1810 | Returns a list of parameter types. | - |
1811 | | - |
1812 | \sa parameterNames(), methodSignature() | - |
1813 | */ | - |
1814 | QList<QByteArray> QMetaMethod::parameterTypes() const | - |
1815 | { | - |
1816 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:9731 |
| 0-9731 |
1817 | return QList<QByteArray>(); never executed: return QList<QByteArray>(); | 0 |
1818 | return QMetaMethodPrivate::get(this)->parameterTypes(); executed: return QMetaMethodPrivate::get(this)->parameterTypes(); Execution Count:9731 | 9731 |
1819 | } | - |
1820 | | - |
1821 | /*! | - |
1822 | Returns a list of parameter names. | - |
1823 | | - |
1824 | \sa parameterTypes(), methodSignature() | - |
1825 | */ | - |
1826 | QList<QByteArray> QMetaMethod::parameterNames() const | - |
1827 | { | - |
1828 | QList<QByteArray> list; executed (the execution status of this line is deduced): QList<QByteArray> list; | - |
1829 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:1138 |
| 0-1138 |
1830 | return list; never executed: return list; | 0 |
1831 | return QMetaMethodPrivate::get(this)->parameterNames(); executed: return QMetaMethodPrivate::get(this)->parameterNames(); Execution Count:1138 | 1138 |
1832 | } | - |
1833 | | - |
1834 | | - |
1835 | /*! | - |
1836 | Returns the return type name of this method. | - |
1837 | | - |
1838 | \sa returnType(), QMetaType::type() | - |
1839 | */ | - |
1840 | const char *QMetaMethod::typeName() const | - |
1841 | { | - |
1842 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:408 |
| 0-408 |
1843 | return 0; never executed: return 0; | 0 |
1844 | return QMetaMethodPrivate::get(this)->rawReturnTypeName(); executed: return QMetaMethodPrivate::get(this)->rawReturnTypeName(); Execution Count:408 | 408 |
1845 | } | - |
1846 | | - |
1847 | /*! | - |
1848 | Returns the tag associated with this method. | - |
1849 | | - |
1850 | Tags are special macros recognized by \c moc that make it | - |
1851 | possible to add extra information about a method. | - |
1852 | | - |
1853 | Tag information can be added in the following | - |
1854 | way in the function declaration: | - |
1855 | | - |
1856 | \code | - |
1857 | #define THISISTESTTAG // tag text | - |
1858 | ... | - |
1859 | private slots: | - |
1860 | THISISTESTTAG void testFunc(); | - |
1861 | \endcode | - |
1862 | | - |
1863 | and the information can be accessed by using: | - |
1864 | | - |
1865 | \code | - |
1866 | MainWindow win; | - |
1867 | win.show(); | - |
1868 | | - |
1869 | int functionIndex = win.metaObject()->indexOfSlot("testFunc()"); | - |
1870 | QMetaMethod mm = metaObject()->method(functionIndex); | - |
1871 | qDebug() << mm.tag(); // prints THISISTESTTAG | - |
1872 | \endcode | - |
1873 | | - |
1874 | For the moment, | - |
1875 | \c moc doesn't support any special tags. | - |
1876 | */ | - |
1877 | const char *QMetaMethod::tag() const | - |
1878 | { | - |
1879 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:1334 |
| 0-1334 |
1880 | return 0; never executed: return 0; | 0 |
1881 | return QMetaMethodPrivate::get(this)->tag().constData(); executed: return QMetaMethodPrivate::get(this)->tag().constData(); Execution Count:1334 | 1334 |
1882 | } | - |
1883 | | - |
1884 | | - |
1885 | /*! | - |
1886 | \internal | - |
1887 | */ | - |
1888 | int QMetaMethod::attributes() const | - |
1889 | { | - |
1890 | if (!mobj) evaluated: !mobj yes Evaluation Count:3 | yes Evaluation Count:101431 |
| 3-101431 |
1891 | return false; executed: return false; Execution Count:3 | 3 |
1892 | return ((mobj->d.data[handle + 4])>>4); executed: return ((mobj->d.data[handle + 4])>>4); Execution Count:101431 | 101431 |
1893 | } | - |
1894 | | - |
1895 | /*! | - |
1896 | \since 4.6 | - |
1897 | | - |
1898 | Returns this method's index. | - |
1899 | */ | - |
1900 | int QMetaMethod::methodIndex() const | - |
1901 | { | - |
1902 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:332 |
| 0-332 |
1903 | return -1; never executed: return -1; | 0 |
1904 | return QMetaMethodPrivate::get(this)->ownMethodIndex() + mobj->methodOffset(); executed: return QMetaMethodPrivate::get(this)->ownMethodIndex() + mobj->methodOffset(); Execution Count:332 | 332 |
1905 | } | - |
1906 | | - |
1907 | /*! | - |
1908 | \internal | - |
1909 | | - |
1910 | Returns the method revision if one was | - |
1911 | specified by Q_REVISION, otherwise returns 0. | - |
1912 | */ | - |
1913 | int QMetaMethod::revision() const | - |
1914 | { | - |
1915 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:209 |
| 0-209 |
1916 | return 0; never executed: return 0; | 0 |
1917 | if ((QMetaMethod::Access)(mobj->d.data[handle + 4] & MethodRevisioned)) { evaluated: (QMetaMethod::Access)(mobj->d.data[handle + 4] & MethodRevisioned) yes Evaluation Count:6 | yes Evaluation Count:203 |
| 6-203 |
1918 | int offset = priv(mobj->d.data)->methodData executed (the execution status of this line is deduced): int offset = priv(mobj->d.data)->methodData | - |
1919 | + priv(mobj->d.data)->methodCount * 5 executed (the execution status of this line is deduced): + priv(mobj->d.data)->methodCount * 5 | - |
1920 | + QMetaMethodPrivate::get(this)->ownMethodIndex(); executed (the execution status of this line is deduced): + QMetaMethodPrivate::get(this)->ownMethodIndex(); | - |
1921 | return mobj->d.data[offset]; executed: return mobj->d.data[offset]; Execution Count:6 | 6 |
1922 | } | - |
1923 | return 0; executed: return 0; Execution Count:203 | 203 |
1924 | } | - |
1925 | | - |
1926 | /*! | - |
1927 | Returns the access specification of this method (private, | - |
1928 | protected, or public). | - |
1929 | | - |
1930 | Signals are always protected, meaning that you can only emit them | - |
1931 | from the class or from a subclass. | - |
1932 | | - |
1933 | \sa methodType() | - |
1934 | */ | - |
1935 | QMetaMethod::Access QMetaMethod::access() const | - |
1936 | { | - |
1937 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:14094 |
| 0-14094 |
1938 | return Private; never executed: return Private; | 0 |
1939 | return (QMetaMethod::Access)(mobj->d.data[handle + 4] & AccessMask); executed: return (QMetaMethod::Access)(mobj->d.data[handle + 4] & AccessMask); Execution Count:14094 | 14094 |
1940 | } | - |
1941 | | - |
1942 | /*! | - |
1943 | Returns the type of this method (signal, slot, or method). | - |
1944 | | - |
1945 | \sa access() | - |
1946 | */ | - |
1947 | QMetaMethod::MethodType QMetaMethod::methodType() const | - |
1948 | { | - |
1949 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:13699 |
| 0-13699 |
1950 | return QMetaMethod::Method; never executed: return QMetaMethod::Method; | 0 |
1951 | return (QMetaMethod::MethodType)((mobj->d.data[handle + 4] & MethodTypeMask)>>2); executed: return (QMetaMethod::MethodType)((mobj->d.data[handle + 4] & MethodTypeMask)>>2); Execution Count:13699 | 13699 |
1952 | } | - |
1953 | | - |
1954 | /*! | - |
1955 | \fn QMetaMethod QMetaMethod::fromSignal(PointerToMemberFunction signal) | - |
1956 | \since 5.0 | - |
1957 | | - |
1958 | Returns the meta-method that corresponds to the given \a signal, or an | - |
1959 | invalid QMetaMethod if \a signal is not a signal of the class. | - |
1960 | | - |
1961 | Example: | - |
1962 | | - |
1963 | \snippet code/src_corelib_kernel_qmetaobject.cpp 9 | - |
1964 | */ | - |
1965 | | - |
1966 | /*! | - |
1967 | \internal | - |
1968 | | - |
1969 | Implementation of the fromSignal() function. | - |
1970 | | - |
1971 | \a metaObject is the class's meta-object | - |
1972 | \a signal is a pointer to a pointer to a member signal of the class | - |
1973 | */ | - |
1974 | QMetaMethod QMetaMethod::fromSignalImpl(const QMetaObject *metaObject, void **signal) | - |
1975 | { | - |
1976 | int i = -1; executed (the execution status of this line is deduced): int i = -1; | - |
1977 | void *args[] = { &i, signal }; executed (the execution status of this line is deduced): void *args[] = { &i, signal }; | - |
1978 | QMetaMethod result; executed (the execution status of this line is deduced): QMetaMethod result; | - |
1979 | for (const QMetaObject *m = metaObject; m; m = m->d.superdata) { evaluated: m yes Evaluation Count:1503 | yes Evaluation Count:2 |
| 2-1503 |
1980 | m->static_metacall(QMetaObject::IndexOfMethod, 0, args); executed (the execution status of this line is deduced): m->static_metacall(QMetaObject::IndexOfMethod, 0, args); | - |
1981 | if (i >= 0) { evaluated: i >= 0 yes Evaluation Count:1500 | yes Evaluation Count:3 |
| 3-1500 |
1982 | result.mobj = m; executed (the execution status of this line is deduced): result.mobj = m; | - |
1983 | result.handle = priv(m->d.data)->methodData + 5*i; executed (the execution status of this line is deduced): result.handle = priv(m->d.data)->methodData + 5*i; | - |
1984 | break; executed: break; Execution Count:1500 | 1500 |
1985 | } | - |
1986 | } executed: } Execution Count:3 | 3 |
1987 | return result; executed: return result; Execution Count:1502 | 1502 |
1988 | } | - |
1989 | | - |
1990 | /*! | - |
1991 | Invokes this method on the object \a object. Returns true if the member could be invoked. | - |
1992 | Returns false if there is no such member or the parameters did not match. | - |
1993 | | - |
1994 | The invocation can be either synchronous or asynchronous, depending on the | - |
1995 | \a connectionType: | - |
1996 | | - |
1997 | \list | - |
1998 | \li If \a connectionType is Qt::DirectConnection, the member will be invoked immediately. | - |
1999 | | - |
2000 | \li If \a connectionType is Qt::QueuedConnection, | - |
2001 | a QEvent will be posted and the member is invoked as soon as the application | - |
2002 | enters the main event loop. | - |
2003 | | - |
2004 | \li If \a connectionType is Qt::AutoConnection, the member is invoked | - |
2005 | synchronously if \a object lives in the same thread as the | - |
2006 | caller; otherwise it will invoke the member asynchronously. | - |
2007 | \endlist | - |
2008 | | - |
2009 | The return value of this method call is placed in \a | - |
2010 | returnValue. If the invocation is asynchronous, the return value cannot | - |
2011 | be evaluated. You can pass up to ten arguments (\a val0, \a val1, | - |
2012 | \a val2, \a val3, \a val4, \a val5, \a val6, \a val7, \a val8, | - |
2013 | and \a val9) to this method call. | - |
2014 | | - |
2015 | QGenericArgument and QGenericReturnArgument are internal | - |
2016 | helper classes. Because signals and slots can be dynamically | - |
2017 | invoked, you must enclose the arguments using the Q_ARG() and | - |
2018 | Q_RETURN_ARG() macros. Q_ARG() takes a type name and a | - |
2019 | const reference of that type; Q_RETURN_ARG() takes a type name | - |
2020 | and a non-const reference. | - |
2021 | | - |
2022 | To asynchronously invoke the | - |
2023 | \l{QPushButton::animateClick()}{animateClick()} slot on a | - |
2024 | QPushButton: | - |
2025 | | - |
2026 | \snippet code/src_corelib_kernel_qmetaobject.cpp 6 | - |
2027 | | - |
2028 | With asynchronous method invocations, the parameters must be of | - |
2029 | types that are known to Qt's meta-object system, because Qt needs | - |
2030 | to copy the arguments to store them in an event behind the | - |
2031 | scenes. If you try to use a queued connection and get the error | - |
2032 | message | - |
2033 | | - |
2034 | \snippet code/src_corelib_kernel_qmetaobject.cpp 7 | - |
2035 | | - |
2036 | call qRegisterMetaType() to register the data type before you | - |
2037 | call QMetaMethod::invoke(). | - |
2038 | | - |
2039 | To synchronously invoke the \c compute(QString, int, double) slot on | - |
2040 | some arbitrary object \c obj retrieve its return value: | - |
2041 | | - |
2042 | \snippet code/src_corelib_kernel_qmetaobject.cpp 8 | - |
2043 | | - |
2044 | QMetaObject::normalizedSignature() is used here to ensure that the format | - |
2045 | of the signature is what invoke() expects. E.g. extra whitespace is | - |
2046 | removed. | - |
2047 | | - |
2048 | If the "compute" slot does not take exactly one QString, one int | - |
2049 | and one double in the specified order, the call will fail. | - |
2050 | | - |
2051 | \warning this method will not test the validity of the arguments: \a object | - |
2052 | must be an instance of the class of the QMetaObject of which this QMetaMethod | - |
2053 | has been constructed with. The arguments must have the same type as the ones | - |
2054 | expected by the method, else, the behaviour is undefined. | - |
2055 | | - |
2056 | \sa Q_ARG(), Q_RETURN_ARG(), qRegisterMetaType(), QMetaObject::invokeMethod() | - |
2057 | */ | - |
2058 | bool QMetaMethod::invoke(QObject *object, | - |
2059 | Qt::ConnectionType connectionType, | - |
2060 | QGenericReturnArgument returnValue, | - |
2061 | QGenericArgument val0, | - |
2062 | QGenericArgument val1, | - |
2063 | QGenericArgument val2, | - |
2064 | QGenericArgument val3, | - |
2065 | QGenericArgument val4, | - |
2066 | QGenericArgument val5, | - |
2067 | QGenericArgument val6, | - |
2068 | QGenericArgument val7, | - |
2069 | QGenericArgument val8, | - |
2070 | QGenericArgument val9) const | - |
2071 | { | - |
2072 | if (!object || !mobj) evaluated: !object yes Evaluation Count:2 | yes Evaluation Count:216785 |
evaluated: !mobj yes Evaluation Count:3 | yes Evaluation Count:216782 |
| 2-216785 |
2073 | return false; executed: return false; Execution Count:5 | 5 |
2074 | | - |
2075 | Q_ASSERT(mobj->cast(object)); executed (the execution status of this line is deduced): qt_noop(); | - |
2076 | | - |
2077 | // check return type | - |
2078 | if (returnValue.data()) { evaluated: returnValue.data() yes Evaluation Count:37 | yes Evaluation Count:216745 |
| 37-216745 |
2079 | const char *retType = typeName(); executed (the execution status of this line is deduced): const char *retType = typeName(); | - |
2080 | if (qstrcmp(returnValue.name(), retType) != 0) { evaluated: qstrcmp(returnValue.name(), retType) != 0 yes Evaluation Count:5 | yes Evaluation Count:32 |
| 5-32 |
2081 | // normalize the return value as well | - |
2082 | QByteArray normalized = QMetaObject::normalizedType(returnValue.name()); executed (the execution status of this line is deduced): QByteArray normalized = QMetaObject::normalizedType(returnValue.name()); | - |
2083 | if (qstrcmp(normalized.constData(), retType) != 0) evaluated: qstrcmp(normalized.constData(), retType) != 0 yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
2084 | return false; executed: return false; Execution Count:1 | 1 |
2085 | } executed: } Execution Count:4 | 4 |
2086 | } executed: } Execution Count:36 | 36 |
2087 | | - |
2088 | // check argument count (we don't allow invoking a method if given too few arguments) | - |
2089 | const char *typeNames[] = { executed (the execution status of this line is deduced): const char *typeNames[] = { | - |
2090 | returnValue.name(), executed (the execution status of this line is deduced): returnValue.name(), | - |
2091 | val0.name(), executed (the execution status of this line is deduced): val0.name(), | - |
2092 | val1.name(), executed (the execution status of this line is deduced): val1.name(), | - |
2093 | val2.name(), executed (the execution status of this line is deduced): val2.name(), | - |
2094 | val3.name(), executed (the execution status of this line is deduced): val3.name(), | - |
2095 | val4.name(), executed (the execution status of this line is deduced): val4.name(), | - |
2096 | val5.name(), executed (the execution status of this line is deduced): val5.name(), | - |
2097 | val6.name(), executed (the execution status of this line is deduced): val6.name(), | - |
2098 | val7.name(), executed (the execution status of this line is deduced): val7.name(), | - |
2099 | val8.name(), executed (the execution status of this line is deduced): val8.name(), | - |
2100 | val9.name() executed (the execution status of this line is deduced): val9.name() | - |
2101 | }; executed (the execution status of this line is deduced): }; | - |
2102 | int paramCount; executed (the execution status of this line is deduced): int paramCount; | - |
2103 | for (paramCount = 1; paramCount < MaximumParamCount; ++paramCount) { partially evaluated: paramCount < MaximumParamCount yes Evaluation Count:238119 | no Evaluation Count:0 |
| 0-238119 |
2104 | if (qstrlen(typeNames[paramCount]) <= 0) evaluated: qstrlen(typeNames[paramCount]) <= 0 yes Evaluation Count:216781 | yes Evaluation Count:21338 |
| 21338-216781 |
2105 | break; executed: break; Execution Count:216781 | 216781 |
2106 | } executed: } Execution Count:21338 | 21338 |
2107 | if (paramCount <= QMetaMethodPrivate::get(this)->parameterCount()) evaluated: paramCount <= QMetaMethodPrivate::get(this)->parameterCount() yes Evaluation Count:1 | yes Evaluation Count:216780 |
| 1-216780 |
2108 | return false; executed: return false; Execution Count:1 | 1 |
2109 | | - |
2110 | // check connection type | - |
2111 | QThread *currentThread = QThread::currentThread(); executed (the execution status of this line is deduced): QThread *currentThread = QThread::currentThread(); | - |
2112 | QThread *objectThread = object->thread(); executed (the execution status of this line is deduced): QThread *objectThread = object->thread(); | - |
2113 | if (connectionType == Qt::AutoConnection) { evaluated: connectionType == Qt::AutoConnection yes Evaluation Count:2637 | yes Evaluation Count:214143 |
| 2637-214143 |
2114 | connectionType = currentThread == objectThread evaluated: currentThread == objectThread yes Evaluation Count:2598 | yes Evaluation Count:39 |
| 39-2598 |
2115 | ? Qt::DirectConnection executed (the execution status of this line is deduced): ? Qt::DirectConnection | - |
2116 | : Qt::QueuedConnection; executed (the execution status of this line is deduced): : Qt::QueuedConnection; | - |
2117 | } executed: } Execution Count:2637 | 2637 |
2118 | | - |
2119 | #ifdef QT_NO_THREAD | - |
2120 | if (connectionType == Qt::BlockingQueuedConnection) { | - |
2121 | connectionType = Qt::DirectConnection; | - |
2122 | } | - |
2123 | #endif | - |
2124 | | - |
2125 | // invoke! | - |
2126 | void *param[] = { executed (the execution status of this line is deduced): void *param[] = { | - |
2127 | returnValue.data(), executed (the execution status of this line is deduced): returnValue.data(), | - |
2128 | val0.data(), executed (the execution status of this line is deduced): val0.data(), | - |
2129 | val1.data(), executed (the execution status of this line is deduced): val1.data(), | - |
2130 | val2.data(), executed (the execution status of this line is deduced): val2.data(), | - |
2131 | val3.data(), executed (the execution status of this line is deduced): val3.data(), | - |
2132 | val4.data(), executed (the execution status of this line is deduced): val4.data(), | - |
2133 | val5.data(), executed (the execution status of this line is deduced): val5.data(), | - |
2134 | val6.data(), executed (the execution status of this line is deduced): val6.data(), | - |
2135 | val7.data(), executed (the execution status of this line is deduced): val7.data(), | - |
2136 | val8.data(), executed (the execution status of this line is deduced): val8.data(), | - |
2137 | val9.data() executed (the execution status of this line is deduced): val9.data() | - |
2138 | }; executed (the execution status of this line is deduced): }; | - |
2139 | int idx_relative = QMetaMethodPrivate::get(this)->ownMethodIndex(); executed (the execution status of this line is deduced): int idx_relative = QMetaMethodPrivate::get(this)->ownMethodIndex(); | - |
2140 | int idx_offset = mobj->methodOffset(); executed (the execution status of this line is deduced): int idx_offset = mobj->methodOffset(); | - |
2141 | Q_ASSERT(QMetaObjectPrivate::get(mobj)->revision >= 6); executed (the execution status of this line is deduced): qt_noop(); | - |
2142 | QObjectPrivate::StaticMetaCallFunction callFunction = mobj->d.static_metacall; executed (the execution status of this line is deduced): QObjectPrivate::StaticMetaCallFunction callFunction = mobj->d.static_metacall; | - |
2143 | | - |
2144 | if (connectionType == Qt::DirectConnection) { evaluated: connectionType == Qt::DirectConnection yes Evaluation Count:143065 | yes Evaluation Count:73715 |
| 73715-143065 |
2145 | if (callFunction) { evaluated: callFunction yes Evaluation Count:143049 | yes Evaluation Count:16 |
| 16-143049 |
2146 | callFunction(object, QMetaObject::InvokeMetaMethod, idx_relative, param); executed (the execution status of this line is deduced): callFunction(object, QMetaObject::InvokeMetaMethod, idx_relative, param); | - |
2147 | return true; executed: return true; Execution Count:143041 | 143041 |
2148 | } else { | - |
2149 | return QMetaObject::metacall(object, QMetaObject::InvokeMetaMethod, idx_relative + idx_offset, param) < 0; executed: return QMetaObject::metacall(object, QMetaObject::InvokeMetaMethod, idx_relative + idx_offset, param) < 0; Execution Count:16 | 16 |
2150 | } | - |
2151 | } else if (connectionType == Qt::QueuedConnection) { evaluated: connectionType == Qt::QueuedConnection yes Evaluation Count:73678 | yes Evaluation Count:37 |
| 37-73678 |
2152 | if (returnValue.data()) { evaluated: returnValue.data() yes Evaluation Count:1 | yes Evaluation Count:73677 |
| 1-73677 |
2153 | qWarning("QMetaMethod::invoke: Unable to invoke methods with return values in " executed (the execution status of this line is deduced): QMessageLogger("kernel/qmetaobject.cpp", 2153, __PRETTY_FUNCTION__).warning("QMetaMethod::invoke: Unable to invoke methods with return values in " | - |
2154 | "queued connections"); executed (the execution status of this line is deduced): "queued connections"); | - |
2155 | return false; executed: return false; Execution Count:1 | 1 |
2156 | } | - |
2157 | | - |
2158 | int nargs = 1; // include return type executed (the execution status of this line is deduced): int nargs = 1; | - |
2159 | void **args = (void **) malloc(paramCount * sizeof(void *)); executed (the execution status of this line is deduced): void **args = (void **) malloc(paramCount * sizeof(void *)); | - |
2160 | Q_CHECK_PTR(args); never executed: qBadAlloc(); executed: } Execution Count:73677 partially evaluated: !(args) no Evaluation Count:0 | yes Evaluation Count:73677 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:73677 |
| 0-73677 |
2161 | int *types = (int *) malloc(paramCount * sizeof(int)); executed (the execution status of this line is deduced): int *types = (int *) malloc(paramCount * sizeof(int)); | - |
2162 | Q_CHECK_PTR(types); never executed: qBadAlloc(); executed: } Execution Count:73677 partially evaluated: !(types) no Evaluation Count:0 | yes Evaluation Count:73677 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:73677 |
| 0-73677 |
2163 | types[0] = 0; // return type executed (the execution status of this line is deduced): types[0] = 0; | - |
2164 | args[0] = 0; executed (the execution status of this line is deduced): args[0] = 0; | - |
2165 | | - |
2166 | for (int i = 1; i < paramCount; ++i) { evaluated: i < paramCount yes Evaluation Count:21161 | yes Evaluation Count:73676 |
| 21161-73676 |
2167 | types[i] = QMetaType::type(typeNames[i]); executed (the execution status of this line is deduced): types[i] = QMetaType::type(typeNames[i]); | - |
2168 | if (types[i] != QMetaType::UnknownType) { evaluated: types[i] != QMetaType::UnknownType yes Evaluation Count:21160 | yes Evaluation Count:1 |
| 1-21160 |
2169 | args[i] = QMetaType::create(types[i], param[i]); executed (the execution status of this line is deduced): args[i] = QMetaType::create(types[i], param[i]); | - |
2170 | ++nargs; executed (the execution status of this line is deduced): ++nargs; | - |
2171 | } else if (param[i]) { executed: } Execution Count:21160 partially evaluated: param[i] yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-21160 |
2172 | // Try to register the type and try again before reporting an error. | - |
2173 | void *argv[] = { &types[i], &i }; executed (the execution status of this line is deduced): void *argv[] = { &types[i], &i }; | - |
2174 | QMetaObject::metacall(object, QMetaObject::RegisterMethodArgumentMetaType, executed (the execution status of this line is deduced): QMetaObject::metacall(object, QMetaObject::RegisterMethodArgumentMetaType, | - |
2175 | idx_relative + idx_offset, argv); executed (the execution status of this line is deduced): idx_relative + idx_offset, argv); | - |
2176 | if (types[i] == -1) { partially evaluated: types[i] == -1 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2177 | qWarning("QMetaMethod::invoke: Unable to handle unregistered datatype '%s'", executed (the execution status of this line is deduced): QMessageLogger("kernel/qmetaobject.cpp", 2177, __PRETTY_FUNCTION__).warning("QMetaMethod::invoke: Unable to handle unregistered datatype '%s'", | - |
2178 | typeNames[i]); executed (the execution status of this line is deduced): typeNames[i]); | - |
2179 | for (int x = 1; x < i; ++x) { partially evaluated: x < i no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2180 | if (types[x] && args[x]) never evaluated: types[x] never evaluated: args[x] | 0 |
2181 | QMetaType::destroy(types[x], args[x]); never executed: QMetaType::destroy(types[x], args[x]); | 0 |
2182 | } | 0 |
2183 | free(types); executed (the execution status of this line is deduced): free(types); | - |
2184 | free(args); executed (the execution status of this line is deduced): free(args); | - |
2185 | return false; executed: return false; Execution Count:1 | 1 |
2186 | } | - |
2187 | } | 0 |
2188 | } | - |
2189 | | - |
2190 | QCoreApplication::postEvent(object, new QMetaCallEvent(idx_offset, idx_relative, callFunction, executed (the execution status of this line is deduced): QCoreApplication::postEvent(object, new QMetaCallEvent(idx_offset, idx_relative, callFunction, | - |
2191 | 0, -1, nargs, types, args)); executed (the execution status of this line is deduced): 0, -1, nargs, types, args)); | - |
2192 | } else { // blocking queued connection executed: } Execution Count:73676 | 73676 |
2193 | #ifndef QT_NO_THREAD | - |
2194 | if (currentThread == objectThread) { partially evaluated: currentThread == objectThread no Evaluation Count:0 | yes Evaluation Count:37 |
| 0-37 |
2195 | qWarning("QMetaMethod::invoke: Dead lock detected in " never executed (the execution status of this line is deduced): QMessageLogger("kernel/qmetaobject.cpp", 2195, __PRETTY_FUNCTION__).warning("QMetaMethod::invoke: Dead lock detected in " | - |
2196 | "BlockingQueuedConnection: Receiver is %s(%p)", never executed (the execution status of this line is deduced): "BlockingQueuedConnection: Receiver is %s(%p)", | - |
2197 | mobj->className(), object); never executed (the execution status of this line is deduced): mobj->className(), object); | - |
2198 | } | 0 |
2199 | | - |
2200 | QSemaphore semaphore; executed (the execution status of this line is deduced): QSemaphore semaphore; | - |
2201 | QCoreApplication::postEvent(object, new QMetaCallEvent(idx_offset, idx_relative, callFunction, executed (the execution status of this line is deduced): QCoreApplication::postEvent(object, new QMetaCallEvent(idx_offset, idx_relative, callFunction, | - |
2202 | 0, -1, 0, 0, param, &semaphore)); executed (the execution status of this line is deduced): 0, -1, 0, 0, param, &semaphore)); | - |
2203 | semaphore.acquire(); executed (the execution status of this line is deduced): semaphore.acquire(); | - |
2204 | #endif // QT_NO_THREAD | - |
2205 | } executed: } Execution Count:37 | 37 |
2206 | return true; executed: return true; Execution Count:73713 | 73713 |
2207 | } | - |
2208 | | - |
2209 | /*! \fn bool QMetaMethod::invoke(QObject *object, | - |
2210 | QGenericReturnArgument returnValue, | - |
2211 | QGenericArgument val0 = QGenericArgument(0), | - |
2212 | QGenericArgument val1 = QGenericArgument(), | - |
2213 | QGenericArgument val2 = QGenericArgument(), | - |
2214 | QGenericArgument val3 = QGenericArgument(), | - |
2215 | QGenericArgument val4 = QGenericArgument(), | - |
2216 | QGenericArgument val5 = QGenericArgument(), | - |
2217 | QGenericArgument val6 = QGenericArgument(), | - |
2218 | QGenericArgument val7 = QGenericArgument(), | - |
2219 | QGenericArgument val8 = QGenericArgument(), | - |
2220 | QGenericArgument val9 = QGenericArgument()) const | - |
2221 | \overload invoke() | - |
2222 | | - |
2223 | This overload always invokes this method using the connection type Qt::AutoConnection. | - |
2224 | */ | - |
2225 | | - |
2226 | /*! \fn bool QMetaMethod::invoke(QObject *object, | - |
2227 | Qt::ConnectionType connectionType, | - |
2228 | QGenericArgument val0 = QGenericArgument(0), | - |
2229 | QGenericArgument val1 = QGenericArgument(), | - |
2230 | QGenericArgument val2 = QGenericArgument(), | - |
2231 | QGenericArgument val3 = QGenericArgument(), | - |
2232 | QGenericArgument val4 = QGenericArgument(), | - |
2233 | QGenericArgument val5 = QGenericArgument(), | - |
2234 | QGenericArgument val6 = QGenericArgument(), | - |
2235 | QGenericArgument val7 = QGenericArgument(), | - |
2236 | QGenericArgument val8 = QGenericArgument(), | - |
2237 | QGenericArgument val9 = QGenericArgument()) const | - |
2238 | | - |
2239 | \overload invoke() | - |
2240 | | - |
2241 | This overload can be used if the return value of the member is of no interest. | - |
2242 | */ | - |
2243 | | - |
2244 | /*! | - |
2245 | \fn bool QMetaMethod::invoke(QObject *object, | - |
2246 | QGenericArgument val0 = QGenericArgument(0), | - |
2247 | QGenericArgument val1 = QGenericArgument(), | - |
2248 | QGenericArgument val2 = QGenericArgument(), | - |
2249 | QGenericArgument val3 = QGenericArgument(), | - |
2250 | QGenericArgument val4 = QGenericArgument(), | - |
2251 | QGenericArgument val5 = QGenericArgument(), | - |
2252 | QGenericArgument val6 = QGenericArgument(), | - |
2253 | QGenericArgument val7 = QGenericArgument(), | - |
2254 | QGenericArgument val8 = QGenericArgument(), | - |
2255 | QGenericArgument val9 = QGenericArgument()) const | - |
2256 | | - |
2257 | \overload invoke() | - |
2258 | | - |
2259 | This overload invokes this method using the | - |
2260 | connection type Qt::AutoConnection and ignores return values. | - |
2261 | */ | - |
2262 | | - |
2263 | /*! | - |
2264 | \class QMetaEnum | - |
2265 | \inmodule QtCore | - |
2266 | \brief The QMetaEnum class provides meta-data about an enumerator. | - |
2267 | | - |
2268 | \ingroup objectmodel | - |
2269 | | - |
2270 | Use name() for the enumerator's name. The enumerator's keys (names | - |
2271 | of each enumerated item) are returned by key(); use keyCount() to find | - |
2272 | the number of keys. isFlag() returns whether the enumerator is | - |
2273 | meant to be used as a flag, meaning that its values can be combined | - |
2274 | using the OR operator. | - |
2275 | | - |
2276 | The conversion functions keyToValue(), valueToKey(), keysToValue(), | - |
2277 | and valueToKeys() allow conversion between the integer | - |
2278 | representation of an enumeration or set value and its literal | - |
2279 | representation. The scope() function returns the class scope this | - |
2280 | enumerator was declared in. | - |
2281 | | - |
2282 | \sa QMetaObject, QMetaMethod, QMetaProperty | - |
2283 | */ | - |
2284 | | - |
2285 | /*! | - |
2286 | \fn bool QMetaEnum::isValid() const | - |
2287 | | - |
2288 | Returns true if this enum is valid (has a name); otherwise returns | - |
2289 | false. | - |
2290 | | - |
2291 | \sa name() | - |
2292 | */ | - |
2293 | | - |
2294 | /*! | - |
2295 | \fn const QMetaObject *QMetaEnum::enclosingMetaObject() const | - |
2296 | \internal | - |
2297 | */ | - |
2298 | | - |
2299 | | - |
2300 | /*! | - |
2301 | \fn QMetaEnum::QMetaEnum() | - |
2302 | \internal | - |
2303 | */ | - |
2304 | | - |
2305 | /*! | - |
2306 | Returns the name of the enumerator (without the scope). | - |
2307 | | - |
2308 | For example, the Qt::AlignmentFlag enumeration has \c | - |
2309 | AlignmentFlag as the name and \l Qt as the scope. | - |
2310 | | - |
2311 | \sa isValid(), scope() | - |
2312 | */ | - |
2313 | const char *QMetaEnum::name() const | - |
2314 | { | - |
2315 | if (!mobj) evaluated: !mobj yes Evaluation Count:583 | yes Evaluation Count:365 |
| 365-583 |
2316 | return 0; executed: return 0; Execution Count:583 | 583 |
2317 | return rawStringData(mobj, mobj->d.data[handle]); executed: return rawStringData(mobj, mobj->d.data[handle]); Execution Count:365 | 365 |
2318 | } | - |
2319 | | - |
2320 | /*! | - |
2321 | Returns the number of keys. | - |
2322 | | - |
2323 | \sa key() | - |
2324 | */ | - |
2325 | int QMetaEnum::keyCount() const | - |
2326 | { | - |
2327 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:24 |
| 0-24 |
2328 | return 0; never executed: return 0; | 0 |
2329 | return mobj->d.data[handle + 2]; executed: return mobj->d.data[handle + 2]; Execution Count:24 | 24 |
2330 | } | - |
2331 | | - |
2332 | | - |
2333 | /*! | - |
2334 | Returns the key with the given \a index, or 0 if no such key exists. | - |
2335 | | - |
2336 | \sa keyCount(), value(), valueToKey() | - |
2337 | */ | - |
2338 | const char *QMetaEnum::key(int index) const | - |
2339 | { | - |
2340 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:24 |
| 0-24 |
2341 | return 0; never executed: return 0; | 0 |
2342 | int count = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int count = mobj->d.data[handle + 2]; | - |
2343 | int data = mobj->d.data[handle + 3]; executed (the execution status of this line is deduced): int data = mobj->d.data[handle + 3]; | - |
2344 | if (index >= 0 && index < count) partially evaluated: index >= 0 yes Evaluation Count:24 | no Evaluation Count:0 |
partially evaluated: index < count yes Evaluation Count:24 | no Evaluation Count:0 |
| 0-24 |
2345 | return rawStringData(mobj, mobj->d.data[data + 2*index]); executed: return rawStringData(mobj, mobj->d.data[data + 2*index]); Execution Count:24 | 24 |
2346 | return 0; never executed: return 0; | 0 |
2347 | } | - |
2348 | | - |
2349 | /*! | - |
2350 | Returns the value with the given \a index; or returns -1 if there | - |
2351 | is no such value. | - |
2352 | | - |
2353 | \sa keyCount(), key(), keyToValue() | - |
2354 | */ | - |
2355 | int QMetaEnum::value(int index) const | - |
2356 | { | - |
2357 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:24 |
| 0-24 |
2358 | return 0; never executed: return 0; | 0 |
2359 | int count = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int count = mobj->d.data[handle + 2]; | - |
2360 | int data = mobj->d.data[handle + 3]; executed (the execution status of this line is deduced): int data = mobj->d.data[handle + 3]; | - |
2361 | if (index >= 0 && index < count) partially evaluated: index >= 0 yes Evaluation Count:24 | no Evaluation Count:0 |
partially evaluated: index < count yes Evaluation Count:24 | no Evaluation Count:0 |
| 0-24 |
2362 | return mobj->d.data[data + 2*index + 1]; executed: return mobj->d.data[data + 2*index + 1]; Execution Count:24 | 24 |
2363 | return -1; never executed: return -1; | 0 |
2364 | } | - |
2365 | | - |
2366 | | - |
2367 | /*! | - |
2368 | Returns true if this enumerator is used as a flag; otherwise returns | - |
2369 | false. | - |
2370 | | - |
2371 | When used as flags, enumerators can be combined using the OR | - |
2372 | operator. | - |
2373 | | - |
2374 | \sa keysToValue(), valueToKeys() | - |
2375 | */ | - |
2376 | bool QMetaEnum::isFlag() const | - |
2377 | { | - |
2378 | return mobj && mobj->d.data[handle + 1]; executed: return mobj && mobj->d.data[handle + 1]; Execution Count:30 | 30 |
2379 | } | - |
2380 | | - |
2381 | | - |
2382 | /*! | - |
2383 | Returns the scope this enumerator was declared in. | - |
2384 | | - |
2385 | For example, the Qt::AlignmentFlag enumeration has \c Qt as | - |
2386 | the scope and \c AlignmentFlag as the name. | - |
2387 | | - |
2388 | \sa name() | - |
2389 | */ | - |
2390 | const char *QMetaEnum::scope() const | - |
2391 | { | - |
2392 | return mobj?rawStringData(mobj, 0) : 0; executed: return mobj?rawStringData(mobj, 0) : 0; Execution Count:34 | 34 |
2393 | } | - |
2394 | | - |
2395 | /*! | - |
2396 | Returns the integer value of the given enumeration \a key, or -1 | - |
2397 | if \a key is not defined. | - |
2398 | | - |
2399 | If \a key is not defined, *\a{ok} is set to false; otherwise | - |
2400 | *\a{ok} is set to true. | - |
2401 | | - |
2402 | For flag types, use keysToValue(). | - |
2403 | | - |
2404 | \sa valueToKey(), isFlag(), keysToValue() | - |
2405 | */ | - |
2406 | int QMetaEnum::keyToValue(const char *key, bool *ok) const | - |
2407 | { | - |
2408 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
2409 | *ok = false; executed: *ok = false; Execution Count:12 | 12 |
2410 | if (!mobj || !key) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:12 |
partially evaluated: !key no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
2411 | return -1; never executed: return -1; | 0 |
2412 | uint scope = 0; executed (the execution status of this line is deduced): uint scope = 0; | - |
2413 | const char *qualified_key = key; executed (the execution status of this line is deduced): const char *qualified_key = key; | - |
2414 | const char *s = key + qstrlen(key); executed (the execution status of this line is deduced): const char *s = key + qstrlen(key); | - |
2415 | while (s > key && *s != ':') evaluated: s > key yes Evaluation Count:109 | yes Evaluation Count:9 |
evaluated: *s != ':' yes Evaluation Count:106 | yes Evaluation Count:3 |
| 3-109 |
2416 | --s; executed: --s; Execution Count:106 | 106 |
2417 | if (s > key && *(s-1)==':') { evaluated: s > key yes Evaluation Count:3 | yes Evaluation Count:9 |
partially evaluated: *(s-1)==':' yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-9 |
2418 | scope = s - key - 1; executed (the execution status of this line is deduced): scope = s - key - 1; | - |
2419 | key += scope + 2; executed (the execution status of this line is deduced): key += scope + 2; | - |
2420 | } executed: } Execution Count:3 | 3 |
2421 | int count = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int count = mobj->d.data[handle + 2]; | - |
2422 | int data = mobj->d.data[handle + 3]; executed (the execution status of this line is deduced): int data = mobj->d.data[handle + 3]; | - |
2423 | for (int i = 0; i < count; ++i) { evaluated: i < count yes Evaluation Count:26 | yes Evaluation Count:4 |
| 4-26 |
2424 | if ((!scope || (stringSize(mobj, 0) == int(scope) && strncmp(qualified_key, rawStringData(mobj, 0), scope) == 0)) evaluated: !scope yes Evaluation Count:18 | yes Evaluation Count:8 |
evaluated: stringSize(mobj, 0) == int(scope) yes Evaluation Count:2 | yes Evaluation Count:6 |
partially evaluated: strncmp(qualified_key, rawStringData(mobj, 0), scope) == 0 yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-18 |
2425 | && strcmp(key, rawStringData(mobj, mobj->d.data[data + 2*i])) == 0) { evaluated: strcmp(key, rawStringData(mobj, mobj->d.data[data + 2*i])) == 0 yes Evaluation Count:8 | yes Evaluation Count:12 |
| 8-12 |
2426 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
2427 | *ok = true; executed: *ok = true; Execution Count:8 | 8 |
2428 | return mobj->d.data[data + 2*i + 1]; executed: return mobj->d.data[data + 2*i + 1]; Execution Count:8 | 8 |
2429 | } | - |
2430 | } executed: } Execution Count:18 | 18 |
2431 | return -1; executed: return -1; Execution Count:4 | 4 |
2432 | } | - |
2433 | | - |
2434 | /*! | - |
2435 | Returns the string that is used as the name of the given | - |
2436 | enumeration \a value, or 0 if \a value is not defined. | - |
2437 | | - |
2438 | For flag types, use valueToKeys(). | - |
2439 | | - |
2440 | \sa isFlag(), valueToKeys() | - |
2441 | */ | - |
2442 | const char* QMetaEnum::valueToKey(int value) const | - |
2443 | { | - |
2444 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:1296 |
| 0-1296 |
2445 | return 0; never executed: return 0; | 0 |
2446 | int count = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int count = mobj->d.data[handle + 2]; | - |
2447 | int data = mobj->d.data[handle + 3]; executed (the execution status of this line is deduced): int data = mobj->d.data[handle + 3]; | - |
2448 | for (int i = 0; i < count; ++i) partially evaluated: i < count yes Evaluation Count:4164 | no Evaluation Count:0 |
| 0-4164 |
2449 | if (value == (int)mobj->d.data[data + 2*i + 1]) evaluated: value == (int)mobj->d.data[data + 2*i + 1] yes Evaluation Count:1296 | yes Evaluation Count:2868 |
| 1296-2868 |
2450 | return rawStringData(mobj, mobj->d.data[data + 2*i]); executed: return rawStringData(mobj, mobj->d.data[data + 2*i]); Execution Count:1296 | 1296 |
2451 | return 0; never executed: return 0; | 0 |
2452 | } | - |
2453 | | - |
2454 | /*! | - |
2455 | Returns the value derived from combining together the values of | - |
2456 | the \a keys using the OR operator, or -1 if \a keys is not | - |
2457 | defined. Note that the strings in \a keys must be '|'-separated. | - |
2458 | | - |
2459 | If \a keys is not defined, *\a{ok} is set to false; otherwise | - |
2460 | *\a{ok} is set to true. | - |
2461 | | - |
2462 | \sa isFlag(), valueToKey(), valueToKeys() | - |
2463 | */ | - |
2464 | int QMetaEnum::keysToValue(const char *keys, bool *ok) const | - |
2465 | { | - |
2466 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
2467 | *ok = false; executed: *ok = false; Execution Count:12 | 12 |
2468 | if (!mobj || !keys) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:12 |
partially evaluated: !keys no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
2469 | return -1; never executed: return -1; | 0 |
2470 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
2471 | *ok = true; executed: *ok = true; Execution Count:12 | 12 |
2472 | QStringList l = QString::fromLatin1(keys).split(QLatin1Char('|')); executed (the execution status of this line is deduced): QStringList l = QString::fromLatin1(keys).split(QLatin1Char('|')); | - |
2473 | if (l.isEmpty()) partially evaluated: l.isEmpty() no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
2474 | return 0; never executed: return 0; | 0 |
2475 | //#### TODO write proper code, do not use QStringList | - |
2476 | int value = 0; executed (the execution status of this line is deduced): int value = 0; | - |
2477 | int count = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int count = mobj->d.data[handle + 2]; | - |
2478 | int data = mobj->d.data[handle + 3]; executed (the execution status of this line is deduced): int data = mobj->d.data[handle + 3]; | - |
2479 | for (int li = 0; li < l.size(); ++li) { evaluated: li < l.size() yes Evaluation Count:19 | yes Evaluation Count:12 |
| 12-19 |
2480 | QString trimmed = l.at(li).trimmed(); executed (the execution status of this line is deduced): QString trimmed = l.at(li).trimmed(); | - |
2481 | QByteArray qualified_key = trimmed.toLatin1(); executed (the execution status of this line is deduced): QByteArray qualified_key = trimmed.toLatin1(); | - |
2482 | const char *key = qualified_key.constData(); executed (the execution status of this line is deduced): const char *key = qualified_key.constData(); | - |
2483 | uint scope = 0; executed (the execution status of this line is deduced): uint scope = 0; | - |
2484 | const char *s = key + qstrlen(key); executed (the execution status of this line is deduced): const char *s = key + qstrlen(key); | - |
2485 | while (s > key && *s != ':') evaluated: s > key yes Evaluation Count:156 | yes Evaluation Count:7 |
evaluated: *s != ':' yes Evaluation Count:144 | yes Evaluation Count:12 |
| 7-156 |
2486 | --s; executed: --s; Execution Count:144 | 144 |
2487 | if (s > key && *(s-1)==':') { evaluated: s > key yes Evaluation Count:12 | yes Evaluation Count:7 |
partially evaluated: *(s-1)==':' yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
2488 | scope = s - key - 1; executed (the execution status of this line is deduced): scope = s - key - 1; | - |
2489 | key += scope + 2; executed (the execution status of this line is deduced): key += scope + 2; | - |
2490 | } executed: } Execution Count:12 | 12 |
2491 | int i; executed (the execution status of this line is deduced): int i; | - |
2492 | for (i = count-1; i >= 0; --i) evaluated: i >= 0 yes Evaluation Count:48 | yes Evaluation Count:7 |
| 7-48 |
2493 | if ((!scope || (stringSize(mobj, 0) == int(scope) && strncmp(qualified_key.constData(), rawStringData(mobj, 0), scope) == 0)) evaluated: !scope yes Evaluation Count:17 | yes Evaluation Count:31 |
evaluated: stringSize(mobj, 0) == int(scope) yes Evaluation Count:13 | yes Evaluation Count:18 |
partially evaluated: strncmp(qualified_key.constData(), rawStringData(mobj, 0), scope) == 0 yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-31 |
2494 | && strcmp(key, rawStringData(mobj, mobj->d.data[data + 2*i])) == 0) { evaluated: strcmp(key, rawStringData(mobj, mobj->d.data[data + 2*i])) == 0 yes Evaluation Count:12 | yes Evaluation Count:18 |
| 12-18 |
2495 | value |= mobj->d.data[data + 2*i + 1]; executed (the execution status of this line is deduced): value |= mobj->d.data[data + 2*i + 1]; | - |
2496 | break; executed: break; Execution Count:12 | 12 |
2497 | } | - |
2498 | if (i < 0) { evaluated: i < 0 yes Evaluation Count:7 | yes Evaluation Count:12 |
| 7-12 |
2499 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
2500 | *ok = false; executed: *ok = false; Execution Count:7 | 7 |
2501 | value |= -1; executed (the execution status of this line is deduced): value |= -1; | - |
2502 | } executed: } Execution Count:7 | 7 |
2503 | } executed: } Execution Count:19 | 19 |
2504 | return value; executed: return value; Execution Count:12 | 12 |
2505 | } | - |
2506 | | - |
2507 | /*! | - |
2508 | Returns a byte array of '|'-separated keys that represents the | - |
2509 | given \a value. | - |
2510 | | - |
2511 | \sa isFlag(), valueToKey(), keysToValue() | - |
2512 | */ | - |
2513 | QByteArray QMetaEnum::valueToKeys(int value) const | - |
2514 | { | - |
2515 | QByteArray keys; executed (the execution status of this line is deduced): QByteArray keys; | - |
2516 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2517 | return keys; never executed: return keys; | 0 |
2518 | int count = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int count = mobj->d.data[handle + 2]; | - |
2519 | int data = mobj->d.data[handle + 3]; executed (the execution status of this line is deduced): int data = mobj->d.data[handle + 3]; | - |
2520 | int v = value; executed (the execution status of this line is deduced): int v = value; | - |
2521 | for(int i = 0; i < count; i++) { evaluated: i < count yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
2522 | int k = mobj->d.data[data + 2*i + 1]; executed (the execution status of this line is deduced): int k = mobj->d.data[data + 2*i + 1]; | - |
2523 | if ((k != 0 && (v & k) == k ) || (k == value)) { partially evaluated: k != 0 yes Evaluation Count:3 | no Evaluation Count:0 |
evaluated: (v & k) == k yes Evaluation Count:2 | yes Evaluation Count:1 |
partially evaluated: (k == value) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-3 |
2524 | v = v & ~k; executed (the execution status of this line is deduced): v = v & ~k; | - |
2525 | if (!keys.isEmpty()) evaluated: !keys.isEmpty() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
2526 | keys += '|'; executed: keys += '|'; Execution Count:1 | 1 |
2527 | keys += stringData(mobj, mobj->d.data[data + 2*i]); executed (the execution status of this line is deduced): keys += stringData(mobj, mobj->d.data[data + 2*i]); | - |
2528 | } executed: } Execution Count:2 | 2 |
2529 | } executed: } Execution Count:3 | 3 |
2530 | return keys; executed: return keys; Execution Count:1 | 1 |
2531 | } | - |
2532 | | - |
2533 | static QByteArray qualifiedName(const QMetaEnum &e) | - |
2534 | { | - |
2535 | return QByteArray(e.scope()) + "::" + e.name(); executed: return QByteArray(e.scope()) + "::" + e.name(); Execution Count:24 | 24 |
2536 | } | - |
2537 | | - |
2538 | /*! | - |
2539 | \class QMetaProperty | - |
2540 | \inmodule QtCore | - |
2541 | \brief The QMetaProperty class provides meta-data about a property. | - |
2542 | | - |
2543 | \ingroup objectmodel | - |
2544 | | - |
2545 | Property meta-data is obtained from an object's meta-object. See | - |
2546 | QMetaObject::property() and QMetaObject::propertyCount() for | - |
2547 | details. | - |
2548 | | - |
2549 | \section1 Property Meta-Data | - |
2550 | | - |
2551 | A property has a name() and a type(), as well as various | - |
2552 | attributes that specify its behavior: isReadable(), isWritable(), | - |
2553 | isDesignable(), isScriptable(), and isStored(). | - |
2554 | | - |
2555 | If the property is an enumeration, isEnumType() returns true; if the | - |
2556 | property is an enumeration that is also a flag (i.e. its values | - |
2557 | can be combined using the OR operator), isEnumType() and | - |
2558 | isFlagType() both return true. The enumerator for these types is | - |
2559 | available from enumerator(). | - |
2560 | | - |
2561 | The property's values are set and retrieved with read(), write(), | - |
2562 | and reset(); they can also be changed through QObject's set and get | - |
2563 | functions. See QObject::setProperty() and QObject::property() for | - |
2564 | details. | - |
2565 | | - |
2566 | \section1 Copying and Assignment | - |
2567 | | - |
2568 | QMetaProperty objects can be copied by value. However, each copy will | - |
2569 | refer to the same underlying property meta-data. | - |
2570 | | - |
2571 | \sa QMetaObject, QMetaEnum, QMetaMethod, {Qt's Property System} | - |
2572 | */ | - |
2573 | | - |
2574 | /*! | - |
2575 | \fn bool QMetaProperty::isValid() const | - |
2576 | | - |
2577 | Returns true if this property is valid (readable); otherwise | - |
2578 | returns false. | - |
2579 | | - |
2580 | \sa isReadable() | - |
2581 | */ | - |
2582 | | - |
2583 | /*! | - |
2584 | \fn const QMetaObject *QMetaProperty::enclosingMetaObject() const | - |
2585 | \internal | - |
2586 | */ | - |
2587 | | - |
2588 | /*! | - |
2589 | \internal | - |
2590 | */ | - |
2591 | QMetaProperty::QMetaProperty() | - |
2592 | : mobj(0), handle(0), idx(0) | - |
2593 | { | - |
2594 | } executed: } Execution Count:13972 | 13972 |
2595 | | - |
2596 | | - |
2597 | /*! | - |
2598 | Returns this property's name. | - |
2599 | | - |
2600 | \sa type(), typeName() | - |
2601 | */ | - |
2602 | const char *QMetaProperty::name() const | - |
2603 | { | - |
2604 | if (!mobj) evaluated: !mobj yes Evaluation Count:3 | yes Evaluation Count:515 |
| 3-515 |
2605 | return 0; executed: return 0; Execution Count:3 | 3 |
2606 | int handle = priv(mobj->d.data)->propertyData + 3*idx; executed (the execution status of this line is deduced): int handle = priv(mobj->d.data)->propertyData + 3*idx; | - |
2607 | return rawStringData(mobj, mobj->d.data[handle]); executed: return rawStringData(mobj, mobj->d.data[handle]); Execution Count:515 | 515 |
2608 | } | - |
2609 | | - |
2610 | /*! | - |
2611 | Returns the name of this property's type. | - |
2612 | | - |
2613 | \sa type(), name() | - |
2614 | */ | - |
2615 | const char *QMetaProperty::typeName() const | - |
2616 | { | - |
2617 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:102 |
| 0-102 |
2618 | return 0; never executed: return 0; | 0 |
2619 | int handle = priv(mobj->d.data)->propertyData + 3*idx; executed (the execution status of this line is deduced): int handle = priv(mobj->d.data)->propertyData + 3*idx; | - |
2620 | return rawTypeNameFromTypeInfo(mobj, mobj->d.data[handle + 1]); executed: return rawTypeNameFromTypeInfo(mobj, mobj->d.data[handle + 1]); Execution Count:102 | 102 |
2621 | } | - |
2622 | | - |
2623 | /*! | - |
2624 | Returns this property's type. The return value is one | - |
2625 | of the values of the QVariant::Type enumeration. | - |
2626 | | - |
2627 | \sa userType(), typeName(), name() | - |
2628 | */ | - |
2629 | QVariant::Type QMetaProperty::type() const | - |
2630 | { | - |
2631 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:180 |
| 0-180 |
2632 | return QVariant::Invalid; never executed: return QVariant::Invalid; | 0 |
2633 | int handle = priv(mobj->d.data)->propertyData + 3*idx; executed (the execution status of this line is deduced): int handle = priv(mobj->d.data)->propertyData + 3*idx; | - |
2634 | | - |
2635 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
2636 | uint type = typeFromTypeInfo(mobj, mobj->d.data[handle + 1]); executed (the execution status of this line is deduced): uint type = typeFromTypeInfo(mobj, mobj->d.data[handle + 1]); | - |
2637 | if (type >= QMetaType::User) evaluated: type >= QMetaType::User yes Evaluation Count:26 | yes Evaluation Count:154 |
| 26-154 |
2638 | return QVariant::UserType; executed: return QVariant::UserType; Execution Count:26 | 26 |
2639 | if (type != QMetaType::UnknownType) evaluated: type != QMetaType::UnknownType yes Evaluation Count:150 | yes Evaluation Count:4 |
| 4-150 |
2640 | return QVariant::Type(type); executed: return QVariant::Type(type); Execution Count:150 | 150 |
2641 | if (isEnumType()) { evaluated: isEnumType() yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
2642 | int enumMetaTypeId = QMetaType::type(qualifiedName(menum)); executed (the execution status of this line is deduced): int enumMetaTypeId = QMetaType::type(qualifiedName(menum)); | - |
2643 | if (enumMetaTypeId == QMetaType::UnknownType) evaluated: enumMetaTypeId == QMetaType::UnknownType yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
2644 | return QVariant::Int; executed: return QVariant::Int; Execution Count:2 | 2 |
2645 | } executed: } Execution Count:1 | 1 |
2646 | #ifdef QT_COORD_TYPE | - |
2647 | // qreal metatype must be resolved at runtime. | - |
2648 | if (strcmp(typeName(), "qreal") == 0) | - |
2649 | return QVariant::Type(qMetaTypeId<qreal>()); | - |
2650 | #endif | - |
2651 | | - |
2652 | return QVariant::UserType; executed: return QVariant::UserType; Execution Count:2 | 2 |
2653 | } | - |
2654 | | - |
2655 | /*! | - |
2656 | \since 4.2 | - |
2657 | | - |
2658 | Returns this property's user type. The return value is one | - |
2659 | of the values that are registered with QMetaType, or QMetaType::UnknownType if | - |
2660 | the type is not registered. | - |
2661 | | - |
2662 | \sa type(), QMetaType, typeName() | - |
2663 | */ | - |
2664 | int QMetaProperty::userType() const | - |
2665 | { | - |
2666 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
2667 | return QMetaType::UnknownType; never executed: return QMetaType::UnknownType; | 0 |
2668 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
2669 | int handle = priv(mobj->d.data)->propertyData + 3*idx; executed (the execution status of this line is deduced): int handle = priv(mobj->d.data)->propertyData + 3*idx; | - |
2670 | int type = typeFromTypeInfo(mobj, mobj->d.data[handle + 1]); executed (the execution status of this line is deduced): int type = typeFromTypeInfo(mobj, mobj->d.data[handle + 1]); | - |
2671 | if (type != QMetaType::UnknownType) evaluated: type != QMetaType::UnknownType yes Evaluation Count:134 | yes Evaluation Count:2 |
| 2-134 |
2672 | return type; executed: return type; Execution Count:134 | 134 |
2673 | if (isEnumType()) { evaluated: isEnumType() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
2674 | int enumMetaTypeId = QMetaType::type(qualifiedName(menum)); executed (the execution status of this line is deduced): int enumMetaTypeId = QMetaType::type(qualifiedName(menum)); | - |
2675 | if (enumMetaTypeId == QMetaType::UnknownType) partially evaluated: enumMetaTypeId == QMetaType::UnknownType no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2676 | return QVariant::Int; // Match behavior of QMetaType::type() never executed: return QVariant::Int; | 0 |
2677 | return enumMetaTypeId; executed: return enumMetaTypeId; Execution Count:1 | 1 |
2678 | } | - |
2679 | type = QMetaType::type(typeName()); executed (the execution status of this line is deduced): type = QMetaType::type(typeName()); | - |
2680 | if (type != QMetaType::UnknownType) partially evaluated: type != QMetaType::UnknownType no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2681 | return type; never executed: return type; | 0 |
2682 | void *argv[] = { &type }; executed (the execution status of this line is deduced): void *argv[] = { &type }; | - |
2683 | mobj->static_metacall(QMetaObject::RegisterPropertyMetaType, idx, argv); executed (the execution status of this line is deduced): mobj->static_metacall(QMetaObject::RegisterPropertyMetaType, idx, argv); | - |
2684 | if (type != -1) partially evaluated: type != -1 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2685 | return type; executed: return type; Execution Count:1 | 1 |
2686 | return QMetaType::UnknownType; never executed: return QMetaType::UnknownType; | 0 |
2687 | } | - |
2688 | | - |
2689 | /*! | - |
2690 | \since 4.6 | - |
2691 | | - |
2692 | Returns this property's index. | - |
2693 | */ | - |
2694 | int QMetaProperty::propertyIndex() const | - |
2695 | { | - |
2696 | if (!mobj) | 0 |
2697 | return -1; never executed: return -1; | 0 |
2698 | return idx + mobj->propertyOffset(); never executed: return idx + mobj->propertyOffset(); | 0 |
2699 | } | - |
2700 | | - |
2701 | /*! | - |
2702 | Returns true if the property's type is an enumeration value that | - |
2703 | is used as a flag; otherwise returns false. | - |
2704 | | - |
2705 | Flags can be combined using the OR operator. A flag type is | - |
2706 | implicitly also an enum type. | - |
2707 | | - |
2708 | \sa isEnumType(), enumerator(), QMetaEnum::isFlag() | - |
2709 | */ | - |
2710 | | - |
2711 | bool QMetaProperty::isFlagType() const | - |
2712 | { | - |
2713 | return isEnumType() && menum.isFlag(); executed: return isEnumType() && menum.isFlag(); Execution Count:83 | 83 |
2714 | } | - |
2715 | | - |
2716 | /*! | - |
2717 | Returns true if the property's type is an enumeration value; | - |
2718 | otherwise returns false. | - |
2719 | | - |
2720 | \sa enumerator(), isFlagType() | - |
2721 | */ | - |
2722 | bool QMetaProperty::isEnumType() const | - |
2723 | { | - |
2724 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:9277 |
| 0-9277 |
2725 | return false; never executed: return false; | 0 |
2726 | int handle = priv(mobj->d.data)->propertyData + 3*idx; executed (the execution status of this line is deduced): int handle = priv(mobj->d.data)->propertyData + 3*idx; | - |
2727 | int flags = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int flags = mobj->d.data[handle + 2]; | - |
2728 | return (flags & EnumOrFlag) && menum.name(); executed: return (flags & EnumOrFlag) && menum.name(); Execution Count:9277 | 9277 |
2729 | } | - |
2730 | | - |
2731 | /*! | - |
2732 | \internal | - |
2733 | | - |
2734 | Returns true if the property has a C++ setter function that | - |
2735 | follows Qt's standard "name" / "setName" pattern. Designer and uic | - |
2736 | query hasStdCppSet() in order to avoid expensive | - |
2737 | QObject::setProperty() calls. All properties in Qt [should] follow | - |
2738 | this pattern. | - |
2739 | */ | - |
2740 | bool QMetaProperty::hasStdCppSet() const | - |
2741 | { | - |
2742 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:54 |
| 0-54 |
2743 | return false; never executed: return false; | 0 |
2744 | int handle = priv(mobj->d.data)->propertyData + 3*idx; executed (the execution status of this line is deduced): int handle = priv(mobj->d.data)->propertyData + 3*idx; | - |
2745 | int flags = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int flags = mobj->d.data[handle + 2]; | - |
2746 | return (flags & StdCppSet); executed: return (flags & StdCppSet); Execution Count:54 | 54 |
2747 | } | - |
2748 | | - |
2749 | /*! | - |
2750 | Returns the enumerator if this property's type is an enumerator | - |
2751 | type; otherwise the returned value is undefined. | - |
2752 | | - |
2753 | \sa isEnumType(), isFlagType() | - |
2754 | */ | - |
2755 | QMetaEnum QMetaProperty::enumerator() const | - |
2756 | { | - |
2757 | return menum; executed: return menum; Execution Count:1 | 1 |
2758 | } | - |
2759 | | - |
2760 | /*! | - |
2761 | Reads the property's value from the given \a object. Returns the value | - |
2762 | if it was able to read it; otherwise returns an invalid variant. | - |
2763 | | - |
2764 | \sa write(), reset(), isReadable() | - |
2765 | */ | - |
2766 | QVariant QMetaProperty::read(const QObject *object) const | - |
2767 | { | - |
2768 | if (!object || !mobj) partially evaluated: !object no Evaluation Count:0 | yes Evaluation Count:8440 |
partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:8440 |
| 0-8440 |
2769 | return QVariant(); never executed: return QVariant(); | 0 |
2770 | | - |
2771 | uint t = QVariant::Int; executed (the execution status of this line is deduced): uint t = QVariant::Int; | - |
2772 | if (isEnumType()) { evaluated: isEnumType() yes Evaluation Count:16 | yes Evaluation Count:8424 |
| 16-8424 |
2773 | /* | - |
2774 | try to create a QVariant that can be converted to this enum | - |
2775 | type (only works if the enum has already been registered | - |
2776 | with QMetaType) | - |
2777 | */ | - |
2778 | int enumMetaTypeId = QMetaType::type(qualifiedName(menum)); executed (the execution status of this line is deduced): int enumMetaTypeId = QMetaType::type(qualifiedName(menum)); | - |
2779 | if (enumMetaTypeId != QMetaType::UnknownType) evaluated: enumMetaTypeId != QMetaType::UnknownType yes Evaluation Count:7 | yes Evaluation Count:9 |
| 7-9 |
2780 | t = enumMetaTypeId; executed: t = enumMetaTypeId; Execution Count:7 | 7 |
2781 | } else { executed: } Execution Count:16 | 16 |
2782 | int handle = priv(mobj->d.data)->propertyData + 3*idx; executed (the execution status of this line is deduced): int handle = priv(mobj->d.data)->propertyData + 3*idx; | - |
2783 | const char *typeName = 0; executed (the execution status of this line is deduced): const char *typeName = 0; | - |
2784 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
2785 | uint typeInfo = mobj->d.data[handle + 1]; executed (the execution status of this line is deduced): uint typeInfo = mobj->d.data[handle + 1]; | - |
2786 | if (!(typeInfo & IsUnresolvedType)) evaluated: !(typeInfo & IsUnresolvedType) yes Evaluation Count:8398 | yes Evaluation Count:26 |
| 26-8398 |
2787 | t = typeInfo; executed: t = typeInfo; Execution Count:8398 | 8398 |
2788 | else { | - |
2789 | typeName = rawStringData(mobj, typeInfo & TypeNameIndexMask); executed (the execution status of this line is deduced): typeName = rawStringData(mobj, typeInfo & TypeNameIndexMask); | - |
2790 | t = QMetaType::type(typeName); executed (the execution status of this line is deduced): t = QMetaType::type(typeName); | - |
2791 | } executed: } Execution Count:26 | 26 |
2792 | if (t == QMetaType::UnknownType) { partially evaluated: t == QMetaType::UnknownType no Evaluation Count:0 | yes Evaluation Count:8424 |
| 0-8424 |
2793 | // Try to register the type and try again before reporting an error. | - |
2794 | int registerResult = -1; never executed (the execution status of this line is deduced): int registerResult = -1; | - |
2795 | void *argv[] = { ®isterResult }; never executed (the execution status of this line is deduced): void *argv[] = { ®isterResult }; | - |
2796 | QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::RegisterPropertyMetaType, never executed (the execution status of this line is deduced): QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::RegisterPropertyMetaType, | - |
2797 | idx + mobj->propertyOffset(), argv); never executed (the execution status of this line is deduced): idx + mobj->propertyOffset(), argv); | - |
2798 | if (registerResult == -1) { never evaluated: registerResult == -1 | 0 |
2799 | qWarning("QMetaProperty::read: Unable to handle unregistered datatype '%s' for property '%s::%s'", typeName, mobj->className(), name()); never executed (the execution status of this line is deduced): QMessageLogger("kernel/qmetaobject.cpp", 2799, __PRETTY_FUNCTION__).warning("QMetaProperty::read: Unable to handle unregistered datatype '%s' for property '%s::%s'", typeName, mobj->className(), name()); | - |
2800 | return QVariant(); never executed: return QVariant(); | 0 |
2801 | } | - |
2802 | t = registerResult; never executed (the execution status of this line is deduced): t = registerResult; | - |
2803 | } | 0 |
2804 | } executed: } Execution Count:8424 | 8424 |
2805 | | - |
2806 | // the status variable is changed by qt_metacall to indicate what it did | - |
2807 | // this feature is currently only used by Qt D-Bus and should not be depended | - |
2808 | // upon. Don't change it without looking into QDBusAbstractInterface first | - |
2809 | // -1 (unchanged): normal qt_metacall, result stored in argv[0] | - |
2810 | // changed: result stored directly in value | - |
2811 | int status = -1; executed (the execution status of this line is deduced): int status = -1; | - |
2812 | QVariant value; executed (the execution status of this line is deduced): QVariant value; | - |
2813 | void *argv[] = { 0, &value, &status }; executed (the execution status of this line is deduced): void *argv[] = { 0, &value, &status }; | - |
2814 | if (t == QMetaType::QVariant) { evaluated: t == QMetaType::QVariant yes Evaluation Count:4 | yes Evaluation Count:8436 |
| 4-8436 |
2815 | argv[0] = &value; executed (the execution status of this line is deduced): argv[0] = &value; | - |
2816 | } else { executed: } Execution Count:4 | 4 |
2817 | value = QVariant(t, (void*)0); executed (the execution status of this line is deduced): value = QVariant(t, (void*)0); | - |
2818 | argv[0] = value.data(); executed (the execution status of this line is deduced): argv[0] = value.data(); | - |
2819 | } executed: } Execution Count:8436 | 8436 |
2820 | QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::ReadProperty, executed (the execution status of this line is deduced): QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::ReadProperty, | - |
2821 | idx + mobj->propertyOffset(), argv); executed (the execution status of this line is deduced): idx + mobj->propertyOffset(), argv); | - |
2822 | | - |
2823 | if (status != -1) evaluated: status != -1 yes Evaluation Count:135 | yes Evaluation Count:8305 |
| 135-8305 |
2824 | return value; executed: return value; Execution Count:135 | 135 |
2825 | if (t != QMetaType::QVariant && argv[0] != value.data()) evaluated: t != QMetaType::QVariant yes Evaluation Count:8301 | yes Evaluation Count:4 |
partially evaluated: argv[0] != value.data() no Evaluation Count:0 | yes Evaluation Count:8301 |
| 0-8301 |
2826 | // pointer or reference | - |
2827 | return QVariant((QVariant::Type)t, argv[0]); never executed: return QVariant((QVariant::Type)t, argv[0]); | 0 |
2828 | return value; executed: return value; Execution Count:8305 | 8305 |
2829 | } | - |
2830 | | - |
2831 | /*! | - |
2832 | Writes \a value as the property's value to the given \a object. Returns | - |
2833 | true if the write succeeded; otherwise returns false. | - |
2834 | | - |
2835 | \sa read(), reset(), isWritable() | - |
2836 | */ | - |
2837 | bool QMetaProperty::write(QObject *object, const QVariant &value) const | - |
2838 | { | - |
2839 | if (!object || !isWritable()) partially evaluated: !object no Evaluation Count:0 | yes Evaluation Count:650 |
partially evaluated: !isWritable() no Evaluation Count:0 | yes Evaluation Count:650 |
| 0-650 |
2840 | return false; never executed: return false; | 0 |
2841 | | - |
2842 | QVariant v = value; executed (the execution status of this line is deduced): QVariant v = value; | - |
2843 | uint t = QVariant::Invalid; executed (the execution status of this line is deduced): uint t = QVariant::Invalid; | - |
2844 | if (isEnumType()) { evaluated: isEnumType() yes Evaluation Count:13 | yes Evaluation Count:637 |
| 13-637 |
2845 | if (v.type() == QVariant::String) { evaluated: v.type() == QVariant::String yes Evaluation Count:3 | yes Evaluation Count:10 |
| 3-10 |
2846 | bool ok; executed (the execution status of this line is deduced): bool ok; | - |
2847 | if (isFlagType()) partially evaluated: isFlagType() no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
2848 | v = QVariant(menum.keysToValue(value.toByteArray(), &ok)); never executed: v = QVariant(menum.keysToValue(value.toByteArray(), &ok)); | 0 |
2849 | else | - |
2850 | v = QVariant(menum.keyToValue(value.toByteArray(), &ok)); executed: v = QVariant(menum.keyToValue(value.toByteArray(), &ok)); Execution Count:3 | 3 |
2851 | if (!ok) partially evaluated: !ok no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
2852 | return false; never executed: return false; | 0 |
2853 | } else if (v.type() != QVariant::Int && v.type() != QVariant::UInt) { executed: } Execution Count:3 evaluated: v.type() != QVariant::Int yes Evaluation Count:4 | yes Evaluation Count:6 |
partially evaluated: v.type() != QVariant::UInt yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-6 |
2854 | int enumMetaTypeId = QMetaType::type(qualifiedName(menum)); executed (the execution status of this line is deduced): int enumMetaTypeId = QMetaType::type(qualifiedName(menum)); | - |
2855 | if ((enumMetaTypeId == QMetaType::UnknownType) || (v.userType() != enumMetaTypeId) || !v.constData()) evaluated: (enumMetaTypeId == QMetaType::UnknownType) yes Evaluation Count:2 | yes Evaluation Count:2 |
evaluated: (v.userType() != enumMetaTypeId) yes Evaluation Count:1 | yes Evaluation Count:1 |
partially evaluated: !v.constData() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-2 |
2856 | return false; executed: return false; Execution Count:3 | 3 |
2857 | v = QVariant(*reinterpret_cast<const int *>(v.constData())); executed (the execution status of this line is deduced): v = QVariant(*reinterpret_cast<const int *>(v.constData())); | - |
2858 | } executed: } Execution Count:1 | 1 |
2859 | v.convert(QVariant::Int); executed (the execution status of this line is deduced): v.convert(QVariant::Int); | - |
2860 | } else { executed: } Execution Count:10 | 10 |
2861 | int handle = priv(mobj->d.data)->propertyData + 3*idx; executed (the execution status of this line is deduced): int handle = priv(mobj->d.data)->propertyData + 3*idx; | - |
2862 | const char *typeName = 0; executed (the execution status of this line is deduced): const char *typeName = 0; | - |
2863 | Q_ASSERT(priv(mobj->d.data)->revision >= 7); executed (the execution status of this line is deduced): qt_noop(); | - |
2864 | uint typeInfo = mobj->d.data[handle + 1]; executed (the execution status of this line is deduced): uint typeInfo = mobj->d.data[handle + 1]; | - |
2865 | if (!(typeInfo & IsUnresolvedType)) evaluated: !(typeInfo & IsUnresolvedType) yes Evaluation Count:621 | yes Evaluation Count:16 |
| 16-621 |
2866 | t = typeInfo; executed: t = typeInfo; Execution Count:621 | 621 |
2867 | else { | - |
2868 | typeName = rawStringData(mobj, typeInfo & TypeNameIndexMask); executed (the execution status of this line is deduced): typeName = rawStringData(mobj, typeInfo & TypeNameIndexMask); | - |
2869 | t = QMetaType::type(typeName); executed (the execution status of this line is deduced): t = QMetaType::type(typeName); | - |
2870 | } executed: } Execution Count:16 | 16 |
2871 | if (t == QMetaType::UnknownType) { partially evaluated: t == QMetaType::UnknownType no Evaluation Count:0 | yes Evaluation Count:637 |
| 0-637 |
2872 | Q_ASSERT(typeName != 0); never executed (the execution status of this line is deduced): qt_noop(); | - |
2873 | const char *vtypeName = value.typeName(); never executed (the execution status of this line is deduced): const char *vtypeName = value.typeName(); | - |
2874 | if (vtypeName && strcmp(typeName, vtypeName) == 0) never evaluated: vtypeName never evaluated: strcmp(typeName, vtypeName) == 0 | 0 |
2875 | t = value.userType(); never executed: t = value.userType(); | 0 |
2876 | else | - |
2877 | t = QVariant::nameToType(typeName); never executed: t = QVariant::nameToType(typeName); | 0 |
2878 | } | - |
2879 | if (t == QVariant::Invalid) partially evaluated: t == QVariant::Invalid no Evaluation Count:0 | yes Evaluation Count:637 |
| 0-637 |
2880 | return false; never executed: return false; | 0 |
2881 | if (t != QMetaType::QVariant && t != (uint)value.userType() && (t < QMetaType::User && !v.convert((QVariant::Type)t))) evaluated: t != QMetaType::QVariant yes Evaluation Count:635 | yes Evaluation Count:2 |
evaluated: t != (uint)value.userType() yes Evaluation Count:24 | yes Evaluation Count:611 |
partially evaluated: t < QMetaType::User yes Evaluation Count:24 | no Evaluation Count:0 |
evaluated: !v.convert((QVariant::Type)t) yes Evaluation Count:6 | yes Evaluation Count:18 |
| 0-635 |
2882 | return false; executed: return false; Execution Count:6 | 6 |
2883 | } executed: } Execution Count:631 | 631 |
2884 | | - |
2885 | // the status variable is changed by qt_metacall to indicate what it did | - |
2886 | // this feature is currently only used by Qt D-Bus and should not be depended | - |
2887 | // upon. Don't change it without looking into QDBusAbstractInterface first | - |
2888 | // -1 (unchanged): normal qt_metacall, result stored in argv[0] | - |
2889 | // changed: result stored directly in value, return the value of status | - |
2890 | int status = -1; executed (the execution status of this line is deduced): int status = -1; | - |
2891 | // the flags variable is used by the declarative module to implement | - |
2892 | // interception of property writes. | - |
2893 | int flags = 0; executed (the execution status of this line is deduced): int flags = 0; | - |
2894 | void *argv[] = { 0, &v, &status, &flags }; executed (the execution status of this line is deduced): void *argv[] = { 0, &v, &status, &flags }; | - |
2895 | if (t == QMetaType::QVariant) evaluated: t == QMetaType::QVariant yes Evaluation Count:2 | yes Evaluation Count:639 |
| 2-639 |
2896 | argv[0] = &v; executed: argv[0] = &v; Execution Count:2 | 2 |
2897 | else | - |
2898 | argv[0] = v.data(); executed: argv[0] = v.data(); Execution Count:639 | 639 |
2899 | QMetaObject::metacall(object, QMetaObject::WriteProperty, idx + mobj->propertyOffset(), argv); executed (the execution status of this line is deduced): QMetaObject::metacall(object, QMetaObject::WriteProperty, idx + mobj->propertyOffset(), argv); | - |
2900 | return status; executed: return status; Execution Count:641 | 641 |
2901 | } | - |
2902 | | - |
2903 | /*! | - |
2904 | Resets the property for the given \a object with a reset method. | - |
2905 | Returns true if the reset worked; otherwise returns false. | - |
2906 | | - |
2907 | Reset methods are optional; only a few properties support them. | - |
2908 | | - |
2909 | \sa read(), write() | - |
2910 | */ | - |
2911 | bool QMetaProperty::reset(QObject *object) const | - |
2912 | { | - |
2913 | if (!object || !mobj || !isResettable()) never evaluated: !object never evaluated: !mobj never evaluated: !isResettable() | 0 |
2914 | return false; never executed: return false; | 0 |
2915 | void *argv[] = { 0 }; never executed (the execution status of this line is deduced): void *argv[] = { 0 }; | - |
2916 | QMetaObject::metacall(object, QMetaObject::ResetProperty, idx + mobj->propertyOffset(), argv); never executed (the execution status of this line is deduced): QMetaObject::metacall(object, QMetaObject::ResetProperty, idx + mobj->propertyOffset(), argv); | - |
2917 | return true; never executed: return true; | 0 |
2918 | } | - |
2919 | | - |
2920 | /*! | - |
2921 | Returns true if this property can be reset to a default value; otherwise | - |
2922 | returns false. | - |
2923 | | - |
2924 | \sa reset() | - |
2925 | */ | - |
2926 | bool QMetaProperty::isResettable() const | - |
2927 | { | - |
2928 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:94 |
| 0-94 |
2929 | return false; never executed: return false; | 0 |
2930 | int flags = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int flags = mobj->d.data[handle + 2]; | - |
2931 | return flags & Resettable; executed: return flags & Resettable; Execution Count:94 | 94 |
2932 | } | - |
2933 | | - |
2934 | /*! | - |
2935 | Returns true if this property is readable; otherwise returns false. | - |
2936 | | - |
2937 | \sa isWritable(), read(), isValid() | - |
2938 | */ | - |
2939 | bool QMetaProperty::isReadable() const | - |
2940 | { | - |
2941 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:183 |
| 0-183 |
2942 | return false; never executed: return false; | 0 |
2943 | int flags = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int flags = mobj->d.data[handle + 2]; | - |
2944 | return flags & Readable; executed: return flags & Readable; Execution Count:183 | 183 |
2945 | } | - |
2946 | | - |
2947 | /*! | - |
2948 | Returns true if this property has a corresponding change notify signal; | - |
2949 | otherwise returns false. | - |
2950 | | - |
2951 | \sa notifySignal() | - |
2952 | */ | - |
2953 | bool QMetaProperty::hasNotifySignal() const | - |
2954 | { | - |
2955 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:96 |
| 0-96 |
2956 | return false; never executed: return false; | 0 |
2957 | int flags = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int flags = mobj->d.data[handle + 2]; | - |
2958 | return flags & Notify; executed: return flags & Notify; Execution Count:96 | 96 |
2959 | } | - |
2960 | | - |
2961 | /*! | - |
2962 | \since 4.5 | - |
2963 | | - |
2964 | Returns the QMetaMethod instance of the property change notifying signal if | - |
2965 | one was specified, otherwise returns an invalid QMetaMethod. | - |
2966 | | - |
2967 | \sa hasNotifySignal() | - |
2968 | */ | - |
2969 | QMetaMethod QMetaProperty::notifySignal() const | - |
2970 | { | - |
2971 | int id = notifySignalIndex(); executed (the execution status of this line is deduced): int id = notifySignalIndex(); | - |
2972 | if (id != -1) evaluated: id != -1 yes Evaluation Count:6 | yes Evaluation Count:2 |
| 2-6 |
2973 | return mobj->method(id); executed: return mobj->method(id); Execution Count:6 | 6 |
2974 | else | - |
2975 | return QMetaMethod(); executed: return QMetaMethod(); Execution Count:2 | 2 |
2976 | } | - |
2977 | | - |
2978 | /*! | - |
2979 | \since 4.6 | - |
2980 | | - |
2981 | Returns the index of the property change notifying signal if one was | - |
2982 | specified, otherwise returns -1. | - |
2983 | | - |
2984 | \sa hasNotifySignal() | - |
2985 | */ | - |
2986 | int QMetaProperty::notifySignalIndex() const | - |
2987 | { | - |
2988 | if (hasNotifySignal()) { evaluated: hasNotifySignal() yes Evaluation Count:22 | yes Evaluation Count:2 |
| 2-22 |
2989 | int offset = priv(mobj->d.data)->propertyData + executed (the execution status of this line is deduced): int offset = priv(mobj->d.data)->propertyData + | - |
2990 | priv(mobj->d.data)->propertyCount * 3 + idx; executed (the execution status of this line is deduced): priv(mobj->d.data)->propertyCount * 3 + idx; | - |
2991 | return mobj->d.data[offset] + mobj->methodOffset(); executed: return mobj->d.data[offset] + mobj->methodOffset(); Execution Count:22 | 22 |
2992 | } else { | - |
2993 | return -1; executed: return -1; Execution Count:2 | 2 |
2994 | } | - |
2995 | } | - |
2996 | | - |
2997 | /*! | - |
2998 | \internal | - |
2999 | | - |
3000 | Returns the property revision if one was | - |
3001 | specified by REVISION, otherwise returns 0. | - |
3002 | */ | - |
3003 | int QMetaProperty::revision() const | - |
3004 | { | - |
3005 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:50 |
| 0-50 |
3006 | return 0; never executed: return 0; | 0 |
3007 | int flags = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int flags = mobj->d.data[handle + 2]; | - |
3008 | if (flags & Revisioned) { evaluated: flags & Revisioned yes Evaluation Count:6 | yes Evaluation Count:44 |
| 6-44 |
3009 | int offset = priv(mobj->d.data)->propertyData + executed (the execution status of this line is deduced): int offset = priv(mobj->d.data)->propertyData + | - |
3010 | priv(mobj->d.data)->propertyCount * 3 + idx; executed (the execution status of this line is deduced): priv(mobj->d.data)->propertyCount * 3 + idx; | - |
3011 | // Revision data is placed after NOTIFY data, if present. | - |
3012 | // Iterate through properties to discover whether we have NOTIFY signals. | - |
3013 | for (int i = 0; i < priv(mobj->d.data)->propertyCount; ++i) { partially evaluated: i < priv(mobj->d.data)->propertyCount yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
3014 | int handle = priv(mobj->d.data)->propertyData + 3*i; executed (the execution status of this line is deduced): int handle = priv(mobj->d.data)->propertyData + 3*i; | - |
3015 | if (mobj->d.data[handle + 2] & Notify) { partially evaluated: mobj->d.data[handle + 2] & Notify yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
3016 | offset += priv(mobj->d.data)->propertyCount; executed (the execution status of this line is deduced): offset += priv(mobj->d.data)->propertyCount; | - |
3017 | break; executed: break; Execution Count:6 | 6 |
3018 | } | - |
3019 | } | 0 |
3020 | return mobj->d.data[offset]; executed: return mobj->d.data[offset]; Execution Count:6 | 6 |
3021 | } else { | - |
3022 | return 0; executed: return 0; Execution Count:44 | 44 |
3023 | } | - |
3024 | } | - |
3025 | | - |
3026 | /*! | - |
3027 | Returns true if this property is writable; otherwise returns | - |
3028 | false. | - |
3029 | | - |
3030 | \sa isReadable(), write() | - |
3031 | */ | - |
3032 | bool QMetaProperty::isWritable() const | - |
3033 | { | - |
3034 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:1517 |
| 0-1517 |
3035 | return false; never executed: return false; | 0 |
3036 | int flags = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int flags = mobj->d.data[handle + 2]; | - |
3037 | return flags & Writable; executed: return flags & Writable; Execution Count:1517 | 1517 |
3038 | } | - |
3039 | | - |
3040 | | - |
3041 | /*! | - |
3042 | Returns true if this property is designable for the given \a object; | - |
3043 | otherwise returns false. | - |
3044 | | - |
3045 | If no \a object is given, the function returns false if the | - |
3046 | \c{Q_PROPERTY()}'s \c DESIGNABLE attribute is false; otherwise | - |
3047 | returns true (if the attribute is true or is a function or expression). | - |
3048 | | - |
3049 | \sa isScriptable(), isStored() | - |
3050 | */ | - |
3051 | bool QMetaProperty::isDesignable(const QObject *object) const | - |
3052 | { | - |
3053 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:94 |
| 0-94 |
3054 | return false; never executed: return false; | 0 |
3055 | int flags = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int flags = mobj->d.data[handle + 2]; | - |
3056 | bool b = flags & Designable; executed (the execution status of this line is deduced): bool b = flags & Designable; | - |
3057 | if (object) { partially evaluated: object no Evaluation Count:0 | yes Evaluation Count:94 |
| 0-94 |
3058 | void *argv[] = { &b }; never executed (the execution status of this line is deduced): void *argv[] = { &b }; | - |
3059 | QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::QueryPropertyDesignable, never executed (the execution status of this line is deduced): QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::QueryPropertyDesignable, | - |
3060 | idx + mobj->propertyOffset(), argv); never executed (the execution status of this line is deduced): idx + mobj->propertyOffset(), argv); | - |
3061 | } | 0 |
3062 | return b; executed: return b; Execution Count:94 | 94 |
3063 | | - |
3064 | | - |
3065 | } | - |
3066 | | - |
3067 | /*! | - |
3068 | Returns true if the property is scriptable for the given \a object; | - |
3069 | otherwise returns false. | - |
3070 | | - |
3071 | If no \a object is given, the function returns false if the | - |
3072 | \c{Q_PROPERTY()}'s \c SCRIPTABLE attribute is false; otherwise returns | - |
3073 | true (if the attribute is true or is a function or expression). | - |
3074 | | - |
3075 | \sa isDesignable(), isStored() | - |
3076 | */ | - |
3077 | bool QMetaProperty::isScriptable(const QObject *object) const | - |
3078 | { | - |
3079 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:179 |
| 0-179 |
3080 | return false; never executed: return false; | 0 |
3081 | int flags = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int flags = mobj->d.data[handle + 2]; | - |
3082 | bool b = flags & Scriptable; executed (the execution status of this line is deduced): bool b = flags & Scriptable; | - |
3083 | if (object) { partially evaluated: object no Evaluation Count:0 | yes Evaluation Count:179 |
| 0-179 |
3084 | void *argv[] = { &b }; never executed (the execution status of this line is deduced): void *argv[] = { &b }; | - |
3085 | QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::QueryPropertyScriptable, never executed (the execution status of this line is deduced): QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::QueryPropertyScriptable, | - |
3086 | idx + mobj->propertyOffset(), argv); never executed (the execution status of this line is deduced): idx + mobj->propertyOffset(), argv); | - |
3087 | } | 0 |
3088 | return b; executed: return b; Execution Count:179 | 179 |
3089 | } | - |
3090 | | - |
3091 | /*! | - |
3092 | Returns true if the property is stored for \a object; otherwise returns | - |
3093 | false. | - |
3094 | | - |
3095 | If no \a object is given, the function returns false if the | - |
3096 | \c{Q_PROPERTY()}'s \c STORED attribute is false; otherwise returns | - |
3097 | true (if the attribute is true or is a function or expression). | - |
3098 | | - |
3099 | \sa isDesignable(), isScriptable() | - |
3100 | */ | - |
3101 | bool QMetaProperty::isStored(const QObject *object) const | - |
3102 | { | - |
3103 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:94 |
| 0-94 |
3104 | return false; never executed: return false; | 0 |
3105 | int flags = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int flags = mobj->d.data[handle + 2]; | - |
3106 | bool b = flags & Stored; executed (the execution status of this line is deduced): bool b = flags & Stored; | - |
3107 | if (object) { partially evaluated: object no Evaluation Count:0 | yes Evaluation Count:94 |
| 0-94 |
3108 | void *argv[] = { &b }; never executed (the execution status of this line is deduced): void *argv[] = { &b }; | - |
3109 | QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::QueryPropertyStored, never executed (the execution status of this line is deduced): QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::QueryPropertyStored, | - |
3110 | idx + mobj->propertyOffset(), argv); never executed (the execution status of this line is deduced): idx + mobj->propertyOffset(), argv); | - |
3111 | } | 0 |
3112 | return b; executed: return b; Execution Count:94 | 94 |
3113 | } | - |
3114 | | - |
3115 | /*! | - |
3116 | Returns true if this property is designated as the \c USER | - |
3117 | property, i.e., the one that the user can edit for \a object or | - |
3118 | that is significant in some other way. Otherwise it returns | - |
3119 | false. e.g., the \c text property is the \c USER editable property | - |
3120 | of a QLineEdit. | - |
3121 | | - |
3122 | If \a object is null, the function returns false if the \c | - |
3123 | {Q_PROPERTY()}'s \c USER attribute is false. Otherwise it returns | - |
3124 | true. | - |
3125 | | - |
3126 | \sa QMetaObject::userProperty(), isDesignable(), isScriptable() | - |
3127 | */ | - |
3128 | bool QMetaProperty::isUser(const QObject *object) const | - |
3129 | { | - |
3130 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:3928 |
| 0-3928 |
3131 | return false; never executed: return false; | 0 |
3132 | int flags = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int flags = mobj->d.data[handle + 2]; | - |
3133 | bool b = flags & User; executed (the execution status of this line is deduced): bool b = flags & User; | - |
3134 | if (object) { partially evaluated: object no Evaluation Count:0 | yes Evaluation Count:3928 |
| 0-3928 |
3135 | void *argv[] = { &b }; never executed (the execution status of this line is deduced): void *argv[] = { &b }; | - |
3136 | QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::QueryPropertyUser, never executed (the execution status of this line is deduced): QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::QueryPropertyUser, | - |
3137 | idx + mobj->propertyOffset(), argv); never executed (the execution status of this line is deduced): idx + mobj->propertyOffset(), argv); | - |
3138 | } | 0 |
3139 | return b; executed: return b; Execution Count:3928 | 3928 |
3140 | } | - |
3141 | | - |
3142 | /*! | - |
3143 | \since 4.6 | - |
3144 | Returns true if the property is constant; otherwise returns false. | - |
3145 | | - |
3146 | A property is constant if the \c{Q_PROPERTY()}'s \c CONSTANT attribute | - |
3147 | is set. | - |
3148 | */ | - |
3149 | bool QMetaProperty::isConstant() const | - |
3150 | { | - |
3151 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
3152 | return false; never executed: return false; | 0 |
3153 | int flags = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int flags = mobj->d.data[handle + 2]; | - |
3154 | return flags & Constant; executed: return flags & Constant; Execution Count:18 | 18 |
3155 | } | - |
3156 | | - |
3157 | /*! | - |
3158 | \since 4.6 | - |
3159 | Returns true if the property is final; otherwise returns false. | - |
3160 | | - |
3161 | A property is final if the \c{Q_PROPERTY()}'s \c FINAL attribute | - |
3162 | is set. | - |
3163 | */ | - |
3164 | bool QMetaProperty::isFinal() const | - |
3165 | { | - |
3166 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
3167 | return false; never executed: return false; | 0 |
3168 | int flags = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int flags = mobj->d.data[handle + 2]; | - |
3169 | return flags & Final; executed: return flags & Final; Execution Count:18 | 18 |
3170 | } | - |
3171 | | - |
3172 | /*! | - |
3173 | \obsolete | - |
3174 | | - |
3175 | Returns true if the property is editable for the given \a object; | - |
3176 | otherwise returns false. | - |
3177 | | - |
3178 | If no \a object is given, the function returns false if the | - |
3179 | \c{Q_PROPERTY()}'s \c EDITABLE attribute is false; otherwise returns | - |
3180 | true (if the attribute is true or is a function or expression). | - |
3181 | | - |
3182 | \sa isDesignable(), isScriptable(), isStored() | - |
3183 | */ | - |
3184 | bool QMetaProperty::isEditable(const QObject *object) const | - |
3185 | { | - |
3186 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:94 |
| 0-94 |
3187 | return false; never executed: return false; | 0 |
3188 | int flags = mobj->d.data[handle + 2]; executed (the execution status of this line is deduced): int flags = mobj->d.data[handle + 2]; | - |
3189 | bool b = flags & Editable; executed (the execution status of this line is deduced): bool b = flags & Editable; | - |
3190 | if (object) { partially evaluated: object no Evaluation Count:0 | yes Evaluation Count:94 |
| 0-94 |
3191 | void *argv[] = { &b }; never executed (the execution status of this line is deduced): void *argv[] = { &b }; | - |
3192 | QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::QueryPropertyEditable, never executed (the execution status of this line is deduced): QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::QueryPropertyEditable, | - |
3193 | idx + mobj->propertyOffset(), argv); never executed (the execution status of this line is deduced): idx + mobj->propertyOffset(), argv); | - |
3194 | } | 0 |
3195 | return b; executed: return b; Execution Count:94 | 94 |
3196 | } | - |
3197 | | - |
3198 | /*! | - |
3199 | \class QMetaClassInfo | - |
3200 | \inmodule QtCore | - |
3201 | | - |
3202 | \brief The QMetaClassInfo class provides additional information | - |
3203 | about a class. | - |
3204 | | - |
3205 | \ingroup objectmodel | - |
3206 | | - |
3207 | Class information items are simple \e{name}--\e{value} pairs that | - |
3208 | are specified using Q_CLASSINFO() in the source code. The | - |
3209 | information can be retrieved using name() and value(). For example: | - |
3210 | | - |
3211 | \snippet code/src_corelib_kernel_qmetaobject.cpp 5 | - |
3212 | | - |
3213 | This mechanism is free for you to use in your Qt applications. Qt | - |
3214 | doesn't use it for any of its classes. | - |
3215 | | - |
3216 | \sa QMetaObject | - |
3217 | */ | - |
3218 | | - |
3219 | | - |
3220 | /*! | - |
3221 | \fn QMetaClassInfo::QMetaClassInfo() | - |
3222 | \internal | - |
3223 | */ | - |
3224 | | - |
3225 | /*! | - |
3226 | \fn const QMetaObject *QMetaClassInfo::enclosingMetaObject() const | - |
3227 | \internal | - |
3228 | */ | - |
3229 | | - |
3230 | /*! | - |
3231 | Returns the name of this item. | - |
3232 | | - |
3233 | \sa value() | - |
3234 | */ | - |
3235 | const char *QMetaClassInfo::name() const | - |
3236 | { | - |
3237 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
3238 | return 0; never executed: return 0; | 0 |
3239 | return rawStringData(mobj, mobj->d.data[handle]); executed: return rawStringData(mobj, mobj->d.data[handle]); Execution Count:12 | 12 |
3240 | } | - |
3241 | | - |
3242 | /*! | - |
3243 | Returns the value of this item. | - |
3244 | | - |
3245 | \sa name() | - |
3246 | */ | - |
3247 | const char* QMetaClassInfo::value() const | - |
3248 | { | - |
3249 | if (!mobj) partially evaluated: !mobj no Evaluation Count:0 | yes Evaluation Count:602 |
| 0-602 |
3250 | return 0; never executed: return 0; | 0 |
3251 | return rawStringData(mobj, mobj->d.data[handle + 1]); executed: return rawStringData(mobj, mobj->d.data[handle + 1]); Execution Count:602 | 602 |
3252 | } | - |
3253 | | - |
3254 | /*! | - |
3255 | \macro QGenericArgument Q_ARG(Type, const Type &value) | - |
3256 | \relates QMetaObject | - |
3257 | | - |
3258 | This macro takes a \a Type and a \a value of that type and | - |
3259 | returns a \l QGenericArgument object that can be passed to | - |
3260 | QMetaObject::invokeMethod(). | - |
3261 | | - |
3262 | \sa Q_RETURN_ARG() | - |
3263 | */ | - |
3264 | | - |
3265 | /*! | - |
3266 | \macro QGenericReturnArgument Q_RETURN_ARG(Type, Type &value) | - |
3267 | \relates QMetaObject | - |
3268 | | - |
3269 | This macro takes a \a Type and a non-const reference to a \a | - |
3270 | value of that type and returns a QGenericReturnArgument object | - |
3271 | that can be passed to QMetaObject::invokeMethod(). | - |
3272 | | - |
3273 | \sa Q_ARG() | - |
3274 | */ | - |
3275 | | - |
3276 | /*! | - |
3277 | \class QGenericArgument | - |
3278 | \inmodule QtCore | - |
3279 | | - |
3280 | \brief The QGenericArgument class is an internal helper class for | - |
3281 | marshalling arguments. | - |
3282 | | - |
3283 | This class should never be used directly. Please use the \l Q_ARG() | - |
3284 | macro instead. | - |
3285 | | - |
3286 | \sa Q_ARG(), QMetaObject::invokeMethod(), QGenericReturnArgument | - |
3287 | */ | - |
3288 | | - |
3289 | /*! | - |
3290 | \fn QGenericArgument::QGenericArgument(const char *name, const void *data) | - |
3291 | | - |
3292 | Constructs a QGenericArgument object with the given \a name and \a data. | - |
3293 | */ | - |
3294 | | - |
3295 | /*! | - |
3296 | \fn QGenericArgument::data () const | - |
3297 | | - |
3298 | Returns the data set in the constructor. | - |
3299 | */ | - |
3300 | | - |
3301 | /*! | - |
3302 | \fn QGenericArgument::name () const | - |
3303 | | - |
3304 | Returns the name set in the constructor. | - |
3305 | */ | - |
3306 | | - |
3307 | /*! | - |
3308 | \class QGenericReturnArgument | - |
3309 | \inmodule QtCore | - |
3310 | | - |
3311 | \brief The QGenericReturnArgument class is an internal helper class for | - |
3312 | marshalling arguments. | - |
3313 | | - |
3314 | This class should never be used directly. Please use the | - |
3315 | Q_RETURN_ARG() macro instead. | - |
3316 | | - |
3317 | \sa Q_RETURN_ARG(), QMetaObject::invokeMethod(), QGenericArgument | - |
3318 | */ | - |
3319 | | - |
3320 | /*! | - |
3321 | \fn QGenericReturnArgument::QGenericReturnArgument(const char *name, void *data) | - |
3322 | | - |
3323 | Constructs a QGenericReturnArgument object with the given \a name | - |
3324 | and \a data. | - |
3325 | */ | - |
3326 | | - |
3327 | /*! | - |
3328 | \internal | - |
3329 | If the local_method_index is a cloned method, return the index of the original. | - |
3330 | | - |
3331 | Example: if the index of "destroyed()" is passed, the index of "destroyed(QObject*)" is returned | - |
3332 | */ | - |
3333 | int QMetaObjectPrivate::originalClone(const QMetaObject *mobj, int local_method_index) | - |
3334 | { | - |
3335 | Q_ASSERT(local_method_index < get(mobj)->methodCount); executed (the execution status of this line is deduced): qt_noop(); | - |
3336 | int handle = get(mobj)->methodData + 5 * local_method_index; executed (the execution status of this line is deduced): int handle = get(mobj)->methodData + 5 * local_method_index; | - |
3337 | while (mobj->d.data[handle + 4] & MethodCloned) { evaluated: mobj->d.data[handle + 4] & MethodCloned yes Evaluation Count:45701 | yes Evaluation Count:615266 |
| 45701-615266 |
3338 | Q_ASSERT(local_method_index > 0); executed (the execution status of this line is deduced): qt_noop(); | - |
3339 | handle -= 5; executed (the execution status of this line is deduced): handle -= 5; | - |
3340 | local_method_index--; executed (the execution status of this line is deduced): local_method_index--; | - |
3341 | } executed: } Execution Count:45701 | 45701 |
3342 | return local_method_index; executed: return local_method_index; Execution Count:615268 | 615268 |
3343 | } | - |
3344 | | - |
3345 | /*! | - |
3346 | \internal | - |
3347 | | - |
3348 | Returns the parameter type names extracted from the given \a signature. | - |
3349 | */ | - |
3350 | QList<QByteArray> QMetaObjectPrivate::parameterTypeNamesFromSignature(const char *signature) | - |
3351 | { | - |
3352 | QList<QByteArray> list; executed (the execution status of this line is deduced): QList<QByteArray> list; | - |
3353 | while (*signature && *signature != '(') partially evaluated: *signature yes Evaluation Count:8944 | no Evaluation Count:0 |
evaluated: *signature != '(' yes Evaluation Count:8223 | yes Evaluation Count:721 |
| 0-8944 |
3354 | ++signature; executed: ++signature; Execution Count:8223 | 8223 |
3355 | while (*signature && *signature != ')' && *++signature != ')') { partially evaluated: *signature yes Evaluation Count:1251 | no Evaluation Count:0 |
evaluated: *signature != ')' yes Evaluation Count:849 | yes Evaluation Count:402 |
evaluated: *++signature != ')' yes Evaluation Count:530 | yes Evaluation Count:319 |
| 0-1251 |
3356 | const char *begin = signature; executed (the execution status of this line is deduced): const char *begin = signature; | - |
3357 | int level = 0; executed (the execution status of this line is deduced): int level = 0; | - |
3358 | while (*signature && (level > 0 || *signature != ',') && *signature != ')') { partially evaluated: *signature yes Evaluation Count:3314 | no Evaluation Count:0 |
partially evaluated: level > 0 no Evaluation Count:0 | yes Evaluation Count:3314 |
evaluated: *signature != ',' yes Evaluation Count:3186 | yes Evaluation Count:128 |
evaluated: *signature != ')' yes Evaluation Count:2784 | yes Evaluation Count:402 |
| 0-3314 |
3359 | if (*signature == '<') partially evaluated: *signature == '<' no Evaluation Count:0 | yes Evaluation Count:2784 |
| 0-2784 |
3360 | ++level; | 0 |
3361 | else if (*signature == '>') partially evaluated: *signature == '>' no Evaluation Count:0 | yes Evaluation Count:2784 |
| 0-2784 |
3362 | --level; | 0 |
3363 | ++signature; executed (the execution status of this line is deduced): ++signature; | - |
3364 | } executed: } Execution Count:2784 | 2784 |
3365 | list += QByteArray(begin, signature - begin); executed (the execution status of this line is deduced): list += QByteArray(begin, signature - begin); | - |
3366 | } executed: } Execution Count:530 | 530 |
3367 | return list; executed: return list; Execution Count:721 | 721 |
3368 | } | - |
3369 | | - |
3370 | QT_END_NAMESPACE | - |
3371 | | - |
| | |