kernel/qmetatype.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2012 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 -
76QT_BEGIN_NAMESPACE -
77 -
78#define NS(x) QT_PREPEND_NAMESPACE(x) -
79 -
80 -
81namespace { -
82struct 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 -
399static 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 -
406Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeGuiHelper = 0; -
407Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeWidgetsHelper = 0; -
408Q_CORE_EXPORT const QMetaObject *qMetaObjectWidgetsHelper = 0; -
409 -
410class QCustomTypeInfo : public QMetaTypeInterface -
411{ -
412public: -
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:4190
4190
419 QByteArray typeName; -
420 int alias; -
421}; -
422 -
423namespace -
424{ -
425union CheckThatItIsPod -
426{ // This should break if QMetaTypeInterface is not a POD type -
427 QMetaTypeInterface iface; -
428}; -
429} -
430 -
431Q_DECLARE_TYPEINFO(QCustomTypeInfo, Q_MOVABLE_TYPE); -
432Q_GLOBAL_STATIC(QVector<QCustomTypeInfo>, customTypes)
executed: delete x;
Execution Count:1
executed: return thisGlobalStatic.pointer.load();
Execution Count:491550
evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:65
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:491518
evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:1
1-491550
433Q_GLOBAL_STATIC(QReadWriteLock, customTypesLock)
executed: delete x;
Execution Count:1
executed: return thisGlobalStatic.pointer.load();
Execution Count:474352
evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:65
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:474376
evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:1
1-474376
434 -
435#ifndef QT_NO_DATASTREAM -
436/*! -
437 \internal -
438*/ -
439void 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*/ -
448void QMetaType::registerStreamOperators(int idx, SaveOperator saveOp, -
449 LoadOperator loadOp) -
450{ -
451 if (idx < User)
evaluated: idx < User
TRUEFALSE
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
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
455 return;
never executed: 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*/ -
469const 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
TRUEFALSE
yes
Evaluation Count:22138
yes
Evaluation Count:3791
evaluated: ((result = namesCache[type]))
TRUEFALSE
yes
Evaluation Count:21536
yes
Evaluation Count:602
602-22138
479 return result;
executed: return result;
Execution Count:21536
21536
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:5
executed: break;
Execution Count:2
executed: break;
Execution Count:8
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:7
executed: break;
Execution Count:3
executed: break;
Execution Count:3
executed: break;
Execution Count:3
executed: break;
Execution Count:2
executed: break;
Execution Count:6
executed: break;
Execution Count:17
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:11
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:2
2-48
486 -
487 default: { -
488 if (Q_UNLIKELY(type < QMetaType::User)) {
evaluated: __builtin_expect(!!(type < QMetaType::User), false)
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:3791
30-3791
489 return 0; // It can happen when someone cast int to QVariant::Type, we should not crash...
executed: return 0;
Execution Count:30
30
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:572
572
504} -
505 -
506/*! -
507 \internal -
508 Similar to QMetaType::type(), but only looks in the static set of types. -
509*/ -
510static 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
TRUEFALSE
yes
Evaluation Count:44712674
yes
Evaluation Count:307977
evaluated: (length != types[i].typeNameLength)
TRUEFALSE
yes
Evaluation Count:42343236
yes
Evaluation Count:2371665
307977-44712674
514 || strcmp(typeName, types[i].typeName))) {
evaluated: strcmp(typeName, types[i].typeName)
TRUEFALSE
yes
Evaluation Count:1413558
yes
Evaluation Count:958148
958148-1413558
515 ++i;
executed (the execution status of this line is deduced): ++i;
-
516 }
executed: }
Execution Count:43754786
43754786
517 return types[i].type;
executed: return types[i].type;
Execution Count:1266114
1266114
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*/ -
525static 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
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:308088
0-308088
529 return QMetaType::UnknownType;
never executed: return QMetaType::UnknownType;
0
530 -
531 for (int v = 0; v < ct->count(); ++v) {
evaluated: v < ct->count()
TRUEFALSE
yes
Evaluation Count:13350002
yes
Evaluation Count:104903
104903-13350002
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())
TRUEFALSE
yes
Evaluation Count:6817064
yes
Evaluation Count:6654602
6654602-6817064
534 && !strcmp(typeName, customInfo.typeName.constData())) {
evaluated: !strcmp(typeName, customInfo.typeName.constData())
TRUEFALSE
yes
Evaluation Count:203172
yes
Evaluation Count:6617490
203172-6617490
535 if (customInfo.alias >= 0)
evaluated: customInfo.alias >= 0
TRUEFALSE
yes
Evaluation Count:57
yes
Evaluation Count:203115
57-203115
536 return customInfo.alias;
executed: return customInfo.alias;
Execution Count:57
57
537 return v + QMetaType::User;
executed: return v + QMetaType::User;
Execution Count:203113
203113
538 } -
539 }
executed: }
Execution Count:13147365
13147365
540 return QMetaType::UnknownType;
executed: return QMetaType::UnknownType;
Execution Count:104903
104903
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 */ -
549int 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 */ -
566int 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:5
5
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 */ -
593int 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
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16270
partially evaluated: normalizedTypeName.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16279
partially evaluated: !deleter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16287
partially evaluated: !creator
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16289
partially evaluated: !destructor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16288
partially evaluated: !constructor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16289
0-16289
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
TRUEFALSE
yes
Evaluation Count:16218
no
Evaluation Count:0
0-16218
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
TRUEFALSE
yes
Evaluation Count:4178
yes
Evaluation Count:12126
4178-12126
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:4178
4178
630 } -
631 -
632 if (idx >= User) {
partially evaluated: idx >= User
TRUEFALSE
yes
Evaluation Count:12126
no
Evaluation Count:0
0-12126
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:12126
12126
636 }
executed: }
Execution Count:12126
12126
637 -
638 if (idx < User) {
partially evaluated: idx < User
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12126
0-12126
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 }
never executed: }
0
642 -
643 if (previousSize != size) {
partially evaluated: previousSize != size
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12126
0-12126
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 }
never executed: }
0
649 if (previousFlags != flags) {
partially evaluated: previousFlags != flags
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12126
0-12126
650 qFatal("QMetaType::registerType: Binary compatibility break "
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qmetatype.cpp", 650, __PRETTY_FUNCTION__).fatal("QMetaType::registerType: Binary compatibility break "
-
651 "-- Type flags for type '%s' [%i] don't match. Previously "
never executed (the execution status of this line is deduced): "-- Type flags for type '%s' [%i] don't match. Previously "
-
652 "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).",
-
653 normalizedTypeName.constData(), idx, previousFlags, int(flags));
never executed (the execution status of this line is deduced): normalizedTypeName.constData(), idx, previousFlags, int(flags));
-
654 }
never executed: }
0
655 -
656 return idx;
executed: return idx;
Execution Count:12126
12126
657} -
658 -
659/*! -
660 \internal -
661 \since 4.7 -
662 -
663 Registers a user type for marshalling, as an alias of another type (typedef) -
664*/ -
665int QMetaType::registerTypedef(const char* typeName, int aliasId) -
666{ -
667#ifdef QT_NO_QOBJECT -
668 NS(QByteArray) normalizedTypeName = typeName; -
669#else -
670 NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName);
never executed (the execution status of this line is deduced): ::QByteArray normalizedTypeName = QMetaObject::normalizedType(typeName);
-
671#endif -
672 -
673 return registerNormalizedTypedef(normalizedTypeName, aliasId);
never executed: return registerNormalizedTypedef(normalizedTypeName, aliasId);
0
674} -
675 -
676/*! -
677 \internal -
678 \since 5.0 -
679 -
680 Registers a user type for marshalling, as an alias of another type (typedef). -
681 Note that normalizedTypeName is not checked for conformance with Qt's normalized format, -
682 so it must already conform. -
683*/ -
684int QMetaType::registerNormalizedTypedef(const NS(QByteArray) &normalizedTypeName, int aliasId) -
685{ -
686 QVector<QCustomTypeInfo> *ct = customTypes();
executed (the execution status of this line is deduced): QVector<QCustomTypeInfo> *ct = customTypes();
-
687 if (!ct || normalizedTypeName.isEmpty())
partially evaluated: !ct
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:688
partially evaluated: normalizedTypeName.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:688
0-688
688 return -1;
never executed: return -1;
0
689 -
690 int idx = qMetaTypeStaticType(normalizedTypeName.constData(),
executed (the execution status of this line is deduced): int idx = qMetaTypeStaticType(normalizedTypeName.constData(),
-
691 normalizedTypeName.size());
executed (the execution status of this line is deduced): normalizedTypeName.size());
-
692 -
693 if (idx == UnknownType) {
evaluated: idx == UnknownType
TRUEFALSE
yes
Evaluation Count:681
yes
Evaluation Count:7
7-681
694 QWriteLocker locker(customTypesLock());
executed (the execution status of this line is deduced): QWriteLocker locker(customTypesLock());
-
695 idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(),
executed (the execution status of this line is deduced): idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(),
-
696 normalizedTypeName.size());
executed (the execution status of this line is deduced): normalizedTypeName.size());
-
697 -
698 if (idx == UnknownType) {
evaluated: idx == UnknownType
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:669
12-669
699 QCustomTypeInfo inf;
executed (the execution status of this line is deduced): QCustomTypeInfo inf;
-
700 inf.typeName = normalizedTypeName;
executed (the execution status of this line is deduced): inf.typeName = normalizedTypeName;
-
701 inf.alias = aliasId;
executed (the execution status of this line is deduced): inf.alias = aliasId;
-
702 inf.creator = 0;
executed (the execution status of this line is deduced): inf.creator = 0;
-
703 inf.deleter = 0;
executed (the execution status of this line is deduced): inf.deleter = 0;
-
704 ct->append(inf);
executed (the execution status of this line is deduced): ct->append(inf);
-
705 return aliasId;
executed: return aliasId;
Execution Count:12
12
706 } -
707 }
executed: }
Execution Count:669
669
708 -
709 if (idx != aliasId) {
partially evaluated: idx != aliasId
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:676
0-676
710 qFatal("QMetaType::registerTypedef: Binary compatibility break "
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qmetatype.cpp", 710, __PRETTY_FUNCTION__).fatal("QMetaType::registerTypedef: Binary compatibility break "
-
711 "-- 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], "
-
712 "now registering as typedef of '%s' [%i].",
never executed (the execution status of this line is deduced): "now registering as typedef of '%s' [%i].",
-
713 normalizedTypeName.constData(), QMetaType::typeName(idx), idx,
never executed (the execution status of this line is deduced): normalizedTypeName.constData(), QMetaType::typeName(idx), idx,
-
714 QMetaType::typeName(aliasId), aliasId);
never executed (the execution status of this line is deduced): QMetaType::typeName(aliasId), aliasId);
-
715 }
never executed: }
0
716 return idx;
executed: return idx;
Execution Count:676
676
717} -
718 -
719/*! -
720 Returns true if the datatype with ID \a type is registered; -
721 otherwise returns false. -
722 -
723 \sa type(), typeName(), Type -
724*/ -
725bool QMetaType::isRegistered(int type) -
726{ -
727 // predefined type -
728 if ((type >= FirstCoreType && type <= LastCoreType)
evaluated: type >= FirstCoreType
TRUEFALSE
yes
Evaluation Count:39877
yes
Evaluation Count:3
evaluated: type <= LastCoreType
TRUEFALSE
yes
Evaluation Count:24794
yes
Evaluation Count:15083
3-39877
729 || (type >= FirstGuiType && type <= LastGuiType)
evaluated: type >= FirstGuiType
TRUEFALSE
yes
Evaluation Count:15085
yes
Evaluation Count:5
evaluated: type <= LastGuiType
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:15017
5-15085
730 || (type >= FirstWidgetsType && type <= LastWidgetsType)) {
evaluated: type >= FirstWidgetsType
TRUEFALSE
yes
Evaluation Count:15015
yes
Evaluation Count:6
evaluated: type <= LastWidgetsType
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:15018
1-15018
731 return true;
executed: return true;
Execution Count:24862
24862
732 } -
733 -
734 QReadLocker locker(customTypesLock());
executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock());
-
735 const QVector<QCustomTypeInfo> * const ct = customTypes();
executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes();
-
736 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:15028
15028
737} -
738 -
739/*! -
740 \fn int qMetaTypeTypeImpl(const char *typeName) -
741 \internal -
742 -
743 Implementation of QMetaType::type(). -
744*/ -
745template <bool tryNormalizedType> -
746static inline int qMetaTypeTypeImpl(const char *typeName) -
747{ -
748 int length = qstrlen(typeName);
executed (the execution status of this line is deduced): int length = qstrlen(typeName);
-
749 if (!length)
evaluated: !length
TRUEFALSE
yes
Evaluation Count:102
yes
Evaluation Count:1249126
102-1249126
750 return QMetaType::UnknownType;
executed: return QMetaType::UnknownType;
Execution Count:102
102
751 int type = qMetaTypeStaticType(typeName, length);
executed (the execution status of this line is deduced): int type = qMetaTypeStaticType(typeName, length);
-
752 if (type == QMetaType::UnknownType) {
evaluated: type == QMetaType::UnknownType
TRUEFALSE
yes
Evaluation Count:290984
yes
Evaluation Count:958140
290984-958140
753 QReadLocker locker(customTypesLock());
executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock());
-
754 type = qMetaTypeCustomType_unlocked(typeName, length);
executed (the execution status of this line is deduced): type = qMetaTypeCustomType_unlocked(typeName, length);
-
755#ifndef QT_NO_QOBJECT -
756 if ((type == QMetaType::UnknownType) && tryNormalizedType) {
evaluated: (type == QMetaType::UnknownType)
TRUEFALSE
yes
Evaluation Count:100612
yes
Evaluation Count:190371
evaluated: tryNormalizedType
TRUEFALSE
yes
Evaluation Count:107
yes
Evaluation Count:100505
107-190371
757 const NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName);
executed (the execution status of this line is deduced): const ::QByteArray normalizedTypeName = QMetaObject::normalizedType(typeName);
-
758 type = qMetaTypeStaticType(normalizedTypeName.constData(),
executed (the execution status of this line is deduced): type = qMetaTypeStaticType(normalizedTypeName.constData(),
-
759 normalizedTypeName.size());
executed (the execution status of this line is deduced): normalizedTypeName.size());
-
760 if (type == QMetaType::UnknownType) {
evaluated: type == QMetaType::UnknownType
TRUEFALSE
yes
Evaluation Count:105
yes
Evaluation Count:2
2-105
761 type = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(),
executed (the execution status of this line is deduced): type = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(),
-
762 normalizedTypeName.size());
executed (the execution status of this line is deduced): normalizedTypeName.size());
-
763 }
executed: }
Execution Count:105
105
764 }
executed: }
Execution Count:107
107
765#endif -
766 }
executed: }
Execution Count:290981
290981
767 return type;
executed: return type;
Execution Count:1249137
1249137
768} -
769 -
770/*! -
771 Returns a handle to the type called \a typeName, or QMetaType::UnknownType if there is -
772 no such type. -
773 -
774 \sa isRegistered(), typeName(), Type -
775*/ -
776int QMetaType::type(const char *typeName) -
777{ -
778 return qMetaTypeTypeImpl</*tryNormalizedType=*/true>(typeName);
executed: return qMetaTypeTypeImpl< true>(typeName);
Execution Count:122057
122057
779} -
780 -
781/*! -
782 \a internal -
783 -
784 Similar to QMetaType::type(); the only difference is that this function -
785 doesn't attempt to normalize the type name (i.e., the lookup will fail -
786 for type names in non-normalized form). -
787*/ -
788int qMetaTypeTypeInternal(const char *typeName) -
789{ -
790 return qMetaTypeTypeImpl</*tryNormalizedType=*/false>(typeName);
executed: return qMetaTypeTypeImpl< false>(typeName);
Execution Count:1127179
1127179
791} -
792 -
793#ifndef QT_NO_DATASTREAM -
794/*! -
795 Writes the object pointed to by \a data with the ID \a type to -
796 the given \a stream. Returns true if the object is saved -
797 successfully; otherwise returns false. -
798 -
799 The type must have been registered with qRegisterMetaType() and -
800 qRegisterMetaTypeStreamOperators() beforehand. -
801 -
802 Normally, you should not need to call this function directly. -
803 Instead, use QVariant's \c operator<<(), which relies on save() -
804 to stream custom types. -
805 -
806 \sa load(), qRegisterMetaTypeStreamOperators() -
807*/ -
808bool QMetaType::save(QDataStream &stream, int type, const void *data) -
809{ -
810 if (!data || !isRegistered(type))
evaluated: !data
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:12358
partially evaluated: !isRegistered(type)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12358
0-12358
811 return false;
executed: return false;
Execution Count:25
25
812 -
813 switch(type) { -
814 case QMetaType::UnknownType: -
815 case QMetaType::Void: -
816 case QMetaType::VoidStar: -
817 case QMetaType::QObjectStar: -
818 case QMetaType::QModelIndex: -
819 case QMetaType::QJsonValue: -
820 case QMetaType::QJsonObject: -
821 case QMetaType::QJsonArray: -
822 case QMetaType::QJsonDocument: -
823 return false;
executed: return false;
Execution Count:7
7
824 case QMetaType::Long: -
825 stream << qlonglong(*static_cast<const long *>(data));
executed (the execution status of this line is deduced): stream << qlonglong(*static_cast<const long *>(data));
-
826 break;
executed: break;
Execution Count:5
5
827 case QMetaType::Int: -
828 stream << *static_cast<const int *>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const int *>(data);
-
829 break;
executed: break;
Execution Count:175
175
830 case QMetaType::Short: -
831 stream << *static_cast<const short *>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const short *>(data);
-
832 break;
executed: break;
Execution Count:5
5
833 case QMetaType::Char: -
834 // force a char to be signed -
835 stream << *static_cast<const signed char *>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const signed char *>(data);
-
836 break;
executed: break;
Execution Count:5
5
837 case QMetaType::ULong: -
838 stream << qulonglong(*static_cast<const ulong *>(data));
executed (the execution status of this line is deduced): stream << qulonglong(*static_cast<const ulong *>(data));
-
839 break;
executed: break;
Execution Count:5
5
840 case QMetaType::UInt: -
841 stream << *static_cast<const uint *>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const uint *>(data);
-
842 break;
executed: break;
Execution Count:4
4
843 case QMetaType::LongLong: -
844 stream << *static_cast<const qlonglong *>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const qlonglong *>(data);
-
845 break;
executed: break;
Execution Count:3
3
846 case QMetaType::ULongLong: -
847 stream << *static_cast<const qulonglong *>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const qulonglong *>(data);
-
848 break;
executed: break;
Execution Count:3
3
849 case QMetaType::UShort: -
850 stream << *static_cast<const ushort *>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ushort *>(data);
-
851 break;
executed: break;
Execution Count:5
5
852 case QMetaType::SChar: -
853 stream << *static_cast<const signed char *>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const signed char *>(data);
-
854 break;
executed: break;
Execution Count:1
1
855 case QMetaType::UChar: -
856 stream << *static_cast<const uchar *>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const uchar *>(data);
-
857 break;
executed: break;
Execution Count:5
5
858 case QMetaType::Bool: -
859 stream << qint8(*static_cast<const bool *>(data));
executed (the execution status of this line is deduced): stream << qint8(*static_cast<const bool *>(data));
-
860 break;
executed: break;
Execution Count:3
3
861 case QMetaType::Float: -
862 stream << *static_cast<const float *>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const float *>(data);
-
863 break;
executed: break;
Execution Count:7
7
864 case QMetaType::Double: -
865 stream << *static_cast<const double *>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const double *>(data);
-
866 break;
executed: break;
Execution Count:6
6
867 case QMetaType::QChar: -
868 stream << *static_cast<const NS(QChar) *>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QChar *>(data);
-
869 break;
executed: break;
Execution Count:5
5
870#ifndef QT_BOOTSTRAPPED -
871 case QMetaType::QVariantMap: -
872 stream << *static_cast<const NS(QVariantMap)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QVariantMap*>(data);
-
873 break;
executed: break;
Execution Count:5
5
874 case QMetaType::QVariantHash: -
875 stream << *static_cast<const NS(QVariantHash)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QVariantHash*>(data);
-
876 break;
executed: break;
Execution Count:3
3
877 case QMetaType::QVariantList: -
878 stream << *static_cast<const NS(QVariantList)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QVariantList*>(data);
-
879 break;
executed: break;
Execution Count:19
19
880 case QMetaType::QVariant: -
881 stream << *static_cast<const NS(QVariant)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QVariant*>(data);
-
882 break;
executed: break;
Execution Count:3
3
883#endif -
884 case QMetaType::QByteArray: -
885 stream << *static_cast<const NS(QByteArray)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QByteArray*>(data);
-
886 break;
executed: break;
Execution Count:6
6
887 case QMetaType::QString: -
888 stream << *static_cast<const NS(QString)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QString*>(data);
-
889 break;
executed: break;
Execution Count:11934
11934
890 case QMetaType::QStringList: -
891 stream << *static_cast<const NS(QStringList)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QStringList*>(data);
-
892 break;
executed: break;
Execution Count:8
8
893#ifndef QT_BOOTSTRAPPED -
894 case QMetaType::QBitArray: -
895 stream << *static_cast<const NS(QBitArray)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QBitArray*>(data);
-
896 break;
executed: break;
Execution Count:5
5
897#endif -
898 case QMetaType::QDate: -
899 stream << *static_cast<const NS(QDate)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QDate*>(data);
-
900 break;
executed: break;
Execution Count:5
5
901 case QMetaType::QTime: -
902 stream << *static_cast<const NS(QTime)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QTime*>(data);
-
903 break;
executed: break;
Execution Count:5
5
904 case QMetaType::QDateTime: -
905 stream << *static_cast<const NS(QDateTime)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QDateTime*>(data);
-
906 break;
executed: break;
Execution Count:5
5
907#ifndef QT_BOOTSTRAPPED -
908 case QMetaType::QUrl: -
909 stream << *static_cast<const NS(QUrl)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QUrl*>(data);
-
910 break;
executed: break;
Execution Count:3
3
911#endif -
912 case QMetaType::QLocale: -
913 stream << *static_cast<const NS(QLocale)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QLocale*>(data);
-
914 break;
executed: break;
Execution Count:3
3
915#ifndef QT_NO_GEOM_VARIANT -
916 case QMetaType::QRect: -
917 stream << *static_cast<const NS(QRect)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QRect*>(data);
-
918 break;
executed: break;
Execution Count:5
5
919 case QMetaType::QRectF: -
920 stream << *static_cast<const NS(QRectF)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QRectF*>(data);
-
921 break;
executed: break;
Execution Count:3
3
922 case QMetaType::QSize: -
923 stream << *static_cast<const NS(QSize)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QSize*>(data);
-
924 break;
executed: break;
Execution Count:6
6
925 case QMetaType::QSizeF: -
926 stream << *static_cast<const NS(QSizeF)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QSizeF*>(data);
-
927 break;
executed: break;
Execution Count:3
3
928 case QMetaType::QLine: -
929 stream << *static_cast<const NS(QLine)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QLine*>(data);
-
930 break;
executed: break;
Execution Count:3
3
931 case QMetaType::QLineF: -
932 stream << *static_cast<const NS(QLineF)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QLineF*>(data);
-
933 break;
executed: break;
Execution Count:3
3
934 case QMetaType::QPoint: -
935 stream << *static_cast<const NS(QPoint)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QPoint*>(data);
-
936 break;
executed: break;
Execution Count:5
5
937 case QMetaType::QPointF: -
938 stream << *static_cast<const NS(QPointF)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QPointF*>(data);
-
939 break;
executed: break;
Execution Count:3
3
940#endif -
941#ifndef QT_NO_REGEXP -
942 case QMetaType::QRegExp: -
943 stream << *static_cast<const NS(QRegExp)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QRegExp*>(data);
-
944 break;
executed: break;
Execution Count:47
47
945#endif -
946#ifndef QT_BOOTSTRAPPED -
947#ifndef QT_NO_REGEXP -
948 case QMetaType::QRegularExpression: -
949 stream << *static_cast<const NS(QRegularExpression)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QRegularExpression*>(data);
-
950 break;
executed: break;
Execution Count:4
4
951#endif // QT_NO_REGEXP -
952 case QMetaType::QEasingCurve: -
953 stream << *static_cast<const NS(QEasingCurve)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QEasingCurve*>(data);
-
954 break;
executed: break;
Execution Count:1
1
955#endif // QT_BOOTSTRAPPED -
956 case QMetaType::QFont: -
957 case QMetaType::QPixmap: -
958 case QMetaType::QBrush: -
959 case QMetaType::QColor: -
960 case QMetaType::QPalette: -
961 case QMetaType::QImage: -
962 case QMetaType::QPolygon: -
963 case QMetaType::QPolygonF: -
964 case QMetaType::QRegion: -
965 case QMetaType::QBitmap: -
966 case QMetaType::QCursor: -
967 case QMetaType::QKeySequence: -
968 case QMetaType::QPen: -
969 case QMetaType::QTextLength: -
970 case QMetaType::QTextFormat: -
971 case QMetaType::QMatrix: -
972 case QMetaType::QTransform: -
973 case QMetaType::QMatrix4x4: -
974 case QMetaType::QVector2D: -
975 case QMetaType::QVector3D: -
976 case QMetaType::QVector4D: -
977 case QMetaType::QQuaternion: -
978 case QMetaType::QIcon: -
979 if (!qMetaTypeGuiHelper)
partially evaluated: !qMetaTypeGuiHelper
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20
0-20
980 return false;
never executed: return false;
0
981 qMetaTypeGuiHelper[type - FirstGuiType].saveOp(stream, data);
executed (the execution status of this line is deduced): qMetaTypeGuiHelper[type - FirstGuiType].saveOp(stream, data);
-
982 break;
executed: break;
Execution Count:20
20
983 case QMetaType::QSizePolicy: -
984 if (!qMetaTypeWidgetsHelper)
never evaluated: !qMetaTypeWidgetsHelper
0
985 return false;
never executed: return false;
0
986 qMetaTypeWidgetsHelper[type - FirstWidgetsType].saveOp(stream, data);
never executed (the execution status of this line is deduced): qMetaTypeWidgetsHelper[type - FirstWidgetsType].saveOp(stream, data);
-
987 break;
never executed: break;
0
988 case QMetaType::QUuid: -
989 stream << *static_cast<const NS(QUuid)*>(data);
executed (the execution status of this line is deduced): stream << *static_cast<const ::QUuid*>(data);
-
990 break;
executed: break;
Execution Count:2
2
991 default: { -
992 const QVector<QCustomTypeInfo> * const ct = customTypes();
executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes();
-
993 if (!ct)
partially evaluated: !ct
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
994 return false;
never executed: return false;
0
995 -
996 SaveOperator saveOp = 0;
executed (the execution status of this line is deduced): SaveOperator saveOp = 0;
-
997 { -
998 QReadLocker locker(customTypesLock());
executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock());
-
999 saveOp = ct->at(type - User).saveOp;
executed (the execution status of this line is deduced): saveOp = ct->at(type - User).saveOp;
-
1000 } -
1001 -
1002 if (!saveOp)
evaluated: !saveOp
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
1-4
1003 return false;
executed: return false;
Execution Count:1
1
1004 saveOp(stream, data);
executed (the execution status of this line is deduced): saveOp(stream, data);
-
1005 break; }
executed: break;
Execution Count:4
4
1006 } -
1007 -
1008 return true;
executed: return true;
Execution Count:12350
12350
1009} -
1010 -
1011/*! -
1012 Reads the object of the specified \a type from the given \a -
1013 stream into \a data. Returns true if the object is loaded -
1014 successfully; otherwise returns false. -
1015 -
1016 The type must have been registered with qRegisterMetaType() and -
1017 qRegisterMetaTypeStreamOperators() beforehand. -
1018 -
1019 Normally, you should not need to call this function directly. -
1020 Instead, use QVariant's \c operator>>(), which relies on load() -
1021 to stream custom types. -
1022 -
1023 \sa save(), qRegisterMetaTypeStreamOperators() -
1024*/ -
1025bool QMetaType::load(QDataStream &stream, int type, void *data) -
1026{ -
1027 if (!data || !isRegistered(type))
evaluated: !data
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:12437
partially evaluated: !isRegistered(type)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12437
0-12437
1028 return false;
executed: return false;
Execution Count:25
25
1029 -
1030 switch(type) { -
1031 case QMetaType::UnknownType: -
1032 case QMetaType::Void: -
1033 case QMetaType::VoidStar: -
1034 case QMetaType::QObjectStar: -
1035 case QMetaType::QModelIndex: -
1036 case QMetaType::QJsonValue: -
1037 case QMetaType::QJsonObject: -
1038 case QMetaType::QJsonArray: -
1039 case QMetaType::QJsonDocument: -
1040 return false;
executed: return false;
Execution Count:7
7
1041 case QMetaType::Long: { -
1042 qlonglong l;
executed (the execution status of this line is deduced): qlonglong l;
-
1043 stream >> l;
executed (the execution status of this line is deduced): stream >> l;
-
1044 *static_cast<long *>(data) = long(l);
executed (the execution status of this line is deduced): *static_cast<long *>(data) = long(l);
-
1045 break; }
executed: break;
Execution Count:9
9
1046 case QMetaType::Int: -
1047 stream >> *static_cast<int *>(data);
executed (the execution status of this line is deduced): stream >> *static_cast<int *>(data);
-
1048 break;
executed: break;
Execution Count:146
146
1049 case QMetaType::Short: -
1050 stream >> *static_cast<short *>(data);
executed (the execution status of this line is deduced): stream >> *static_cast<short *>(data);
-
1051 break;
executed: break;
Execution Count:9
9
1052 case QMetaType::Char: -
1053 // force a char to be signed -
1054 stream >> *static_cast<signed char *>(data);
executed (the execution status of this line is deduced): stream >> *static_cast<signed char *>(data);
-
1055 break;
executed: break;
Execution Count:9
9
1056 case QMetaType::ULong: { -
1057 qulonglong ul;
executed (the execution status of this line is deduced): qulonglong ul;
-
1058 stream >> ul;
executed (the execution status of this line is deduced): stream >> ul;
-
1059 *static_cast<ulong *>(data) = ulong(ul);
executed (the execution status of this line is deduced): *static_cast<ulong *>(data) = ulong(ul);
-
1060 break; }
executed: break;
Execution Count:9
9
1061 case QMetaType::UInt: -
1062 stream >> *static_cast<uint *>(data);
executed (the execution status of this line is deduced): stream >> *static_cast<uint *>(data);
-
1063 break;
executed: break;
Execution Count:8
8
1064 case QMetaType::LongLong: -
1065 stream >> *static_cast<qlonglong *>(data);
executed (the execution status of this line is deduced): stream >> *static_cast<qlonglong *>(data);
-
1066 break;
executed: break;
Execution Count:7
7
1067 case QMetaType::ULongLong: -
1068 stream >> *static_cast<qulonglong *>(data);
executed (the execution status of this line is deduced): stream >> *static_cast<qulonglong *>(data);
-
1069 break;
executed: break;
Execution Count:7
7
1070 case QMetaType::UShort: -
1071 stream >> *static_cast<ushort *>(data);
executed (the execution status of this line is deduced): stream >> *static_cast<ushort *>(data);
-
1072 break;
executed: break;
Execution Count:9
9
1073 case QMetaType::SChar: -
1074 stream >> *static_cast<signed char *>(data);
executed (the execution status of this line is deduced): stream >> *static_cast<signed char *>(data);
-
1075 break;
executed: break;
Execution Count:3
3
1076 case QMetaType::UChar: -
1077 stream >> *static_cast<uchar *>(data);
executed (the execution status of this line is deduced): stream >> *static_cast<uchar *>(data);
-
1078 break;
executed: break;
Execution Count:9
9
1079 case QMetaType::Bool: { -
1080 qint8 b;
executed (the execution status of this line is deduced): qint8 b;
-
1081 stream >> b;
executed (the execution status of this line is deduced): stream >> b;
-
1082 *static_cast<bool *>(data) = b;
executed (the execution status of this line is deduced): *static_cast<bool *>(data) = b;
-
1083 break; }
executed: break;
Execution Count:7
7
1084 case QMetaType::Float: -
1085 stream >> *static_cast<float *>(data);
executed (the execution status of this line is deduced): stream >> *static_cast<float *>(data);
-
1086 break;
executed: break;
Execution Count:11
11
1087 case QMetaType::Double: -
1088 stream >> *static_cast<double *>(data);
executed (the execution status of this line is deduced): stream >> *static_cast<double *>(data);
-
1089 break;
executed: break;
Execution Count:10
10
1090 case QMetaType::QChar: -
1091 stream >> *static_cast< NS(QChar)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QChar*>(data);
-
1092 break;
executed: break;
Execution Count:9
9
1093#ifndef QT_BOOTSTRAPPED -
1094 case QMetaType::QVariantMap: -
1095 stream >> *static_cast< NS(QVariantMap)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QVariantMap*>(data);
-
1096 break;
executed: break;
Execution Count:8
8
1097 case QMetaType::QVariantHash: -
1098 stream >> *static_cast< NS(QVariantHash)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QVariantHash*>(data);
-
1099 break;
executed: break;
Execution Count:7
7
1100 case QMetaType::QVariantList: -
1101 stream >> *static_cast< NS(QVariantList)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QVariantList*>(data);
-
1102 break;
executed: break;
Execution Count:12
12
1103 case QMetaType::QVariant: -
1104 stream >> *static_cast< NS(QVariant)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QVariant*>(data);
-
1105 break;
executed: break;
Execution Count:7
7
1106#endif -
1107 case QMetaType::QByteArray: -
1108 stream >> *static_cast< NS(QByteArray)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QByteArray*>(data);
-
1109 break;
executed: break;
Execution Count:9
9
1110 case QMetaType::QString: -
1111 stream >> *static_cast< NS(QString)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QString*>(data);
-
1112 break;
executed: break;
Execution Count:11907
11907
1113 case QMetaType::QStringList: -
1114 stream >> *static_cast< NS(QStringList)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QStringList*>(data);
-
1115 break;
executed: break;
Execution Count:12
12
1116#ifndef QT_BOOTSTRAPPED -
1117 case QMetaType::QBitArray: -
1118 stream >> *static_cast< NS(QBitArray)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QBitArray*>(data);
-
1119 break;
executed: break;
Execution Count:9
9
1120#endif -
1121 case QMetaType::QDate: -
1122 stream >> *static_cast< NS(QDate)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QDate*>(data);
-
1123 break;
executed: break;
Execution Count:9
9
1124 case QMetaType::QTime: -
1125 stream >> *static_cast< NS(QTime)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QTime*>(data);
-
1126 break;
executed: break;
Execution Count:9
9
1127 case QMetaType::QDateTime: -
1128 stream >> *static_cast< NS(QDateTime)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QDateTime*>(data);
-
1129 break;
executed: break;
Execution Count:9
9
1130#ifndef QT_BOOTSTRAPPED -
1131 case QMetaType::QUrl: -
1132 stream >> *static_cast< NS(QUrl)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QUrl*>(data);
-
1133 break;
executed: break;
Execution Count:7
7
1134#endif -
1135 case QMetaType::QLocale: -
1136 stream >> *static_cast< NS(QLocale)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QLocale*>(data);
-
1137 break;
executed: break;
Execution Count:7
7
1138#ifndef QT_NO_GEOM_VARIANT -
1139 case QMetaType::QRect: -
1140 stream >> *static_cast< NS(QRect)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QRect*>(data);
-
1141 break;
executed: break;
Execution Count:9
9
1142 case QMetaType::QRectF: -
1143 stream >> *static_cast< NS(QRectF)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QRectF*>(data);
-
1144 break;
executed: break;
Execution Count:7
7
1145 case QMetaType::QSize: -
1146 stream >> *static_cast< NS(QSize)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QSize*>(data);
-
1147 break;
executed: break;
Execution Count:10
10
1148 case QMetaType::QSizeF: -
1149 stream >> *static_cast< NS(QSizeF)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QSizeF*>(data);
-
1150 break;
executed: break;
Execution Count:7
7
1151 case QMetaType::QLine: -
1152 stream >> *static_cast< NS(QLine)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QLine*>(data);
-
1153 break;
executed: break;
Execution Count:7
7
1154 case QMetaType::QLineF: -
1155 stream >> *static_cast< NS(QLineF)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QLineF*>(data);
-
1156 break;
executed: break;
Execution Count:7
7
1157 case QMetaType::QPoint: -
1158 stream >> *static_cast< NS(QPoint)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QPoint*>(data);
-
1159 break;
executed: break;
Execution Count:9
9
1160 case QMetaType::QPointF: -
1161 stream >> *static_cast< NS(QPointF)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QPointF*>(data);
-
1162 break;
executed: break;
Execution Count:7
7
1163#endif -
1164#ifndef QT_NO_REGEXP -
1165 case QMetaType::QRegExp: -
1166 stream >> *static_cast< NS(QRegExp)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QRegExp*>(data);
-
1167 break;
executed: break;
Execution Count:51
51
1168#endif -
1169#ifndef QT_BOOTSTRAPPED -
1170#ifndef QT_NO_REGEXP -
1171 case QMetaType::QRegularExpression: -
1172 stream >> *static_cast< NS(QRegularExpression)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QRegularExpression*>(data);
-
1173 break;
executed: break;
Execution Count:7
7
1174#endif // QT_NO_REGEXP -
1175 case QMetaType::QEasingCurve: -
1176 stream >> *static_cast< NS(QEasingCurve)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QEasingCurve*>(data);
-
1177 break;
executed: break;
Execution Count:3
3
1178#endif // QT_BOOTSTRAPPED -
1179 case QMetaType::QFont: -
1180 case QMetaType::QPixmap: -
1181 case QMetaType::QBrush: -
1182 case QMetaType::QColor: -
1183 case QMetaType::QPalette: -
1184 case QMetaType::QImage: -
1185 case QMetaType::QPolygon: -
1186 case QMetaType::QPolygonF: -
1187 case QMetaType::QRegion: -
1188 case QMetaType::QBitmap: -
1189 case QMetaType::QCursor: -
1190 case QMetaType::QKeySequence: -
1191 case QMetaType::QPen: -
1192 case QMetaType::QTextLength: -
1193 case QMetaType::QTextFormat: -
1194 case QMetaType::QMatrix: -
1195 case QMetaType::QTransform: -
1196 case QMetaType::QMatrix4x4: -
1197 case QMetaType::QVector2D: -
1198 case QMetaType::QVector3D: -
1199 case QMetaType::QVector4D: -
1200 case QMetaType::QQuaternion: -
1201 case QMetaType::QIcon: -
1202 if (!qMetaTypeGuiHelper)
partially evaluated: !qMetaTypeGuiHelper
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
1203 return false;
never executed: return false;
0
1204 qMetaTypeGuiHelper[type - FirstGuiType].loadOp(stream, data);
executed (the execution status of this line is deduced): qMetaTypeGuiHelper[type - FirstGuiType].loadOp(stream, data);
-
1205 break;
executed: break;
Execution Count:19
19
1206 case QMetaType::QSizePolicy: -
1207 if (!qMetaTypeWidgetsHelper)
never evaluated: !qMetaTypeWidgetsHelper
0
1208 return false;
never executed: return false;
0
1209 qMetaTypeWidgetsHelper[type - FirstWidgetsType].loadOp(stream, data);
never executed (the execution status of this line is deduced): qMetaTypeWidgetsHelper[type - FirstWidgetsType].loadOp(stream, data);
-
1210 break;
never executed: break;
0
1211 case QMetaType::QUuid: -
1212 stream >> *static_cast< NS(QUuid)*>(data);
executed (the execution status of this line is deduced): stream >> *static_cast< ::QUuid*>(data);
-
1213 break;
executed: break;
Execution Count:5
5
1214 default: { -
1215 const QVector<QCustomTypeInfo> * const ct = customTypes();
executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes();
-
1216 if (!ct)
partially evaluated: !ct
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1217 return false;
never executed: return false;
0
1218 -
1219 LoadOperator loadOp = 0;
executed (the execution status of this line is deduced): LoadOperator loadOp = 0;
-
1220 { -
1221 QReadLocker locker(customTypesLock());
executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock());
-
1222 loadOp = ct->at(type - User).loadOp;
executed (the execution status of this line is deduced): loadOp = ct->at(type - User).loadOp;
-
1223 } -
1224 -
1225 if (!loadOp)
evaluated: !loadOp
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
2-6
1226 return false;
executed: return false;
Execution Count:2
2
1227 loadOp(stream, data);
executed (the execution status of this line is deduced): loadOp(stream, data);
-
1228 break; }
executed: break;
Execution Count:6
6
1229 } -
1230 return true;
executed: return true;
Execution Count:12428
12428
1231} -
1232#endif // QT_NO_DATASTREAM -
1233namespace { -
1234class TypeCreator { -
1235 template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> -
1236 struct CreatorImpl { -
1237 static void *Create(const int /* type */, const void *copy) -
1238 { -
1239 // Using QMetaTypeFunctionHelper<T>::Create adds function call cost, even if it is a template (gcc). -
1240 // This "copy" check is moved out from the switcher by compiler (at least by gcc) -
1241 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:185874
185874
1242 } -
1243 }; -
1244 template<typename T> -
1245 struct CreatorImpl<T, /* IsAcceptedType = */ false> { -
1246 static void *Create(const int type, const void *copy) -
1247 { -
1248 if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) {
evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui
TRUEFALSE
yes
Evaluation Count:2918
yes
Evaluation Count:3
3-2918
1249 if (Q_LIKELY(qMetaTypeGuiHelper))
evaluated: __builtin_expect(!!(qMetaTypeGuiHelper), true)
TRUEFALSE
yes
Evaluation Count:2895
yes
Evaluation Count:23
23-2895
1250 return qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].creator(copy);
executed: return qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].creator(copy);
Execution Count:2895
2895
1251 }
executed: }
Execution Count:23
23
1252 if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) {
evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:23
3-23
1253 if (Q_LIKELY(qMetaTypeWidgetsHelper))
evaluated: __builtin_expect(!!(qMetaTypeWidgetsHelper), true)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1254 return qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].creator(copy);
executed: return qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].creator(copy);
Execution Count:2
2
1255 }
executed: }
Execution Count:1
1
1256 // This point can be reached only for known types that definition is not available, for example -
1257 // in bootstrap mode. We have no other choice then ignore it. -
1258 return 0;
executed: return 0;
Execution Count:24
24
1259 } -
1260 }; -
1261public: -
1262 TypeCreator(const int type) -
1263 : m_type(type) -
1264 {}
executed: }
Execution Count:237801
237801
1265 -
1266 template<typename T> -
1267 void *delegate(const T *copy) { return CreatorImpl<T>::Create(m_type, copy); }
executed: return CreatorImpl<T>::Create(m_type, copy);
Execution Count:188795
188795
1268 void *delegate(const void*) { return 0; }
executed: return 0;
Execution Count:3
3
1269 void *delegate(const QMetaTypeSwitcher::UnknownType *) { return 0; }
executed: return 0;
Execution Count:86
86
1270 void *delegate(const QMetaTypeSwitcher::NotBuiltinType *copy) -
1271 { -
1272 QMetaType::Creator creator;
executed (the execution status of this line is deduced): QMetaType::Creator creator;
-
1273 const QVector<QCustomTypeInfo> * const ct = customTypes();
executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes();
-
1274 { -
1275 QReadLocker locker(customTypesLock());
executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock());
-
1276 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)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:48927
0-48927
1277 return 0;
never executed: return 0;
0
1278 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;
-
1279 } -
1280 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();
-
1281 return creator(copy);
executed: return creator(copy);
Execution Count:48931
48931
1282 } -
1283private: -
1284 const int m_type; -
1285}; -
1286} // namespace -
1287 -
1288/*! -
1289 Returns a copy of \a copy, assuming it is of type \a type. If \a -
1290 copy is zero, creates a default constructed instance. -
1291 -
1292 \sa destroy(), isRegistered(), Type -
1293*/ -
1294void *QMetaType::create(int type, const void *copy) -
1295{ -
1296 TypeCreator typeCreator(type);
executed (the execution status of this line is deduced): TypeCreator typeCreator(type);
-
1297 return QMetaTypeSwitcher::switcher<void*>(typeCreator, type, copy);
executed: return QMetaTypeSwitcher::switcher<void*>(typeCreator, type, copy);
Execution Count:237801
237801
1298} -
1299 -
1300namespace { -
1301class TypeDestroyer { -
1302 template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> -
1303 struct DestroyerImpl { -
1304 static void Destroy(const int /* type */, void *where) { QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Delete(where); }
executed: }
Execution Count:185778
185778
1305 }; -
1306 template<typename T> -
1307 struct DestroyerImpl<T, /* IsAcceptedType = */ false> { -
1308 static void Destroy(const int type, void *where) -
1309 { -
1310 if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) {
evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui
TRUEFALSE
yes
Evaluation Count:2918
yes
Evaluation Count:3
3-2918
1311 if (Q_LIKELY(qMetaTypeGuiHelper))
evaluated: __builtin_expect(!!(qMetaTypeGuiHelper), true)
TRUEFALSE
yes
Evaluation Count:2895
yes
Evaluation Count:23
23-2895
1312 qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].deleter(where);
executed: qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].deleter(where);
Execution Count:2895
2895
1313 return;
executed: return;
Execution Count:2918
2918
1314 } -
1315 if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) {
partially evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
1316 if (Q_LIKELY(qMetaTypeWidgetsHelper))
evaluated: __builtin_expect(!!(qMetaTypeWidgetsHelper), true)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1317 qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].deleter(where);
executed: qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].deleter(where);
Execution Count:2
2
1318 return;
executed: return;
Execution Count:3
3
1319 } -
1320 // This point can be reached only for known types that definition is not available, for example -
1321 // in bootstrap mode. We have no other choice then ignore it. -
1322 }
never executed: }
0
1323 }; -
1324public: -
1325 TypeDestroyer(const int type) -
1326 : m_type(type) -
1327 {}
executed: }
Execution Count:235375
235375
1328 -
1329 template<typename T> -
1330 void delegate(const T *where) { DestroyerImpl<T>::Destroy(m_type, const_cast<T*>(where)); }
executed: }
Execution Count:188699
188699
1331 void delegate(const void *) {} -
1332 void delegate(const QMetaTypeSwitcher::UnknownType*) {} -
1333 void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) { customTypeDestroyer(m_type, (void*)where); }
executed: }
Execution Count:46685
46685
1334 -
1335private: -
1336 static void customTypeDestroyer(const int type, void *where) -
1337 { -
1338 QMetaType::Destructor deleter;
executed (the execution status of this line is deduced): QMetaType::Destructor deleter;
-
1339 const QVector<QCustomTypeInfo> * const ct = customTypes();
executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes();
-
1340 { -
1341 QReadLocker locker(customTypesLock());
executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock());
-
1342 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)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:46685
1-46685
1343 return;
executed: return;
Execution Count:1
1
1344 deleter = ct->at(type - QMetaType::User).deleter;
executed (the execution status of this line is deduced): deleter = ct->at(type - QMetaType::User).deleter;
-
1345 } -
1346 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();
-
1347 deleter(where);
executed (the execution status of this line is deduced): deleter(where);
-
1348 }
executed: }
Execution Count:46684
46684
1349 -
1350 const int m_type; -
1351}; -
1352} // namespace -
1353 -
1354 -
1355/*! -
1356 Destroys the \a data, assuming it is of the \a type given. -
1357 -
1358 \sa create(), isRegistered(), Type -
1359*/ -
1360void QMetaType::destroy(int type, void *data) -
1361{ -
1362 TypeDestroyer deleter(type);
executed (the execution status of this line is deduced): TypeDestroyer deleter(type);
-
1363 QMetaTypeSwitcher::switcher<void>(deleter, type, data);
executed (the execution status of this line is deduced): QMetaTypeSwitcher::switcher<void>(deleter, type, data);
-
1364}
executed: }
Execution Count:235387
235387
1365 -
1366namespace { -
1367class TypeConstructor { -
1368 template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> -
1369 struct ConstructorImpl { -
1370 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
1371 }; -
1372 template<typename T> -
1373 struct ConstructorImpl<T, /* IsAcceptedType = */ false> { -
1374 static void *Construct(const int type, void *where, const void *copy) -
1375 { -
1376 if (QModulesPrivate::QTypeModuleInfo<T>::IsGui)
partially evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui
TRUEFALSE
yes
Evaluation Count:42
no
Evaluation Count:0
0-42
1377 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
1378 -
1379 if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget)
never evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget
0
1380 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
1381 -
1382 // This point can be reached only for known types that definition is not available, for example -
1383 // in bootstrap mode. We have no other choice then ignore it. -
1384 return 0;
never executed: return 0;
0
1385 } -
1386 }; -
1387public: -
1388 TypeConstructor(const int type, void *where) -
1389 : m_type(type) -
1390 , m_where(where) -
1391 {}
executed: }
Execution Count:6125
6125
1392 -
1393 template<typename T> -
1394 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
1395 void *delegate(const void *) { return m_where; }
never executed: return m_where;
0
1396 void *delegate(const QMetaTypeSwitcher::UnknownType*) { return m_where; }
never executed: return m_where;
0
1397 void *delegate(const QMetaTypeSwitcher::NotBuiltinType *copy) { return customTypeConstructor(m_type, m_where, copy); }
executed: return customTypeConstructor(m_type, m_where, copy);
Execution Count:5998
5998
1398 -
1399private: -
1400 static void *customTypeConstructor(const int type, void *where, const void *copy) -
1401 { -
1402 QMetaType::Constructor ctor;
executed (the execution status of this line is deduced): QMetaType::Constructor ctor;
-
1403 const QVector<QCustomTypeInfo> * const ct = customTypes();
executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes();
-
1404 { -
1405 QReadLocker locker(customTypesLock());
executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock());
-
1406 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)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5999
0-5999
1407 return 0;
never executed: return 0;
0
1408 ctor = ct->at(type - QMetaType::User).constructor;
executed (the execution status of this line is deduced): ctor = ct->at(type - QMetaType::User).constructor;
-
1409 } -
1410 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();
-
1411 return ctor(where, copy);
executed: return ctor(where, copy);
Execution Count:5998
5998
1412 } -
1413 -
1414 const int m_type; -
1415 void *m_where; -
1416}; -
1417} // namespace -
1418 -
1419/*! -
1420 \since 5.0 -
1421 -
1422 Constructs a value of the given \a type in the existing memory -
1423 addressed by \a where, that is a copy of \a copy, and returns -
1424 \a where. If \a copy is zero, the value is default constructed. -
1425 -
1426 This is a low-level function for explicitly managing the memory -
1427 used to store the type. Consider calling create() if you don't -
1428 need this level of control (that is, use "new" rather than -
1429 "placement new"). -
1430 -
1431 You must ensure that \a where points to a location that can store -
1432 a value of type \a type, and that \a where is suitably aligned. -
1433 The type's size can be queried by calling sizeOf(). -
1434 -
1435 The rule of thumb for alignment is that a type is aligned to its -
1436 natural boundary, which is the smallest power of 2 that is bigger -
1437 than the type, unless that alignment is larger than the maximum -
1438 useful alignment for the platform. For practical purposes, -
1439 alignment larger than 2 * sizeof(void*) is only necessary for -
1440 special hardware instructions (e.g., aligned SSE loads and stores -
1441 on x86). -
1442 -
1443 \sa destruct(), sizeOf() -
1444*/ -
1445void *QMetaType::construct(int type, void *where, const void *copy) -
1446{ -
1447 if (!where)
evaluated: !where
TRUEFALSE
yes
Evaluation Count:90
yes
Evaluation Count:6126
90-6126
1448 return 0;
executed: return 0;
Execution Count:90
90
1449 TypeConstructor constructor(type, where);
executed (the execution status of this line is deduced): TypeConstructor constructor(type, where);
-
1450 return QMetaTypeSwitcher::switcher<void*>(constructor, type, copy);
executed: return QMetaTypeSwitcher::switcher<void*>(constructor, type, copy);
Execution Count:6126
6126
1451} -
1452 -
1453 -
1454namespace { -
1455class TypeDestructor { -
1456 template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> -
1457 struct DestructorImpl { -
1458 static void Destruct(const int /* type */, void *where) { QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Destruct(where); }
executed: }
Execution Count:86
86
1459 }; -
1460 template<typename T> -
1461 struct DestructorImpl<T, /* IsAcceptedType = */ false> { -
1462 static void Destruct(const int type, void *where) -
1463 { -
1464 if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) {
partially evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui
TRUEFALSE
yes
Evaluation Count:42
no
Evaluation Count:0
0-42
1465 if (Q_LIKELY(qMetaTypeGuiHelper))
partially evaluated: __builtin_expect(!!(qMetaTypeGuiHelper), true)
TRUEFALSE
yes
Evaluation Count:42
no
Evaluation Count:0
0-42
1466 qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].destructor(where);
executed: qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].destructor(where);
Execution Count:42
42
1467 return;
executed: return;
Execution Count:42
42
1468 } -
1469 if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) {
never evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget
0
1470 if (Q_LIKELY(qMetaTypeWidgetsHelper))
never evaluated: __builtin_expect(!!(qMetaTypeWidgetsHelper), true)
0
1471 qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].destructor(where);
never executed: qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].destructor(where);
0
1472 return;
never executed: return;
0
1473 } -
1474 // This point can be reached only for known types that definition is not available, for example -
1475 // in bootstrap mode. We have no other choice then ignore it. -
1476 }
never executed: }
0
1477 }; -
1478public: -
1479 TypeDestructor(const int type) -
1480 : m_type(type) -
1481 {}
executed: }
Execution Count:22836
22836
1482 -
1483 template<typename T> -
1484 void delegate(const T *where) { DestructorImpl<T>::Destruct(m_type, const_cast<T*>(where)); }
executed: }
Execution Count:128
128
1485 void delegate(const void *) {} -
1486 void delegate(const QMetaTypeSwitcher::UnknownType*) {} -
1487 void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) { customTypeDestructor(m_type, (void*)where); }
executed: }
Execution Count:22710
22710
1488 -
1489private: -
1490 static void customTypeDestructor(const int type, void *where) -
1491 { -
1492 QMetaType::Destructor dtor;
executed (the execution status of this line is deduced): QMetaType::Destructor dtor;
-
1493 const QVector<QCustomTypeInfo> * const ct = customTypes();
executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes();
-
1494 { -
1495 QReadLocker locker(customTypesLock());
executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock());
-
1496 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)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22711
0-22711
1497 return;
never executed: return;
0
1498 dtor = ct->at(type - QMetaType::User).destructor;
executed (the execution status of this line is deduced): dtor = ct->at(type - QMetaType::User).destructor;
-
1499 } -
1500 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();
-
1501 dtor(where);
executed (the execution status of this line is deduced): dtor(where);
-
1502 }
executed: }
Execution Count:22709
22709
1503 -
1504 const int m_type; -
1505}; -
1506} // namespace -
1507 -
1508/*! -
1509 \since 5.0 -
1510 -
1511 Destructs the value of the given \a type, located at \a where. -
1512 -
1513 Unlike destroy(), this function only invokes the type's -
1514 destructor, it doesn't invoke the delete operator. -
1515 -
1516 \sa construct() -
1517*/ -
1518void QMetaType::destruct(int type, void *where) -
1519{ -
1520 if (!where)
evaluated: !where
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:22838
46-22838
1521 return;
executed: return;
Execution Count:46
46
1522 TypeDestructor destructor(type);
executed (the execution status of this line is deduced): TypeDestructor destructor(type);
-
1523 QMetaTypeSwitcher::switcher<void>(destructor, type, where);
executed (the execution status of this line is deduced): QMetaTypeSwitcher::switcher<void>(destructor, type, where);
-
1524}
executed: }
Execution Count:22838
22838
1525 -
1526 -
1527namespace { -
1528class SizeOf { -
1529 template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> -
1530 struct SizeOfImpl { -
1531 static int Size(const int) { return QTypeInfo<T>::sizeOf; }
executed: return QTypeInfo<T>::sizeOf;
Execution Count:89
89
1532 }; -
1533 template<typename T> -
1534 struct SizeOfImpl<T, /* IsAcceptedType = */ false> { -
1535 static int Size(const int type) -
1536 { -
1537 if (QModulesPrivate::QTypeModuleInfo<T>::IsGui)
partially evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui
TRUEFALSE
yes
Evaluation Count:63
no
Evaluation Count:0
0-63
1538 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
1539 -
1540 if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget)
never evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget
0
1541 return Q_LIKELY(qMetaTypeWidgetsHelper) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].size : 0;
never executed: return __builtin_expect(!!(qMetaTypeWidgetsHelper), true) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].size : 0;
0
1542 -
1543 // This point can be reached only for known types that definition is not available, for example -
1544 // in bootstrap mode. We have no other choice then ignore it. -
1545 return 0;
never executed: return 0;
0
1546 } -
1547 }; -
1548 -
1549public: -
1550 SizeOf(int type) -
1551 : m_type(type) -
1552 {}
executed: }
Execution Count:220
220
1553 -
1554 template<typename T> -
1555 int delegate(const T*) { return SizeOfImpl<T>::Size(m_type); }
executed: return SizeOfImpl<T>::Size(m_type);
Execution Count:152
152
1556 int delegate(const QMetaTypeSwitcher::UnknownType*) { return 0; }
executed: return 0;
Execution Count:3
3
1557 int delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customTypeSizeOf(m_type); }
executed: return customTypeSizeOf(m_type);
Execution Count:65
65
1558private: -
1559 static int customTypeSizeOf(const int type) -
1560 { -
1561 const QVector<QCustomTypeInfo> * const ct = customTypes();
executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes();
-
1562 QReadLocker locker(customTypesLock());
executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock());
-
1563 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)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:64
1-64
1564 return 0;
executed: return 0;
Execution Count:1
1
1565 return ct->at(type - QMetaType::User).size;
executed: return ct->at(type - QMetaType::User).size;
Execution Count:64
64
1566 } -
1567 -
1568 const int m_type; -
1569}; -
1570} // namespace -
1571 -
1572/*! -
1573 \since 5.0 -
1574 -
1575 Returns the size of the given \a type in bytes (i.e. sizeof(T), -
1576 where T is the actual type identified by the \a type argument). -
1577 -
1578 This function is typically used together with construct() -
1579 to perform low-level management of the memory used by a type. -
1580 -
1581 \sa construct() -
1582*/ -
1583int QMetaType::sizeOf(int type) -
1584{ -
1585 SizeOf sizeOf(type);
executed (the execution status of this line is deduced): SizeOf sizeOf(type);
-
1586 return QMetaTypeSwitcher::switcher<int>(sizeOf, type, 0);
executed: return QMetaTypeSwitcher::switcher<int>(sizeOf, type, 0);
Execution Count:220
220
1587} -
1588 -
1589namespace { -
1590class Flags -
1591{ -
1592 template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> -
1593 struct FlagsImpl -
1594 { -
1595 static quint32 Flags(const int /* type */) -
1596 { -
1597 return QtPrivate::QMetaTypeTypeFlags<T>::Flags;
executed: return QtPrivate::QMetaTypeTypeFlags<T>::Flags;
Execution Count:491
491
1598 } -
1599 }; -
1600 template<typename T> -
1601 struct FlagsImpl<T, /* IsAcceptedType = */ false> -
1602 { -
1603 static quint32 Flags(const int type) -
1604 { -
1605 if (QModulesPrivate::QTypeModuleInfo<T>::IsGui)
evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui
TRUEFALSE
yes
Evaluation Count:163
yes
Evaluation Count:1
1-163
1606 return Q_LIKELY(qMetaTypeGuiHelper) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].flags : 0;
executed: return __builtin_expect(!!(qMetaTypeGuiHelper), true) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].flags : 0;
Execution Count:163
163
1607 -
1608 if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget)
partially evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1609 return Q_LIKELY(qMetaTypeWidgetsHelper) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].flags : 0;
executed: return __builtin_expect(!!(qMetaTypeWidgetsHelper), true) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].flags : 0;
Execution Count:1
1
1610 -
1611 // This point can be reached only for known types that definition is not available, for example -
1612 // in bootstrap mode. We have no other choice then ignore it. -
1613 return 0;
never executed: return 0;
0
1614 } -
1615 }; -
1616public: -
1617 Flags(const int type) -
1618 : m_type(type) -
1619 {}
executed: }
Execution Count:4987
4987
1620 template<typename T> -
1621 quint32 delegate(const T*) { return FlagsImpl<T>::Flags(m_type); }
executed: return FlagsImpl<T>::Flags(m_type);
Execution Count:655
655
1622 quint32 delegate(const void*) { return 0; }
executed: return 0;
Execution Count:1
1
1623 quint32 delegate(const QMetaTypeSwitcher::UnknownType*) { return 0; }
executed: return 0;
Execution Count:14
14
1624 quint32 delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customTypeFlags(m_type); }
executed: return customTypeFlags(m_type);
Execution Count:4317
4317
1625private: -
1626 const int m_type; -
1627 static quint32 customTypeFlags(const int type) -
1628 { -
1629 const QVector<QCustomTypeInfo> * const ct = customTypes();
executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes();
-
1630 if (Q_UNLIKELY(!ct || type < QMetaType::User))
partially evaluated: __builtin_expect(!!(!ct || type < QMetaType::User), false)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4317
0-4317
1631 return 0;
never executed: return 0;
0
1632 QReadLocker locker(customTypesLock());
executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock());
-
1633 if (Q_UNLIKELY(ct->count() <= type - QMetaType::User))
evaluated: __builtin_expect(!!(ct->count() <= type - QMetaType::User), false)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4312
5-4312
1634 return 0;
executed: return 0;
Execution Count:5
5
1635 return ct->at(type - QMetaType::User).flags;
executed: return ct->at(type - QMetaType::User).flags;
Execution Count:4312
4312
1636 } -
1637}; -
1638} // namespace -
1639 -
1640/*! -
1641 \since 5.0 -
1642 -
1643 Returns flags of the given \a type. -
1644 -
1645 \sa QMetaType::TypeFlags -
1646*/ -
1647QMetaType::TypeFlags QMetaType::typeFlags(int type) -
1648{ -
1649 Flags flags(type);
executed (the execution status of this line is deduced): Flags flags(type);
-
1650 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:4987
4987
1651} -
1652 -
1653#ifndef QT_BOOTSTRAPPED -
1654namespace { -
1655class MetaObject -
1656{ -
1657public: -
1658 MetaObject(const int type) -
1659 : m_type(type) -
1660 {}
executed: }
Execution Count:7
7
1661 template<typename T> -
1662 const QMetaObject *delegate(const T*) { return QtPrivate::MetaObjectForType<T>::value(); }
executed: return QtPrivate::MetaObjectForType<T>::value();
Execution Count:2
2
1663 const QMetaObject *delegate(const void*) { return 0; }
never executed: return 0;
0
1664 const QMetaObject *delegate(const QMetaTypeSwitcher::UnknownType*) { return 0; }
never executed: return 0;
0
1665 const QMetaObject *delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customMetaObject(m_type); }
executed: return customMetaObject(m_type);
Execution Count:5
5
1666private: -
1667 const int m_type; -
1668 static const QMetaObject *customMetaObject(const int type) -
1669 { -
1670 const QVector<QCustomTypeInfo> * const ct = customTypes();
executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes();
-
1671 if (Q_UNLIKELY(!ct || type < QMetaType::User))
partially evaluated: __builtin_expect(!!(!ct || type < QMetaType::User), false)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1672 return 0;
never executed: return 0;
0
1673 QReadLocker locker(customTypesLock());
executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock());
-
1674 if (Q_UNLIKELY(ct->count() <= type - QMetaType::User))
partially evaluated: __builtin_expect(!!(ct->count() <= type - QMetaType::User), false)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1675 return 0;
never executed: return 0;
0
1676 return ct->at(type - QMetaType::User).metaObject;
executed: return ct->at(type - QMetaType::User).metaObject;
Execution Count:5
5
1677 } -
1678}; -
1679} // namespace -
1680#endif -
1681 -
1682/*! -
1683 \since 5.0 -
1684 -
1685 Returns QMetaObject of a given \a type, if the \a type is a pointer to type derived from QObject. -
1686*/ -
1687const QMetaObject *QMetaType::metaObjectForType(int type) -
1688{ -
1689#ifndef QT_BOOTSTRAPPED -
1690 MetaObject mo(type);
executed (the execution status of this line is deduced): MetaObject mo(type);
-
1691 return QMetaTypeSwitcher::switcher<const QMetaObject*>(mo, type, 0);
executed: return QMetaTypeSwitcher::switcher<const QMetaObject*>(mo, type, 0);
Execution Count:7
7
1692#else -
1693 Q_UNUSED(type); -
1694 return 0; -
1695#endif -
1696} -
1697 -
1698/*! -
1699 \fn int qRegisterMetaType(const char *typeName) -
1700 \relates QMetaType -
1701 \threadsafe -
1702 -
1703 Registers the type name \a typeName for the type \c{T}. Returns -
1704 the internal ID used by QMetaType. Any class or struct that has a -
1705 public default constructor, a public copy constructor and a public -
1706 destructor can be registered. -
1707 -
1708 This function requires that \c{T} is a fully defined type at the point -
1709 where the function is called. For pointer types, it also requires that the -
1710 pointed to type is fully defined. Use Q_DECLARE_OPAQUE_POINTER() to be able -
1711 to register pointers to forward declared types. -
1712 -
1713 After a type has been registered, you can create and destroy -
1714 objects of that type dynamically at run-time. -
1715 -
1716 This example registers the class \c{MyClass}: -
1717 -
1718 \snippet code/src_corelib_kernel_qmetatype.cpp 4 -
1719 -
1720 This function is useful to register typedefs so they can be used -
1721 by QMetaProperty, or in QueuedConnections -
1722 -
1723 \snippet code/src_corelib_kernel_qmetatype.cpp 9 -
1724 -
1725 \sa qRegisterMetaTypeStreamOperators(), QMetaType::isRegistered(), -
1726 Q_DECLARE_METATYPE() -
1727*/ -
1728 -
1729/*! -
1730 \fn void qRegisterMetaTypeStreamOperators(const char *typeName) -
1731 \relates QMetaType -
1732 \threadsafe -
1733 -
1734 Registers the stream operators for the type \c{T} called \a -
1735 typeName. -
1736 -
1737 Afterward, the type can be streamed using QMetaType::load() and -
1738 QMetaType::save(). These functions are used when streaming a -
1739 QVariant. -
1740 -
1741 \snippet code/src_corelib_kernel_qmetatype.cpp 5 -
1742 -
1743 The stream operators should have the following signatures: -
1744 -
1745 \snippet code/src_corelib_kernel_qmetatype.cpp 6 -
1746 -
1747 \sa qRegisterMetaType(), QMetaType::isRegistered(), Q_DECLARE_METATYPE() -
1748*/ -
1749 -
1750/*! \typedef QMetaType::Deleter -
1751 \internal -
1752*/ -
1753/*! \typedef QMetaType::Creator -
1754 \internal -
1755*/ -
1756/*! \typedef QMetaType::SaveOperator -
1757 \internal -
1758*/ -
1759/*! \typedef QMetaType::LoadOperator -
1760 \internal -
1761*/ -
1762/*! \typedef QMetaType::Destructor -
1763 \internal -
1764*/ -
1765/*! \typedef QMetaType::Constructor -
1766 \internal -
1767*/ -
1768 -
1769/*! -
1770 \fn int qRegisterMetaType(const char *typeName) -
1771 \relates QMetaType -
1772 \threadsafe -
1773 \since 4.2 -
1774 -
1775 Call this function to register the type \c T. \c T must be declared with -
1776 Q_DECLARE_METATYPE(). Returns the meta type Id. -
1777 -
1778 Example: -
1779 -
1780 \snippet code/src_corelib_kernel_qmetatype.cpp 7 -
1781 -
1782 To use the type \c T in QVariant, using Q_DECLARE_METATYPE() is -
1783 sufficient. To use the type \c T in queued signal and slot connections, -
1784 \c{qRegisterMetaType<T>()} must be called before the first connection -
1785 is established. -
1786 -
1787 Also, to use type \c T with the QObject::property() API, -
1788 \c{qRegisterMetaType<T>()} must be called before it is used, typically -
1789 in the constructor of the class that uses \c T, or in the \c{main()} -
1790 function. -
1791 -
1792 \sa Q_DECLARE_METATYPE() -
1793 */ -
1794 -
1795/*! -
1796 \fn int qMetaTypeId() -
1797 \relates QMetaType -
1798 \threadsafe -
1799 \since 4.1 -
1800 -
1801 Returns the meta type id of type \c T at compile time. If the -
1802 type was not declared with Q_DECLARE_METATYPE(), compilation will -
1803 fail. -
1804 -
1805 Typical usage: -
1806 -
1807 \snippet code/src_corelib_kernel_qmetatype.cpp 8 -
1808 -
1809 QMetaType::type() returns the same ID as qMetaTypeId(), but does -
1810 a lookup at runtime based on the name of the type. -
1811 QMetaType::type() is a bit slower, but compilation succeeds if a -
1812 type is not registered. -
1813 -
1814 \sa Q_DECLARE_METATYPE(), QMetaType::type() -
1815*/ -
1816 -
1817namespace { -
1818class TypeInfo { -
1819 template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> -
1820 struct TypeInfoImpl -
1821 { -
1822 TypeInfoImpl(const uint /* type */, QMetaTypeInterface &info) -
1823 { -
1824 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()) };
-
1825 info = tmp;
executed (the execution status of this line is deduced): info = tmp;
-
1826 }
executed: }
Execution Count:282
282
1827 }; -
1828 -
1829 template<typename T> -
1830 struct TypeInfoImpl<T, /* IsAcceptedType = */ false> -
1831 { -
1832 TypeInfoImpl(const uint type, QMetaTypeInterface &info) -
1833 { -
1834 if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) {
never evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui
0
1835 if (Q_LIKELY(qMetaTypeGuiHelper))
never evaluated: __builtin_expect(!!(qMetaTypeGuiHelper), true)
0
1836 info = qMetaTypeGuiHelper[type - QMetaType::FirstGuiType];
never executed: info = qMetaTypeGuiHelper[type - QMetaType::FirstGuiType];
0
1837 return;
never executed: return;
0
1838 } -
1839 if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) {
never evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget
0
1840 if (Q_LIKELY(qMetaTypeWidgetsHelper))
never evaluated: __builtin_expect(!!(qMetaTypeWidgetsHelper), true)
0
1841 info = qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType];
never executed: info = qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType];
0
1842 return;
never executed: return;
0
1843 } -
1844 }
never executed: }
0
1845 }; -
1846public: -
1847 QMetaTypeInterface info; -
1848 TypeInfo(const uint type) -
1849 : m_type(type) -
1850 { -
1851 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 };
-
1852 info = tmp;
executed (the execution status of this line is deduced): info = tmp;
-
1853 }
executed: }
Execution Count:19705
19705
1854 template<typename T> -
1855 void delegate(const T*) { TypeInfoImpl<T>(m_type, info); }
executed: }
Execution Count:282
282
1856 void delegate(const QMetaTypeSwitcher::UnknownType*) {} -
1857 void delegate(const QMetaTypeSwitcher::NotBuiltinType*) { customTypeInfo(m_type); }
executed: }
Execution Count:19409
19409
1858private: -
1859 void customTypeInfo(const uint type) -
1860 { -
1861 const QVector<QCustomTypeInfo> * const ct = customTypes();
executed (the execution status of this line is deduced): const QVector<QCustomTypeInfo> * const ct = customTypes();
-
1862 if (Q_UNLIKELY(!ct))
partially evaluated: __builtin_expect(!!(!ct), false)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19409
0-19409
1863 return;
never executed: return;
0
1864 QReadLocker locker(customTypesLock());
executed (the execution status of this line is deduced): QReadLocker locker(customTypesLock());
-
1865 if (Q_LIKELY(uint(ct->count()) > type - QMetaType::User))
evaluated: __builtin_expect(!!(uint(ct->count()) > type - QMetaType::User), true)
TRUEFALSE
yes
Evaluation Count:19378
yes
Evaluation Count:31
31-19378
1866 info = ct->at(type - QMetaType::User);
executed: info = ct->at(type - QMetaType::User);
Execution Count:19377
19377
1867 }
executed: }
Execution Count:19408
19408
1868 -
1869 const uint m_type; -
1870}; -
1871} // namespace -
1872 -
1873/*! -
1874 \fn QMetaType QMetaType::typeInfo(const int type) -
1875 \internal -
1876*/ -
1877QMetaType QMetaType::typeInfo(const int type) -
1878{ -
1879 TypeInfo typeInfo(type);
executed (the execution status of this line is deduced): TypeInfo typeInfo(type);
-
1880 QMetaTypeSwitcher::switcher<void>(typeInfo, type, 0);
executed (the execution status of this line is deduced): QMetaTypeSwitcher::switcher<void>(typeInfo, type, 0);
-
1881 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:19705
19705
1882 , 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:19705
19705
1883 , 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:19705
19705
1884 , 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:19705
19705
1885 , 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:19705
19705
1886 , 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:19705
19705
1887 , 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:19705
19705
1888 , 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:19705
19705
1889 , 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:19705
19705
1890 , 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:19705
19705
1891 , 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:19705
19705
1892 , 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:19705
19705
1893 : 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:19705
19705
1894} -
1895 -
1896/*! -
1897 \fn QMetaType::QMetaType(const int typeId) -
1898 \since 5.0 -
1899 -
1900 Constructs a QMetaType object that contains all information about type \a typeId. -
1901*/ -
1902QMetaType::QMetaType(const int typeId) -
1903 : m_typeId(typeId) -
1904{ -
1905 if (Q_UNLIKELY(typeId == UnknownType)) {
evaluated: __builtin_expect(!!(typeId == UnknownType), false)
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:19705
47-19705
1906 // Constructs invalid QMetaType instance. -
1907 m_extensionFlags = 0xffffffff;
executed (the execution status of this line is deduced): m_extensionFlags = 0xffffffff;
-
1908 Q_ASSERT(!isValid());
executed (the execution status of this line is deduced): qt_noop();
-
1909 } else {
executed: }
Execution Count:47
47
1910 // TODO it can be better. -
1911 *this = QMetaType::typeInfo(typeId);
executed (the execution status of this line is deduced): *this = QMetaType::typeInfo(typeId);
-
1912 if (m_typeId == UnknownType)
evaluated: m_typeId == UnknownType
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:19660
45-19660
1913 m_extensionFlags = 0xffffffff;
executed: m_extensionFlags = 0xffffffff;
Execution Count:45
45
1914 else if (m_typeId == QMetaType::Void)
evaluated: m_typeId == QMetaType::Void
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:19658
2-19658
1915 m_extensionFlags = CreateEx | DestroyEx | ConstructEx | DestructEx;
executed: m_extensionFlags = CreateEx | DestroyEx | ConstructEx | DestructEx;
Execution Count:2
2
1916 } -
1917} -
1918 -
1919/*! -
1920 \fn QMetaType::QMetaType(const QMetaType &other) -
1921 \since 5.0 -
1922 -
1923 Copy constructs a QMetaType object. -
1924*/ -
1925QMetaType::QMetaType(const QMetaType &other) -
1926 : m_creator(other.m_creator) -
1927 , m_deleter(other.m_deleter) -
1928 , m_saveOp(other.m_saveOp) -
1929 , m_loadOp(other.m_loadOp) -
1930 , m_constructor(other.m_constructor) -
1931 , m_destructor(other.m_destructor) -
1932 , m_extension(other.m_extension) // space reserved for future use -
1933 , m_size(other.m_size) -
1934 , m_typeFlags(other.m_typeFlags) -
1935 , m_extensionFlags(other.m_extensionFlags) -
1936 , m_typeId(other.m_typeId) -
1937 , m_metaObject(other.m_metaObject) -
1938{}
never executed: }
0
1939 -
1940QMetaType &QMetaType::operator =(const QMetaType &other) -
1941{ -
1942 m_creator = other.m_creator;
executed (the execution status of this line is deduced): m_creator = other.m_creator;
-
1943 m_deleter = other.m_deleter;
executed (the execution status of this line is deduced): m_deleter = other.m_deleter;
-
1944 m_saveOp = other.m_saveOp;
executed (the execution status of this line is deduced): m_saveOp = other.m_saveOp;
-
1945 m_loadOp = other.m_loadOp;
executed (the execution status of this line is deduced): m_loadOp = other.m_loadOp;
-
1946 m_constructor = other.m_constructor;
executed (the execution status of this line is deduced): m_constructor = other.m_constructor;
-
1947 m_destructor = other.m_destructor;
executed (the execution status of this line is deduced): m_destructor = other.m_destructor;
-
1948 m_size = other.m_size;
executed (the execution status of this line is deduced): m_size = other.m_size;
-
1949 m_typeFlags = other.m_typeFlags;
executed (the execution status of this line is deduced): m_typeFlags = other.m_typeFlags;
-
1950 m_extensionFlags = other.m_extensionFlags;
executed (the execution status of this line is deduced): m_extensionFlags = other.m_extensionFlags;
-
1951 m_extension = other.m_extension; // space reserved for future use
executed (the execution status of this line is deduced): m_extension = other.m_extension;
-
1952 m_typeId = other.m_typeId;
executed (the execution status of this line is deduced): m_typeId = other.m_typeId;
-
1953 m_metaObject = other.m_metaObject;
executed (the execution status of this line is deduced): m_metaObject = other.m_metaObject;
-
1954 return *this;
executed: return *this;
Execution Count:19705
19705
1955} -
1956 -
1957/*! -
1958 \fn void QMetaType::ctor(const QMetaTypeInterface *info) -
1959 \internal -
1960 -
1961 Method used for future binary compatible extensions. The function may be -
1962 called from within QMetaType's constructor to force a library call from -
1963 inlined code. -
1964*/ -
1965void QMetaType::ctor(const QMetaTypeInterface *info) -
1966{ -
1967 // Special case for Void type, the type is valid but not constructible. -
1968 // In future we may consider to remove this assert and extend this function to initialize -
1969 // differently m_extensionFlags for different types. Currently it is not needed. -
1970 Q_ASSERT(m_typeId == QMetaType::Void);
executed (the execution status of this line is deduced): qt_noop();
-
1971 Q_UNUSED(info);
executed (the execution status of this line is deduced): (void)info;;
-
1972 m_extensionFlags = CreateEx | DestroyEx | ConstructEx | DestructEx;
executed (the execution status of this line is deduced): m_extensionFlags = CreateEx | DestroyEx | ConstructEx | DestructEx;
-
1973}
executed: }
Execution Count:2
2
1974 -
1975/*! -
1976 \fn void QMetaType::dtor() -
1977 \internal -
1978 -
1979 Method used for future binary compatible extensions. The function may be -
1980 called from within QMetaType's destructor to force a library call from -
1981 inlined code. -
1982*/ -
1983void QMetaType::dtor() -
1984{} -
1985 -
1986/*! -
1987 \fn void *QMetaType::createExtended(const void *copy) const -
1988 \internal -
1989 -
1990 Method used for future binary compatible extensions. The function may be called -
1991 during QMetaType::create to force library call from inlined code. -
1992*/ -
1993void *QMetaType::createExtended(const void *copy) const -
1994{ -
1995 Q_UNUSED(copy);
never executed (the execution status of this line is deduced): (void)copy;;
-
1996 return 0;
never executed: return 0;
0
1997} -
1998 -
1999/*! -
2000 \fn void QMetaType::destroyExtended(void *data) const -
2001 \internal -
2002 -
2003 Method used for future binary compatible extensions. The function may be called -
2004 during QMetaType::destroy to force library call from inlined code. -
2005*/ -
2006void QMetaType::destroyExtended(void *data) const -
2007{ -
2008 Q_UNUSED(data);
never executed (the execution status of this line is deduced): (void)data;;
-
2009}
never executed: }
0
2010 -
2011/*! -
2012 \fn void *QMetaType::constructExtended(void *where, const void *copy) const -
2013 \internal -
2014 -
2015 Method used for future binary compatible extensions. The function may be called -
2016 during QMetaType::construct to force library call from inlined code. -
2017*/ -
2018void *QMetaType::constructExtended(void *where, const void *copy) const -
2019{ -
2020 Q_UNUSED(where);
never executed (the execution status of this line is deduced): (void)where;;
-
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::destructExtended(void *data) const -
2027 \internal -
2028 -
2029 Method used for future binary compatible extensions. The function may be called -
2030 during QMetaType::destruct to force library call from inlined code. -
2031*/ -
2032void QMetaType::destructExtended(void *data) const -
2033{ -
2034 Q_UNUSED(data);
never executed (the execution status of this line is deduced): (void)data;;
-
2035}
never executed: }
0
2036 -
2037/*! -
2038 \fn uint QMetaType::sizeExtended() const -
2039 \internal -
2040 -
2041 Method used for future binary compatible extensions. The function may be -
2042 called from within QMetaType::size to force a library call from -
2043 inlined code. -
2044*/ -
2045uint QMetaType::sizeExtended() const -
2046{ -
2047 return 0;
executed: return 0;
Execution Count:18
18
2048} -
2049 -
2050/*! -
2051 \fn QMetaType::TypeFlags QMetaType::flagsExtended() const -
2052 \internal -
2053 -
2054 Method used for future binary compatible extensions. The function may be -
2055 called from within QMetaType::flags to force a library call from -
2056 inlined code. -
2057*/ -
2058QMetaType::TypeFlags QMetaType::flagsExtended() const -
2059{ -
2060 return 0;
executed: return 0;
Execution Count:3
3
2061} -
2062 -
2063/*! -
2064 \brief QMetaType::metaObjectExtended -
2065 \internal -
2066 -
2067 Method used for future binary compatible extensions. The function may be -
2068 called from within QMetaType::metaObject to force a library call from -
2069 inlined code. -
2070*/ -
2071const QMetaObject *QMetaType::metaObjectExtended() const -
2072{ -
2073 return 0;
never executed: return 0;
0
2074} -
2075 -
2076 -
2077namespace QtPrivate -
2078{ -
2079const QMetaObject *metaObjectForQWidget() -
2080{ -
2081 if (!qMetaTypeWidgetsHelper)
never evaluated: !qMetaTypeWidgetsHelper
0
2082 return 0;
never executed: return 0;
0
2083 return qMetaObjectWidgetsHelper;
never executed: return qMetaObjectWidgetsHelper;
0
2084} -
2085} -
2086 -
2087QT_END_NAMESPACE -
2088 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial