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 "qmetatype.h" | - |
43 | #include "qmetatype_p.h" | - |
44 | #include "qobjectdefs.h" | - |
45 | #include "qdatetime.h" | - |
46 | #include "qbytearray.h" | - |
47 | #include "qreadwritelock.h" | - |
48 | #include "qstring.h" | - |
49 | #include "qstringlist.h" | - |
50 | #include "qvector.h" | - |
51 | #include "qlocale.h" | - |
52 | #include "qeasingcurve.h" | - |
53 | #include "quuid.h" | - |
54 | #include "qvariant.h" | - |
55 | #include "qmetatypeswitcher_p.h" | - |
56 | | - |
57 | #ifndef QT_BOOTSTRAPPED | - |
58 | # include "qbitarray.h" | - |
59 | # include "qurl.h" | - |
60 | # include "qvariant.h" | - |
61 | # include "qabstractitemmodel.h" | - |
62 | # include "qregularexpression.h" | - |
63 | # include "qjsonvalue.h" | - |
64 | # include "qjsonobject.h" | - |
65 | # include "qjsonarray.h" | - |
66 | # include "qjsondocument.h" | - |
67 | #endif | - |
68 | | - |
69 | #ifndef QT_NO_GEOM_VARIANT | - |
70 | # include "qsize.h" | - |
71 | # include "qpoint.h" | - |
72 | # include "qrect.h" | - |
73 | # include "qline.h" | - |
74 | #endif | - |
75 | | - |
76 | QT_BEGIN_NAMESPACE | - |
77 | | - |
78 | #define NS(x) QT_PREPEND_NAMESPACE(x) | - |
79 | | - |
80 | | - |
81 | namespace { | - |
82 | struct DefinedTypesFilter { | - |
83 | template<typename T> | - |
84 | struct Acceptor { | - |
85 | static const bool IsAccepted = QtMetaTypePrivate::TypeDefinition<T>::IsAvailable && QModulesPrivate::QTypeModuleInfo<T>::IsCore; | - |
86 | }; | - |
87 | }; | - |
88 | } // namespace | - |
89 | | - |
90 | /*! | - |
91 | \macro Q_DECLARE_OPAQUE_POINTER(PointerType) | - |
92 | \relates QMetaType | - |
93 | | - |
94 | This macro enables pointers to forward-declared types (\a PointerType) | - |
95 | to be registered with QMetaType using either Q_DECLARE_METATYPE() | - |
96 | or qRegisterMetaType(). | - |
97 | | - |
98 | \sa Q_DECLARE_METATYPE(), qRegisterMetaType() | - |
99 | */ | - |
100 | | - |
101 | /*! | - |
102 | \macro Q_DECLARE_METATYPE(Type) | - |
103 | \relates QMetaType | - |
104 | | - |
105 | This macro makes the type \a Type known to QMetaType as long as it | - |
106 | provides a public default constructor, a public copy constructor and | - |
107 | a public destructor. | - |
108 | It is needed to use the type \a Type as a custom type in QVariant. | - |
109 | | - |
110 | This macro requires that \a Type is a fully defined type at the point where | - |
111 | it is used. For pointer types, it also requires that the pointed to type is | - |
112 | fully defined. Use in conjunction with Q_DECLARE_OPAQUE_POINTER() to | - |
113 | register pointers to forward declared types. | - |
114 | | - |
115 | Ideally, this macro should be placed below the declaration of | - |
116 | the class or struct. If that is not possible, it can be put in | - |
117 | a private header file which has to be included every time that | - |
118 | type is used in a QVariant. | - |
119 | | - |
120 | Adding a Q_DECLARE_METATYPE() makes the type known to all template | - |
121 | based functions, including QVariant. Note that if you intend to | - |
122 | use the type in \e queued signal and slot connections or in | - |
123 | QObject's property system, you also have to call | - |
124 | qRegisterMetaType() since the names are resolved at runtime. | - |
125 | | - |
126 | This example shows a typical use case of Q_DECLARE_METATYPE(): | - |
127 | | - |
128 | \snippet code/src_corelib_kernel_qmetatype.cpp 0 | - |
129 | | - |
130 | If \c MyStruct is in a namespace, the Q_DECLARE_METATYPE() macro | - |
131 | has to be outside the namespace: | - |
132 | | - |
133 | \snippet code/src_corelib_kernel_qmetatype.cpp 1 | - |
134 | | - |
135 | Since \c{MyStruct} is now known to QMetaType, it can be used in QVariant: | - |
136 | | - |
137 | \snippet code/src_corelib_kernel_qmetatype.cpp 2 | - |
138 | | - |
139 | \sa qRegisterMetaType() | - |
140 | */ | - |
141 | | - |
142 | /*! | - |
143 | \enum QMetaType::Type | - |
144 | | - |
145 | These are the built-in types supported by QMetaType: | - |
146 | | - |
147 | \value Void \c void | - |
148 | \value Bool \c bool | - |
149 | \value Int \c int | - |
150 | \value UInt \c{unsigned int} | - |
151 | \value Double \c double | - |
152 | \value QChar QChar | - |
153 | \value QString QString | - |
154 | \value QByteArray QByteArray | - |
155 | | - |
156 | \value VoidStar \c{void *} | - |
157 | \value Long \c{long} | - |
158 | \value LongLong LongLong | - |
159 | \value Short \c{short} | - |
160 | \value Char \c{char} | - |
161 | \value ULong \c{unsigned long} | - |
162 | \value ULongLong ULongLong | - |
163 | \value UShort \c{unsigned short} | - |
164 | \value SChar \c{signed char} | - |
165 | \value UChar \c{unsigned char} | - |
166 | \value Float \c float | - |
167 | \value QObjectStar QObject * | - |
168 | \value QVariant QVariant | - |
169 | | - |
170 | \value QCursor QCursor | - |
171 | \value QDate QDate | - |
172 | \value QSize QSize | - |
173 | \value QTime QTime | - |
174 | \value QVariantList QVariantList | - |
175 | \value QPolygon QPolygon | - |
176 | \value QPolygonF QPolygonF | - |
177 | \value QColor QColor | - |
178 | \value QSizeF QSizeF | - |
179 | \value QRectF QRectF | - |
180 | \value QLine QLine | - |
181 | \value QTextLength QTextLength | - |
182 | \value QStringList QStringList | - |
183 | \value QVariantMap QVariantMap | - |
184 | \value QVariantHash QVariantHash | - |
185 | \value QIcon QIcon | - |
186 | \value QPen QPen | - |
187 | \value QLineF QLineF | - |
188 | \value QTextFormat QTextFormat | - |
189 | \value QRect QRect | - |
190 | \value QPoint QPoint | - |
191 | \value QUrl QUrl | - |
192 | \value QRegExp QRegExp | - |
193 | \value QRegularExpression QRegularExpression | - |
194 | \value QDateTime QDateTime | - |
195 | \value QPointF QPointF | - |
196 | \value QPalette QPalette | - |
197 | \value QFont QFont | - |
198 | \value QBrush QBrush | - |
199 | \value QRegion QRegion | - |
200 | \value QBitArray QBitArray | - |
201 | \value QImage QImage | - |
202 | \value QKeySequence QKeySequence | - |
203 | \value QSizePolicy QSizePolicy | - |
204 | \value QPixmap QPixmap | - |
205 | \value QLocale QLocale | - |
206 | \value QBitmap QBitmap | - |
207 | \value QMatrix QMatrix | - |
208 | \value QTransform QTransform | - |
209 | \value QMatrix4x4 QMatrix4x4 | - |
210 | \value QVector2D QVector2D | - |
211 | \value QVector3D QVector3D | - |
212 | \value QVector4D QVector4D | - |
213 | \value QQuaternion QQuaternion | - |
214 | \value QEasingCurve QEasingCurve | - |
215 | \value QJsonValue QJsonValue | - |
216 | \value QJsonObject QJsonObject | - |
217 | \value QJsonArray QJsonArray | - |
218 | \value QJsonDocument QJsonDocument | - |
219 | \value QModelIndex QModelIndex | - |
220 | \value QUuid QUuid | - |
221 | | - |
222 | \value User Base value for user types | - |
223 | \value UnknownType This is an invalid type id. It is returned from QMetaType for types that are not registered | - |
224 | | - |
225 | Additional types can be registered using Q_DECLARE_METATYPE(). | - |
226 | | - |
227 | \sa type(), typeName() | - |
228 | */ | - |
229 | | - |
230 | /*! | - |
231 | \enum QMetaType::TypeFlag | - |
232 | | - |
233 | The enum describes attributes of a type supported by QMetaType. | - |
234 | | - |
235 | \value NeedsConstruction This type has non-trivial constructors. If the flag is not set instances can be safely initialized with memset to 0. | - |
236 | \value NeedsDestruction This type has a non-trivial destructor. If the flag is not set calls to the destructor are not necessary before discarding objects. | - |
237 | \value MovableType An instance of a type having this attribute can be safely moved by memcpy. | - |
238 | \omitvalue SharedPointerToQObject | - |
239 | \omitvalue IsEnumeration | - |
240 | \omitvalue PointerToQObject | - |
241 | \omitvalue WeakPointerToQObject | - |
242 | \omitvalue TrackingPointerToQObject | - |
243 | \omitvalue WasDeclaredAsMetaType | - |
244 | */ | - |
245 | | - |
246 | /*! | - |
247 | \class QMetaType | - |
248 | \inmodule QtCore | - |
249 | \brief The QMetaType class manages named types in the meta-object system. | - |
250 | | - |
251 | \ingroup objectmodel | - |
252 | \threadsafe | - |
253 | | - |
254 | The class is used as a helper to marshall types in QVariant and | - |
255 | in queued signals and slots connections. It associates a type | - |
256 | name to a type so that it can be created and destructed | - |
257 | dynamically at run-time. Declare new types with Q_DECLARE_METATYPE() | - |
258 | to make them available to QVariant and other template-based functions. | - |
259 | Call qRegisterMetaType() to make type available to non-template based | - |
260 | functions, such as the queued signal and slot connections. | - |
261 | | - |
262 | Any class or struct that has a public default | - |
263 | constructor, a public copy constructor, and a public destructor | - |
264 | can be registered. | - |
265 | | - |
266 | The following code allocates and destructs an instance of | - |
267 | \c{MyClass}: | - |
268 | | - |
269 | \snippet code/src_corelib_kernel_qmetatype.cpp 3 | - |
270 | | - |
271 | If we want the stream operators \c operator<<() and \c | - |
272 | operator>>() to work on QVariant objects that store custom types, | - |
273 | the custom type must provide \c operator<<() and \c operator>>() | - |
274 | operators. | - |
275 | | - |
276 | \sa Q_DECLARE_METATYPE(), QVariant::setValue(), QVariant::value(), QVariant::fromValue() | - |
277 | */ | - |
278 | | - |
279 | /*! | - |
280 | \fn bool QMetaType::isValid() const | - |
281 | \since 5.0 | - |
282 | | - |
283 | Returns true if this QMetaType object contains valid | - |
284 | information about a type, false otherwise. | - |
285 | */ | - |
286 | | - |
287 | /*! | - |
288 | \fn bool QMetaType::isRegistered() const | - |
289 | \since 5.0 | - |
290 | | - |
291 | Returns true if this QMetaType object contains valid | - |
292 | information about a type, false otherwise. | - |
293 | */ | - |
294 | | - |
295 | /*! | - |
296 | \fn bool QMetaType::sizeOf() const | - |
297 | \since 5.0 | - |
298 | | - |
299 | Returns the size of the type in bytes (i.e. sizeof(T), | - |
300 | where T is the actual type for which this QMetaType instance | - |
301 | was constructed for). | - |
302 | | - |
303 | This function is typically used together with construct() | - |
304 | to perform low-level management of the memory used by a type. | - |
305 | | - |
306 | \sa QMetaType::construct(void *where, const void *copy), QMetaType::sizeOf(int) | - |
307 | */ | - |
308 | | - |
309 | /*! | - |
310 | \fn TypeFlags QMetaType::flags() const | - |
311 | \since 5.0 | - |
312 | | - |
313 | Returns flags of the type for which this QMetaType instance was constructed. | - |
314 | | - |
315 | \sa QMetaType::TypeFlags, QMetaType::typeFlags(int type) | - |
316 | */ | - |
317 | | - |
318 | /*! | - |
319 | \fn const QMetaObject *QMetaType::metaObject() const | - |
320 | \since 5.0 | - |
321 | \internal | - |
322 | */ | - |
323 | | - |
324 | /*! | - |
325 | \fn void *QMetaType::create(const void *copy = 0) const | - |
326 | \since 5.0 | - |
327 | | - |
328 | Returns a copy of \a copy, assuming it is of the type that this | - |
329 | QMetaType instance was created for. If \a copy is null, creates | - |
330 | a default constructed instance. | - |
331 | | - |
332 | \sa QMetaType::destroy(void*) | - |
333 | */ | - |
334 | | - |
335 | /*! | - |
336 | \fn void QMetaType::destroy(void *data) const | - |
337 | \since 5.0 | - |
338 | | - |
339 | Destroys the \a data, assuming it is of the type that this | - |
340 | QMetaType instance was created for. | - |
341 | | - |
342 | \sa QMetaType::create(const void *) | - |
343 | */ | - |
344 | | - |
345 | /*! | - |
346 | \fn void *QMetaType::construct(void *where, const void *copy = 0) const | - |
347 | \since 5.0 | - |
348 | | - |
349 | Constructs a value of the type that this QMetaType instance | - |
350 | was constructed for in the existing memory addressed by \a where, | - |
351 | that is a copy of \a copy, and returns \a where. If \a copy is | - |
352 | zero, the value is default constructed. | - |
353 | | - |
354 | This is a low-level function for explicitly managing the memory | - |
355 | used to store the type. Consider calling create() if you don't | - |
356 | need this level of control (that is, use "new" rather than | - |
357 | "placement new"). | - |
358 | | - |
359 | You must ensure that \a where points to a location where the new | - |
360 | value can be stored and that \a where is suitably aligned. | - |
361 | The type's size can be queried by calling sizeOf(). | - |
362 | | - |
363 | The rule of thumb for alignment is that a type is aligned to its | - |
364 | natural boundary, which is the smallest power of 2 that is bigger | - |
365 | than the type, unless that alignment is larger than the maximum | - |
366 | useful alignment for the platform. For practical purposes, | - |
367 | alignment larger than 2 * sizeof(void*) is only necessary for | - |
368 | special hardware instructions (e.g., aligned SSE loads and stores | - |
369 | on x86). | - |
370 | */ | - |
371 | | - |
372 | /*! | - |
373 | \fn void QMetaType::destruct(void *data) const | - |
374 | \since 5.0 | - |
375 | | - |
376 | Destructs the value, located at \a data, assuming that it is | - |
377 | of the type for which this QMetaType instance was constructed for. | - |
378 | | - |
379 | Unlike destroy(), this function only invokes the type's | - |
380 | destructor, it doesn't invoke the delete operator. | - |
381 | \sa QMetaType::construct() | - |
382 | */ | - |
383 | | - |
384 | /*! | - |
385 | \fn QMetaType::~QMetaType() | - |
386 | | - |
387 | Destructs this object. | - |
388 | */ | - |
389 | | - |
390 | #define QT_ADD_STATIC_METATYPE(MetaTypeName, MetaTypeId, RealName) \ | - |
391 | { #RealName, sizeof(#RealName) - 1, MetaTypeId }, | - |
392 | | - |
393 | #define QT_ADD_STATIC_METATYPE_ALIASES_ITER(MetaTypeName, MetaTypeId, AliasingName, RealNameStr) \ | - |
394 | { RealNameStr, sizeof(RealNameStr) - 1, QMetaType::MetaTypeName }, | - |
395 | | - |
396 | #define QT_ADD_STATIC_METATYPE_HACKS_ITER(MetaTypeName, TypeId, Name) \ | - |
397 | QT_ADD_STATIC_METATYPE(MetaTypeName, MetaTypeName, Name) | - |
398 | | - |
399 | static const struct { const char * typeName; int typeNameLength; int type; } types[] = { | - |
400 | QT_FOR_EACH_STATIC_TYPE(QT_ADD_STATIC_METATYPE) | - |
401 | QT_FOR_EACH_STATIC_ALIAS_TYPE(QT_ADD_STATIC_METATYPE_ALIASES_ITER) | - |
402 | QT_FOR_EACH_STATIC_HACKS_TYPE(QT_ADD_STATIC_METATYPE_HACKS_ITER) | - |
403 | {0, 0, QMetaType::UnknownType} | - |
404 | }; | - |
405 | | - |
406 | Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeGuiHelper = 0; | - |
407 | Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeWidgetsHelper = 0; | - |
408 | Q_CORE_EXPORT const QMetaObject *qMetaObjectWidgetsHelper = 0; | - |
409 | | - |
410 | class QCustomTypeInfo : public QMetaTypeInterface | - |
411 | { | - |
412 | public: | - |
413 | QCustomTypeInfo() | - |
414 | : alias(-1) | - |
415 | { | - |
416 | QMetaTypeInterface empty = QT_METATYPE_INTERFACE_INIT(void); executed (the execution status of this line is deduced): QMetaTypeInterface empty = { (QtMetaTypePrivate::QMetaTypeFunctionHelper<void, QtMetaTypePrivate::TypeDefinition<void>::IsAvailable>::Create), (QtMetaTypePrivate::QMetaTypeFunctionHelper<void, QtMetaTypePrivate::TypeDefinition<void>::IsAvailable>::Delete), (QtMetaTypePrivate::QMetaTypeFunctionHelper<void, QtMetaTypePrivate::TypeDefinition<void>::IsAvailable>::Save), (QtMetaTypePrivate::QMetaTypeFunctionHelper<void, QtMetaTypePrivate::TypeDefinition<void>::IsAvailable>::Load), (QtMetaTypePrivate::QMetaTypeFunctionHelper<void, QtMetaTypePrivate::TypeDefinition<void>::IsAvailable>::Construct), (QtMetaTypePrivate::QMetaTypeFunctionHelper<void, QtMetaTypePrivate::TypeDefinition<void>::IsAvailable>::Destruct), (QTypeInfo<void>::sizeOf), QtPrivate::QMetaTypeTypeFlags<void>::Flags, (QtPrivate::MetaObjectForType<void>::value()) }; | - |
417 | *static_cast<QMetaTypeInterface*>(this) = empty; executed (the execution status of this line is deduced): *static_cast<QMetaTypeInterface*>(this) = empty; | - |
418 | } executed: } Execution Count:4165 | 4165 |
419 | QByteArray typeName; | - |
420 | int alias; | - |
421 | }; | - |
422 | | - |
423 | namespace | - |
424 | { | - |
425 | union CheckThatItIsPod | - |
426 | { // This should break if QMetaTypeInterface is not a POD type | - |
427 | QMetaTypeInterface iface; | - |
428 | }; | - |
429 | } | - |
430 | | - |
431 | Q_DECLARE_TYPEINFO(QCustomTypeInfo, Q_MOVABLE_TYPE); | - |
432 | Q_GLOBAL_STATIC(QVector<QCustomTypeInfo>, customTypes) never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:569435 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:65 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:66 | yes Evaluation Count:569388 |
evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:65 | yes Evaluation Count:1 |
| 0-569435 |
433 | Q_GLOBAL_STATIC(QReadWriteLock, customTypesLock) never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:551942 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:65 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:66 | yes Evaluation Count:551860 |
evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:65 | yes Evaluation Count:1 |
| 0-551942 |
434 | | - |
435 | #ifndef QT_NO_DATASTREAM | - |
436 | /*! | - |
437 | \internal | - |
438 | */ | - |
439 | void QMetaType::registerStreamOperators(const char *typeName, SaveOperator saveOp, | - |
440 | LoadOperator loadOp) | - |
441 | { | - |
442 | registerStreamOperators(type(typeName), saveOp, loadOp); executed (the execution status of this line is deduced): registerStreamOperators(type(typeName), saveOp, loadOp); | - |
443 | } executed: } Execution Count:5 | 5 |
444 | | - |
445 | /*! | - |
446 | \internal | - |
447 | */ | - |
448 | void QMetaType::registerStreamOperators(int idx, SaveOperator saveOp, | - |
449 | LoadOperator loadOp) | - |
450 | { | - |
451 | if (idx < User) evaluated: idx < User yes Evaluation Count:2 | yes Evaluation Count:6 |
| 2-6 |
452 | return; //builtin types should not be registered; executed: return; Execution Count:2 | 2 |
453 | QVector<QCustomTypeInfo> *ct = customTypes(); executed (the execution status of this line is deduced): QVector<QCustomTypeInfo> *ct = customTypes(); | - |
454 | if (!ct) partially evaluated: !ct no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
455 | return; | 0 |
456 | QWriteLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QWriteLocker locker(customTypesLock()); | - |
457 | QCustomTypeInfo &inf = (*ct)[idx - User]; executed (the execution status of this line is deduced): QCustomTypeInfo &inf = (*ct)[idx - User]; | - |
458 | inf.saveOp = saveOp; executed (the execution status of this line is deduced): inf.saveOp = saveOp; | - |
459 | inf.loadOp = loadOp; executed (the execution status of this line is deduced): inf.loadOp = loadOp; | - |
460 | } executed: } Execution Count:6 | 6 |
461 | #endif // QT_NO_DATASTREAM | - |
462 | | - |
463 | /*! | - |
464 | Returns the type name associated with the given \a typeId, or 0 if no | - |
465 | matching type was found. The returned pointer must not be deleted. | - |
466 | | - |
467 | \sa type(), isRegistered(), Type | - |
468 | */ | - |
469 | const char *QMetaType::typeName(int typeId) | - |
470 | { | - |
471 | const uint type = typeId; executed (the execution status of this line is deduced): const uint type = typeId; | - |
472 | // In theory it can be filled during compilation time, but for some reason template code | - |
473 | // that is able to do it causes GCC 4.6 to generate additional 3K of executable code. Probably | - |
474 | // it is not worth of it. | - |
475 | static const char *namesCache[QMetaType::HighestInternalId + 1]; | - |
476 | | - |
477 | const char *result; executed (the execution status of this line is deduced): const char *result; | - |
478 | if (type <= QMetaType::HighestInternalId && ((result = namesCache[type]))) evaluated: type <= QMetaType::HighestInternalId yes Evaluation Count:22860 | yes Evaluation Count:4692 |
evaluated: ((result = namesCache[type])) yes Evaluation Count:22216 | yes Evaluation Count:644 |
| 644-22860 |
479 | return result; executed: return result; Execution Count:22216 | 22216 |
480 | | - |
481 | #define QT_METATYPE_TYPEID_TYPENAME_CONVERTER(MetaTypeName, TypeId, RealName) \ | - |
482 | case QMetaType::MetaTypeName: result = #RealName; break; | - |
483 | | - |
484 | switch (QMetaType::Type(type)) { | - |
485 | QT_FOR_EACH_STATIC_TYPE(QT_METATYPE_TYPEID_TYPENAME_CONVERTER) executed: break; Execution Count:6 executed: break; Execution Count:30 executed: break; Execution Count:48 executed: break; Execution Count:29 executed: break; Execution Count:31 executed: break; Execution Count:29 executed: break; Execution Count:32 executed: break; Execution Count:4 executed: break; Execution Count:28 executed: break; Execution Count:3 executed: break; Execution Count:3 executed: break; Execution Count:28 executed: break; Execution Count:5 executed: break; Execution Count:3 executed: break; Execution Count:2 executed: break; Execution Count:9 executed: break; Execution Count:3 executed: break; Execution Count:35 executed: break; Execution Count:16 executed: break; Execution Count:14 executed: break; Execution Count:2 executed: break; Execution Count:4 executed: break; Execution Count:3 executed: break; Execution Count:6 executed: break; Execution Count:6 executed: break; Execution Count:2 executed: break; Execution Count:9 executed: break; Execution Count:3 executed: break; Execution Count:2 executed: break; Execution Count:3 executed: break; Execution Count:2 executed: break; Execution Count:2 executed: break; Execution Count:8 executed: break; Execution Count:3 executed: break; Execution Count:3 executed: break; Execution Count:3 executed: break; Execution Count:2 executed: break; Execution Count:8 executed: break; Execution Count:18 executed: break; Execution Count:2 executed: break; Execution Count:2 executed: break; Execution Count:2 executed: break; Execution Count:2 executed: break; Execution Count:2 executed: break; Execution Count:12 executed: break; Execution Count:4 executed: break; Execution Count:5 executed: break; Execution Count:2 executed: break; Execution Count:5 executed: break; Execution Count:4 executed: break; Execution Count:4 executed: break; Execution Count:4 executed: break; Execution Count:4 executed: break; Execution Count:3 executed: break; Execution Count:5 executed: break; Execution Count:4 executed: break; Execution Count:4 executed: break; Execution Count:4 executed: break; Execution Count:4 executed: break; Execution Count:4 executed: break; Execution Count:4 executed: break; Execution Count:4 executed: break; Execution Count:4 executed: break; Execution Count:4 executed: break; Execution Count:4 executed: break; Execution Count:5 executed: break; Execution Count:5 executed: break; Execution Count:5 executed: break; Execution Count:5 executed: break; Execution Count:5 executed: break; Execution Count:3 executed: break; Execution Count:3 | 2-48 |
486 | | - |
487 | default: { | - |
488 | if (Q_UNLIKELY(type < QMetaType::User)) { evaluated: __builtin_expect(!!(type < QMetaType::User), false) yes Evaluation Count:966 | yes Evaluation Count:3790 |
| 966-3790 |
489 | return 0; // It can happen when someone cast int to QVariant::Type, we should not crash... executed: return 0; Execution Count:966 | 966 |
490 | } else { | - |
491 | const QVector<QCustomTypeInfo> * const ct = customTypes(); executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes(); | - |
492 | QReadLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock()); | - |
493 | return ct && uint(ct->count()) > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty() executed: return ct && uint(ct->count()) > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty() ? ct->at(type - QMetaType::User).typeName.constData() : 0; Execution Count:3790 | 3790 |
494 | ? ct->at(type - QMetaType::User).typeName.constData() executed: return ct && uint(ct->count()) > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty() ? ct->at(type - QMetaType::User).typeName.constData() : 0; Execution Count:3790 | 3790 |
495 | : 0; executed: return ct && uint(ct->count()) > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty() ? ct->at(type - QMetaType::User).typeName.constData() : 0; Execution Count:3790 | 3790 |
496 | } | - |
497 | } | - |
498 | } | - |
499 | #undef QT_METATYPE_TYPEID_TYPENAME_CONVERTER | - |
500 | | - |
501 | Q_ASSERT(type <= QMetaType::HighestInternalId); executed (the execution status of this line is deduced): qt_noop(); | - |
502 | namesCache[type] = result; executed (the execution status of this line is deduced): namesCache[type] = result; | - |
503 | return result; executed: return result; Execution Count:580 | 580 |
504 | } | - |
505 | | - |
506 | /*! | - |
507 | \internal | - |
508 | Similar to QMetaType::type(), but only looks in the static set of types. | - |
509 | */ | - |
510 | static inline int qMetaTypeStaticType(const char *typeName, int length) | - |
511 | { | - |
512 | int i = 0; executed (the execution status of this line is deduced): int i = 0; | - |
513 | while (types[i].typeName && ((length != types[i].typeNameLength) evaluated: types[i].typeName yes Evaluation Count:48341949 | yes Evaluation Count:328547 |
evaluated: (length != types[i].typeNameLength) yes Evaluation Count:45734700 | yes Evaluation Count:2610175 |
| 328547-48341949 |
514 | || strcmp(typeName, types[i].typeName))) { evaluated: strcmp(typeName, types[i].typeName) yes Evaluation Count:1549675 | yes Evaluation Count:1060542 |
| 1060542-1549675 |
515 | ++i; executed (the execution status of this line is deduced): ++i; | - |
516 | } executed: } Execution Count:47279290 | 47279290 |
517 | return types[i].type; executed: return types[i].type; Execution Count:1389069 | 1389069 |
518 | } | - |
519 | | - |
520 | /*! | - |
521 | \internal | - |
522 | Similar to QMetaType::type(), but only looks in the custom set of | - |
523 | types, and doesn't lock the mutex. | - |
524 | */ | - |
525 | static int qMetaTypeCustomType_unlocked(const char *typeName, int length) | - |
526 | { | - |
527 | const QVector<QCustomTypeInfo> * const ct = customTypes(); executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes(); | - |
528 | if (!ct) partially evaluated: !ct no Evaluation Count:0 | yes Evaluation Count:328811 |
| 0-328811 |
529 | return QMetaType::UnknownType; never executed: return QMetaType::UnknownType; | 0 |
530 | | - |
531 | for (int v = 0; v < ct->count(); ++v) { evaluated: v < ct->count() yes Evaluation Count:12332377 | yes Evaluation Count:116358 |
| 116358-12332377 |
532 | const QCustomTypeInfo &customInfo = ct->at(v); executed (the execution status of this line is deduced): const QCustomTypeInfo &customInfo = ct->at(v); | - |
533 | if ((length == customInfo.typeName.size()) evaluated: (length == customInfo.typeName.size()) yes Evaluation Count:7005978 | yes Evaluation Count:5435231 |
| 5435231-7005978 |
534 | && !strcmp(typeName, customInfo.typeName.constData())) { evaluated: !strcmp(typeName, customInfo.typeName.constData()) yes Evaluation Count:212433 | yes Evaluation Count:6795590 |
| 212433-6795590 |
535 | if (customInfo.alias >= 0) evaluated: customInfo.alias >= 0 yes Evaluation Count:57 | yes Evaluation Count:212378 |
| 57-212378 |
536 | return customInfo.alias; executed: return customInfo.alias; Execution Count:57 | 57 |
537 | return v + QMetaType::User; executed: return v + QMetaType::User; Execution Count:212378 | 212378 |
538 | } | - |
539 | } executed: } Execution Count:12120432 | 12120432 |
540 | return QMetaType::UnknownType; executed: return QMetaType::UnknownType; Execution Count:116358 | 116358 |
541 | } | - |
542 | | - |
543 | /*! | - |
544 | \internal | - |
545 | | - |
546 | This function is needed until existing code outside of qtbase | - |
547 | has been changed to call the new version of registerType(). | - |
548 | */ | - |
549 | int QMetaType::registerType(const char *typeName, Deleter deleter, | - |
550 | Creator creator) | - |
551 | { | - |
552 | return registerType(typeName, deleter, creator, never executed: return registerType(typeName, deleter, creator, QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Destruct, QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Construct, 0, TypeFlags(), 0); | 0 |
553 | QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Destruct, never executed: return registerType(typeName, deleter, creator, QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Destruct, QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Construct, 0, TypeFlags(), 0); | 0 |
554 | QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Construct, 0, TypeFlags(), 0); never executed: return registerType(typeName, deleter, creator, QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Destruct, QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Construct, 0, TypeFlags(), 0); | 0 |
555 | } | - |
556 | | - |
557 | /*! | - |
558 | \internal | - |
559 | \since 5.0 | - |
560 | | - |
561 | Registers a user type for marshalling, with \a typeName, a \a | - |
562 | deleter, a \a creator, a \a destructor, a \a constructor, and | - |
563 | a \a size. Returns the type's handle, or -1 if the type could | - |
564 | not be registered. | - |
565 | */ | - |
566 | int QMetaType::registerType(const char *typeName, Deleter deleter, | - |
567 | Creator creator, | - |
568 | Destructor destructor, | - |
569 | Constructor constructor, | - |
570 | int size, TypeFlags flags, const QMetaObject *metaObject) | - |
571 | { | - |
572 | #ifdef QT_NO_QOBJECT | - |
573 | NS(QByteArray) normalizedTypeName = typeName; | - |
574 | #else | - |
575 | NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName); executed (the execution status of this line is deduced): ::QByteArray normalizedTypeName = QMetaObject::normalizedType(typeName); | - |
576 | #endif | - |
577 | | - |
578 | return registerNormalizedType(normalizedTypeName, deleter, creator, destructor, constructor, size, flags, metaObject); executed: return registerNormalizedType(normalizedTypeName, deleter, creator, destructor, constructor, size, flags, metaObject); Execution Count:4 | 4 |
579 | } | - |
580 | | - |
581 | | - |
582 | /*! | - |
583 | \internal | - |
584 | \since 5.0 | - |
585 | | - |
586 | Registers a user type for marshalling, with \a normalizedTypeName, a \a | - |
587 | deleter, a \a creator, a \a destructor, a \a constructor, and | - |
588 | a \a size. Returns the type's handle, or -1 if the type could | - |
589 | not be registered. Note that normalizedTypeName is not checked for | - |
590 | conformance with Qt's normalized format, so it must already | - |
591 | conform. | - |
592 | */ | - |
593 | int QMetaType::registerNormalizedType(const NS(QByteArray) &normalizedTypeName, Deleter deleter, | - |
594 | Creator creator, | - |
595 | Destructor destructor, | - |
596 | Constructor constructor, | - |
597 | int size, TypeFlags flags, const QMetaObject *metaObject) | - |
598 | { | - |
599 | QVector<QCustomTypeInfo> *ct = customTypes(); executed (the execution status of this line is deduced): QVector<QCustomTypeInfo> *ct = customTypes(); | - |
600 | if (!ct || normalizedTypeName.isEmpty() || !deleter || !creator || !destructor || !constructor) partially evaluated: !ct no Evaluation Count:0 | yes Evaluation Count:16253 |
partially evaluated: normalizedTypeName.isEmpty() no Evaluation Count:0 | yes Evaluation Count:16259 |
partially evaluated: !deleter no Evaluation Count:0 | yes Evaluation Count:16258 |
partially evaluated: !creator no Evaluation Count:0 | yes Evaluation Count:16259 |
partially evaluated: !destructor no Evaluation Count:0 | yes Evaluation Count:16260 |
partially evaluated: !constructor no Evaluation Count:0 | yes Evaluation Count:16263 |
| 0-16263 |
601 | return -1; never executed: return -1; | 0 |
602 | | - |
603 | int idx = qMetaTypeStaticType(normalizedTypeName.constData(), executed (the execution status of this line is deduced): int idx = qMetaTypeStaticType(normalizedTypeName.constData(), | - |
604 | normalizedTypeName.size()); executed (the execution status of this line is deduced): normalizedTypeName.size()); | - |
605 | | - |
606 | int previousSize = 0; executed (the execution status of this line is deduced): int previousSize = 0; | - |
607 | int previousFlags = 0; executed (the execution status of this line is deduced): int previousFlags = 0; | - |
608 | if (idx == UnknownType) { partially evaluated: idx == UnknownType yes Evaluation Count:16077 | no Evaluation Count:0 |
| 0-16077 |
609 | QWriteLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QWriteLocker locker(customTypesLock()); | - |
610 | idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), executed (the execution status of this line is deduced): idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), | - |
611 | normalizedTypeName.size()); executed (the execution status of this line is deduced): normalizedTypeName.size()); | - |
612 | if (idx == UnknownType) { evaluated: idx == UnknownType yes Evaluation Count:4153 | yes Evaluation Count:12127 |
| 4153-12127 |
613 | QCustomTypeInfo inf; executed (the execution status of this line is deduced): QCustomTypeInfo inf; | - |
614 | inf.typeName = normalizedTypeName; executed (the execution status of this line is deduced): inf.typeName = normalizedTypeName; | - |
615 | inf.creator = creator; executed (the execution status of this line is deduced): inf.creator = creator; | - |
616 | inf.deleter = deleter; executed (the execution status of this line is deduced): inf.deleter = deleter; | - |
617 | #ifndef QT_NO_DATASTREAM | - |
618 | inf.loadOp = 0; executed (the execution status of this line is deduced): inf.loadOp = 0; | - |
619 | inf.saveOp = 0; executed (the execution status of this line is deduced): inf.saveOp = 0; | - |
620 | #endif | - |
621 | inf.alias = -1; executed (the execution status of this line is deduced): inf.alias = -1; | - |
622 | inf.constructor = constructor; executed (the execution status of this line is deduced): inf.constructor = constructor; | - |
623 | inf.destructor = destructor; executed (the execution status of this line is deduced): inf.destructor = destructor; | - |
624 | inf.size = size; executed (the execution status of this line is deduced): inf.size = size; | - |
625 | inf.flags = flags; executed (the execution status of this line is deduced): inf.flags = flags; | - |
626 | inf.metaObject = metaObject; executed (the execution status of this line is deduced): inf.metaObject = metaObject; | - |
627 | idx = ct->size() + User; executed (the execution status of this line is deduced): idx = ct->size() + User; | - |
628 | ct->append(inf); executed (the execution status of this line is deduced): ct->append(inf); | - |
629 | return idx; executed: return idx; Execution Count:4153 | 4153 |
630 | } | - |
631 | | - |
632 | if (idx >= User) { partially evaluated: idx >= User yes Evaluation Count:12127 | no Evaluation Count:0 |
| 0-12127 |
633 | previousSize = ct->at(idx - User).size; executed (the execution status of this line is deduced): previousSize = ct->at(idx - User).size; | - |
634 | previousFlags = ct->at(idx - User).flags; executed (the execution status of this line is deduced): previousFlags = ct->at(idx - User).flags; | - |
635 | } executed: } Execution Count:12127 | 12127 |
636 | } executed: } Execution Count:12127 | 12127 |
637 | | - |
638 | if (idx < User) { partially evaluated: idx < User no Evaluation Count:0 | yes Evaluation Count:12127 |
| 0-12127 |
639 | previousSize = QMetaType::sizeOf(idx); never executed (the execution status of this line is deduced): previousSize = QMetaType::sizeOf(idx); | - |
640 | previousFlags = QMetaType::typeFlags(idx); never executed (the execution status of this line is deduced): previousFlags = QMetaType::typeFlags(idx); | - |
641 | } | 0 |
642 | | - |
643 | if (previousSize != size) { partially evaluated: previousSize != size no Evaluation Count:0 | yes Evaluation Count:12127 |
| 0-12127 |
644 | qFatal("QMetaType::registerType: Binary compatibility break " never executed (the execution status of this line is deduced): QMessageLogger("kernel/qmetatype.cpp", 644, __PRETTY_FUNCTION__).fatal("QMetaType::registerType: Binary compatibility break " | - |
645 | "-- Size mismatch for type '%s' [%i]. Previously registered " never executed (the execution status of this line is deduced): "-- Size mismatch for type '%s' [%i]. Previously registered " | - |
646 | "size %i, now registering size %i.", never executed (the execution status of this line is deduced): "size %i, now registering size %i.", | - |
647 | normalizedTypeName.constData(), idx, previousSize, size); never executed (the execution status of this line is deduced): normalizedTypeName.constData(), idx, previousSize, size); | - |
648 | } | 0 |
649 | | - |
650 | // Ignore WasDeclaredAsMetaType inconsitency, to many users were hitting the problem | - |
651 | previousFlags |= WasDeclaredAsMetaType; executed (the execution status of this line is deduced): previousFlags |= WasDeclaredAsMetaType; | - |
652 | flags |= WasDeclaredAsMetaType; executed (the execution status of this line is deduced): flags |= WasDeclaredAsMetaType; | - |
653 | | - |
654 | if (previousFlags != flags) { partially evaluated: previousFlags != flags no Evaluation Count:0 | yes Evaluation Count:12127 |
| 0-12127 |
655 | const int maskForTypeInfo = NeedsConstruction | NeedsDestruction | MovableType; never executed (the execution status of this line is deduced): const int maskForTypeInfo = NeedsConstruction | NeedsDestruction | MovableType; | - |
656 | const char *msg = "QMetaType::registerType: Binary compatibility break. " never executed (the execution status of this line is deduced): const char *msg = "QMetaType::registerType: Binary compatibility break. " | - |
657 | "\nType flags for type '%s' [%i] don't match. Previously " never executed (the execution status of this line is deduced): "\nType flags for type '%s' [%i] don't match. Previously " | - |
658 | "registered TypeFlags(0x%x), now registering TypeFlags(0x%x). " never executed (the execution status of this line is deduced): "registered TypeFlags(0x%x), now registering TypeFlags(0x%x). " | - |
659 | "This is an ODR break, which means that your application depends on a C++ undefined behavior." never executed (the execution status of this line is deduced): "This is an ODR break, which means that your application depends on a C++ undefined behavior." | - |
660 | "\nHint: %s"; never executed (the execution status of this line is deduced): "\nHint: %s"; | - |
661 | QT_PREPEND_NAMESPACE(QByteArray) hint; never executed (the execution status of this line is deduced): ::QByteArray hint; | - |
662 | if ((previousFlags & maskForTypeInfo) != (flags & maskForTypeInfo)) { never evaluated: (previousFlags & maskForTypeInfo) != (flags & maskForTypeInfo) | 0 |
663 | hint += "\nIt seems that the type was registered at least twice in a different translation units, " never executed (the execution status of this line is deduced): hint += "\nIt seems that the type was registered at least twice in a different translation units, " | - |
664 | "but Q_DECLARE_TYPEINFO is not visible from all the translations unit or different flags were used." never executed (the execution status of this line is deduced): "but Q_DECLARE_TYPEINFO is not visible from all the translations unit or different flags were used." | - |
665 | "Remember that Q_DECLARE_TYPEINFO should be declared before QMetaType registration, " never executed (the execution status of this line is deduced): "Remember that Q_DECLARE_TYPEINFO should be declared before QMetaType registration, " | - |
666 | "preferably it should be placed just after the type declaration and before Q_DECLARE_METATYPE"; never executed (the execution status of this line is deduced): "preferably it should be placed just after the type declaration and before Q_DECLARE_METATYPE"; | - |
667 | } | 0 |
668 | qFatal(msg, normalizedTypeName.constData(), idx, previousFlags, int(flags), hint.constData()); never executed (the execution status of this line is deduced): QMessageLogger("kernel/qmetatype.cpp", 668, __PRETTY_FUNCTION__).fatal(msg, normalizedTypeName.constData(), idx, previousFlags, int(flags), hint.constData()); | - |
669 | } | 0 |
670 | | - |
671 | return idx; executed: return idx; Execution Count:12127 | 12127 |
672 | } | - |
673 | | - |
674 | /*! | - |
675 | \internal | - |
676 | \since 4.7 | - |
677 | | - |
678 | Registers a user type for marshalling, as an alias of another type (typedef) | - |
679 | */ | - |
680 | int QMetaType::registerTypedef(const char* typeName, int aliasId) | - |
681 | { | - |
682 | #ifdef QT_NO_QOBJECT | - |
683 | NS(QByteArray) normalizedTypeName = typeName; | - |
684 | #else | - |
685 | NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName); never executed (the execution status of this line is deduced): ::QByteArray normalizedTypeName = QMetaObject::normalizedType(typeName); | - |
686 | #endif | - |
687 | | - |
688 | return registerNormalizedTypedef(normalizedTypeName, aliasId); never executed: return registerNormalizedTypedef(normalizedTypeName, aliasId); | 0 |
689 | } | - |
690 | | - |
691 | /*! | - |
692 | \internal | - |
693 | \since 5.0 | - |
694 | | - |
695 | Registers a user type for marshalling, as an alias of another type (typedef). | - |
696 | Note that normalizedTypeName is not checked for conformance with Qt's normalized format, | - |
697 | so it must already conform. | - |
698 | */ | - |
699 | int QMetaType::registerNormalizedTypedef(const NS(QByteArray) &normalizedTypeName, int aliasId) | - |
700 | { | - |
701 | QVector<QCustomTypeInfo> *ct = customTypes(); executed (the execution status of this line is deduced): QVector<QCustomTypeInfo> *ct = customTypes(); | - |
702 | if (!ct || normalizedTypeName.isEmpty()) partially evaluated: !ct no Evaluation Count:0 | yes Evaluation Count:688 |
partially evaluated: normalizedTypeName.isEmpty() no Evaluation Count:0 | yes Evaluation Count:688 |
| 0-688 |
703 | return -1; never executed: return -1; | 0 |
704 | | - |
705 | int idx = qMetaTypeStaticType(normalizedTypeName.constData(), executed (the execution status of this line is deduced): int idx = qMetaTypeStaticType(normalizedTypeName.constData(), | - |
706 | normalizedTypeName.size()); executed (the execution status of this line is deduced): normalizedTypeName.size()); | - |
707 | | - |
708 | if (idx == UnknownType) { evaluated: idx == UnknownType yes Evaluation Count:681 | yes Evaluation Count:7 |
| 7-681 |
709 | QWriteLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QWriteLocker locker(customTypesLock()); | - |
710 | idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), executed (the execution status of this line is deduced): idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), | - |
711 | normalizedTypeName.size()); executed (the execution status of this line is deduced): normalizedTypeName.size()); | - |
712 | | - |
713 | if (idx == UnknownType) { evaluated: idx == UnknownType yes Evaluation Count:12 | yes Evaluation Count:669 |
| 12-669 |
714 | QCustomTypeInfo inf; executed (the execution status of this line is deduced): QCustomTypeInfo inf; | - |
715 | inf.typeName = normalizedTypeName; executed (the execution status of this line is deduced): inf.typeName = normalizedTypeName; | - |
716 | inf.alias = aliasId; executed (the execution status of this line is deduced): inf.alias = aliasId; | - |
717 | inf.creator = 0; executed (the execution status of this line is deduced): inf.creator = 0; | - |
718 | inf.deleter = 0; executed (the execution status of this line is deduced): inf.deleter = 0; | - |
719 | ct->append(inf); executed (the execution status of this line is deduced): ct->append(inf); | - |
720 | return aliasId; executed: return aliasId; Execution Count:12 | 12 |
721 | } | - |
722 | } executed: } Execution Count:669 | 669 |
723 | | - |
724 | if (idx != aliasId) { partially evaluated: idx != aliasId no Evaluation Count:0 | yes Evaluation Count:676 |
| 0-676 |
725 | qFatal("QMetaType::registerTypedef: Binary compatibility break " never executed (the execution status of this line is deduced): QMessageLogger("kernel/qmetatype.cpp", 725, __PRETTY_FUNCTION__).fatal("QMetaType::registerTypedef: Binary compatibility break " | - |
726 | "-- Type name '%s' previously registered as typedef of '%s' [%i], " never executed (the execution status of this line is deduced): "-- Type name '%s' previously registered as typedef of '%s' [%i], " | - |
727 | "now registering as typedef of '%s' [%i].", never executed (the execution status of this line is deduced): "now registering as typedef of '%s' [%i].", | - |
728 | normalizedTypeName.constData(), QMetaType::typeName(idx), idx, never executed (the execution status of this line is deduced): normalizedTypeName.constData(), QMetaType::typeName(idx), idx, | - |
729 | QMetaType::typeName(aliasId), aliasId); never executed (the execution status of this line is deduced): QMetaType::typeName(aliasId), aliasId); | - |
730 | } | 0 |
731 | return idx; executed: return idx; Execution Count:676 | 676 |
732 | } | - |
733 | | - |
734 | /*! | - |
735 | Returns true if the datatype with ID \a type is registered; | - |
736 | otherwise returns false. | - |
737 | | - |
738 | \sa type(), typeName(), Type | - |
739 | */ | - |
740 | bool QMetaType::isRegistered(int type) | - |
741 | { | - |
742 | // predefined type | - |
743 | if ((type >= FirstCoreType && type <= LastCoreType) evaluated: type >= FirstCoreType yes Evaluation Count:39891 | yes Evaluation Count:3 |
evaluated: type <= LastCoreType yes Evaluation Count:24794 | yes Evaluation Count:15097 |
| 3-39891 |
744 | || (type >= FirstGuiType && type <= LastGuiType) evaluated: type >= FirstGuiType yes Evaluation Count:15095 | yes Evaluation Count:5 |
evaluated: type <= LastGuiType yes Evaluation Count:67 | yes Evaluation Count:15028 |
| 5-15095 |
745 | || (type >= FirstWidgetsType && type <= LastWidgetsType)) { evaluated: type >= FirstWidgetsType yes Evaluation Count:15026 | yes Evaluation Count:7 |
evaluated: type <= LastWidgetsType yes Evaluation Count:3 | yes Evaluation Count:15023 |
| 3-15026 |
746 | return true; executed: return true; Execution Count:24864 | 24864 |
747 | } | - |
748 | | - |
749 | QReadLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock()); | - |
750 | const QVector<QCustomTypeInfo> * const ct = customTypes(); executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes(); | - |
751 | return ((type >= User) && (ct && ct->count() > type - User) && !ct->at(type - User).typeName.isEmpty()); executed: return ((type >= User) && (ct && ct->count() > type - User) && !ct->at(type - User).typeName.isEmpty()); Execution Count:15030 | 15030 |
752 | } | - |
753 | | - |
754 | /*! | - |
755 | \fn int qMetaTypeTypeImpl(const char *typeName) | - |
756 | \internal | - |
757 | | - |
758 | Implementation of QMetaType::type(). | - |
759 | */ | - |
760 | template <bool tryNormalizedType> | - |
761 | static inline int qMetaTypeTypeImpl(const char *typeName) | - |
762 | { | - |
763 | int length = qstrlen(typeName); executed (the execution status of this line is deduced): int length = qstrlen(typeName); | - |
764 | if (!length) evaluated: !length yes Evaluation Count:102 | yes Evaluation Count:1372267 |
| 102-1372267 |
765 | return QMetaType::UnknownType; executed: return QMetaType::UnknownType; Execution Count:102 | 102 |
766 | int type = qMetaTypeStaticType(typeName, length); executed (the execution status of this line is deduced): int type = qMetaTypeStaticType(typeName, length); | - |
767 | if (type == QMetaType::UnknownType) { evaluated: type == QMetaType::UnknownType yes Evaluation Count:311729 | yes Evaluation Count:1060532 |
| 311729-1060532 |
768 | QReadLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock()); | - |
769 | type = qMetaTypeCustomType_unlocked(typeName, length); executed (the execution status of this line is deduced): type = qMetaTypeCustomType_unlocked(typeName, length); | - |
770 | #ifndef QT_NO_QOBJECT | - |
771 | if ((type == QMetaType::UnknownType) && tryNormalizedType) { evaluated: (type == QMetaType::UnknownType) yes Evaluation Count:112093 | yes Evaluation Count:199636 |
evaluated: tryNormalizedType yes Evaluation Count:106 | yes Evaluation Count:111987 |
| 106-199636 |
772 | const NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName); executed (the execution status of this line is deduced): const ::QByteArray normalizedTypeName = QMetaObject::normalizedType(typeName); | - |
773 | type = qMetaTypeStaticType(normalizedTypeName.constData(), executed (the execution status of this line is deduced): type = qMetaTypeStaticType(normalizedTypeName.constData(), | - |
774 | normalizedTypeName.size()); executed (the execution status of this line is deduced): normalizedTypeName.size()); | - |
775 | if (type == QMetaType::UnknownType) { evaluated: type == QMetaType::UnknownType yes Evaluation Count:104 | yes Evaluation Count:2 |
| 2-104 |
776 | type = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), executed (the execution status of this line is deduced): type = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), | - |
777 | normalizedTypeName.size()); executed (the execution status of this line is deduced): normalizedTypeName.size()); | - |
778 | } executed: } Execution Count:104 | 104 |
779 | } executed: } Execution Count:106 | 106 |
780 | #endif | - |
781 | } executed: } Execution Count:311724 | 311724 |
782 | return type; executed: return type; Execution Count:1372273 | 1372273 |
783 | } | - |
784 | | - |
785 | /*! | - |
786 | Returns a handle to the type called \a typeName, or QMetaType::UnknownType if there is | - |
787 | no such type. | - |
788 | | - |
789 | \sa isRegistered(), typeName(), Type | - |
790 | */ | - |
791 | int QMetaType::type(const char *typeName) | - |
792 | { | - |
793 | return qMetaTypeTypeImpl</*tryNormalizedType=*/true>(typeName); executed: return qMetaTypeTypeImpl< true>(typeName); Execution Count:126573 | 126573 |
794 | } | - |
795 | | - |
796 | /*! | - |
797 | \a internal | - |
798 | | - |
799 | Similar to QMetaType::type(); the only difference is that this function | - |
800 | doesn't attempt to normalize the type name (i.e., the lookup will fail | - |
801 | for type names in non-normalized form). | - |
802 | */ | - |
803 | int qMetaTypeTypeInternal(const char *typeName) | - |
804 | { | - |
805 | return qMetaTypeTypeImpl</*tryNormalizedType=*/false>(typeName); executed: return qMetaTypeTypeImpl< false>(typeName); Execution Count:1245806 | 1245806 |
806 | } | - |
807 | | - |
808 | #ifndef QT_NO_DATASTREAM | - |
809 | /*! | - |
810 | Writes the object pointed to by \a data with the ID \a type to | - |
811 | the given \a stream. Returns true if the object is saved | - |
812 | successfully; otherwise returns false. | - |
813 | | - |
814 | The type must have been registered with qRegisterMetaType() and | - |
815 | qRegisterMetaTypeStreamOperators() beforehand. | - |
816 | | - |
817 | Normally, you should not need to call this function directly. | - |
818 | Instead, use QVariant's \c operator<<(), which relies on save() | - |
819 | to stream custom types. | - |
820 | | - |
821 | \sa load(), qRegisterMetaTypeStreamOperators() | - |
822 | */ | - |
823 | bool QMetaType::save(QDataStream &stream, int type, const void *data) | - |
824 | { | - |
825 | if (!data || !isRegistered(type)) evaluated: !data yes Evaluation Count:25 | yes Evaluation Count:12359 |
partially evaluated: !isRegistered(type) no Evaluation Count:0 | yes Evaluation Count:12359 |
| 0-12359 |
826 | return false; executed: return false; Execution Count:25 | 25 |
827 | | - |
828 | switch(type) { | - |
829 | case QMetaType::UnknownType: | - |
830 | case QMetaType::Void: | - |
831 | case QMetaType::VoidStar: | - |
832 | case QMetaType::QObjectStar: | - |
833 | case QMetaType::QModelIndex: | - |
834 | case QMetaType::QJsonValue: | - |
835 | case QMetaType::QJsonObject: | - |
836 | case QMetaType::QJsonArray: | - |
837 | case QMetaType::QJsonDocument: | - |
838 | return false; executed: return false; Execution Count:7 | 7 |
839 | case QMetaType::Long: | - |
840 | stream << qlonglong(*static_cast<const long *>(data)); executed (the execution status of this line is deduced): stream << qlonglong(*static_cast<const long *>(data)); | - |
841 | break; executed: break; Execution Count:5 | 5 |
842 | case QMetaType::Int: | - |
843 | stream << *static_cast<const int *>(data); executed (the execution status of this line is deduced): stream << *static_cast<const int *>(data); | - |
844 | break; executed: break; Execution Count:175 | 175 |
845 | case QMetaType::Short: | - |
846 | stream << *static_cast<const short *>(data); executed (the execution status of this line is deduced): stream << *static_cast<const short *>(data); | - |
847 | break; executed: break; Execution Count:5 | 5 |
848 | case QMetaType::Char: | - |
849 | // force a char to be signed | - |
850 | stream << *static_cast<const signed char *>(data); executed (the execution status of this line is deduced): stream << *static_cast<const signed char *>(data); | - |
851 | break; executed: break; Execution Count:5 | 5 |
852 | case QMetaType::ULong: | - |
853 | stream << qulonglong(*static_cast<const ulong *>(data)); executed (the execution status of this line is deduced): stream << qulonglong(*static_cast<const ulong *>(data)); | - |
854 | break; executed: break; Execution Count:5 | 5 |
855 | case QMetaType::UInt: | - |
856 | stream << *static_cast<const uint *>(data); executed (the execution status of this line is deduced): stream << *static_cast<const uint *>(data); | - |
857 | break; executed: break; Execution Count:4 | 4 |
858 | case QMetaType::LongLong: | - |
859 | stream << *static_cast<const qlonglong *>(data); executed (the execution status of this line is deduced): stream << *static_cast<const qlonglong *>(data); | - |
860 | break; executed: break; Execution Count:3 | 3 |
861 | case QMetaType::ULongLong: | - |
862 | stream << *static_cast<const qulonglong *>(data); executed (the execution status of this line is deduced): stream << *static_cast<const qulonglong *>(data); | - |
863 | break; executed: break; Execution Count:3 | 3 |
864 | case QMetaType::UShort: | - |
865 | stream << *static_cast<const ushort *>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ushort *>(data); | - |
866 | break; executed: break; Execution Count:5 | 5 |
867 | case QMetaType::SChar: | - |
868 | stream << *static_cast<const signed char *>(data); executed (the execution status of this line is deduced): stream << *static_cast<const signed char *>(data); | - |
869 | break; executed: break; Execution Count:1 | 1 |
870 | case QMetaType::UChar: | - |
871 | stream << *static_cast<const uchar *>(data); executed (the execution status of this line is deduced): stream << *static_cast<const uchar *>(data); | - |
872 | break; executed: break; Execution Count:5 | 5 |
873 | case QMetaType::Bool: | - |
874 | stream << qint8(*static_cast<const bool *>(data)); executed (the execution status of this line is deduced): stream << qint8(*static_cast<const bool *>(data)); | - |
875 | break; executed: break; Execution Count:3 | 3 |
876 | case QMetaType::Float: | - |
877 | stream << *static_cast<const float *>(data); executed (the execution status of this line is deduced): stream << *static_cast<const float *>(data); | - |
878 | break; executed: break; Execution Count:7 | 7 |
879 | case QMetaType::Double: | - |
880 | stream << *static_cast<const double *>(data); executed (the execution status of this line is deduced): stream << *static_cast<const double *>(data); | - |
881 | break; executed: break; Execution Count:6 | 6 |
882 | case QMetaType::QChar: | - |
883 | stream << *static_cast<const NS(QChar) *>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QChar *>(data); | - |
884 | break; executed: break; Execution Count:5 | 5 |
885 | #ifndef QT_BOOTSTRAPPED | - |
886 | case QMetaType::QVariantMap: | - |
887 | stream << *static_cast<const NS(QVariantMap)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QVariantMap*>(data); | - |
888 | break; executed: break; Execution Count:5 | 5 |
889 | case QMetaType::QVariantHash: | - |
890 | stream << *static_cast<const NS(QVariantHash)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QVariantHash*>(data); | - |
891 | break; executed: break; Execution Count:3 | 3 |
892 | case QMetaType::QVariantList: | - |
893 | stream << *static_cast<const NS(QVariantList)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QVariantList*>(data); | - |
894 | break; executed: break; Execution Count:19 | 19 |
895 | case QMetaType::QVariant: | - |
896 | stream << *static_cast<const NS(QVariant)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QVariant*>(data); | - |
897 | break; executed: break; Execution Count:3 | 3 |
898 | #endif | - |
899 | case QMetaType::QByteArray: | - |
900 | stream << *static_cast<const NS(QByteArray)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QByteArray*>(data); | - |
901 | break; executed: break; Execution Count:6 | 6 |
902 | case QMetaType::QString: | - |
903 | stream << *static_cast<const NS(QString)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QString*>(data); | - |
904 | break; executed: break; Execution Count:11934 | 11934 |
905 | case QMetaType::QStringList: | - |
906 | stream << *static_cast<const NS(QStringList)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QStringList*>(data); | - |
907 | break; executed: break; Execution Count:8 | 8 |
908 | #ifndef QT_BOOTSTRAPPED | - |
909 | case QMetaType::QBitArray: | - |
910 | stream << *static_cast<const NS(QBitArray)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QBitArray*>(data); | - |
911 | break; executed: break; Execution Count:5 | 5 |
912 | #endif | - |
913 | case QMetaType::QDate: | - |
914 | stream << *static_cast<const NS(QDate)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QDate*>(data); | - |
915 | break; executed: break; Execution Count:5 | 5 |
916 | case QMetaType::QTime: | - |
917 | stream << *static_cast<const NS(QTime)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QTime*>(data); | - |
918 | break; executed: break; Execution Count:5 | 5 |
919 | case QMetaType::QDateTime: | - |
920 | stream << *static_cast<const NS(QDateTime)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QDateTime*>(data); | - |
921 | break; executed: break; Execution Count:5 | 5 |
922 | #ifndef QT_BOOTSTRAPPED | - |
923 | case QMetaType::QUrl: | - |
924 | stream << *static_cast<const NS(QUrl)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QUrl*>(data); | - |
925 | break; executed: break; Execution Count:3 | 3 |
926 | #endif | - |
927 | case QMetaType::QLocale: | - |
928 | stream << *static_cast<const NS(QLocale)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QLocale*>(data); | - |
929 | break; executed: break; Execution Count:3 | 3 |
930 | #ifndef QT_NO_GEOM_VARIANT | - |
931 | case QMetaType::QRect: | - |
932 | stream << *static_cast<const NS(QRect)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QRect*>(data); | - |
933 | break; executed: break; Execution Count:5 | 5 |
934 | case QMetaType::QRectF: | - |
935 | stream << *static_cast<const NS(QRectF)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QRectF*>(data); | - |
936 | break; executed: break; Execution Count:3 | 3 |
937 | case QMetaType::QSize: | - |
938 | stream << *static_cast<const NS(QSize)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QSize*>(data); | - |
939 | break; executed: break; Execution Count:6 | 6 |
940 | case QMetaType::QSizeF: | - |
941 | stream << *static_cast<const NS(QSizeF)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QSizeF*>(data); | - |
942 | break; executed: break; Execution Count:3 | 3 |
943 | case QMetaType::QLine: | - |
944 | stream << *static_cast<const NS(QLine)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QLine*>(data); | - |
945 | break; executed: break; Execution Count:3 | 3 |
946 | case QMetaType::QLineF: | - |
947 | stream << *static_cast<const NS(QLineF)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QLineF*>(data); | - |
948 | break; executed: break; Execution Count:3 | 3 |
949 | case QMetaType::QPoint: | - |
950 | stream << *static_cast<const NS(QPoint)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QPoint*>(data); | - |
951 | break; executed: break; Execution Count:5 | 5 |
952 | case QMetaType::QPointF: | - |
953 | stream << *static_cast<const NS(QPointF)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QPointF*>(data); | - |
954 | break; executed: break; Execution Count:3 | 3 |
955 | #endif | - |
956 | #ifndef QT_NO_REGEXP | - |
957 | case QMetaType::QRegExp: | - |
958 | stream << *static_cast<const NS(QRegExp)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QRegExp*>(data); | - |
959 | break; executed: break; Execution Count:47 | 47 |
960 | #endif | - |
961 | #ifndef QT_BOOTSTRAPPED | - |
962 | #ifndef QT_NO_REGEXP | - |
963 | case QMetaType::QRegularExpression: | - |
964 | stream << *static_cast<const NS(QRegularExpression)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QRegularExpression*>(data); | - |
965 | break; executed: break; Execution Count:4 | 4 |
966 | #endif // QT_NO_REGEXP | - |
967 | case QMetaType::QEasingCurve: | - |
968 | stream << *static_cast<const NS(QEasingCurve)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QEasingCurve*>(data); | - |
969 | break; executed: break; Execution Count:1 | 1 |
970 | #endif // QT_BOOTSTRAPPED | - |
971 | case QMetaType::QFont: | - |
972 | case QMetaType::QPixmap: | - |
973 | case QMetaType::QBrush: | - |
974 | case QMetaType::QColor: | - |
975 | case QMetaType::QPalette: | - |
976 | case QMetaType::QImage: | - |
977 | case QMetaType::QPolygon: | - |
978 | case QMetaType::QPolygonF: | - |
979 | case QMetaType::QRegion: | - |
980 | case QMetaType::QBitmap: | - |
981 | case QMetaType::QCursor: | - |
982 | case QMetaType::QKeySequence: | - |
983 | case QMetaType::QPen: | - |
984 | case QMetaType::QTextLength: | - |
985 | case QMetaType::QTextFormat: | - |
986 | case QMetaType::QMatrix: | - |
987 | case QMetaType::QTransform: | - |
988 | case QMetaType::QMatrix4x4: | - |
989 | case QMetaType::QVector2D: | - |
990 | case QMetaType::QVector3D: | - |
991 | case QMetaType::QVector4D: | - |
992 | case QMetaType::QQuaternion: | - |
993 | case QMetaType::QIcon: | - |
994 | if (!qMetaTypeGuiHelper) partially evaluated: !qMetaTypeGuiHelper no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
995 | return false; never executed: return false; | 0 |
996 | qMetaTypeGuiHelper[type - FirstGuiType].saveOp(stream, data); executed (the execution status of this line is deduced): qMetaTypeGuiHelper[type - FirstGuiType].saveOp(stream, data); | - |
997 | break; executed: break; Execution Count:20 | 20 |
998 | case QMetaType::QSizePolicy: | - |
999 | if (!qMetaTypeWidgetsHelper) partially evaluated: !qMetaTypeWidgetsHelper no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1000 | return false; never executed: return false; | 0 |
1001 | qMetaTypeWidgetsHelper[type - FirstWidgetsType].saveOp(stream, data); executed (the execution status of this line is deduced): qMetaTypeWidgetsHelper[type - FirstWidgetsType].saveOp(stream, data); | - |
1002 | break; executed: break; Execution Count:1 | 1 |
1003 | case QMetaType::QUuid: | - |
1004 | stream << *static_cast<const NS(QUuid)*>(data); executed (the execution status of this line is deduced): stream << *static_cast<const ::QUuid*>(data); | - |
1005 | break; executed: break; Execution Count:2 | 2 |
1006 | default: { | - |
1007 | const QVector<QCustomTypeInfo> * const ct = customTypes(); executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes(); | - |
1008 | if (!ct) partially evaluated: !ct no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1009 | return false; never executed: return false; | 0 |
1010 | | - |
1011 | SaveOperator saveOp = 0; executed (the execution status of this line is deduced): SaveOperator saveOp = 0; | - |
1012 | { | - |
1013 | QReadLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock()); | - |
1014 | saveOp = ct->at(type - User).saveOp; executed (the execution status of this line is deduced): saveOp = ct->at(type - User).saveOp; | - |
1015 | } | - |
1016 | | - |
1017 | if (!saveOp) evaluated: !saveOp yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
1018 | return false; executed: return false; Execution Count:1 | 1 |
1019 | saveOp(stream, data); executed (the execution status of this line is deduced): saveOp(stream, data); | - |
1020 | break; } executed: break; Execution Count:4 | 4 |
1021 | } | - |
1022 | | - |
1023 | return true; executed: return true; Execution Count:12351 | 12351 |
1024 | } | - |
1025 | | - |
1026 | /*! | - |
1027 | Reads the object of the specified \a type from the given \a | - |
1028 | stream into \a data. Returns true if the object is loaded | - |
1029 | successfully; otherwise returns false. | - |
1030 | | - |
1031 | The type must have been registered with qRegisterMetaType() and | - |
1032 | qRegisterMetaTypeStreamOperators() beforehand. | - |
1033 | | - |
1034 | Normally, you should not need to call this function directly. | - |
1035 | Instead, use QVariant's \c operator>>(), which relies on load() | - |
1036 | to stream custom types. | - |
1037 | | - |
1038 | \sa save(), qRegisterMetaTypeStreamOperators() | - |
1039 | */ | - |
1040 | bool QMetaType::load(QDataStream &stream, int type, void *data) | - |
1041 | { | - |
1042 | if (!data || !isRegistered(type)) evaluated: !data yes Evaluation Count:25 | yes Evaluation Count:12438 |
partially evaluated: !isRegistered(type) no Evaluation Count:0 | yes Evaluation Count:12438 |
| 0-12438 |
1043 | return false; executed: return false; Execution Count:25 | 25 |
1044 | | - |
1045 | switch(type) { | - |
1046 | case QMetaType::UnknownType: | - |
1047 | case QMetaType::Void: | - |
1048 | case QMetaType::VoidStar: | - |
1049 | case QMetaType::QObjectStar: | - |
1050 | case QMetaType::QModelIndex: | - |
1051 | case QMetaType::QJsonValue: | - |
1052 | case QMetaType::QJsonObject: | - |
1053 | case QMetaType::QJsonArray: | - |
1054 | case QMetaType::QJsonDocument: | - |
1055 | return false; executed: return false; Execution Count:7 | 7 |
1056 | case QMetaType::Long: { | - |
1057 | qlonglong l; executed (the execution status of this line is deduced): qlonglong l; | - |
1058 | stream >> l; executed (the execution status of this line is deduced): stream >> l; | - |
1059 | *static_cast<long *>(data) = long(l); executed (the execution status of this line is deduced): *static_cast<long *>(data) = long(l); | - |
1060 | break; } executed: break; Execution Count:9 | 9 |
1061 | case QMetaType::Int: | - |
1062 | stream >> *static_cast<int *>(data); executed (the execution status of this line is deduced): stream >> *static_cast<int *>(data); | - |
1063 | break; executed: break; Execution Count:146 | 146 |
1064 | case QMetaType::Short: | - |
1065 | stream >> *static_cast<short *>(data); executed (the execution status of this line is deduced): stream >> *static_cast<short *>(data); | - |
1066 | break; executed: break; Execution Count:9 | 9 |
1067 | case QMetaType::Char: | - |
1068 | // force a char to be signed | - |
1069 | stream >> *static_cast<signed char *>(data); executed (the execution status of this line is deduced): stream >> *static_cast<signed char *>(data); | - |
1070 | break; executed: break; Execution Count:9 | 9 |
1071 | case QMetaType::ULong: { | - |
1072 | qulonglong ul; executed (the execution status of this line is deduced): qulonglong ul; | - |
1073 | stream >> ul; executed (the execution status of this line is deduced): stream >> ul; | - |
1074 | *static_cast<ulong *>(data) = ulong(ul); executed (the execution status of this line is deduced): *static_cast<ulong *>(data) = ulong(ul); | - |
1075 | break; } executed: break; Execution Count:9 | 9 |
1076 | case QMetaType::UInt: | - |
1077 | stream >> *static_cast<uint *>(data); executed (the execution status of this line is deduced): stream >> *static_cast<uint *>(data); | - |
1078 | break; executed: break; Execution Count:8 | 8 |
1079 | case QMetaType::LongLong: | - |
1080 | stream >> *static_cast<qlonglong *>(data); executed (the execution status of this line is deduced): stream >> *static_cast<qlonglong *>(data); | - |
1081 | break; executed: break; Execution Count:7 | 7 |
1082 | case QMetaType::ULongLong: | - |
1083 | stream >> *static_cast<qulonglong *>(data); executed (the execution status of this line is deduced): stream >> *static_cast<qulonglong *>(data); | - |
1084 | break; executed: break; Execution Count:7 | 7 |
1085 | case QMetaType::UShort: | - |
1086 | stream >> *static_cast<ushort *>(data); executed (the execution status of this line is deduced): stream >> *static_cast<ushort *>(data); | - |
1087 | break; executed: break; Execution Count:9 | 9 |
1088 | case QMetaType::SChar: | - |
1089 | stream >> *static_cast<signed char *>(data); executed (the execution status of this line is deduced): stream >> *static_cast<signed char *>(data); | - |
1090 | break; executed: break; Execution Count:3 | 3 |
1091 | case QMetaType::UChar: | - |
1092 | stream >> *static_cast<uchar *>(data); executed (the execution status of this line is deduced): stream >> *static_cast<uchar *>(data); | - |
1093 | break; executed: break; Execution Count:9 | 9 |
1094 | case QMetaType::Bool: { | - |
1095 | qint8 b; executed (the execution status of this line is deduced): qint8 b; | - |
1096 | stream >> b; executed (the execution status of this line is deduced): stream >> b; | - |
1097 | *static_cast<bool *>(data) = b; executed (the execution status of this line is deduced): *static_cast<bool *>(data) = b; | - |
1098 | break; } executed: break; Execution Count:7 | 7 |
1099 | case QMetaType::Float: | - |
1100 | stream >> *static_cast<float *>(data); executed (the execution status of this line is deduced): stream >> *static_cast<float *>(data); | - |
1101 | break; executed: break; Execution Count:11 | 11 |
1102 | case QMetaType::Double: | - |
1103 | stream >> *static_cast<double *>(data); executed (the execution status of this line is deduced): stream >> *static_cast<double *>(data); | - |
1104 | break; executed: break; Execution Count:10 | 10 |
1105 | case QMetaType::QChar: | - |
1106 | stream >> *static_cast< NS(QChar)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QChar*>(data); | - |
1107 | break; executed: break; Execution Count:9 | 9 |
1108 | #ifndef QT_BOOTSTRAPPED | - |
1109 | case QMetaType::QVariantMap: | - |
1110 | stream >> *static_cast< NS(QVariantMap)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QVariantMap*>(data); | - |
1111 | break; executed: break; Execution Count:8 | 8 |
1112 | case QMetaType::QVariantHash: | - |
1113 | stream >> *static_cast< NS(QVariantHash)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QVariantHash*>(data); | - |
1114 | break; executed: break; Execution Count:7 | 7 |
1115 | case QMetaType::QVariantList: | - |
1116 | stream >> *static_cast< NS(QVariantList)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QVariantList*>(data); | - |
1117 | break; executed: break; Execution Count:12 | 12 |
1118 | case QMetaType::QVariant: | - |
1119 | stream >> *static_cast< NS(QVariant)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QVariant*>(data); | - |
1120 | break; executed: break; Execution Count:7 | 7 |
1121 | #endif | - |
1122 | case QMetaType::QByteArray: | - |
1123 | stream >> *static_cast< NS(QByteArray)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QByteArray*>(data); | - |
1124 | break; executed: break; Execution Count:9 | 9 |
1125 | case QMetaType::QString: | - |
1126 | stream >> *static_cast< NS(QString)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QString*>(data); | - |
1127 | break; executed: break; Execution Count:11907 | 11907 |
1128 | case QMetaType::QStringList: | - |
1129 | stream >> *static_cast< NS(QStringList)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QStringList*>(data); | - |
1130 | break; executed: break; Execution Count:12 | 12 |
1131 | #ifndef QT_BOOTSTRAPPED | - |
1132 | case QMetaType::QBitArray: | - |
1133 | stream >> *static_cast< NS(QBitArray)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QBitArray*>(data); | - |
1134 | break; executed: break; Execution Count:9 | 9 |
1135 | #endif | - |
1136 | case QMetaType::QDate: | - |
1137 | stream >> *static_cast< NS(QDate)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QDate*>(data); | - |
1138 | break; executed: break; Execution Count:9 | 9 |
1139 | case QMetaType::QTime: | - |
1140 | stream >> *static_cast< NS(QTime)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QTime*>(data); | - |
1141 | break; executed: break; Execution Count:9 | 9 |
1142 | case QMetaType::QDateTime: | - |
1143 | stream >> *static_cast< NS(QDateTime)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QDateTime*>(data); | - |
1144 | break; executed: break; Execution Count:9 | 9 |
1145 | #ifndef QT_BOOTSTRAPPED | - |
1146 | case QMetaType::QUrl: | - |
1147 | stream >> *static_cast< NS(QUrl)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QUrl*>(data); | - |
1148 | break; executed: break; Execution Count:7 | 7 |
1149 | #endif | - |
1150 | case QMetaType::QLocale: | - |
1151 | stream >> *static_cast< NS(QLocale)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QLocale*>(data); | - |
1152 | break; executed: break; Execution Count:7 | 7 |
1153 | #ifndef QT_NO_GEOM_VARIANT | - |
1154 | case QMetaType::QRect: | - |
1155 | stream >> *static_cast< NS(QRect)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QRect*>(data); | - |
1156 | break; executed: break; Execution Count:9 | 9 |
1157 | case QMetaType::QRectF: | - |
1158 | stream >> *static_cast< NS(QRectF)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QRectF*>(data); | - |
1159 | break; executed: break; Execution Count:7 | 7 |
1160 | case QMetaType::QSize: | - |
1161 | stream >> *static_cast< NS(QSize)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QSize*>(data); | - |
1162 | break; executed: break; Execution Count:10 | 10 |
1163 | case QMetaType::QSizeF: | - |
1164 | stream >> *static_cast< NS(QSizeF)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QSizeF*>(data); | - |
1165 | break; executed: break; Execution Count:7 | 7 |
1166 | case QMetaType::QLine: | - |
1167 | stream >> *static_cast< NS(QLine)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QLine*>(data); | - |
1168 | break; executed: break; Execution Count:7 | 7 |
1169 | case QMetaType::QLineF: | - |
1170 | stream >> *static_cast< NS(QLineF)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QLineF*>(data); | - |
1171 | break; executed: break; Execution Count:7 | 7 |
1172 | case QMetaType::QPoint: | - |
1173 | stream >> *static_cast< NS(QPoint)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QPoint*>(data); | - |
1174 | break; executed: break; Execution Count:9 | 9 |
1175 | case QMetaType::QPointF: | - |
1176 | stream >> *static_cast< NS(QPointF)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QPointF*>(data); | - |
1177 | break; executed: break; Execution Count:7 | 7 |
1178 | #endif | - |
1179 | #ifndef QT_NO_REGEXP | - |
1180 | case QMetaType::QRegExp: | - |
1181 | stream >> *static_cast< NS(QRegExp)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QRegExp*>(data); | - |
1182 | break; executed: break; Execution Count:51 | 51 |
1183 | #endif | - |
1184 | #ifndef QT_BOOTSTRAPPED | - |
1185 | #ifndef QT_NO_REGEXP | - |
1186 | case QMetaType::QRegularExpression: | - |
1187 | stream >> *static_cast< NS(QRegularExpression)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QRegularExpression*>(data); | - |
1188 | break; executed: break; Execution Count:7 | 7 |
1189 | #endif // QT_NO_REGEXP | - |
1190 | case QMetaType::QEasingCurve: | - |
1191 | stream >> *static_cast< NS(QEasingCurve)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QEasingCurve*>(data); | - |
1192 | break; executed: break; Execution Count:3 | 3 |
1193 | #endif // QT_BOOTSTRAPPED | - |
1194 | case QMetaType::QFont: | - |
1195 | case QMetaType::QPixmap: | - |
1196 | case QMetaType::QBrush: | - |
1197 | case QMetaType::QColor: | - |
1198 | case QMetaType::QPalette: | - |
1199 | case QMetaType::QImage: | - |
1200 | case QMetaType::QPolygon: | - |
1201 | case QMetaType::QPolygonF: | - |
1202 | case QMetaType::QRegion: | - |
1203 | case QMetaType::QBitmap: | - |
1204 | case QMetaType::QCursor: | - |
1205 | case QMetaType::QKeySequence: | - |
1206 | case QMetaType::QPen: | - |
1207 | case QMetaType::QTextLength: | - |
1208 | case QMetaType::QTextFormat: | - |
1209 | case QMetaType::QMatrix: | - |
1210 | case QMetaType::QTransform: | - |
1211 | case QMetaType::QMatrix4x4: | - |
1212 | case QMetaType::QVector2D: | - |
1213 | case QMetaType::QVector3D: | - |
1214 | case QMetaType::QVector4D: | - |
1215 | case QMetaType::QQuaternion: | - |
1216 | case QMetaType::QIcon: | - |
1217 | if (!qMetaTypeGuiHelper) partially evaluated: !qMetaTypeGuiHelper no Evaluation Count:0 | yes Evaluation Count:19 |
| 0-19 |
1218 | return false; never executed: return false; | 0 |
1219 | qMetaTypeGuiHelper[type - FirstGuiType].loadOp(stream, data); executed (the execution status of this line is deduced): qMetaTypeGuiHelper[type - FirstGuiType].loadOp(stream, data); | - |
1220 | break; executed: break; Execution Count:19 | 19 |
1221 | case QMetaType::QSizePolicy: | - |
1222 | if (!qMetaTypeWidgetsHelper) partially evaluated: !qMetaTypeWidgetsHelper no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1223 | return false; never executed: return false; | 0 |
1224 | qMetaTypeWidgetsHelper[type - FirstWidgetsType].loadOp(stream, data); executed (the execution status of this line is deduced): qMetaTypeWidgetsHelper[type - FirstWidgetsType].loadOp(stream, data); | - |
1225 | break; executed: break; Execution Count:1 | 1 |
1226 | case QMetaType::QUuid: | - |
1227 | stream >> *static_cast< NS(QUuid)*>(data); executed (the execution status of this line is deduced): stream >> *static_cast< ::QUuid*>(data); | - |
1228 | break; executed: break; Execution Count:5 | 5 |
1229 | default: { | - |
1230 | const QVector<QCustomTypeInfo> * const ct = customTypes(); executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes(); | - |
1231 | if (!ct) partially evaluated: !ct no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
1232 | return false; never executed: return false; | 0 |
1233 | | - |
1234 | LoadOperator loadOp = 0; executed (the execution status of this line is deduced): LoadOperator loadOp = 0; | - |
1235 | { | - |
1236 | QReadLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock()); | - |
1237 | loadOp = ct->at(type - User).loadOp; executed (the execution status of this line is deduced): loadOp = ct->at(type - User).loadOp; | - |
1238 | } | - |
1239 | | - |
1240 | if (!loadOp) evaluated: !loadOp yes Evaluation Count:2 | yes Evaluation Count:6 |
| 2-6 |
1241 | return false; executed: return false; Execution Count:2 | 2 |
1242 | loadOp(stream, data); executed (the execution status of this line is deduced): loadOp(stream, data); | - |
1243 | break; } executed: break; Execution Count:6 | 6 |
1244 | } | - |
1245 | return true; executed: return true; Execution Count:12429 | 12429 |
1246 | } | - |
1247 | #endif // QT_NO_DATASTREAM | - |
1248 | namespace { | - |
1249 | class TypeCreator { | - |
1250 | template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> | - |
1251 | struct CreatorImpl { | - |
1252 | static void *Create(const int /* type */, const void *copy) | - |
1253 | { | - |
1254 | // Using QMetaTypeFunctionHelper<T>::Create adds function call cost, even if it is a template (gcc). | - |
1255 | // This "copy" check is moved out from the switcher by compiler (at least by gcc) | - |
1256 | return copy ? new T(*static_cast<const T*>(copy)) : new T(); executed: return copy ? new T(*static_cast<const T*>(copy)) : new T(); Execution Count:197530 | 197530 |
1257 | } | - |
1258 | }; | - |
1259 | template<typename T> | - |
1260 | struct CreatorImpl<T, /* IsAcceptedType = */ false> { | - |
1261 | static void *Create(const int type, const void *copy) | - |
1262 | { | - |
1263 | if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) { evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui yes Evaluation Count:3330 | yes Evaluation Count:3 |
| 3-3330 |
1264 | if (Q_LIKELY(qMetaTypeGuiHelper)) evaluated: __builtin_expect(!!(qMetaTypeGuiHelper), true) yes Evaluation Count:3307 | yes Evaluation Count:23 |
| 23-3307 |
1265 | return qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].creator(copy); executed: return qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].creator(copy); Execution Count:3307 | 3307 |
1266 | } executed: } Execution Count:23 | 23 |
1267 | if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) { evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget yes Evaluation Count:3 | yes Evaluation Count:23 |
| 3-23 |
1268 | if (Q_LIKELY(qMetaTypeWidgetsHelper)) evaluated: __builtin_expect(!!(qMetaTypeWidgetsHelper), true) yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
1269 | return qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].creator(copy); executed: return qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].creator(copy); Execution Count:2 | 2 |
1270 | } executed: } Execution Count:1 | 1 |
1271 | // This point can be reached only for known types that definition is not available, for example | - |
1272 | // in bootstrap mode. We have no other choice then ignore it. | - |
1273 | return 0; executed: return 0; Execution Count:24 | 24 |
1274 | } | - |
1275 | }; | - |
1276 | public: | - |
1277 | TypeCreator(const int type) | - |
1278 | : m_type(type) | - |
1279 | {} executed: } Execution Count:252696 | 252696 |
1280 | | - |
1281 | template<typename T> | - |
1282 | void *delegate(const T *copy) { return CreatorImpl<T>::Create(m_type, copy); } executed: return CreatorImpl<T>::Create(m_type, copy); Execution Count:200863 | 200863 |
1283 | void *delegate(const void*) { return 0; } executed: return 0; Execution Count:3 | 3 |
1284 | void *delegate(const QMetaTypeSwitcher::UnknownType *) { return 0; } executed: return 0; Execution Count:86 | 86 |
1285 | void *delegate(const QMetaTypeSwitcher::NotBuiltinType *copy) | - |
1286 | { | - |
1287 | QMetaType::Creator creator; executed (the execution status of this line is deduced): QMetaType::Creator creator; | - |
1288 | const QVector<QCustomTypeInfo> * const ct = customTypes(); executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes(); | - |
1289 | { | - |
1290 | QReadLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock()); | - |
1291 | if (Q_UNLIKELY(m_type < QMetaType::User || !ct || ct->count() <= m_type - QMetaType::User)) partially evaluated: __builtin_expect(!!(m_type < QMetaType::User || !ct || ct->count() <= m_type - QMetaType::User), false) no Evaluation Count:0 | yes Evaluation Count:51744 |
| 0-51744 |
1292 | return 0; never executed: return 0; | 0 |
1293 | creator = ct->at(m_type - QMetaType::User).creator; executed (the execution status of this line is deduced): creator = ct->at(m_type - QMetaType::User).creator; | - |
1294 | } | - |
1295 | Q_ASSERT_X(creator, "void *QMetaType::create(int type, const void *copy)", "The type was not properly registered"); executed (the execution status of this line is deduced): qt_noop(); | - |
1296 | return creator(copy); executed: return creator(copy); Execution Count:51745 | 51745 |
1297 | } | - |
1298 | private: | - |
1299 | const int m_type; | - |
1300 | }; | - |
1301 | } // namespace | - |
1302 | | - |
1303 | /*! | - |
1304 | Returns a copy of \a copy, assuming it is of type \a type. If \a | - |
1305 | copy is zero, creates a default constructed instance. | - |
1306 | | - |
1307 | \sa destroy(), isRegistered(), Type | - |
1308 | */ | - |
1309 | void *QMetaType::create(int type, const void *copy) | - |
1310 | { | - |
1311 | TypeCreator typeCreator(type); executed (the execution status of this line is deduced): TypeCreator typeCreator(type); | - |
1312 | return QMetaTypeSwitcher::switcher<void*>(typeCreator, type, copy); executed: return QMetaTypeSwitcher::switcher<void*>(typeCreator, type, copy); Execution Count:252699 | 252699 |
1313 | } | - |
1314 | | - |
1315 | namespace { | - |
1316 | class TypeDestroyer { | - |
1317 | template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> | - |
1318 | struct DestroyerImpl { | - |
1319 | static void Destroy(const int /* type */, void *where) { QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Delete(where); } executed: } Execution Count:197524 | 197524 |
1320 | }; | - |
1321 | template<typename T> | - |
1322 | struct DestroyerImpl<T, /* IsAcceptedType = */ false> { | - |
1323 | static void Destroy(const int type, void *where) | - |
1324 | { | - |
1325 | if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) { evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui yes Evaluation Count:3330 | yes Evaluation Count:3 |
| 3-3330 |
1326 | if (Q_LIKELY(qMetaTypeGuiHelper)) evaluated: __builtin_expect(!!(qMetaTypeGuiHelper), true) yes Evaluation Count:3307 | yes Evaluation Count:23 |
| 23-3307 |
1327 | qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].deleter(where); executed: qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].deleter(where); Execution Count:3307 | 3307 |
1328 | return; executed: return; Execution Count:3330 | 3330 |
1329 | } | - |
1330 | if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) { partially evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1331 | if (Q_LIKELY(qMetaTypeWidgetsHelper)) evaluated: __builtin_expect(!!(qMetaTypeWidgetsHelper), true) yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
1332 | qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].deleter(where); executed: qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].deleter(where); Execution Count:2 | 2 |
1333 | return; executed: return; Execution Count:3 | 3 |
1334 | } | - |
1335 | // This point can be reached only for known types that definition is not available, for example | - |
1336 | // in bootstrap mode. We have no other choice then ignore it. | - |
1337 | } | 0 |
1338 | }; | - |
1339 | public: | - |
1340 | TypeDestroyer(const int type) | - |
1341 | : m_type(type) | - |
1342 | {} executed: } Execution Count:250056 | 250056 |
1343 | | - |
1344 | template<typename T> | - |
1345 | void delegate(const T *where) { DestroyerImpl<T>::Destroy(m_type, const_cast<T*>(where)); } executed: } Execution Count:200857 | 200857 |
1346 | void delegate(const void *) {} | - |
1347 | void delegate(const QMetaTypeSwitcher::UnknownType*) {} | - |
1348 | void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) { customTypeDestroyer(m_type, (void*)where); } executed: } Execution Count:49209 | 49209 |
1349 | | - |
1350 | private: | - |
1351 | static void customTypeDestroyer(const int type, void *where) | - |
1352 | { | - |
1353 | QMetaType::Destructor deleter; executed (the execution status of this line is deduced): QMetaType::Destructor deleter; | - |
1354 | const QVector<QCustomTypeInfo> * const ct = customTypes(); executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes(); | - |
1355 | { | - |
1356 | QReadLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock()); | - |
1357 | if (Q_UNLIKELY(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User)) evaluated: __builtin_expect(!!(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User), false) yes Evaluation Count:1 | yes Evaluation Count:49213 |
| 1-49213 |
1358 | return; executed: return; Execution Count:1 | 1 |
1359 | deleter = ct->at(type - QMetaType::User).deleter; executed (the execution status of this line is deduced): deleter = ct->at(type - QMetaType::User).deleter; | - |
1360 | } | - |
1361 | Q_ASSERT_X(deleter, "void QMetaType::destroy(int type, void *data)", "The type was not properly registered"); executed (the execution status of this line is deduced): qt_noop(); | - |
1362 | deleter(where); executed (the execution status of this line is deduced): deleter(where); | - |
1363 | } executed: } Execution Count:49209 | 49209 |
1364 | | - |
1365 | const int m_type; | - |
1366 | }; | - |
1367 | } // namespace | - |
1368 | | - |
1369 | | - |
1370 | /*! | - |
1371 | Destroys the \a data, assuming it is of the \a type given. | - |
1372 | | - |
1373 | \sa create(), isRegistered(), Type | - |
1374 | */ | - |
1375 | void QMetaType::destroy(int type, void *data) | - |
1376 | { | - |
1377 | TypeDestroyer deleter(type); executed (the execution status of this line is deduced): TypeDestroyer deleter(type); | - |
1378 | QMetaTypeSwitcher::switcher<void>(deleter, type, data); executed (the execution status of this line is deduced): QMetaTypeSwitcher::switcher<void>(deleter, type, data); | - |
1379 | } executed: } Execution Count:250070 | 250070 |
1380 | | - |
1381 | namespace { | - |
1382 | class TypeConstructor { | - |
1383 | template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> | - |
1384 | struct ConstructorImpl { | - |
1385 | static void *Construct(const int /*type*/, void *where, const void *copy) { return QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Construct(where, copy); } executed: return QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Construct(where, copy); Execution Count:86 | 86 |
1386 | }; | - |
1387 | template<typename T> | - |
1388 | struct ConstructorImpl<T, /* IsAcceptedType = */ false> { | - |
1389 | static void *Construct(const int type, void *where, const void *copy) | - |
1390 | { | - |
1391 | if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) partially evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui yes Evaluation Count:42 | no Evaluation Count:0 |
| 0-42 |
1392 | return Q_LIKELY(qMetaTypeGuiHelper) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].constructor(where, copy) : 0; executed: return __builtin_expect(!!(qMetaTypeGuiHelper), true) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].constructor(where, copy) : 0; Execution Count:42 | 42 |
1393 | | - |
1394 | if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) never evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget | 0 |
1395 | return Q_LIKELY(qMetaTypeWidgetsHelper) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].constructor(where, copy) : 0; never executed: return __builtin_expect(!!(qMetaTypeWidgetsHelper), true) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].constructor(where, copy) : 0; | 0 |
1396 | | - |
1397 | // This point can be reached only for known types that definition is not available, for example | - |
1398 | // in bootstrap mode. We have no other choice then ignore it. | - |
1399 | return 0; never executed: return 0; | 0 |
1400 | } | - |
1401 | }; | - |
1402 | public: | - |
1403 | TypeConstructor(const int type, void *where) | - |
1404 | : m_type(type) | - |
1405 | , m_where(where) | - |
1406 | {} executed: } Execution Count:6127 | 6127 |
1407 | | - |
1408 | template<typename T> | - |
1409 | void *delegate(const T *copy) { return ConstructorImpl<T>::Construct(m_type, m_where, copy); } executed: return ConstructorImpl<T>::Construct(m_type, m_where, copy); Execution Count:128 | 128 |
1410 | void *delegate(const void *) { return m_where; } never executed: return m_where; | 0 |
1411 | void *delegate(const QMetaTypeSwitcher::UnknownType*) { return m_where; } never executed: return m_where; | 0 |
1412 | void *delegate(const QMetaTypeSwitcher::NotBuiltinType *copy) { return customTypeConstructor(m_type, m_where, copy); } executed: return customTypeConstructor(m_type, m_where, copy); Execution Count:6000 | 6000 |
1413 | | - |
1414 | private: | - |
1415 | static void *customTypeConstructor(const int type, void *where, const void *copy) | - |
1416 | { | - |
1417 | QMetaType::Constructor ctor; executed (the execution status of this line is deduced): QMetaType::Constructor ctor; | - |
1418 | const QVector<QCustomTypeInfo> * const ct = customTypes(); executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes(); | - |
1419 | { | - |
1420 | QReadLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock()); | - |
1421 | if (Q_UNLIKELY(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User)) partially evaluated: __builtin_expect(!!(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User), false) no Evaluation Count:0 | yes Evaluation Count:6000 |
| 0-6000 |
1422 | return 0; never executed: return 0; | 0 |
1423 | ctor = ct->at(type - QMetaType::User).constructor; executed (the execution status of this line is deduced): ctor = ct->at(type - QMetaType::User).constructor; | - |
1424 | } | - |
1425 | Q_ASSERT_X(ctor, "void *QMetaType::construct(int type, void *where, const void *copy)", "The type was not properly registered"); executed (the execution status of this line is deduced): qt_noop(); | - |
1426 | return ctor(where, copy); executed: return ctor(where, copy); Execution Count:5998 | 5998 |
1427 | } | - |
1428 | | - |
1429 | const int m_type; | - |
1430 | void *m_where; | - |
1431 | }; | - |
1432 | } // namespace | - |
1433 | | - |
1434 | /*! | - |
1435 | \since 5.0 | - |
1436 | | - |
1437 | Constructs a value of the given \a type in the existing memory | - |
1438 | addressed by \a where, that is a copy of \a copy, and returns | - |
1439 | \a where. If \a copy is zero, the value is default constructed. | - |
1440 | | - |
1441 | This is a low-level function for explicitly managing the memory | - |
1442 | used to store the type. Consider calling create() if you don't | - |
1443 | need this level of control (that is, use "new" rather than | - |
1444 | "placement new"). | - |
1445 | | - |
1446 | You must ensure that \a where points to a location that can store | - |
1447 | a value of type \a type, and that \a where is suitably aligned. | - |
1448 | The type's size can be queried by calling sizeOf(). | - |
1449 | | - |
1450 | The rule of thumb for alignment is that a type is aligned to its | - |
1451 | natural boundary, which is the smallest power of 2 that is bigger | - |
1452 | than the type, unless that alignment is larger than the maximum | - |
1453 | useful alignment for the platform. For practical purposes, | - |
1454 | alignment larger than 2 * sizeof(void*) is only necessary for | - |
1455 | special hardware instructions (e.g., aligned SSE loads and stores | - |
1456 | on x86). | - |
1457 | | - |
1458 | \sa destruct(), sizeOf() | - |
1459 | */ | - |
1460 | void *QMetaType::construct(int type, void *where, const void *copy) | - |
1461 | { | - |
1462 | if (!where) evaluated: !where yes Evaluation Count:90 | yes Evaluation Count:6127 |
| 90-6127 |
1463 | return 0; executed: return 0; Execution Count:90 | 90 |
1464 | TypeConstructor constructor(type, where); executed (the execution status of this line is deduced): TypeConstructor constructor(type, where); | - |
1465 | return QMetaTypeSwitcher::switcher<void*>(constructor, type, copy); executed: return QMetaTypeSwitcher::switcher<void*>(constructor, type, copy); Execution Count:6127 | 6127 |
1466 | } | - |
1467 | | - |
1468 | | - |
1469 | namespace { | - |
1470 | class TypeDestructor { | - |
1471 | template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> | - |
1472 | struct DestructorImpl { | - |
1473 | static void Destruct(const int /* type */, void *where) { QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Destruct(where); } executed: } Execution Count:86 | 86 |
1474 | }; | - |
1475 | template<typename T> | - |
1476 | struct DestructorImpl<T, /* IsAcceptedType = */ false> { | - |
1477 | static void Destruct(const int type, void *where) | - |
1478 | { | - |
1479 | if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) { partially evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui yes Evaluation Count:42 | no Evaluation Count:0 |
| 0-42 |
1480 | if (Q_LIKELY(qMetaTypeGuiHelper)) partially evaluated: __builtin_expect(!!(qMetaTypeGuiHelper), true) yes Evaluation Count:42 | no Evaluation Count:0 |
| 0-42 |
1481 | qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].destructor(where); executed: qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].destructor(where); Execution Count:42 | 42 |
1482 | return; executed: return; Execution Count:42 | 42 |
1483 | } | - |
1484 | if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) { never evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget | 0 |
1485 | if (Q_LIKELY(qMetaTypeWidgetsHelper)) never evaluated: __builtin_expect(!!(qMetaTypeWidgetsHelper), true) | 0 |
1486 | qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].destructor(where); never executed: qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].destructor(where); | 0 |
1487 | return; | 0 |
1488 | } | - |
1489 | // This point can be reached only for known types that definition is not available, for example | - |
1490 | // in bootstrap mode. We have no other choice then ignore it. | - |
1491 | } | 0 |
1492 | }; | - |
1493 | public: | - |
1494 | TypeDestructor(const int type) | - |
1495 | : m_type(type) | - |
1496 | {} executed: } Execution Count:48583 | 48583 |
1497 | | - |
1498 | template<typename T> | - |
1499 | void delegate(const T *where) { DestructorImpl<T>::Destruct(m_type, const_cast<T*>(where)); } executed: } Execution Count:128 | 128 |
1500 | void delegate(const void *) {} | - |
1501 | void delegate(const QMetaTypeSwitcher::UnknownType*) {} | - |
1502 | void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) { customTypeDestructor(m_type, (void*)where); } executed: } Execution Count:48457 | 48457 |
1503 | | - |
1504 | private: | - |
1505 | static void customTypeDestructor(const int type, void *where) | - |
1506 | { | - |
1507 | QMetaType::Destructor dtor; executed (the execution status of this line is deduced): QMetaType::Destructor dtor; | - |
1508 | const QVector<QCustomTypeInfo> * const ct = customTypes(); executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes(); | - |
1509 | { | - |
1510 | QReadLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock()); | - |
1511 | if (Q_UNLIKELY(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User)) partially evaluated: __builtin_expect(!!(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User), false) no Evaluation Count:0 | yes Evaluation Count:48456 |
| 0-48456 |
1512 | return; | 0 |
1513 | dtor = ct->at(type - QMetaType::User).destructor; executed (the execution status of this line is deduced): dtor = ct->at(type - QMetaType::User).destructor; | - |
1514 | } | - |
1515 | Q_ASSERT_X(dtor, "void QMetaType::destruct(int type, void *where)", "The type was not properly registered"); executed (the execution status of this line is deduced): qt_noop(); | - |
1516 | dtor(where); executed (the execution status of this line is deduced): dtor(where); | - |
1517 | } executed: } Execution Count:48457 | 48457 |
1518 | | - |
1519 | const int m_type; | - |
1520 | }; | - |
1521 | } // namespace | - |
1522 | | - |
1523 | /*! | - |
1524 | \since 5.0 | - |
1525 | | - |
1526 | Destructs the value of the given \a type, located at \a where. | - |
1527 | | - |
1528 | Unlike destroy(), this function only invokes the type's | - |
1529 | destructor, it doesn't invoke the delete operator. | - |
1530 | | - |
1531 | \sa construct() | - |
1532 | */ | - |
1533 | void QMetaType::destruct(int type, void *where) | - |
1534 | { | - |
1535 | if (!where) evaluated: !where yes Evaluation Count:46 | yes Evaluation Count:48583 |
| 46-48583 |
1536 | return; executed: return; Execution Count:46 | 46 |
1537 | TypeDestructor destructor(type); executed (the execution status of this line is deduced): TypeDestructor destructor(type); | - |
1538 | QMetaTypeSwitcher::switcher<void>(destructor, type, where); executed (the execution status of this line is deduced): QMetaTypeSwitcher::switcher<void>(destructor, type, where); | - |
1539 | } executed: } Execution Count:48585 | 48585 |
1540 | | - |
1541 | | - |
1542 | namespace { | - |
1543 | class SizeOf { | - |
1544 | template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> | - |
1545 | struct SizeOfImpl { | - |
1546 | static int Size(const int) { return QTypeInfo<T>::sizeOf; } executed: return QTypeInfo<T>::sizeOf; Execution Count:89 | 89 |
1547 | }; | - |
1548 | template<typename T> | - |
1549 | struct SizeOfImpl<T, /* IsAcceptedType = */ false> { | - |
1550 | static int Size(const int type) | - |
1551 | { | - |
1552 | if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) partially evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui yes Evaluation Count:63 | no Evaluation Count:0 |
| 0-63 |
1553 | return Q_LIKELY(qMetaTypeGuiHelper) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].size : 0; executed: return __builtin_expect(!!(qMetaTypeGuiHelper), true) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].size : 0; Execution Count:63 | 63 |
1554 | | - |
1555 | if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) never evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget | 0 |
1556 | return Q_LIKELY(qMetaTypeWidgetsHelper) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].size : 0; never executed: return __builtin_expect(!!(qMetaTypeWidgetsHelper), true) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].size : 0; | 0 |
1557 | | - |
1558 | // This point can be reached only for known types that definition is not available, for example | - |
1559 | // in bootstrap mode. We have no other choice then ignore it. | - |
1560 | return 0; never executed: return 0; | 0 |
1561 | } | - |
1562 | }; | - |
1563 | | - |
1564 | public: | - |
1565 | SizeOf(int type) | - |
1566 | : m_type(type) | - |
1567 | {} executed: } Execution Count:221 | 221 |
1568 | | - |
1569 | template<typename T> | - |
1570 | int delegate(const T*) { return SizeOfImpl<T>::Size(m_type); } executed: return SizeOfImpl<T>::Size(m_type); Execution Count:152 | 152 |
1571 | int delegate(const QMetaTypeSwitcher::UnknownType*) { return 0; } executed: return 0; Execution Count:3 | 3 |
1572 | int delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customTypeSizeOf(m_type); } executed: return customTypeSizeOf(m_type); Execution Count:66 | 66 |
1573 | private: | - |
1574 | static int customTypeSizeOf(const int type) | - |
1575 | { | - |
1576 | const QVector<QCustomTypeInfo> * const ct = customTypes(); executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes(); | - |
1577 | QReadLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock()); | - |
1578 | if (Q_UNLIKELY(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User)) evaluated: __builtin_expect(!!(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User), false) yes Evaluation Count:1 | yes Evaluation Count:65 |
| 1-65 |
1579 | return 0; executed: return 0; Execution Count:1 | 1 |
1580 | return ct->at(type - QMetaType::User).size; executed: return ct->at(type - QMetaType::User).size; Execution Count:65 | 65 |
1581 | } | - |
1582 | | - |
1583 | const int m_type; | - |
1584 | }; | - |
1585 | } // namespace | - |
1586 | | - |
1587 | /*! | - |
1588 | \since 5.0 | - |
1589 | | - |
1590 | Returns the size of the given \a type in bytes (i.e. sizeof(T), | - |
1591 | where T is the actual type identified by the \a type argument). | - |
1592 | | - |
1593 | This function is typically used together with construct() | - |
1594 | to perform low-level management of the memory used by a type. | - |
1595 | | - |
1596 | \sa construct() | - |
1597 | */ | - |
1598 | int QMetaType::sizeOf(int type) | - |
1599 | { | - |
1600 | SizeOf sizeOf(type); executed (the execution status of this line is deduced): SizeOf sizeOf(type); | - |
1601 | return QMetaTypeSwitcher::switcher<int>(sizeOf, type, 0); executed: return QMetaTypeSwitcher::switcher<int>(sizeOf, type, 0); Execution Count:221 | 221 |
1602 | } | - |
1603 | | - |
1604 | namespace { | - |
1605 | class Flags | - |
1606 | { | - |
1607 | template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> | - |
1608 | struct FlagsImpl | - |
1609 | { | - |
1610 | static quint32 Flags(const int /* type */) | - |
1611 | { | - |
1612 | return QtPrivate::QMetaTypeTypeFlags<T>::Flags; executed: return QtPrivate::QMetaTypeTypeFlags<T>::Flags; Execution Count:492 | 492 |
1613 | } | - |
1614 | }; | - |
1615 | template<typename T> | - |
1616 | struct FlagsImpl<T, /* IsAcceptedType = */ false> | - |
1617 | { | - |
1618 | static quint32 Flags(const int type) | - |
1619 | { | - |
1620 | if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui yes Evaluation Count:164 | yes Evaluation Count:2 |
| 2-164 |
1621 | return Q_LIKELY(qMetaTypeGuiHelper) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].flags : 0; executed: return __builtin_expect(!!(qMetaTypeGuiHelper), true) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].flags : 0; Execution Count:164 | 164 |
1622 | | - |
1623 | if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) partially evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1624 | return Q_LIKELY(qMetaTypeWidgetsHelper) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].flags : 0; executed: return __builtin_expect(!!(qMetaTypeWidgetsHelper), true) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].flags : 0; Execution Count:2 | 2 |
1625 | | - |
1626 | // This point can be reached only for known types that definition is not available, for example | - |
1627 | // in bootstrap mode. We have no other choice then ignore it. | - |
1628 | return 0; never executed: return 0; | 0 |
1629 | } | - |
1630 | }; | - |
1631 | public: | - |
1632 | Flags(const int type) | - |
1633 | : m_type(type) | - |
1634 | {} executed: } Execution Count:5615 | 5615 |
1635 | template<typename T> | - |
1636 | quint32 delegate(const T*) { return FlagsImpl<T>::Flags(m_type); } executed: return FlagsImpl<T>::Flags(m_type); Execution Count:658 | 658 |
1637 | quint32 delegate(const void*) { return 0; } executed: return 0; Execution Count:1 | 1 |
1638 | quint32 delegate(const QMetaTypeSwitcher::UnknownType*) { return 0; } executed: return 0; Execution Count:14 | 14 |
1639 | quint32 delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customTypeFlags(m_type); } executed: return customTypeFlags(m_type); Execution Count:4942 | 4942 |
1640 | private: | - |
1641 | const int m_type; | - |
1642 | static quint32 customTypeFlags(const int type) | - |
1643 | { | - |
1644 | const QVector<QCustomTypeInfo> * const ct = customTypes(); executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes(); | - |
1645 | if (Q_UNLIKELY(!ct || type < QMetaType::User)) partially evaluated: __builtin_expect(!!(!ct || type < QMetaType::User), false) no Evaluation Count:0 | yes Evaluation Count:4942 |
| 0-4942 |
1646 | return 0; never executed: return 0; | 0 |
1647 | QReadLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock()); | - |
1648 | if (Q_UNLIKELY(ct->count() <= type - QMetaType::User)) evaluated: __builtin_expect(!!(ct->count() <= type - QMetaType::User), false) yes Evaluation Count:5 | yes Evaluation Count:4937 |
| 5-4937 |
1649 | return 0; executed: return 0; Execution Count:5 | 5 |
1650 | return ct->at(type - QMetaType::User).flags; executed: return ct->at(type - QMetaType::User).flags; Execution Count:4937 | 4937 |
1651 | } | - |
1652 | }; | - |
1653 | } // namespace | - |
1654 | | - |
1655 | /*! | - |
1656 | \since 5.0 | - |
1657 | | - |
1658 | Returns flags of the given \a type. | - |
1659 | | - |
1660 | \sa QMetaType::TypeFlags | - |
1661 | */ | - |
1662 | QMetaType::TypeFlags QMetaType::typeFlags(int type) | - |
1663 | { | - |
1664 | Flags flags(type); executed (the execution status of this line is deduced): Flags flags(type); | - |
1665 | return static_cast<QMetaType::TypeFlags>(QMetaTypeSwitcher::switcher<quint32>(flags, type, 0)); executed: return static_cast<QMetaType::TypeFlags>(QMetaTypeSwitcher::switcher<quint32>(flags, type, 0)); Execution Count:5615 | 5615 |
1666 | } | - |
1667 | | - |
1668 | #ifndef QT_BOOTSTRAPPED | - |
1669 | namespace { | - |
1670 | class MetaObject | - |
1671 | { | - |
1672 | public: | - |
1673 | MetaObject(const int type) | - |
1674 | : m_type(type) | - |
1675 | {} executed: } Execution Count:7 | 7 |
1676 | template<typename T> | - |
1677 | const QMetaObject *delegate(const T*) { return QtPrivate::MetaObjectForType<T>::value(); } executed: return QtPrivate::MetaObjectForType<T>::value(); Execution Count:2 | 2 |
1678 | const QMetaObject *delegate(const void*) { return 0; } never executed: return 0; | 0 |
1679 | const QMetaObject *delegate(const QMetaTypeSwitcher::UnknownType*) { return 0; } never executed: return 0; | 0 |
1680 | const QMetaObject *delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customMetaObject(m_type); } executed: return customMetaObject(m_type); Execution Count:5 | 5 |
1681 | private: | - |
1682 | const int m_type; | - |
1683 | static const QMetaObject *customMetaObject(const int type) | - |
1684 | { | - |
1685 | const QVector<QCustomTypeInfo> * const ct = customTypes(); executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes(); | - |
1686 | if (Q_UNLIKELY(!ct || type < QMetaType::User)) partially evaluated: __builtin_expect(!!(!ct || type < QMetaType::User), false) no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1687 | return 0; never executed: return 0; | 0 |
1688 | QReadLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock()); | - |
1689 | if (Q_UNLIKELY(ct->count() <= type - QMetaType::User)) partially evaluated: __builtin_expect(!!(ct->count() <= type - QMetaType::User), false) no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1690 | return 0; never executed: return 0; | 0 |
1691 | return ct->at(type - QMetaType::User).metaObject; executed: return ct->at(type - QMetaType::User).metaObject; Execution Count:5 | 5 |
1692 | } | - |
1693 | }; | - |
1694 | } // namespace | - |
1695 | #endif | - |
1696 | | - |
1697 | /*! | - |
1698 | \since 5.0 | - |
1699 | | - |
1700 | Returns QMetaObject of a given \a type, if the \a type is a pointer to type derived from QObject. | - |
1701 | */ | - |
1702 | const QMetaObject *QMetaType::metaObjectForType(int type) | - |
1703 | { | - |
1704 | #ifndef QT_BOOTSTRAPPED | - |
1705 | MetaObject mo(type); executed (the execution status of this line is deduced): MetaObject mo(type); | - |
1706 | return QMetaTypeSwitcher::switcher<const QMetaObject*>(mo, type, 0); executed: return QMetaTypeSwitcher::switcher<const QMetaObject*>(mo, type, 0); Execution Count:7 | 7 |
1707 | #else | - |
1708 | Q_UNUSED(type); | - |
1709 | return 0; | - |
1710 | #endif | - |
1711 | } | - |
1712 | | - |
1713 | /*! | - |
1714 | \fn int qRegisterMetaType(const char *typeName) | - |
1715 | \relates QMetaType | - |
1716 | \threadsafe | - |
1717 | | - |
1718 | Registers the type name \a typeName for the type \c{T}. Returns | - |
1719 | the internal ID used by QMetaType. Any class or struct that has a | - |
1720 | public default constructor, a public copy constructor and a public | - |
1721 | destructor can be registered. | - |
1722 | | - |
1723 | This function requires that \c{T} is a fully defined type at the point | - |
1724 | where the function is called. For pointer types, it also requires that the | - |
1725 | pointed to type is fully defined. Use Q_DECLARE_OPAQUE_POINTER() to be able | - |
1726 | to register pointers to forward declared types. | - |
1727 | | - |
1728 | After a type has been registered, you can create and destroy | - |
1729 | objects of that type dynamically at run-time. | - |
1730 | | - |
1731 | This example registers the class \c{MyClass}: | - |
1732 | | - |
1733 | \snippet code/src_corelib_kernel_qmetatype.cpp 4 | - |
1734 | | - |
1735 | This function is useful to register typedefs so they can be used | - |
1736 | by QMetaProperty, or in QueuedConnections | - |
1737 | | - |
1738 | \snippet code/src_corelib_kernel_qmetatype.cpp 9 | - |
1739 | | - |
1740 | \warning This function is useful only for registering an alias (typedef) | - |
1741 | for every other use case Q_DECLARE_METATYPE and qMetaTypeId() should be used instead. | - |
1742 | | - |
1743 | \sa qRegisterMetaTypeStreamOperators(), QMetaType::isRegistered(), | - |
1744 | Q_DECLARE_METATYPE() | - |
1745 | */ | - |
1746 | | - |
1747 | /*! | - |
1748 | \fn void qRegisterMetaTypeStreamOperators(const char *typeName) | - |
1749 | \relates QMetaType | - |
1750 | \threadsafe | - |
1751 | | - |
1752 | Registers the stream operators for the type \c{T} called \a | - |
1753 | typeName. | - |
1754 | | - |
1755 | Afterward, the type can be streamed using QMetaType::load() and | - |
1756 | QMetaType::save(). These functions are used when streaming a | - |
1757 | QVariant. | - |
1758 | | - |
1759 | \snippet code/src_corelib_kernel_qmetatype.cpp 5 | - |
1760 | | - |
1761 | The stream operators should have the following signatures: | - |
1762 | | - |
1763 | \snippet code/src_corelib_kernel_qmetatype.cpp 6 | - |
1764 | | - |
1765 | \sa qRegisterMetaType(), QMetaType::isRegistered(), Q_DECLARE_METATYPE() | - |
1766 | */ | - |
1767 | | - |
1768 | /*! \typedef QMetaType::Deleter | - |
1769 | \internal | - |
1770 | */ | - |
1771 | /*! \typedef QMetaType::Creator | - |
1772 | \internal | - |
1773 | */ | - |
1774 | /*! \typedef QMetaType::SaveOperator | - |
1775 | \internal | - |
1776 | */ | - |
1777 | /*! \typedef QMetaType::LoadOperator | - |
1778 | \internal | - |
1779 | */ | - |
1780 | /*! \typedef QMetaType::Destructor | - |
1781 | \internal | - |
1782 | */ | - |
1783 | /*! \typedef QMetaType::Constructor | - |
1784 | \internal | - |
1785 | */ | - |
1786 | | - |
1787 | /*! | - |
1788 | \fn int qRegisterMetaType() | - |
1789 | \relates QMetaType | - |
1790 | \threadsafe | - |
1791 | \since 4.2 | - |
1792 | | - |
1793 | Call this function to register the type \c T. \c T must be declared with | - |
1794 | Q_DECLARE_METATYPE(). Returns the meta type Id. | - |
1795 | | - |
1796 | Example: | - |
1797 | | - |
1798 | \snippet code/src_corelib_kernel_qmetatype.cpp 7 | - |
1799 | | - |
1800 | This function requires that \c{T} is a fully defined type at the point | - |
1801 | where the function is called. For pointer types, it also requires that the | - |
1802 | pointed to type is fully defined. Use Q_DECLARE_OPAQUE_POINTER() to be able | - |
1803 | to register pointers to forward declared types. | - |
1804 | | - |
1805 | After a type has been registered, you can create and destroy | - |
1806 | objects of that type dynamically at run-time. | - |
1807 | | - |
1808 | To use the type \c T in QVariant, using Q_DECLARE_METATYPE() is | - |
1809 | sufficient. To use the type \c T in queued signal and slot connections, | - |
1810 | \c{qRegisterMetaType<T>()} must be called before the first connection | - |
1811 | is established. | - |
1812 | | - |
1813 | Also, to use type \c T with the QObject::property() API, | - |
1814 | \c{qRegisterMetaType<T>()} must be called before it is used, typically | - |
1815 | in the constructor of the class that uses \c T, or in the \c{main()} | - |
1816 | function. | - |
1817 | | - |
1818 | \sa Q_DECLARE_METATYPE() | - |
1819 | */ | - |
1820 | | - |
1821 | /*! | - |
1822 | \fn int qMetaTypeId() | - |
1823 | \relates QMetaType | - |
1824 | \threadsafe | - |
1825 | \since 4.1 | - |
1826 | | - |
1827 | Returns the meta type id of type \c T at compile time. If the | - |
1828 | type was not declared with Q_DECLARE_METATYPE(), compilation will | - |
1829 | fail. | - |
1830 | | - |
1831 | Typical usage: | - |
1832 | | - |
1833 | \snippet code/src_corelib_kernel_qmetatype.cpp 8 | - |
1834 | | - |
1835 | QMetaType::type() returns the same ID as qMetaTypeId(), but does | - |
1836 | a lookup at runtime based on the name of the type. | - |
1837 | QMetaType::type() is a bit slower, but compilation succeeds if a | - |
1838 | type is not registered. | - |
1839 | | - |
1840 | \sa Q_DECLARE_METATYPE(), QMetaType::type() | - |
1841 | */ | - |
1842 | | - |
1843 | namespace { | - |
1844 | class TypeInfo { | - |
1845 | template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> | - |
1846 | struct TypeInfoImpl | - |
1847 | { | - |
1848 | TypeInfoImpl(const uint /* type */, QMetaTypeInterface &info) | - |
1849 | { | - |
1850 | QMetaTypeInterface tmp = QT_METATYPE_INTERFACE_INIT_NO_DATASTREAM(T); executed (the execution status of this line is deduced): QMetaTypeInterface tmp = { (QtMetaTypePrivate::QMetaTypeFunctionHelper<T, QtMetaTypePrivate::TypeDefinition<T>::IsAvailable>::Create), (QtMetaTypePrivate::QMetaTypeFunctionHelper<T, QtMetaTypePrivate::TypeDefinition<T>::IsAvailable>::Delete), 0, 0, (QtMetaTypePrivate::QMetaTypeFunctionHelper<T, QtMetaTypePrivate::TypeDefinition<T>::IsAvailable>::Construct), (QtMetaTypePrivate::QMetaTypeFunctionHelper<T, QtMetaTypePrivate::TypeDefinition<T>::IsAvailable>::Destruct), (QTypeInfo<T>::sizeOf), QtPrivate::QMetaTypeTypeFlags<T>::Flags, (QtPrivate::MetaObjectForType<T>::value()) }; | - |
1851 | info = tmp; executed (the execution status of this line is deduced): info = tmp; | - |
1852 | } executed: } Execution Count:290 | 290 |
1853 | }; | - |
1854 | | - |
1855 | template<typename T> | - |
1856 | struct TypeInfoImpl<T, /* IsAcceptedType = */ false> | - |
1857 | { | - |
1858 | TypeInfoImpl(const uint type, QMetaTypeInterface &info) | - |
1859 | { | - |
1860 | if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) { never evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui | 0 |
1861 | if (Q_LIKELY(qMetaTypeGuiHelper)) never evaluated: __builtin_expect(!!(qMetaTypeGuiHelper), true) | 0 |
1862 | info = qMetaTypeGuiHelper[type - QMetaType::FirstGuiType]; never executed: info = qMetaTypeGuiHelper[type - QMetaType::FirstGuiType]; | 0 |
1863 | return; | 0 |
1864 | } | - |
1865 | if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) { never evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget | 0 |
1866 | if (Q_LIKELY(qMetaTypeWidgetsHelper)) never evaluated: __builtin_expect(!!(qMetaTypeWidgetsHelper), true) | 0 |
1867 | info = qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType]; never executed: info = qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType]; | 0 |
1868 | return; | 0 |
1869 | } | - |
1870 | } | 0 |
1871 | }; | - |
1872 | public: | - |
1873 | QMetaTypeInterface info; | - |
1874 | TypeInfo(const uint type) | - |
1875 | : m_type(type) | - |
1876 | { | - |
1877 | QMetaTypeInterface tmp = QT_METATYPE_INTERFACE_INIT_EMPTY(); executed (the execution status of this line is deduced): QMetaTypeInterface tmp = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; | - |
1878 | info = tmp; executed (the execution status of this line is deduced): info = tmp; | - |
1879 | } executed: } Execution Count:45057 | 45057 |
1880 | template<typename T> | - |
1881 | void delegate(const T*) { TypeInfoImpl<T>(m_type, info); } executed: } Execution Count:290 | 290 |
1882 | void delegate(const QMetaTypeSwitcher::UnknownType*) {} | - |
1883 | void delegate(const QMetaTypeSwitcher::NotBuiltinType*) { customTypeInfo(m_type); } executed: } Execution Count:44749 | 44749 |
1884 | private: | - |
1885 | void customTypeInfo(const uint type) | - |
1886 | { | - |
1887 | const QVector<QCustomTypeInfo> * const ct = customTypes(); executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes(); | - |
1888 | if (Q_UNLIKELY(!ct)) partially evaluated: __builtin_expect(!!(!ct), false) no Evaluation Count:0 | yes Evaluation Count:44749 |
| 0-44749 |
1889 | return; | 0 |
1890 | QReadLocker locker(customTypesLock()); executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock()); | - |
1891 | if (Q_LIKELY(uint(ct->count()) > type - QMetaType::User)) evaluated: __builtin_expect(!!(uint(ct->count()) > type - QMetaType::User), true) yes Evaluation Count:44718 | yes Evaluation Count:31 |
| 31-44718 |
1892 | info = ct->at(type - QMetaType::User); executed: info = ct->at(type - QMetaType::User); Execution Count:44718 | 44718 |
1893 | } executed: } Execution Count:44749 | 44749 |
1894 | | - |
1895 | const uint m_type; | - |
1896 | }; | - |
1897 | } // namespace | - |
1898 | | - |
1899 | /*! | - |
1900 | \fn QMetaType QMetaType::typeInfo(const int type) | - |
1901 | \internal | - |
1902 | */ | - |
1903 | QMetaType QMetaType::typeInfo(const int type) | - |
1904 | { | - |
1905 | TypeInfo typeInfo(type); executed (the execution status of this line is deduced): TypeInfo typeInfo(type); | - |
1906 | QMetaTypeSwitcher::switcher<void>(typeInfo, type, 0); executed (the execution status of this line is deduced): QMetaTypeSwitcher::switcher<void>(typeInfo, type, 0); | - |
1907 | return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags executed: return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags , static_cast<const QMetaTypeInterface *>(0) , typeInfo.info.creator , typeInfo.info.deleter , typeInfo.info.saveOp , typeInfo.info.loadOp , typeInfo.info.constructor , typeInfo.info.destructor , typeInfo.info.size , typeInfo.info.flags , type , typeInfo.info.metaObject) : QMetaType(UnknownType); Execution Count:45057 | 45057 |
1908 | , static_cast<const QMetaTypeInterface *>(0) // typeInfo::info is a temporary variable, we can't return address of it. executed: return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags , static_cast<const QMetaTypeInterface *>(0) , typeInfo.info.creator , typeInfo.info.deleter , typeInfo.info.saveOp , typeInfo.info.loadOp , typeInfo.info.constructor , typeInfo.info.destructor , typeInfo.info.size , typeInfo.info.flags , type , typeInfo.info.metaObject) : QMetaType(UnknownType); Execution Count:45057 | 45057 |
1909 | , typeInfo.info.creator executed: return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags , static_cast<const QMetaTypeInterface *>(0) , typeInfo.info.creator , typeInfo.info.deleter , typeInfo.info.saveOp , typeInfo.info.loadOp , typeInfo.info.constructor , typeInfo.info.destructor , typeInfo.info.size , typeInfo.info.flags , type , typeInfo.info.metaObject) : QMetaType(UnknownType); Execution Count:45057 | 45057 |
1910 | , typeInfo.info.deleter executed: return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags , static_cast<const QMetaTypeInterface *>(0) , typeInfo.info.creator , typeInfo.info.deleter , typeInfo.info.saveOp , typeInfo.info.loadOp , typeInfo.info.constructor , typeInfo.info.destructor , typeInfo.info.size , typeInfo.info.flags , type , typeInfo.info.metaObject) : QMetaType(UnknownType); Execution Count:45057 | 45057 |
1911 | , typeInfo.info.saveOp executed: return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags , static_cast<const QMetaTypeInterface *>(0) , typeInfo.info.creator , typeInfo.info.deleter , typeInfo.info.saveOp , typeInfo.info.loadOp , typeInfo.info.constructor , typeInfo.info.destructor , typeInfo.info.size , typeInfo.info.flags , type , typeInfo.info.metaObject) : QMetaType(UnknownType); Execution Count:45057 | 45057 |
1912 | , typeInfo.info.loadOp executed: return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags , static_cast<const QMetaTypeInterface *>(0) , typeInfo.info.creator , typeInfo.info.deleter , typeInfo.info.saveOp , typeInfo.info.loadOp , typeInfo.info.constructor , typeInfo.info.destructor , typeInfo.info.size , typeInfo.info.flags , type , typeInfo.info.metaObject) : QMetaType(UnknownType); Execution Count:45057 | 45057 |
1913 | , typeInfo.info.constructor executed: return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags , static_cast<const QMetaTypeInterface *>(0) , typeInfo.info.creator , typeInfo.info.deleter , typeInfo.info.saveOp , typeInfo.info.loadOp , typeInfo.info.constructor , typeInfo.info.destructor , typeInfo.info.size , typeInfo.info.flags , type , typeInfo.info.metaObject) : QMetaType(UnknownType); Execution Count:45057 | 45057 |
1914 | , typeInfo.info.destructor executed: return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags , static_cast<const QMetaTypeInterface *>(0) , typeInfo.info.creator , typeInfo.info.deleter , typeInfo.info.saveOp , typeInfo.info.loadOp , typeInfo.info.constructor , typeInfo.info.destructor , typeInfo.info.size , typeInfo.info.flags , type , typeInfo.info.metaObject) : QMetaType(UnknownType); Execution Count:45057 | 45057 |
1915 | , typeInfo.info.size executed: return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags , static_cast<const QMetaTypeInterface *>(0) , typeInfo.info.creator , typeInfo.info.deleter , typeInfo.info.saveOp , typeInfo.info.loadOp , typeInfo.info.constructor , typeInfo.info.destructor , typeInfo.info.size , typeInfo.info.flags , type , typeInfo.info.metaObject) : QMetaType(UnknownType); Execution Count:45057 | 45057 |
1916 | , typeInfo.info.flags executed: return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags , static_cast<const QMetaTypeInterface *>(0) , typeInfo.info.creator , typeInfo.info.deleter , typeInfo.info.saveOp , typeInfo.info.loadOp , typeInfo.info.constructor , typeInfo.info.destructor , typeInfo.info.size , typeInfo.info.flags , type , typeInfo.info.metaObject) : QMetaType(UnknownType); Execution Count:45057 | 45057 |
1917 | , type executed: return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags , static_cast<const QMetaTypeInterface *>(0) , typeInfo.info.creator , typeInfo.info.deleter , typeInfo.info.saveOp , typeInfo.info.loadOp , typeInfo.info.constructor , typeInfo.info.destructor , typeInfo.info.size , typeInfo.info.flags , type , typeInfo.info.metaObject) : QMetaType(UnknownType); Execution Count:45057 | 45057 |
1918 | , typeInfo.info.metaObject) executed: return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags , static_cast<const QMetaTypeInterface *>(0) , typeInfo.info.creator , typeInfo.info.deleter , typeInfo.info.saveOp , typeInfo.info.loadOp , typeInfo.info.constructor , typeInfo.info.destructor , typeInfo.info.size , typeInfo.info.flags , type , typeInfo.info.metaObject) : QMetaType(UnknownType); Execution Count:45057 | 45057 |
1919 | : QMetaType(UnknownType); executed: return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags , static_cast<const QMetaTypeInterface *>(0) , typeInfo.info.creator , typeInfo.info.deleter , typeInfo.info.saveOp , typeInfo.info.loadOp , typeInfo.info.constructor , typeInfo.info.destructor , typeInfo.info.size , typeInfo.info.flags , type , typeInfo.info.metaObject) : QMetaType(UnknownType); Execution Count:45057 | 45057 |
1920 | } | - |
1921 | | - |
1922 | /*! | - |
1923 | \fn QMetaType::QMetaType(const int typeId) | - |
1924 | \since 5.0 | - |
1925 | | - |
1926 | Constructs a QMetaType object that contains all information about type \a typeId. | - |
1927 | */ | - |
1928 | QMetaType::QMetaType(const int typeId) | - |
1929 | : m_typeId(typeId) | - |
1930 | { | - |
1931 | if (Q_UNLIKELY(typeId == UnknownType)) { evaluated: __builtin_expect(!!(typeId == UnknownType), false) yes Evaluation Count:51 | yes Evaluation Count:45057 |
| 51-45057 |
1932 | // Constructs invalid QMetaType instance. | - |
1933 | m_extensionFlags = 0xffffffff; executed (the execution status of this line is deduced): m_extensionFlags = 0xffffffff; | - |
1934 | Q_ASSERT(!isValid()); executed (the execution status of this line is deduced): qt_noop(); | - |
1935 | } else { executed: } Execution Count:51 | 51 |
1936 | // TODO it can be better. | - |
1937 | *this = QMetaType::typeInfo(typeId); executed (the execution status of this line is deduced): *this = QMetaType::typeInfo(typeId); | - |
1938 | if (m_typeId == UnknownType) evaluated: m_typeId == UnknownType yes Evaluation Count:49 | yes Evaluation Count:45008 |
| 49-45008 |
1939 | m_extensionFlags = 0xffffffff; executed: m_extensionFlags = 0xffffffff; Execution Count:49 | 49 |
1940 | else if (m_typeId == QMetaType::Void) evaluated: m_typeId == QMetaType::Void yes Evaluation Count:2 | yes Evaluation Count:45006 |
| 2-45006 |
1941 | m_extensionFlags = CreateEx | DestroyEx | ConstructEx | DestructEx; executed: m_extensionFlags = CreateEx | DestroyEx | ConstructEx | DestructEx; Execution Count:2 | 2 |
1942 | } | - |
1943 | } | - |
1944 | | - |
1945 | /*! | - |
1946 | \fn QMetaType::QMetaType(const QMetaType &other) | - |
1947 | \since 5.0 | - |
1948 | | - |
1949 | Copy constructs a QMetaType object. | - |
1950 | */ | - |
1951 | QMetaType::QMetaType(const QMetaType &other) | - |
1952 | : m_creator(other.m_creator) | - |
1953 | , m_deleter(other.m_deleter) | - |
1954 | , m_saveOp(other.m_saveOp) | - |
1955 | , m_loadOp(other.m_loadOp) | - |
1956 | , m_constructor(other.m_constructor) | - |
1957 | , m_destructor(other.m_destructor) | - |
1958 | , m_extension(other.m_extension) // space reserved for future use | - |
1959 | , m_size(other.m_size) | - |
1960 | , m_typeFlags(other.m_typeFlags) | - |
1961 | , m_extensionFlags(other.m_extensionFlags) | - |
1962 | , m_typeId(other.m_typeId) | - |
1963 | , m_metaObject(other.m_metaObject) | - |
1964 | {} | 0 |
1965 | | - |
1966 | QMetaType &QMetaType::operator =(const QMetaType &other) | - |
1967 | { | - |
1968 | m_creator = other.m_creator; executed (the execution status of this line is deduced): m_creator = other.m_creator; | - |
1969 | m_deleter = other.m_deleter; executed (the execution status of this line is deduced): m_deleter = other.m_deleter; | - |
1970 | m_saveOp = other.m_saveOp; executed (the execution status of this line is deduced): m_saveOp = other.m_saveOp; | - |
1971 | m_loadOp = other.m_loadOp; executed (the execution status of this line is deduced): m_loadOp = other.m_loadOp; | - |
1972 | m_constructor = other.m_constructor; executed (the execution status of this line is deduced): m_constructor = other.m_constructor; | - |
1973 | m_destructor = other.m_destructor; executed (the execution status of this line is deduced): m_destructor = other.m_destructor; | - |
1974 | m_size = other.m_size; executed (the execution status of this line is deduced): m_size = other.m_size; | - |
1975 | m_typeFlags = other.m_typeFlags; executed (the execution status of this line is deduced): m_typeFlags = other.m_typeFlags; | - |
1976 | m_extensionFlags = other.m_extensionFlags; executed (the execution status of this line is deduced): m_extensionFlags = other.m_extensionFlags; | - |
1977 | m_extension = other.m_extension; // space reserved for future use executed (the execution status of this line is deduced): m_extension = other.m_extension; | - |
1978 | m_typeId = other.m_typeId; executed (the execution status of this line is deduced): m_typeId = other.m_typeId; | - |
1979 | m_metaObject = other.m_metaObject; executed (the execution status of this line is deduced): m_metaObject = other.m_metaObject; | - |
1980 | return *this; executed: return *this; Execution Count:45057 | 45057 |
1981 | } | - |
1982 | | - |
1983 | /*! | - |
1984 | \fn void QMetaType::ctor(const QMetaTypeInterface *info) | - |
1985 | \internal | - |
1986 | | - |
1987 | Method used for future binary compatible extensions. The function may be | - |
1988 | called from within QMetaType's constructor to force a library call from | - |
1989 | inlined code. | - |
1990 | */ | - |
1991 | void QMetaType::ctor(const QMetaTypeInterface *info) | - |
1992 | { | - |
1993 | // Special case for Void type, the type is valid but not constructible. | - |
1994 | // In future we may consider to remove this assert and extend this function to initialize | - |
1995 | // differently m_extensionFlags for different types. Currently it is not needed. | - |
1996 | Q_ASSERT(m_typeId == QMetaType::Void); executed (the execution status of this line is deduced): qt_noop(); | - |
1997 | Q_UNUSED(info); executed (the execution status of this line is deduced): (void)info;; | - |
1998 | m_extensionFlags = CreateEx | DestroyEx | ConstructEx | DestructEx; executed (the execution status of this line is deduced): m_extensionFlags = CreateEx | DestroyEx | ConstructEx | DestructEx; | - |
1999 | } executed: } Execution Count:2 | 2 |
2000 | | - |
2001 | /*! | - |
2002 | \fn void QMetaType::dtor() | - |
2003 | \internal | - |
2004 | | - |
2005 | Method used for future binary compatible extensions. The function may be | - |
2006 | called from within QMetaType's destructor to force a library call from | - |
2007 | inlined code. | - |
2008 | */ | - |
2009 | void QMetaType::dtor() | - |
2010 | {} | - |
2011 | | - |
2012 | /*! | - |
2013 | \fn void *QMetaType::createExtended(const void *copy) const | - |
2014 | \internal | - |
2015 | | - |
2016 | Method used for future binary compatible extensions. The function may be called | - |
2017 | during QMetaType::create to force library call from inlined code. | - |
2018 | */ | - |
2019 | void *QMetaType::createExtended(const void *copy) const | - |
2020 | { | - |
2021 | Q_UNUSED(copy); never executed (the execution status of this line is deduced): (void)copy;; | - |
2022 | return 0; never executed: return 0; | 0 |
2023 | } | - |
2024 | | - |
2025 | /*! | - |
2026 | \fn void QMetaType::destroyExtended(void *data) const | - |
2027 | \internal | - |
2028 | | - |
2029 | Method used for future binary compatible extensions. The function may be called | - |
2030 | during QMetaType::destroy to force library call from inlined code. | - |
2031 | */ | - |
2032 | void QMetaType::destroyExtended(void *data) const | - |
2033 | { | - |
2034 | Q_UNUSED(data); never executed (the execution status of this line is deduced): (void)data;; | - |
2035 | } | 0 |
2036 | | - |
2037 | /*! | - |
2038 | \fn void *QMetaType::constructExtended(void *where, const void *copy) const | - |
2039 | \internal | - |
2040 | | - |
2041 | Method used for future binary compatible extensions. The function may be called | - |
2042 | during QMetaType::construct to force library call from inlined code. | - |
2043 | */ | - |
2044 | void *QMetaType::constructExtended(void *where, const void *copy) const | - |
2045 | { | - |
2046 | Q_UNUSED(where); never executed (the execution status of this line is deduced): (void)where;; | - |
2047 | Q_UNUSED(copy); never executed (the execution status of this line is deduced): (void)copy;; | - |
2048 | return 0; never executed: return 0; | 0 |
2049 | } | - |
2050 | | - |
2051 | /*! | - |
2052 | \fn void QMetaType::destructExtended(void *data) const | - |
2053 | \internal | - |
2054 | | - |
2055 | Method used for future binary compatible extensions. The function may be called | - |
2056 | during QMetaType::destruct to force library call from inlined code. | - |
2057 | */ | - |
2058 | void QMetaType::destructExtended(void *data) const | - |
2059 | { | - |
2060 | Q_UNUSED(data); never executed (the execution status of this line is deduced): (void)data;; | - |
2061 | } | 0 |
2062 | | - |
2063 | /*! | - |
2064 | \fn uint QMetaType::sizeExtended() const | - |
2065 | \internal | - |
2066 | | - |
2067 | Method used for future binary compatible extensions. The function may be | - |
2068 | called from within QMetaType::size to force a library call from | - |
2069 | inlined code. | - |
2070 | */ | - |
2071 | uint QMetaType::sizeExtended() const | - |
2072 | { | - |
2073 | return 0; executed: return 0; Execution Count:22 | 22 |
2074 | } | - |
2075 | | - |
2076 | /*! | - |
2077 | \fn QMetaType::TypeFlags QMetaType::flagsExtended() const | - |
2078 | \internal | - |
2079 | | - |
2080 | Method used for future binary compatible extensions. The function may be | - |
2081 | called from within QMetaType::flags to force a library call from | - |
2082 | inlined code. | - |
2083 | */ | - |
2084 | QMetaType::TypeFlags QMetaType::flagsExtended() const | - |
2085 | { | - |
2086 | return 0; executed: return 0; Execution Count:3 | 3 |
2087 | } | - |
2088 | | - |
2089 | /*! | - |
2090 | \brief QMetaType::metaObjectExtended | - |
2091 | \internal | - |
2092 | | - |
2093 | Method used for future binary compatible extensions. The function may be | - |
2094 | called from within QMetaType::metaObject to force a library call from | - |
2095 | inlined code. | - |
2096 | */ | - |
2097 | const QMetaObject *QMetaType::metaObjectExtended() const | - |
2098 | { | - |
2099 | return 0; never executed: return 0; | 0 |
2100 | } | - |
2101 | | - |
2102 | | - |
2103 | namespace QtPrivate | - |
2104 | { | - |
2105 | const QMetaObject *metaObjectForQWidget() | - |
2106 | { | - |
2107 | if (!qMetaTypeWidgetsHelper) never evaluated: !qMetaTypeWidgetsHelper | 0 |
2108 | return 0; never executed: return 0; | 0 |
2109 | return qMetaObjectWidgetsHelper; never executed: return qMetaObjectWidgetsHelper; | 0 |
2110 | } | - |
2111 | } | - |
2112 | | - |
2113 | QT_END_NAMESPACE | - |
2114 | | - |
| | |