kernel/qmetatype.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9 -
10 -
11 -
12 -
13 -
14namespace { -
15struct DefinedTypesFilter { -
16 template<typename T> -
17 struct Acceptor { -
18 static const bool IsAccepted = QtMetaTypePrivate::TypeDefinition<T>::IsAvailable && QModulesPrivate::QTypeModuleInfo<T>::IsCore; -
19 }; -
20}; -
21} -
22static const struct { const char * typeName; int typeNameLength; int type; } types[] = { -
23 { "void", sizeof("void") - 1, 43 }, { "bool", sizeof("bool") - 1, 1 }, { "int", sizeof("int") - 1, 2 }, { "uint", sizeof("uint") - 1, 3 }, { "qlonglong", sizeof("qlonglong") - 1, 4 }, { "qulonglong", sizeof("qulonglong") - 1, 5 }, { "double", sizeof("double") - 1, 6 }, { "long", sizeof("long") - 1, 32 }, { "short", sizeof("short") - 1, 33 }, { "char", sizeof("char") - 1, 34 }, { "ulong", sizeof("ulong") - 1, 35 }, { "ushort", sizeof("ushort") - 1, 36 }, { "uchar", sizeof("uchar") - 1, 37 }, { "float", sizeof("float") - 1, 38 }, { "signed char", sizeof("signed char") - 1, 40 }, { "void*", sizeof("void*") - 1, 31 }, { "QChar", sizeof("QChar") - 1, 7 }, { "QString", sizeof("QString") - 1, 10 }, { "QStringList", sizeof("QStringList") - 1, 11 }, { "QByteArray", sizeof("QByteArray") - 1, 12 }, { "QBitArray", sizeof("QBitArray") - 1, 13 }, { "QDate", sizeof("QDate") - 1, 14 }, { "QTime", sizeof("QTime") - 1, 15 }, { "QDateTime", sizeof("QDateTime") - 1, 16 }, { "QUrl", sizeof("QUrl") - 1, 17 }, { "QLocale", sizeof("QLocale") - 1, 18 }, { "QRect", sizeof("QRect") - 1, 19 }, { "QRectF", sizeof("QRectF") - 1, 20 }, { "QSize", sizeof("QSize") - 1, 21 }, { "QSizeF", sizeof("QSizeF") - 1, 22 }, { "QLine", sizeof("QLine") - 1, 23 }, { "QLineF", sizeof("QLineF") - 1, 24 }, { "QPoint", sizeof("QPoint") - 1, 25 }, { "QPointF", sizeof("QPointF") - 1, 26 }, { "QRegExp", sizeof("QRegExp") - 1, 27 }, { "QEasingCurve", sizeof("QEasingCurve") - 1, 29 }, { "QUuid", sizeof("QUuid") - 1, 30 }, { "QVariant", sizeof("QVariant") - 1, 41 }, { "QModelIndex", sizeof("QModelIndex") - 1, 42 }, { "QRegularExpression", sizeof("QRegularExpression") - 1, 44 }, { "QJsonValue", sizeof("QJsonValue") - 1, 45 }, { "QJsonObject", sizeof("QJsonObject") - 1, 46 }, { "QJsonArray", sizeof("QJsonArray") - 1, 47 }, { "QJsonDocument", sizeof("QJsonDocument") - 1, 48 }, { "QObject*", sizeof("QObject*") - 1, 39 }, { "QVariantMap", sizeof("QVariantMap") - 1, 8 }, { "QVariantList", sizeof("QVariantList") - 1, 9 }, { "QVariantHash", sizeof("QVariantHash") - 1, 28 }, { "QFont", sizeof("QFont") - 1, 64 }, { "QPixmap", sizeof("QPixmap") - 1, 65 }, { "QBrush", sizeof("QBrush") - 1, 66 }, { "QColor", sizeof("QColor") - 1, 67 }, { "QPalette", sizeof("QPalette") - 1, 68 }, { "QIcon", sizeof("QIcon") - 1, 69 }, { "QImage", sizeof("QImage") - 1, 70 }, { "QPolygon", sizeof("QPolygon") - 1, 71 }, { "QRegion", sizeof("QRegion") - 1, 72 }, { "QBitmap", sizeof("QBitmap") - 1, 73 }, { "QCursor", sizeof("QCursor") - 1, 74 }, { "QKeySequence", sizeof("QKeySequence") - 1, 75 }, { "QPen", sizeof("QPen") - 1, 76 }, { "QTextLength", sizeof("QTextLength") - 1, 77 }, { "QTextFormat", sizeof("QTextFormat") - 1, 78 }, { "QMatrix", sizeof("QMatrix") - 1, 79 }, { "QTransform", sizeof("QTransform") - 1, 80 }, { "QMatrix4x4", sizeof("QMatrix4x4") - 1, 81 }, { "QVector2D", sizeof("QVector2D") - 1, 82 }, { "QVector3D", sizeof("QVector3D") - 1, 83 }, { "QVector4D", sizeof("QVector4D") - 1, 84 }, { "QQuaternion", sizeof("QQuaternion") - 1, 85 }, { "QPolygonF", sizeof("QPolygonF") - 1, 86 }, { "QSizePolicy", sizeof("QSizePolicy") - 1, 121 }, -
24 { "unsigned long", sizeof("unsigned long") - 1, QMetaType::ULong }, { "unsigned int", sizeof("unsigned int") - 1, QMetaType::UInt }, { "unsigned short", sizeof("unsigned short") - 1, QMetaType::UShort }, { "unsigned char", sizeof("unsigned char") - 1, QMetaType::UChar }, { "long long", sizeof("long long") - 1, QMetaType::LongLong }, { "unsigned long long", sizeof("unsigned long long") - 1, QMetaType::ULongLong }, { "qint8", sizeof("qint8") - 1, QMetaType::SChar }, { "quint8", sizeof("quint8") - 1, QMetaType::UChar }, { "qint16", sizeof("qint16") - 1, QMetaType::Short }, { "quint16", sizeof("quint16") - 1, QMetaType::UShort }, { "qint32", sizeof("qint32") - 1, QMetaType::Int }, { "quint32", sizeof("quint32") - 1, QMetaType::UInt }, { "qint64", sizeof("qint64") - 1, QMetaType::LongLong }, { "quint64", sizeof("quint64") - 1, QMetaType::ULongLong }, { "QList<QVariant>", sizeof("QList<QVariant>") - 1, QMetaType::QVariantList }, { "QMap<QString,QVariant>", sizeof("QMap<QString,QVariant>") - 1, QMetaType::QVariantMap }, { "QHash<QString,QVariant>", sizeof("QHash<QString,QVariant>") - 1, QMetaType::QVariantHash }, -
25 { "qreal", sizeof("qreal") - 1, QMetaTypeId2<qreal>::MetaType }, -
26 {0, 0, QMetaType::UnknownType} -
27}; -
28 -
29__attribute__((visibility("default"))) const QMetaTypeInterface *qMetaTypeGuiHelper = 0; -
30__attribute__((visibility("default"))) const QMetaTypeInterface *qMetaTypeWidgetsHelper = 0; -
31__attribute__((visibility("default"))) const QMetaObject *qMetaObjectWidgetsHelper = 0; -
32 -
33class QCustomTypeInfo : public QMetaTypeInterface -
34{ -
35public: -
36 QCustomTypeInfo() -
37 : alias(-1) -
38 { -
39 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()) }; -
40 *static_cast<QMetaTypeInterface*>(this) = empty; -
41 }
executed: }
Execution Count:4165
4165
42 QByteArray typeName; -
43 int alias; -
44}; -
45 -
46namespace -
47{ -
48union CheckThatItIsPod -
49{ -
50 QMetaTypeInterface iface; -
51}; -
52} -
53 -
54template<> class QTypeInfo<QCustomTypeInfo > { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QCustomTypeInfo)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QCustomTypeInfo) }; static inline const char *name() { return "QCustomTypeInfo"; } }; -
55static QVector<QCustomTypeInfo> *customTypes() { static QGlobalStatic<QVector<QCustomTypeInfo> > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QVector<QCustomTypeInfo> *x = new QVector<QCustomTypeInfo>; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QVector<QCustomTypeInfo> > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:569435
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:569388
evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:65
yes
Evaluation Count:1
0-569435
56static QReadWriteLock *customTypesLock() { static QGlobalStatic<QReadWriteLock > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QReadWriteLock *x = new QReadWriteLock; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QReadWriteLock > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
never executed: delete x;
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65
executed: return thisGlobalStatic.pointer.load();
Execution Count:551942
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:551860
evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:65
yes
Evaluation Count:1
0-551942
57 -
58 -
59 -
60 -
61 -
62void QMetaType::registerStreamOperators(const char *typeName, SaveOperator saveOp, -
63 LoadOperator loadOp) -
64{ -
65 registerStreamOperators(type(typeName), saveOp, loadOp); -
66}
executed: }
Execution Count:5
5
67 -
68 -
69 -
70 -
71void QMetaType::registerStreamOperators(int idx, SaveOperator saveOp, -
72 LoadOperator loadOp) -
73{ -
74 if (idx < User)
evaluated: idx < User
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
2-6
75 return;
executed: return;
Execution Count:2
2
76 QVector<QCustomTypeInfo> *ct = customTypes(); -
77 if (!ct)
partially evaluated: !ct
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
78 return;
never executed: return;
0
79 QWriteLocker locker(customTypesLock()); -
80 QCustomTypeInfo &inf = (*ct)[idx - User]; -
81 inf.saveOp = saveOp; -
82 inf.loadOp = loadOp; -
83}
executed: }
Execution Count:6
6
84const char *QMetaType::typeName(int typeId) -
85{ -
86 const uint type = typeId; -
87 -
88 -
89 -
90 static const char *namesCache[QMetaType::HighestInternalId + 1]; -
91 -
92 const char *result; -
93 if (type <= QMetaType::HighestInternalId && ((result = namesCache[type])))
evaluated: type <= QMetaType::HighestInternalId
TRUEFALSE
yes
Evaluation Count:22860
yes
Evaluation Count:4692
evaluated: ((result = namesCache[type]))
TRUEFALSE
yes
Evaluation Count:22216
yes
Evaluation Count:644
644-22860
94 return result;
executed: return result;
Execution Count:22216
22216
95 -
96 -
97 -
98 -
99 switch (QMetaType::Type(type)) { -
100 case QMetaType::Void: result = "void"; break; case QMetaType::Bool: result = "bool"; break; case QMetaType::Int: result = "int"; break; case QMetaType::UInt: result = "uint"; break; case QMetaType::LongLong: result = "qlonglong"; break; case QMetaType::ULongLong: result = "qulonglong"; break; case QMetaType::Double: result = "double"; break; case QMetaType::Long: result = "long"; break; case QMetaType::Short: result = "short"; break; case QMetaType::Char: result = "char"; break; case QMetaType::ULong: result = "ulong"; break; case QMetaType::UShort: result = "ushort"; break; case QMetaType::UChar: result = "uchar"; break; case QMetaType::Float: result = "float"; break; case QMetaType::SChar: result = "signed char"; break; case QMetaType::VoidStar: result = "void*"; break; case QMetaType::QChar: result = "QChar"; break; case QMetaType::QString: result = "QString"; break; case QMetaType::QStringList: result = "QStringList"; break; case QMetaType::QByteArray: result = "QByteArray"; break; case QMetaType::QBitArray: result = "QBitArray"; break; case QMetaType::QDate: result = "QDate"; break; case QMetaType::QTime: result = "QTime"; break; case QMetaType::QDateTime: result = "QDateTime"; break; case QMetaType::QUrl: result = "QUrl"; break; case QMetaType::QLocale: result = "QLocale"; break; case QMetaType::QRect: result = "QRect"; break; case QMetaType::QRectF: result = "QRectF"; break; case QMetaType::QSize: result = "QSize"; break; case QMetaType::QSizeF: result = "QSizeF"; break; case QMetaType::QLine: result = "QLine"; break; case QMetaType::QLineF: result = "QLineF"; break; case QMetaType::QPoint: result = "QPoint"; break; case QMetaType::QPointF: result = "QPointF"; break; case QMetaType::QRegExp: result = "QRegExp"; break; case QMetaType::QEasingCurve: result = "QEasingCurve"; break; case QMetaType::QUuid: result = "QUuid"; break; case QMetaType::QVariant: result = "QVariant"; break; case QMetaType::QModelIndex: result = "QModelIndex"; break; case QMetaType::QRegularExpression: result = "QRegularExpression"; break; case QMetaType::QJsonValue: result = "QJsonValue"; break; case QMetaType::QJsonObject: result = "QJsonObject"; break; case QMetaType::QJsonArray: result = "QJsonArray"; break; case QMetaType::QJsonDocument: result = "QJsonDocument"; break; case QMetaType::QObjectStar: result = "QObject*"; break; case QMetaType::QVariantMap: result = "QVariantMap"; break; case QMetaType::QVariantList: result = "QVariantList"; break; case QMetaType::QVariantHash: result = "QVariantHash"; break; case QMetaType::QFont: result = "QFont"; break; case QMetaType::QPixmap: result = "QPixmap"; break; case QMetaType::QBrush: result = "QBrush"; break; case QMetaType::QColor: result = "QColor"; break; case QMetaType::QPalette: result = "QPalette"; break; case QMetaType::QIcon: result = "QIcon"; break; case QMetaType::QImage: result = "QImage"; break; case QMetaType::QPolygon: result = "QPolygon"; break; case QMetaType::QRegion: result = "QRegion"; break; case QMetaType::QBitmap: result = "QBitmap"; break; case QMetaType::QCursor: result = "QCursor"; break; case QMetaType::QKeySequence: result = "QKeySequence"; break; case QMetaType::QPen: result = "QPen"; break; case QMetaType::QTextLength: result = "QTextLength"; break; case QMetaType::QTextFormat: result = "QTextFormat"; break; case QMetaType::QMatrix: result = "QMatrix"; break; case QMetaType::QTransform: result = "QTransform"; break; case QMetaType::QMatrix4x4: result = "QMatrix4x4"; break; case QMetaType::QVector2D: result = "QVector2D"; break; case QMetaType::QVector3D: result = "QVector3D"; break; case QMetaType::QVector4D: result = "QVector4D"; break; case QMetaType::QQuaternion: result = "QQuaternion"; break; case QMetaType::QPolygonF: result = "QPolygonF"; break; case QMetaType::QSizePolicy: result = "QSizePolicy"; break;
executed: break;
Execution Count:6
executed: break;
Execution Count:30
executed: break;
Execution Count:48
executed: break;
Execution Count:29
executed: break;
Execution Count:31
executed: break;
Execution Count:29
executed: break;
Execution Count:32
executed: break;
Execution Count:4
executed: break;
Execution Count:28
executed: break;
Execution Count:3
executed: break;
Execution Count:3
executed: break;
Execution Count:28
executed: break;
Execution Count:5
executed: break;
Execution Count:3
executed: break;
Execution Count:2
executed: break;
Execution Count:9
executed: break;
Execution Count:3
executed: break;
Execution Count:35
executed: break;
Execution Count:16
executed: break;
Execution Count:14
executed: break;
Execution Count:2
executed: break;
Execution Count:4
executed: break;
Execution Count:3
executed: break;
Execution Count:6
executed: break;
Execution Count:6
executed: break;
Execution Count:2
executed: break;
Execution Count:9
executed: break;
Execution Count:3
executed: break;
Execution Count:2
executed: break;
Execution Count:3
executed: break;
Execution Count:2
executed: break;
Execution Count:2
executed: break;
Execution Count:8
executed: break;
Execution Count:3
executed: break;
Execution Count:3
executed: break;
Execution Count:3
executed: break;
Execution Count:2
executed: break;
Execution Count:8
executed: break;
Execution Count:18
executed: break;
Execution Count:2
executed: break;
Execution Count:2
executed: break;
Execution Count:2
executed: break;
Execution Count:2
executed: break;
Execution Count:2
executed: break;
Execution Count:12
executed: break;
Execution Count:4
executed: break;
Execution Count:5
executed: break;
Execution Count:2
executed: break;
Execution Count:5
executed: break;
Execution Count:4
executed: break;
Execution Count:4
executed: break;
Execution Count:4
executed: break;
Execution Count:4
executed: break;
Execution Count:3
executed: break;
Execution Count:5
executed: break;
Execution Count:4
executed: break;
Execution Count:4
executed: break;
Execution Count:4
executed: break;
Execution Count:4
executed: break;
Execution Count:4
executed: break;
Execution Count:4
executed: break;
Execution Count:4
executed: break;
Execution Count:4
executed: break;
Execution Count:4
executed: break;
Execution Count:4
executed: break;
Execution Count:5
executed: break;
Execution Count:5
executed: break;
Execution Count:5
executed: break;
Execution Count:5
executed: break;
Execution Count:5
executed: break;
Execution Count:3
executed: break;
Execution Count:3
2-48
101 -
102 default: { -
103 if (__builtin_expect(!!(type < QMetaType::User), false)) {
evaluated: __builtin_expect(!!(type < QMetaType::User), false)
TRUEFALSE
yes
Evaluation Count:966
yes
Evaluation Count:3790
966-3790
104 return 0;
executed: return 0;
Execution Count:966
966
105 } else { -
106 const QVector<QCustomTypeInfo> * const ct = customTypes(); -
107 QReadLocker locker(customTypesLock()); -
108 return ct && uint(ct->count()) > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty() 3790
109 ? ct->at(type - QMetaType::User).typeName.constData() 3790
110 : 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
111 } -
112 } -
113 } -
114 -
115 -
116 qt_noop(); -
117 namesCache[type] = result; -
118 return result;
executed: return result;
Execution Count:580
580
119} -
120 -
121 -
122 -
123 -
124 -
125static inline int qMetaTypeStaticType(const char *typeName, int length) -
126{ -
127 int i = 0; -
128 while (types[i].typeName && ((length != types[i].typeNameLength)
evaluated: types[i].typeName
TRUEFALSE
yes
Evaluation Count:48341949
yes
Evaluation Count:328547
evaluated: (length != types[i].typeNameLength)
TRUEFALSE
yes
Evaluation Count:45734700
yes
Evaluation Count:2610175
328547-48341949
129 || strcmp(typeName, types[i].typeName))) {
evaluated: strcmp(typeName, types[i].typeName)
TRUEFALSE
yes
Evaluation Count:1549675
yes
Evaluation Count:1060542
1060542-1549675
130 ++i; -
131 }
executed: }
Execution Count:47279290
47279290
132 return types[i].type;
executed: return types[i].type;
Execution Count:1389069
1389069
133} -
134 -
135 -
136 -
137 -
138 -
139 -
140static int qMetaTypeCustomType_unlocked(const char *typeName, int length) -
141{ -
142 const QVector<QCustomTypeInfo> * const ct = customTypes(); -
143 if (!ct)
partially evaluated: !ct
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:328811
0-328811
144 return QMetaType::UnknownType;
never executed: return QMetaType::UnknownType;
0
145 -
146 for (int v = 0; v < ct->count(); ++v) {
evaluated: v < ct->count()
TRUEFALSE
yes
Evaluation Count:12332377
yes
Evaluation Count:116358
116358-12332377
147 const QCustomTypeInfo &customInfo = ct->at(v); -
148 if ((length == customInfo.typeName.size())
evaluated: (length == customInfo.typeName.size())
TRUEFALSE
yes
Evaluation Count:7005978
yes
Evaluation Count:5435231
5435231-7005978
149 && !strcmp(typeName, customInfo.typeName.constData())) {
evaluated: !strcmp(typeName, customInfo.typeName.constData())
TRUEFALSE
yes
Evaluation Count:212433
yes
Evaluation Count:6795590
212433-6795590
150 if (customInfo.alias >= 0)
evaluated: customInfo.alias >= 0
TRUEFALSE
yes
Evaluation Count:57
yes
Evaluation Count:212378
57-212378
151 return customInfo.alias;
executed: return customInfo.alias;
Execution Count:57
57
152 return v + QMetaType::User;
executed: return v + QMetaType::User;
Execution Count:212378
212378
153 } -
154 }
executed: }
Execution Count:12120432
12120432
155 return QMetaType::UnknownType;
executed: return QMetaType::UnknownType;
Execution Count:116358
116358
156} -
157 -
158 -
159 -
160 -
161 -
162 -
163 -
164int QMetaType::registerType(const char *typeName, Deleter deleter, -
165 Creator creator) -
166{ -
167 return registerType(typeName, deleter, creator, 0
168 QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Destruct, 0
169 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
170} -
171int QMetaType::registerType(const char *typeName, Deleter deleter, -
172 Creator creator, -
173 Destructor destructor, -
174 Constructor constructor, -
175 int size, TypeFlags flags, const QMetaObject *metaObject) -
176{ -
177 -
178 -
179 -
180 ::QByteArray normalizedTypeName = QMetaObject::normalizedType(typeName); -
181 -
182 -
183 return registerNormalizedType(normalizedTypeName, deleter, creator, destructor, constructor, size, flags, metaObject);
executed: return registerNormalizedType(normalizedTypeName, deleter, creator, destructor, constructor, size, flags, metaObject);
Execution Count:4
4
184} -
185int QMetaType::registerNormalizedType(const ::QByteArray &normalizedTypeName, Deleter deleter, -
186 Creator creator, -
187 Destructor destructor, -
188 Constructor constructor, -
189 int size, TypeFlags flags, const QMetaObject *metaObject) -
190{ -
191 QVector<QCustomTypeInfo> *ct = customTypes(); -
192 if (!ct || normalizedTypeName.isEmpty() || !deleter || !creator || !destructor || !constructor)
partially evaluated: !ct
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16253
partially evaluated: normalizedTypeName.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16259
partially evaluated: !deleter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16258
partially evaluated: !creator
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16259
partially evaluated: !destructor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16260
partially evaluated: !constructor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16263
0-16263
193 return -1;
never executed: return -1;
0
194 -
195 int idx = qMetaTypeStaticType(normalizedTypeName.constData(), -
196 normalizedTypeName.size()); -
197 -
198 int previousSize = 0; -
199 int previousFlags = 0; -
200 if (idx == UnknownType) {
partially evaluated: idx == UnknownType
TRUEFALSE
yes
Evaluation Count:16077
no
Evaluation Count:0
0-16077
201 QWriteLocker locker(customTypesLock()); -
202 idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), -
203 normalizedTypeName.size()); -
204 if (idx == UnknownType) {
evaluated: idx == UnknownType
TRUEFALSE
yes
Evaluation Count:4153
yes
Evaluation Count:12127
4153-12127
205 QCustomTypeInfo inf; -
206 inf.typeName = normalizedTypeName; -
207 inf.creator = creator; -
208 inf.deleter = deleter; -
209 -
210 inf.loadOp = 0; -
211 inf.saveOp = 0; -
212 -
213 inf.alias = -1; -
214 inf.constructor = constructor; -
215 inf.destructor = destructor; -
216 inf.size = size; -
217 inf.flags = flags; -
218 inf.metaObject = metaObject; -
219 idx = ct->size() + User; -
220 ct->append(inf); -
221 return idx;
executed: return idx;
Execution Count:4153
4153
222 } -
223 -
224 if (idx >= User) {
partially evaluated: idx >= User
TRUEFALSE
yes
Evaluation Count:12127
no
Evaluation Count:0
0-12127
225 previousSize = ct->at(idx - User).size; -
226 previousFlags = ct->at(idx - User).flags; -
227 }
executed: }
Execution Count:12127
12127
228 }
executed: }
Execution Count:12127
12127
229 -
230 if (idx < User) {
partially evaluated: idx < User
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12127
0-12127
231 previousSize = QMetaType::sizeOf(idx); -
232 previousFlags = QMetaType::typeFlags(idx); -
233 }
never executed: }
0
234 -
235 if (previousSize != size) {
partially evaluated: previousSize != size
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12127
0-12127
236 QMessageLogger("kernel/qmetatype.cpp", 644, __PRETTY_FUNCTION__).fatal("QMetaType::registerType: Binary compatibility break " -
237 "-- Size mismatch for type '%s' [%i]. Previously registered " -
238 "size %i, now registering size %i.", -
239 normalizedTypeName.constData(), idx, previousSize, size); -
240 }
never executed: }
0
241 -
242 -
243 previousFlags |= WasDeclaredAsMetaType; -
244 flags |= WasDeclaredAsMetaType; -
245 -
246 if (previousFlags != flags) {
partially evaluated: previousFlags != flags
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12127
0-12127
247 const int maskForTypeInfo = NeedsConstruction | NeedsDestruction | MovableType; -
248 const char *msg = "QMetaType::registerType: Binary compatibility break. " -
249 "\nType flags for type '%s' [%i] don't match. Previously " -
250 "registered TypeFlags(0x%x), now registering TypeFlags(0x%x). " -
251 "This is an ODR break, which means that your application depends on a C++ undefined behavior." -
252 "\nHint: %s"; -
253 ::QByteArray hint; -
254 if ((previousFlags & maskForTypeInfo) != (flags & maskForTypeInfo)) {
never evaluated: (previousFlags & maskForTypeInfo) != (flags & maskForTypeInfo)
0
255 hint += "\nIt seems that the type was registered at least twice in a different translation units, " -
256 "but Q_DECLARE_TYPEINFO is not visible from all the translations unit or different flags were used." -
257 "Remember that Q_DECLARE_TYPEINFO should be declared before QMetaType registration, " -
258 "preferably it should be placed just after the type declaration and before Q_DECLARE_METATYPE"; -
259 }
never executed: }
0
260 QMessageLogger("kernel/qmetatype.cpp", 668, __PRETTY_FUNCTION__).fatal(msg, normalizedTypeName.constData(), idx, previousFlags, int(flags), hint.constData()); -
261 }
never executed: }
0
262 -
263 return idx;
executed: return idx;
Execution Count:12127
12127
264} -
265 -
266 -
267 -
268 -
269 -
270 -
271 -
272int QMetaType::registerTypedef(const char* typeName, int aliasId) -
273{ -
274 -
275 -
276 -
277 ::QByteArray normalizedTypeName = QMetaObject::normalizedType(typeName); -
278 -
279 -
280 return registerNormalizedTypedef(normalizedTypeName, aliasId);
never executed: return registerNormalizedTypedef(normalizedTypeName, aliasId);
0
281} -
282int QMetaType::registerNormalizedTypedef(const ::QByteArray &normalizedTypeName, int aliasId) -
283{ -
284 QVector<QCustomTypeInfo> *ct = customTypes(); -
285 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
286 return -1;
never executed: return -1;
0
287 -
288 int idx = qMetaTypeStaticType(normalizedTypeName.constData(), -
289 normalizedTypeName.size()); -
290 -
291 if (idx == UnknownType) {
evaluated: idx == UnknownType
TRUEFALSE
yes
Evaluation Count:681
yes
Evaluation Count:7
7-681
292 QWriteLocker locker(customTypesLock()); -
293 idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), -
294 normalizedTypeName.size()); -
295 -
296 if (idx == UnknownType) {
evaluated: idx == UnknownType
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:669
12-669
297 QCustomTypeInfo inf; -
298 inf.typeName = normalizedTypeName; -
299 inf.alias = aliasId; -
300 inf.creator = 0; -
301 inf.deleter = 0; -
302 ct->append(inf); -
303 return aliasId;
executed: return aliasId;
Execution Count:12
12
304 } -
305 }
executed: }
Execution Count:669
669
306 -
307 if (idx != aliasId) {
partially evaluated: idx != aliasId
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:676
0-676
308 QMessageLogger("kernel/qmetatype.cpp", 725, __PRETTY_FUNCTION__).fatal("QMetaType::registerTypedef: Binary compatibility break " -
309 "-- Type name '%s' previously registered as typedef of '%s' [%i], " -
310 "now registering as typedef of '%s' [%i].", -
311 normalizedTypeName.constData(), QMetaType::typeName(idx), idx, -
312 QMetaType::typeName(aliasId), aliasId); -
313 }
never executed: }
0
314 return idx;
executed: return idx;
Execution Count:676
676
315} -
316 -
317 -
318 -
319 -
320 -
321 -
322 -
323bool QMetaType::isRegistered(int type) -
324{ -
325 -
326 if ((type >= FirstCoreType && type <= LastCoreType)
evaluated: type >= FirstCoreType
TRUEFALSE
yes
Evaluation Count:39891
yes
Evaluation Count:3
evaluated: type <= LastCoreType
TRUEFALSE
yes
Evaluation Count:24794
yes
Evaluation Count:15097
3-39891
327 || (type >= FirstGuiType && type <= LastGuiType)
evaluated: type >= FirstGuiType
TRUEFALSE
yes
Evaluation Count:15095
yes
Evaluation Count:5
evaluated: type <= LastGuiType
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:15028
5-15095
328 || (type >= FirstWidgetsType && type <= LastWidgetsType)) {
evaluated: type >= FirstWidgetsType
TRUEFALSE
yes
Evaluation Count:15026
yes
Evaluation Count:7
evaluated: type <= LastWidgetsType
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:15023
3-15026
329 return true;
executed: return true;
Execution Count:24864
24864
330 } -
331 -
332 QReadLocker locker(customTypesLock()); -
333 const QVector<QCustomTypeInfo> * const ct = customTypes(); -
334 return ((type >= User) && (ct && ct->count() > type - User) && !ct->at(type - User).typeName.isEmpty());
executed: return ((type >= User) && (ct && ct->count() > type - User) && !ct->at(type - User).typeName.isEmpty());
Execution Count:15030
15030
335} -
336 -
337 -
338 -
339 -
340 -
341 -
342 -
343template <bool tryNormalizedType> -
344static inline int qMetaTypeTypeImpl(const char *typeName) -
345{ -
346 int length = qstrlen(typeName); -
347 if (!length)
evaluated: !length
TRUEFALSE
yes
Evaluation Count:102
yes
Evaluation Count:1372267
102-1372267
348 return QMetaType::UnknownType;
executed: return QMetaType::UnknownType;
Execution Count:102
102
349 int type = qMetaTypeStaticType(typeName, length); -
350 if (type == QMetaType::UnknownType) {
evaluated: type == QMetaType::UnknownType
TRUEFALSE
yes
Evaluation Count:311729
yes
Evaluation Count:1060532
311729-1060532
351 QReadLocker locker(customTypesLock()); -
352 type = qMetaTypeCustomType_unlocked(typeName, length); -
353 -
354 if ((type == QMetaType::UnknownType) && tryNormalizedType) {
evaluated: (type == QMetaType::UnknownType)
TRUEFALSE
yes
Evaluation Count:112093
yes
Evaluation Count:199636
evaluated: tryNormalizedType
TRUEFALSE
yes
Evaluation Count:106
yes
Evaluation Count:111987
106-199636
355 const ::QByteArray normalizedTypeName = QMetaObject::normalizedType(typeName); -
356 type = qMetaTypeStaticType(normalizedTypeName.constData(), -
357 normalizedTypeName.size()); -
358 if (type == QMetaType::UnknownType) {
evaluated: type == QMetaType::UnknownType
TRUEFALSE
yes
Evaluation Count:104
yes
Evaluation Count:2
2-104
359 type = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), -
360 normalizedTypeName.size()); -
361 }
executed: }
Execution Count:104
104
362 }
executed: }
Execution Count:106
106
363 -
364 }
executed: }
Execution Count:311724
311724
365 return type;
executed: return type;
Execution Count:1372273
1372273
366} -
367 -
368 -
369 -
370 -
371 -
372 -
373 -
374int QMetaType::type(const char *typeName) -
375{ -
376 return qMetaTypeTypeImpl< true>(typeName);
executed: return qMetaTypeTypeImpl< true>(typeName);
Execution Count:126573
126573
377} -
378int qMetaTypeTypeInternal(const char *typeName) -
379{ -
380 return qMetaTypeTypeImpl< false>(typeName);
executed: return qMetaTypeTypeImpl< false>(typeName);
Execution Count:1245806
1245806
381} -
382bool QMetaType::save(QDataStream &stream, int type, const void *data) -
383{ -
384 if (!data || !isRegistered(type))
evaluated: !data
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:12359
partially evaluated: !isRegistered(type)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12359
0-12359
385 return false;
executed: return false;
Execution Count:25
25
386 -
387 switch(type) { -
388 case QMetaType::UnknownType: -
389 case QMetaType::Void: -
390 case QMetaType::VoidStar: -
391 case QMetaType::QObjectStar: -
392 case QMetaType::QModelIndex: -
393 case QMetaType::QJsonValue: -
394 case QMetaType::QJsonObject: -
395 case QMetaType::QJsonArray: -
396 case QMetaType::QJsonDocument: -
397 return false;
executed: return false;
Execution Count:7
7
398 case QMetaType::Long: -
399 stream << qlonglong(*static_cast<const long *>(data)); -
400 break;
executed: break;
Execution Count:5
5
401 case QMetaType::Int: -
402 stream << *static_cast<const int *>(data); -
403 break;
executed: break;
Execution Count:175
175
404 case QMetaType::Short: -
405 stream << *static_cast<const short *>(data); -
406 break;
executed: break;
Execution Count:5
5
407 case QMetaType::Char: -
408 -
409 stream << *static_cast<const signed char *>(data); -
410 break;
executed: break;
Execution Count:5
5
411 case QMetaType::ULong: -
412 stream << qulonglong(*static_cast<const ulong *>(data)); -
413 break;
executed: break;
Execution Count:5
5
414 case QMetaType::UInt: -
415 stream << *static_cast<const uint *>(data); -
416 break;
executed: break;
Execution Count:4
4
417 case QMetaType::LongLong: -
418 stream << *static_cast<const qlonglong *>(data); -
419 break;
executed: break;
Execution Count:3
3
420 case QMetaType::ULongLong: -
421 stream << *static_cast<const qulonglong *>(data); -
422 break;
executed: break;
Execution Count:3
3
423 case QMetaType::UShort: -
424 stream << *static_cast<const ushort *>(data); -
425 break;
executed: break;
Execution Count:5
5
426 case QMetaType::SChar: -
427 stream << *static_cast<const signed char *>(data); -
428 break;
executed: break;
Execution Count:1
1
429 case QMetaType::UChar: -
430 stream << *static_cast<const uchar *>(data); -
431 break;
executed: break;
Execution Count:5
5
432 case QMetaType::Bool: -
433 stream << qint8(*static_cast<const bool *>(data)); -
434 break;
executed: break;
Execution Count:3
3
435 case QMetaType::Float: -
436 stream << *static_cast<const float *>(data); -
437 break;
executed: break;
Execution Count:7
7
438 case QMetaType::Double: -
439 stream << *static_cast<const double *>(data); -
440 break;
executed: break;
Execution Count:6
6
441 case QMetaType::QChar: -
442 stream << *static_cast<const ::QChar *>(data); -
443 break;
executed: break;
Execution Count:5
5
444 -
445 case QMetaType::QVariantMap: -
446 stream << *static_cast<const ::QVariantMap*>(data); -
447 break;
executed: break;
Execution Count:5
5
448 case QMetaType::QVariantHash: -
449 stream << *static_cast<const ::QVariantHash*>(data); -
450 break;
executed: break;
Execution Count:3
3
451 case QMetaType::QVariantList: -
452 stream << *static_cast<const ::QVariantList*>(data); -
453 break;
executed: break;
Execution Count:19
19
454 case QMetaType::QVariant: -
455 stream << *static_cast<const ::QVariant*>(data); -
456 break;
executed: break;
Execution Count:3
3
457 -
458 case QMetaType::QByteArray: -
459 stream << *static_cast<const ::QByteArray*>(data); -
460 break;
executed: break;
Execution Count:6
6
461 case QMetaType::QString: -
462 stream << *static_cast<const ::QString*>(data); -
463 break;
executed: break;
Execution Count:11934
11934
464 case QMetaType::QStringList: -
465 stream << *static_cast<const ::QStringList*>(data); -
466 break;
executed: break;
Execution Count:8
8
467 -
468 case QMetaType::QBitArray: -
469 stream << *static_cast<const ::QBitArray*>(data); -
470 break;
executed: break;
Execution Count:5
5
471 -
472 case QMetaType::QDate: -
473 stream << *static_cast<const ::QDate*>(data); -
474 break;
executed: break;
Execution Count:5
5
475 case QMetaType::QTime: -
476 stream << *static_cast<const ::QTime*>(data); -
477 break;
executed: break;
Execution Count:5
5
478 case QMetaType::QDateTime: -
479 stream << *static_cast<const ::QDateTime*>(data); -
480 break;
executed: break;
Execution Count:5
5
481 -
482 case QMetaType::QUrl: -
483 stream << *static_cast<const ::QUrl*>(data); -
484 break;
executed: break;
Execution Count:3
3
485 -
486 case QMetaType::QLocale: -
487 stream << *static_cast<const ::QLocale*>(data); -
488 break;
executed: break;
Execution Count:3
3
489 -
490 case QMetaType::QRect: -
491 stream << *static_cast<const ::QRect*>(data); -
492 break;
executed: break;
Execution Count:5
5
493 case QMetaType::QRectF: -
494 stream << *static_cast<const ::QRectF*>(data); -
495 break;
executed: break;
Execution Count:3
3
496 case QMetaType::QSize: -
497 stream << *static_cast<const ::QSize*>(data); -
498 break;
executed: break;
Execution Count:6
6
499 case QMetaType::QSizeF: -
500 stream << *static_cast<const ::QSizeF*>(data); -
501 break;
executed: break;
Execution Count:3
3
502 case QMetaType::QLine: -
503 stream << *static_cast<const ::QLine*>(data); -
504 break;
executed: break;
Execution Count:3
3
505 case QMetaType::QLineF: -
506 stream << *static_cast<const ::QLineF*>(data); -
507 break;
executed: break;
Execution Count:3
3
508 case QMetaType::QPoint: -
509 stream << *static_cast<const ::QPoint*>(data); -
510 break;
executed: break;
Execution Count:5
5
511 case QMetaType::QPointF: -
512 stream << *static_cast<const ::QPointF*>(data); -
513 break;
executed: break;
Execution Count:3
3
514 -
515 -
516 case QMetaType::QRegExp: -
517 stream << *static_cast<const ::QRegExp*>(data); -
518 break;
executed: break;
Execution Count:47
47
519 -
520 -
521 -
522 case QMetaType::QRegularExpression: -
523 stream << *static_cast<const ::QRegularExpression*>(data); -
524 break;
executed: break;
Execution Count:4
4
525 -
526 case QMetaType::QEasingCurve: -
527 stream << *static_cast<const ::QEasingCurve*>(data); -
528 break;
executed: break;
Execution Count:1
1
529 -
530 case QMetaType::QFont: -
531 case QMetaType::QPixmap: -
532 case QMetaType::QBrush: -
533 case QMetaType::QColor: -
534 case QMetaType::QPalette: -
535 case QMetaType::QImage: -
536 case QMetaType::QPolygon: -
537 case QMetaType::QPolygonF: -
538 case QMetaType::QRegion: -
539 case QMetaType::QBitmap: -
540 case QMetaType::QCursor: -
541 case QMetaType::QKeySequence: -
542 case QMetaType::QPen: -
543 case QMetaType::QTextLength: -
544 case QMetaType::QTextFormat: -
545 case QMetaType::QMatrix: -
546 case QMetaType::QTransform: -
547 case QMetaType::QMatrix4x4: -
548 case QMetaType::QVector2D: -
549 case QMetaType::QVector3D: -
550 case QMetaType::QVector4D: -
551 case QMetaType::QQuaternion: -
552 case QMetaType::QIcon: -
553 if (!qMetaTypeGuiHelper)
partially evaluated: !qMetaTypeGuiHelper
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20
0-20
554 return false;
never executed: return false;
0
555 qMetaTypeGuiHelper[type - FirstGuiType].saveOp(stream, data); -
556 break;
executed: break;
Execution Count:20
20
557 case QMetaType::QSizePolicy: -
558 if (!qMetaTypeWidgetsHelper)
partially evaluated: !qMetaTypeWidgetsHelper
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
559 return false;
never executed: return false;
0
560 qMetaTypeWidgetsHelper[type - FirstWidgetsType].saveOp(stream, data); -
561 break;
executed: break;
Execution Count:1
1
562 case QMetaType::QUuid: -
563 stream << *static_cast<const ::QUuid*>(data); -
564 break;
executed: break;
Execution Count:2
2
565 default: { -
566 const QVector<QCustomTypeInfo> * const ct = customTypes(); -
567 if (!ct)
partially evaluated: !ct
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
568 return false;
never executed: return false;
0
569 -
570 SaveOperator saveOp = 0; -
571 { -
572 QReadLocker locker(customTypesLock()); -
573 saveOp = ct->at(type - User).saveOp; -
574 } -
575 -
576 if (!saveOp)
evaluated: !saveOp
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
1-4
577 return false;
executed: return false;
Execution Count:1
1
578 saveOp(stream, data); -
579 break; }
executed: break;
Execution Count:4
4
580 } -
581 -
582 return true;
executed: return true;
Execution Count:12351
12351
583} -
584bool QMetaType::load(QDataStream &stream, int type, void *data) -
585{ -
586 if (!data || !isRegistered(type))
evaluated: !data
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:12438
partially evaluated: !isRegistered(type)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12438
0-12438
587 return false;
executed: return false;
Execution Count:25
25
588 -
589 switch(type) { -
590 case QMetaType::UnknownType: -
591 case QMetaType::Void: -
592 case QMetaType::VoidStar: -
593 case QMetaType::QObjectStar: -
594 case QMetaType::QModelIndex: -
595 case QMetaType::QJsonValue: -
596 case QMetaType::QJsonObject: -
597 case QMetaType::QJsonArray: -
598 case QMetaType::QJsonDocument: -
599 return false;
executed: return false;
Execution Count:7
7
600 case QMetaType::Long: { -
601 qlonglong l; -
602 stream >> l; -
603 *static_cast<long *>(data) = long(l); -
604 break; }
executed: break;
Execution Count:9
9
605 case QMetaType::Int: -
606 stream >> *static_cast<int *>(data); -
607 break;
executed: break;
Execution Count:146
146
608 case QMetaType::Short: -
609 stream >> *static_cast<short *>(data); -
610 break;
executed: break;
Execution Count:9
9
611 case QMetaType::Char: -
612 -
613 stream >> *static_cast<signed char *>(data); -
614 break;
executed: break;
Execution Count:9
9
615 case QMetaType::ULong: { -
616 qulonglong ul; -
617 stream >> ul; -
618 *static_cast<ulong *>(data) = ulong(ul); -
619 break; }
executed: break;
Execution Count:9
9
620 case QMetaType::UInt: -
621 stream >> *static_cast<uint *>(data); -
622 break;
executed: break;
Execution Count:8
8
623 case QMetaType::LongLong: -
624 stream >> *static_cast<qlonglong *>(data); -
625 break;
executed: break;
Execution Count:7
7
626 case QMetaType::ULongLong: -
627 stream >> *static_cast<qulonglong *>(data); -
628 break;
executed: break;
Execution Count:7
7
629 case QMetaType::UShort: -
630 stream >> *static_cast<ushort *>(data); -
631 break;
executed: break;
Execution Count:9
9
632 case QMetaType::SChar: -
633 stream >> *static_cast<signed char *>(data); -
634 break;
executed: break;
Execution Count:3
3
635 case QMetaType::UChar: -
636 stream >> *static_cast<uchar *>(data); -
637 break;
executed: break;
Execution Count:9
9
638 case QMetaType::Bool: { -
639 qint8 b; -
640 stream >> b; -
641 *static_cast<bool *>(data) = b; -
642 break; }
executed: break;
Execution Count:7
7
643 case QMetaType::Float: -
644 stream >> *static_cast<float *>(data); -
645 break;
executed: break;
Execution Count:11
11
646 case QMetaType::Double: -
647 stream >> *static_cast<double *>(data); -
648 break;
executed: break;
Execution Count:10
10
649 case QMetaType::QChar: -
650 stream >> *static_cast< ::QChar*>(data); -
651 break;
executed: break;
Execution Count:9
9
652 -
653 case QMetaType::QVariantMap: -
654 stream >> *static_cast< ::QVariantMap*>(data); -
655 break;
executed: break;
Execution Count:8
8
656 case QMetaType::QVariantHash: -
657 stream >> *static_cast< ::QVariantHash*>(data); -
658 break;
executed: break;
Execution Count:7
7
659 case QMetaType::QVariantList: -
660 stream >> *static_cast< ::QVariantList*>(data); -
661 break;
executed: break;
Execution Count:12
12
662 case QMetaType::QVariant: -
663 stream >> *static_cast< ::QVariant*>(data); -
664 break;
executed: break;
Execution Count:7
7
665 -
666 case QMetaType::QByteArray: -
667 stream >> *static_cast< ::QByteArray*>(data); -
668 break;
executed: break;
Execution Count:9
9
669 case QMetaType::QString: -
670 stream >> *static_cast< ::QString*>(data); -
671 break;
executed: break;
Execution Count:11907
11907
672 case QMetaType::QStringList: -
673 stream >> *static_cast< ::QStringList*>(data); -
674 break;
executed: break;
Execution Count:12
12
675 -
676 case QMetaType::QBitArray: -
677 stream >> *static_cast< ::QBitArray*>(data); -
678 break;
executed: break;
Execution Count:9
9
679 -
680 case QMetaType::QDate: -
681 stream >> *static_cast< ::QDate*>(data); -
682 break;
executed: break;
Execution Count:9
9
683 case QMetaType::QTime: -
684 stream >> *static_cast< ::QTime*>(data); -
685 break;
executed: break;
Execution Count:9
9
686 case QMetaType::QDateTime: -
687 stream >> *static_cast< ::QDateTime*>(data); -
688 break;
executed: break;
Execution Count:9
9
689 -
690 case QMetaType::QUrl: -
691 stream >> *static_cast< ::QUrl*>(data); -
692 break;
executed: break;
Execution Count:7
7
693 -
694 case QMetaType::QLocale: -
695 stream >> *static_cast< ::QLocale*>(data); -
696 break;
executed: break;
Execution Count:7
7
697 -
698 case QMetaType::QRect: -
699 stream >> *static_cast< ::QRect*>(data); -
700 break;
executed: break;
Execution Count:9
9
701 case QMetaType::QRectF: -
702 stream >> *static_cast< ::QRectF*>(data); -
703 break;
executed: break;
Execution Count:7
7
704 case QMetaType::QSize: -
705 stream >> *static_cast< ::QSize*>(data); -
706 break;
executed: break;
Execution Count:10
10
707 case QMetaType::QSizeF: -
708 stream >> *static_cast< ::QSizeF*>(data); -
709 break;
executed: break;
Execution Count:7
7
710 case QMetaType::QLine: -
711 stream >> *static_cast< ::QLine*>(data); -
712 break;
executed: break;
Execution Count:7
7
713 case QMetaType::QLineF: -
714 stream >> *static_cast< ::QLineF*>(data); -
715 break;
executed: break;
Execution Count:7
7
716 case QMetaType::QPoint: -
717 stream >> *static_cast< ::QPoint*>(data); -
718 break;
executed: break;
Execution Count:9
9
719 case QMetaType::QPointF: -
720 stream >> *static_cast< ::QPointF*>(data); -
721 break;
executed: break;
Execution Count:7
7
722 -
723 -
724 case QMetaType::QRegExp: -
725 stream >> *static_cast< ::QRegExp*>(data); -
726 break;
executed: break;
Execution Count:51
51
727 -
728 -
729 -
730 case QMetaType::QRegularExpression: -
731 stream >> *static_cast< ::QRegularExpression*>(data); -
732 break;
executed: break;
Execution Count:7
7
733 -
734 case QMetaType::QEasingCurve: -
735 stream >> *static_cast< ::QEasingCurve*>(data); -
736 break;
executed: break;
Execution Count:3
3
737 -
738 case QMetaType::QFont: -
739 case QMetaType::QPixmap: -
740 case QMetaType::QBrush: -
741 case QMetaType::QColor: -
742 case QMetaType::QPalette: -
743 case QMetaType::QImage: -
744 case QMetaType::QPolygon: -
745 case QMetaType::QPolygonF: -
746 case QMetaType::QRegion: -
747 case QMetaType::QBitmap: -
748 case QMetaType::QCursor: -
749 case QMetaType::QKeySequence: -
750 case QMetaType::QPen: -
751 case QMetaType::QTextLength: -
752 case QMetaType::QTextFormat: -
753 case QMetaType::QMatrix: -
754 case QMetaType::QTransform: -
755 case QMetaType::QMatrix4x4: -
756 case QMetaType::QVector2D: -
757 case QMetaType::QVector3D: -
758 case QMetaType::QVector4D: -
759 case QMetaType::QQuaternion: -
760 case QMetaType::QIcon: -
761 if (!qMetaTypeGuiHelper)
partially evaluated: !qMetaTypeGuiHelper
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
762 return false;
never executed: return false;
0
763 qMetaTypeGuiHelper[type - FirstGuiType].loadOp(stream, data); -
764 break;
executed: break;
Execution Count:19
19
765 case QMetaType::QSizePolicy: -
766 if (!qMetaTypeWidgetsHelper)
partially evaluated: !qMetaTypeWidgetsHelper
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
767 return false;
never executed: return false;
0
768 qMetaTypeWidgetsHelper[type - FirstWidgetsType].loadOp(stream, data); -
769 break;
executed: break;
Execution Count:1
1
770 case QMetaType::QUuid: -
771 stream >> *static_cast< ::QUuid*>(data); -
772 break;
executed: break;
Execution Count:5
5
773 default: { -
774 const QVector<QCustomTypeInfo> * const ct = customTypes(); -
775 if (!ct)
partially evaluated: !ct
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
776 return false;
never executed: return false;
0
777 -
778 LoadOperator loadOp = 0; -
779 { -
780 QReadLocker locker(customTypesLock()); -
781 loadOp = ct->at(type - User).loadOp; -
782 } -
783 -
784 if (!loadOp)
evaluated: !loadOp
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
2-6
785 return false;
executed: return false;
Execution Count:2
2
786 loadOp(stream, data); -
787 break; }
executed: break;
Execution Count:6
6
788 } -
789 return true;
executed: return true;
Execution Count:12429
12429
790} -
791 -
792namespace { -
793class TypeCreator { -
794 template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> -
795 struct CreatorImpl { -
796 static void *Create(const int , const void *copy) -
797 { -
798 -
799 -
800 return copy ? new T(*static_cast<const T*>(copy)) : new T();
executed: return copy ? new T(*static_cast<const T*>(copy)) : new T();
Execution Count:197530
197530
801 } -
802 }; -
803 template<typename T> -
804 struct CreatorImpl<T, false> { -
805 static void *Create(const int type, const void *copy) -
806 { -
807 if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) {
evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui
TRUEFALSE
yes
Evaluation Count:3330
yes
Evaluation Count:3
3-3330
808 if (__builtin_expect(!!(qMetaTypeGuiHelper), true))
evaluated: __builtin_expect(!!(qMetaTypeGuiHelper), true)
TRUEFALSE
yes
Evaluation Count:3307
yes
Evaluation Count:23
23-3307
809 return qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].creator(copy);
executed: return qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].creator(copy);
Execution Count:3307
3307
810 }
executed: }
Execution Count:23
23
811 if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) {
evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:23
3-23
812 if (__builtin_expect(!!(qMetaTypeWidgetsHelper), true))
evaluated: __builtin_expect(!!(qMetaTypeWidgetsHelper), true)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
813 return qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].creator(copy);
executed: return qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].creator(copy);
Execution Count:2
2
814 }
executed: }
Execution Count:1
1
815 -
816 -
817 return 0;
executed: return 0;
Execution Count:24
24
818 } -
819 }; -
820public: -
821 TypeCreator(const int type) -
822 : m_type(type) -
823 {}
executed: }
Execution Count:252696
252696
824 -
825 template<typename T> -
826 void *delegate(const T *copy) { return CreatorImpl<T>::Create(m_type, copy); }
executed: return CreatorImpl<T>::Create(m_type, copy);
Execution Count:200863
200863
827 void *delegate(const void*) { return 0; }
executed: return 0;
Execution Count:3
3
828 void *delegate(const QMetaTypeSwitcher::UnknownType *) { return 0; }
executed: return 0;
Execution Count:86
86
829 void *delegate(const QMetaTypeSwitcher::NotBuiltinType *copy) -
830 { -
831 QMetaType::Creator creator; -
832 const QVector<QCustomTypeInfo> * const ct = customTypes(); -
833 { -
834 QReadLocker locker(customTypesLock()); -
835 if (__builtin_expect(!!(m_type < QMetaType::User || !ct || ct->count() <= m_type - QMetaType::User), false))
partially evaluated: __builtin_expect(!!(m_type < QMetaType::User || !ct || ct->count() <= m_type - QMetaType::User), false)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:51744
0-51744
836 return 0;
never executed: return 0;
0
837 creator = ct->at(m_type - QMetaType::User).creator; -
838 } -
839 qt_noop(); -
840 return creator(copy);
executed: return creator(copy);
Execution Count:51745
51745
841 } -
842private: -
843 const int m_type; -
844}; -
845} -
846 -
847 -
848 -
849 -
850 -
851 -
852 -
853void *QMetaType::create(int type, const void *copy) -
854{ -
855 TypeCreator typeCreator(type); -
856 return QMetaTypeSwitcher::switcher<void*>(typeCreator, type, copy);
executed: return QMetaTypeSwitcher::switcher<void*>(typeCreator, type, copy);
Execution Count:252699
252699
857} -
858 -
859namespace { -
860class TypeDestroyer { -
861 template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> -
862 struct DestroyerImpl { -
863 static void Destroy(const int , void *where) { QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Delete(where); }
executed: }
Execution Count:197524
197524
864 }; -
865 template<typename T> -
866 struct DestroyerImpl<T, false> { -
867 static void Destroy(const int type, void *where) -
868 { -
869 if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) {
evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui
TRUEFALSE
yes
Evaluation Count:3330
yes
Evaluation Count:3
3-3330
870 if (__builtin_expect(!!(qMetaTypeGuiHelper), true))
evaluated: __builtin_expect(!!(qMetaTypeGuiHelper), true)
TRUEFALSE
yes
Evaluation Count:3307
yes
Evaluation Count:23
23-3307
871 qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].deleter(where);
executed: qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].deleter(where);
Execution Count:3307
3307
872 return;
executed: return;
Execution Count:3330
3330
873 } -
874 if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) {
partially evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
875 if (__builtin_expect(!!(qMetaTypeWidgetsHelper), true))
evaluated: __builtin_expect(!!(qMetaTypeWidgetsHelper), true)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
876 qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].deleter(where);
executed: qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].deleter(where);
Execution Count:2
2
877 return;
executed: return;
Execution Count:3
3
878 } -
879 -
880 -
881 }
never executed: }
0
882 }; -
883public: -
884 TypeDestroyer(const int type) -
885 : m_type(type) -
886 {}
executed: }
Execution Count:250056
250056
887 -
888 template<typename T> -
889 void delegate(const T *where) { DestroyerImpl<T>::Destroy(m_type, const_cast<T*>(where)); }
executed: }
Execution Count:200857
200857
890 void delegate(const void *) {} -
891 void delegate(const QMetaTypeSwitcher::UnknownType*) {} -
892 void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) { customTypeDestroyer(m_type, (void*)where); }
executed: }
Execution Count:49209
49209
893 -
894private: -
895 static void customTypeDestroyer(const int type, void *where) -
896 { -
897 QMetaType::Destructor deleter; -
898 const QVector<QCustomTypeInfo> * const ct = customTypes(); -
899 { -
900 QReadLocker locker(customTypesLock()); -
901 if (__builtin_expect(!!(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User), false))
evaluated: __builtin_expect(!!(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User), false)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:49213
1-49213
902 return;
executed: return;
Execution Count:1
1
903 deleter = ct->at(type - QMetaType::User).deleter; -
904 } -
905 qt_noop(); -
906 deleter(where); -
907 }
executed: }
Execution Count:49209
49209
908 -
909 const int m_type; -
910}; -
911} -
912 -
913 -
914 -
915 -
916 -
917 -
918 -
919void QMetaType::destroy(int type, void *data) -
920{ -
921 TypeDestroyer deleter(type); -
922 QMetaTypeSwitcher::switcher<void>(deleter, type, data); -
923}
executed: }
Execution Count:250070
250070
924 -
925namespace { -
926class TypeConstructor { -
927 template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> -
928 struct ConstructorImpl { -
929 static void *Construct(const int , void *where, const void *copy) { return QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Construct(where, copy); }
executed: return QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Construct(where, copy);
Execution Count:86
86
930 }; -
931 template<typename T> -
932 struct ConstructorImpl<T, false> { -
933 static void *Construct(const int type, void *where, const void *copy) -
934 { -
935 if (QModulesPrivate::QTypeModuleInfo<T>::IsGui)
partially evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui
TRUEFALSE
yes
Evaluation Count:42
no
Evaluation Count:0
0-42
936 return __builtin_expect(!!(qMetaTypeGuiHelper), true) ? 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
937 -
938 if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget)
never evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget
0
939 return __builtin_expect(!!(qMetaTypeWidgetsHelper), true) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].constructor(where, copy) : 0;
never executed: return __builtin_expect(!!(qMetaTypeWidgetsHelper), true) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].constructor(where, copy) : 0;
0
940 -
941 -
942 -
943 return 0;
never executed: return 0;
0
944 } -
945 }; -
946public: -
947 TypeConstructor(const int type, void *where) -
948 : m_type(type) -
949 , m_where(where) -
950 {}
executed: }
Execution Count:6127
6127
951 -
952 template<typename T> -
953 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
954 void *delegate(const void *) { return m_where; }
never executed: return m_where;
0
955 void *delegate(const QMetaTypeSwitcher::UnknownType*) { return m_where; }
never executed: return m_where;
0
956 void *delegate(const QMetaTypeSwitcher::NotBuiltinType *copy) { return customTypeConstructor(m_type, m_where, copy); }
executed: return customTypeConstructor(m_type, m_where, copy);
Execution Count:6000
6000
957 -
958private: -
959 static void *customTypeConstructor(const int type, void *where, const void *copy) -
960 { -
961 QMetaType::Constructor ctor; -
962 const QVector<QCustomTypeInfo> * const ct = customTypes(); -
963 { -
964 QReadLocker locker(customTypesLock()); -
965 if (__builtin_expect(!!(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User), false))
partially evaluated: __builtin_expect(!!(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User), false)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6000
0-6000
966 return 0;
never executed: return 0;
0
967 ctor = ct->at(type - QMetaType::User).constructor; -
968 } -
969 qt_noop(); -
970 return ctor(where, copy);
executed: return ctor(where, copy);
Execution Count:5998
5998
971 } -
972 -
973 const int m_type; -
974 void *m_where; -
975}; -
976} -
977void *QMetaType::construct(int type, void *where, const void *copy) -
978{ -
979 if (!where)
evaluated: !where
TRUEFALSE
yes
Evaluation Count:90
yes
Evaluation Count:6127
90-6127
980 return 0;
executed: return 0;
Execution Count:90
90
981 TypeConstructor constructor(type, where); -
982 return QMetaTypeSwitcher::switcher<void*>(constructor, type, copy);
executed: return QMetaTypeSwitcher::switcher<void*>(constructor, type, copy);
Execution Count:6127
6127
983} -
984 -
985 -
986namespace { -
987class TypeDestructor { -
988 template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> -
989 struct DestructorImpl { -
990 static void Destruct(const int , void *where) { QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Destruct(where); }
executed: }
Execution Count:86
86
991 }; -
992 template<typename T> -
993 struct DestructorImpl<T, false> { -
994 static void Destruct(const int type, void *where) -
995 { -
996 if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) {
partially evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui
TRUEFALSE
yes
Evaluation Count:42
no
Evaluation Count:0
0-42
997 if (__builtin_expect(!!(qMetaTypeGuiHelper), true))
partially evaluated: __builtin_expect(!!(qMetaTypeGuiHelper), true)
TRUEFALSE
yes
Evaluation Count:42
no
Evaluation Count:0
0-42
998 qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].destructor(where);
executed: qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].destructor(where);
Execution Count:42
42
999 return;
executed: return;
Execution Count:42
42
1000 } -
1001 if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) {
never evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget
0
1002 if (__builtin_expect(!!(qMetaTypeWidgetsHelper), true))
never evaluated: __builtin_expect(!!(qMetaTypeWidgetsHelper), true)
0
1003 qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].destructor(where);
never executed: qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].destructor(where);
0
1004 return;
never executed: return;
0
1005 } -
1006 -
1007 -
1008 }
never executed: }
0
1009 }; -
1010public: -
1011 TypeDestructor(const int type) -
1012 : m_type(type) -
1013 {}
executed: }
Execution Count:48583
48583
1014 -
1015 template<typename T> -
1016 void delegate(const T *where) { DestructorImpl<T>::Destruct(m_type, const_cast<T*>(where)); }
executed: }
Execution Count:128
128
1017 void delegate(const void *) {} -
1018 void delegate(const QMetaTypeSwitcher::UnknownType*) {} -
1019 void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) { customTypeDestructor(m_type, (void*)where); }
executed: }
Execution Count:48457
48457
1020 -
1021private: -
1022 static void customTypeDestructor(const int type, void *where) -
1023 { -
1024 QMetaType::Destructor dtor; -
1025 const QVector<QCustomTypeInfo> * const ct = customTypes(); -
1026 { -
1027 QReadLocker locker(customTypesLock()); -
1028 if (__builtin_expect(!!(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User), false))
partially evaluated: __builtin_expect(!!(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User), false)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:48456
0-48456
1029 return;
never executed: return;
0
1030 dtor = ct->at(type - QMetaType::User).destructor; -
1031 } -
1032 qt_noop(); -
1033 dtor(where); -
1034 }
executed: }
Execution Count:48457
48457
1035 -
1036 const int m_type; -
1037}; -
1038} -
1039void QMetaType::destruct(int type, void *where) -
1040{ -
1041 if (!where)
evaluated: !where
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:48583
46-48583
1042 return;
executed: return;
Execution Count:46
46
1043 TypeDestructor destructor(type); -
1044 QMetaTypeSwitcher::switcher<void>(destructor, type, where); -
1045}
executed: }
Execution Count:48585
48585
1046 -
1047 -
1048namespace { -
1049class SizeOf { -
1050 template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> -
1051 struct SizeOfImpl { -
1052 static int Size(const int) { return QTypeInfo<T>::sizeOf; }
executed: return QTypeInfo<T>::sizeOf;
Execution Count:89
89
1053 }; -
1054 template<typename T> -
1055 struct SizeOfImpl<T, false> { -
1056 static int Size(const int type) -
1057 { -
1058 if (QModulesPrivate::QTypeModuleInfo<T>::IsGui)
partially evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui
TRUEFALSE
yes
Evaluation Count:63
no
Evaluation Count:0
0-63
1059 return __builtin_expect(!!(qMetaTypeGuiHelper), true) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].size : 0;
executed: return __builtin_expect(!!(qMetaTypeGuiHelper), true) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].size : 0;
Execution Count:63
63
1060 -
1061 if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget)
never evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget
0
1062 return __builtin_expect(!!(qMetaTypeWidgetsHelper), true) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].size : 0;
never executed: return __builtin_expect(!!(qMetaTypeWidgetsHelper), true) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].size : 0;
0
1063 -
1064 -
1065 -
1066 return 0;
never executed: return 0;
0
1067 } -
1068 }; -
1069 -
1070public: -
1071 SizeOf(int type) -
1072 : m_type(type) -
1073 {}
executed: }
Execution Count:221
221
1074 -
1075 template<typename T> -
1076 int delegate(const T*) { return SizeOfImpl<T>::Size(m_type); }
executed: return SizeOfImpl<T>::Size(m_type);
Execution Count:152
152
1077 int delegate(const QMetaTypeSwitcher::UnknownType*) { return 0; }
executed: return 0;
Execution Count:3
3
1078 int delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customTypeSizeOf(m_type); }
executed: return customTypeSizeOf(m_type);
Execution Count:66
66
1079private: -
1080 static int customTypeSizeOf(const int type) -
1081 { -
1082 const QVector<QCustomTypeInfo> * const ct = customTypes(); -
1083 QReadLocker locker(customTypesLock()); -
1084 if (__builtin_expect(!!(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User), false))
evaluated: __builtin_expect(!!(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User), false)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:65
1-65
1085 return 0;
executed: return 0;
Execution Count:1
1
1086 return ct->at(type - QMetaType::User).size;
executed: return ct->at(type - QMetaType::User).size;
Execution Count:65
65
1087 } -
1088 -
1089 const int m_type; -
1090}; -
1091} -
1092int QMetaType::sizeOf(int type) -
1093{ -
1094 SizeOf sizeOf(type); -
1095 return QMetaTypeSwitcher::switcher<int>(sizeOf, type, 0);
executed: return QMetaTypeSwitcher::switcher<int>(sizeOf, type, 0);
Execution Count:221
221
1096} -
1097 -
1098namespace { -
1099class Flags -
1100{ -
1101 template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> -
1102 struct FlagsImpl -
1103 { -
1104 static quint32 Flags(const int ) -
1105 { -
1106 return QtPrivate::QMetaTypeTypeFlags<T>::Flags;
executed: return QtPrivate::QMetaTypeTypeFlags<T>::Flags;
Execution Count:492
492
1107 } -
1108 }; -
1109 template<typename T> -
1110 struct FlagsImpl<T, false> -
1111 { -
1112 static quint32 Flags(const int type) -
1113 { -
1114 if (QModulesPrivate::QTypeModuleInfo<T>::IsGui)
evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui
TRUEFALSE
yes
Evaluation Count:164
yes
Evaluation Count:2
2-164
1115 return __builtin_expect(!!(qMetaTypeGuiHelper), true) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].flags : 0;
executed: return __builtin_expect(!!(qMetaTypeGuiHelper), true) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].flags : 0;
Execution Count:164
164
1116 -
1117 if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget)
partially evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1118 return __builtin_expect(!!(qMetaTypeWidgetsHelper), true) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].flags : 0;
executed: return __builtin_expect(!!(qMetaTypeWidgetsHelper), true) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].flags : 0;
Execution Count:2
2
1119 -
1120 -
1121 -
1122 return 0;
never executed: return 0;
0
1123 } -
1124 }; -
1125public: -
1126 Flags(const int type) -
1127 : m_type(type) -
1128 {}
executed: }
Execution Count:5615
5615
1129 template<typename T> -
1130 quint32 delegate(const T*) { return FlagsImpl<T>::Flags(m_type); }
executed: return FlagsImpl<T>::Flags(m_type);
Execution Count:658
658
1131 quint32 delegate(const void*) { return 0; }
executed: return 0;
Execution Count:1
1
1132 quint32 delegate(const QMetaTypeSwitcher::UnknownType*) { return 0; }
executed: return 0;
Execution Count:14
14
1133 quint32 delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customTypeFlags(m_type); }
executed: return customTypeFlags(m_type);
Execution Count:4942
4942
1134private: -
1135 const int m_type; -
1136 static quint32 customTypeFlags(const int type) -
1137 { -
1138 const QVector<QCustomTypeInfo> * const ct = customTypes(); -
1139 if (__builtin_expect(!!(!ct || type < QMetaType::User), false))
partially evaluated: __builtin_expect(!!(!ct || type < QMetaType::User), false)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4942
0-4942
1140 return 0;
never executed: return 0;
0
1141 QReadLocker locker(customTypesLock()); -
1142 if (__builtin_expect(!!(ct->count() <= type - QMetaType::User), false))
evaluated: __builtin_expect(!!(ct->count() <= type - QMetaType::User), false)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4937
5-4937
1143 return 0;
executed: return 0;
Execution Count:5
5
1144 return ct->at(type - QMetaType::User).flags;
executed: return ct->at(type - QMetaType::User).flags;
Execution Count:4937
4937
1145 } -
1146}; -
1147} -
1148QMetaType::TypeFlags QMetaType::typeFlags(int type) -
1149{ -
1150 Flags flags(type); -
1151 return static_cast<QMetaType::TypeFlags>(QMetaTypeSwitcher::switcher<quint32>(flags, type, 0));
executed: return static_cast<QMetaType::TypeFlags>(QMetaTypeSwitcher::switcher<quint32>(flags, type, 0));
Execution Count:5615
5615
1152} -
1153 -
1154 -
1155namespace { -
1156class MetaObject -
1157{ -
1158public: -
1159 MetaObject(const int type) -
1160 : m_type(type) -
1161 {}
executed: }
Execution Count:7
7
1162 template<typename T> -
1163 const QMetaObject *delegate(const T*) { return QtPrivate::MetaObjectForType<T>::value(); }
executed: return QtPrivate::MetaObjectForType<T>::value();
Execution Count:2
2
1164 const QMetaObject *delegate(const void*) { return 0; }
never executed: return 0;
0
1165 const QMetaObject *delegate(const QMetaTypeSwitcher::UnknownType*) { return 0; }
never executed: return 0;
0
1166 const QMetaObject *delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customMetaObject(m_type); }
executed: return customMetaObject(m_type);
Execution Count:5
5
1167private: -
1168 const int m_type; -
1169 static const QMetaObject *customMetaObject(const int type) -
1170 { -
1171 const QVector<QCustomTypeInfo> * const ct = customTypes(); -
1172 if (__builtin_expect(!!(!ct || type < QMetaType::User), false))
partially evaluated: __builtin_expect(!!(!ct || type < QMetaType::User), false)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1173 return 0;
never executed: return 0;
0
1174 QReadLocker locker(customTypesLock()); -
1175 if (__builtin_expect(!!(ct->count() <= type - QMetaType::User), false))
partially evaluated: __builtin_expect(!!(ct->count() <= type - QMetaType::User), false)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1176 return 0;
never executed: return 0;
0
1177 return ct->at(type - QMetaType::User).metaObject;
executed: return ct->at(type - QMetaType::User).metaObject;
Execution Count:5
5
1178 } -
1179}; -
1180} -
1181 -
1182 -
1183 -
1184 -
1185 -
1186 -
1187 -
1188const QMetaObject *QMetaType::metaObjectForType(int type) -
1189{ -
1190 -
1191 MetaObject mo(type); -
1192 return QMetaTypeSwitcher::switcher<const QMetaObject*>(mo, type, 0);
executed: return QMetaTypeSwitcher::switcher<const QMetaObject*>(mo, type, 0);
Execution Count:7
7
1193 -
1194 -
1195 -
1196 -
1197} -
1198namespace { -
1199class TypeInfo { -
1200 template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> -
1201 struct TypeInfoImpl -
1202 { -
1203 TypeInfoImpl(const uint , QMetaTypeInterface &info) -
1204 { -
1205 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()) }; -
1206 info = tmp; -
1207 }
executed: }
Execution Count:290
290
1208 }; -
1209 -
1210 template<typename T> -
1211 struct TypeInfoImpl<T, false> -
1212 { -
1213 TypeInfoImpl(const uint type, QMetaTypeInterface &info) -
1214 { -
1215 if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) {
never evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsGui
0
1216 if (__builtin_expect(!!(qMetaTypeGuiHelper), true))
never evaluated: __builtin_expect(!!(qMetaTypeGuiHelper), true)
0
1217 info = qMetaTypeGuiHelper[type - QMetaType::FirstGuiType];
never executed: info = qMetaTypeGuiHelper[type - QMetaType::FirstGuiType];
0
1218 return;
never executed: return;
0
1219 } -
1220 if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) {
never evaluated: QModulesPrivate::QTypeModuleInfo<T>::IsWidget
0
1221 if (__builtin_expect(!!(qMetaTypeWidgetsHelper), true))
never evaluated: __builtin_expect(!!(qMetaTypeWidgetsHelper), true)
0
1222 info = qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType];
never executed: info = qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType];
0
1223 return;
never executed: return;
0
1224 } -
1225 }
never executed: }
0
1226 }; -
1227public: -
1228 QMetaTypeInterface info; -
1229 TypeInfo(const uint type) -
1230 : m_type(type) -
1231 { -
1232 QMetaTypeInterface tmp = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -
1233 info = tmp; -
1234 }
executed: }
Execution Count:45057
45057
1235 template<typename T> -
1236 void delegate(const T*) { TypeInfoImpl<T>(m_type, info); }
executed: }
Execution Count:290
290
1237 void delegate(const QMetaTypeSwitcher::UnknownType*) {} -
1238 void delegate(const QMetaTypeSwitcher::NotBuiltinType*) { customTypeInfo(m_type); }
executed: }
Execution Count:44749
44749
1239private: -
1240 void customTypeInfo(const uint type) -
1241 { -
1242 const QVector<QCustomTypeInfo> * const ct = customTypes(); -
1243 if (__builtin_expect(!!(!ct), false))
partially evaluated: __builtin_expect(!!(!ct), false)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44749
0-44749
1244 return;
never executed: return;
0
1245 QReadLocker locker(customTypesLock()); -
1246 if (__builtin_expect(!!(uint(ct->count()) > type - QMetaType::User), true))
evaluated: __builtin_expect(!!(uint(ct->count()) > type - QMetaType::User), true)
TRUEFALSE
yes
Evaluation Count:44718
yes
Evaluation Count:31
31-44718
1247 info = ct->at(type - QMetaType::User);
executed: info = ct->at(type - QMetaType::User);
Execution Count:44718
44718
1248 }
executed: }
Execution Count:44749
44749
1249 -
1250 const uint m_type; -
1251}; -
1252} -
1253 -
1254 -
1255 -
1256 -
1257 -
1258QMetaType QMetaType::typeInfo(const int type) -
1259{ -
1260 TypeInfo typeInfo(type); -
1261 QMetaTypeSwitcher::switcher<void>(typeInfo, type, 0); -
1262 return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags 45057
1263 , static_cast<const QMetaTypeInterface *>(0) 45057
1264 , typeInfo.info.creator 45057
1265 , typeInfo.info.deleter 45057
1266 , typeInfo.info.saveOp 45057
1267 , typeInfo.info.loadOp 45057
1268 , typeInfo.info.constructor 45057
1269 , typeInfo.info.destructor 45057
1270 , typeInfo.info.size 45057
1271 , typeInfo.info.flags 45057
1272 , type 45057
1273 , typeInfo.info.metaObject) 45057
1274 : QMetaType(UnknownType);
executed: return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags , static_cast<const QMetaTypeInterface *>(0) , typeInfo.info.creator , typeInfo.info.deleter , typeInfo.info.saveOp , typeInfo.info.loadOp , typeInfo.info.constructor , typeInfo.info.destructor , typeInfo.info.size , typeInfo.info.flags , type , typeInfo.info.metaObject) : QMetaType(UnknownType);
Execution Count:45057
45057
1275} -
1276 -
1277 -
1278 -
1279 -
1280 -
1281 -
1282 -
1283QMetaType::QMetaType(const int typeId) -
1284 : m_typeId(typeId) -
1285{ -
1286 if (__builtin_expect(!!(typeId == UnknownType), false)) {
evaluated: __builtin_expect(!!(typeId == UnknownType), false)
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:45057
51-45057
1287 -
1288 m_extensionFlags = 0xffffffff; -
1289 qt_noop(); -
1290 } else {
executed: }
Execution Count:51
51
1291 -
1292 *this = QMetaType::typeInfo(typeId); -
1293 if (m_typeId == UnknownType)
evaluated: m_typeId == UnknownType
TRUEFALSE
yes
Evaluation Count:49
yes
Evaluation Count:45008
49-45008
1294 m_extensionFlags = 0xffffffff;
executed: m_extensionFlags = 0xffffffff;
Execution Count:49
49
1295 else if (m_typeId == QMetaType::Void)
evaluated: m_typeId == QMetaType::Void
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:45006
2-45006
1296 m_extensionFlags = CreateEx | DestroyEx | ConstructEx | DestructEx;
executed: m_extensionFlags = CreateEx | DestroyEx | ConstructEx | DestructEx;
Execution Count:2
2
1297 } -
1298} -
1299 -
1300 -
1301 -
1302 -
1303 -
1304 -
1305 -
1306QMetaType::QMetaType(const QMetaType &other) -
1307 : m_creator(other.m_creator) -
1308 , m_deleter(other.m_deleter) -
1309 , m_saveOp(other.m_saveOp) -
1310 , m_loadOp(other.m_loadOp) -
1311 , m_constructor(other.m_constructor) -
1312 , m_destructor(other.m_destructor) -
1313 , m_extension(other.m_extension) -
1314 , m_size(other.m_size) -
1315 , m_typeFlags(other.m_typeFlags) -
1316 , m_extensionFlags(other.m_extensionFlags) -
1317 , m_typeId(other.m_typeId) -
1318 , m_metaObject(other.m_metaObject) -
1319{}
never executed: }
0
1320 -
1321QMetaType &QMetaType::operator =(const QMetaType &other) -
1322{ -
1323 m_creator = other.m_creator; -
1324 m_deleter = other.m_deleter; -
1325 m_saveOp = other.m_saveOp; -
1326 m_loadOp = other.m_loadOp; -
1327 m_constructor = other.m_constructor; -
1328 m_destructor = other.m_destructor; -
1329 m_size = other.m_size; -
1330 m_typeFlags = other.m_typeFlags; -
1331 m_extensionFlags = other.m_extensionFlags; -
1332 m_extension = other.m_extension; -
1333 m_typeId = other.m_typeId; -
1334 m_metaObject = other.m_metaObject; -
1335 return *this;
executed: return *this;
Execution Count:45057
45057
1336} -
1337void QMetaType::ctor(const QMetaTypeInterface *info) -
1338{ -
1339 -
1340 -
1341 -
1342 qt_noop(); -
1343 (void)info;; -
1344 m_extensionFlags = CreateEx | DestroyEx | ConstructEx | DestructEx; -
1345}
executed: }
Execution Count:2
2
1346void QMetaType::dtor() -
1347{} -
1348void *QMetaType::createExtended(const void *copy) const -
1349{ -
1350 (void)copy;; -
1351 return 0;
never executed: return 0;
0
1352} -
1353void QMetaType::destroyExtended(void *data) const -
1354{ -
1355 (void)data;; -
1356}
never executed: }
0
1357void *QMetaType::constructExtended(void *where, const void *copy) const -
1358{ -
1359 (void)where;; -
1360 (void)copy;; -
1361 return 0;
never executed: return 0;
0
1362} -
1363void QMetaType::destructExtended(void *data) const -
1364{ -
1365 (void)data;; -
1366}
never executed: }
0
1367uint QMetaType::sizeExtended() const -
1368{ -
1369 return 0;
executed: return 0;
Execution Count:22
22
1370} -
1371QMetaType::TypeFlags QMetaType::flagsExtended() const -
1372{ -
1373 return 0;
executed: return 0;
Execution Count:3
3
1374} -
1375const QMetaObject *QMetaType::metaObjectExtended() const -
1376{ -
1377 return 0;
never executed: return 0;
0
1378} -
1379 -
1380 -
1381namespace QtPrivate -
1382{ -
1383const QMetaObject *metaObjectForQWidget() -
1384{ -
1385 if (!qMetaTypeWidgetsHelper)
never evaluated: !qMetaTypeWidgetsHelper
0
1386 return 0;
never executed: return 0;
0
1387 return qMetaObjectWidgetsHelper;
never executed: return qMetaObjectWidgetsHelper;
0
1388} -
1389} -
1390 -
1391 -
1392 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial