| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/kernel/qmetatype.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||
| 14 | namespace { | - | ||||||||||||||||||||||||
| 15 | struct DefinedTypesFilter { | - | ||||||||||||||||||||||||
| 16 | template<typename T> | - | ||||||||||||||||||||||||
| 17 | struct Acceptor { | - | ||||||||||||||||||||||||
| 18 | static const bool IsAccepted = QtMetaTypePrivate::TypeDefinition<T>::IsAvailable && QModulesPrivate::QTypeModuleInfo<T>::IsCore; | - | ||||||||||||||||||||||||
| 19 | }; | - | ||||||||||||||||||||||||
| 20 | }; | - | ||||||||||||||||||||||||
| 21 | } | - | ||||||||||||||||||||||||
| 22 | static 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 }, { "QPersistentModelIndex", sizeof("QPersistentModelIndex") - 1, 50 }, { "QObject*", sizeof("QObject*") - 1, 39 }, { "QVariantMap", sizeof("QVariantMap") - 1, 8 }, { "QVariantList", sizeof("QVariantList") - 1, 9 }, { "QVariantHash", sizeof("QVariantHash") - 1, 28 }, { "QByteArrayList", sizeof("QByteArrayList") - 1, 49 }, { "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 }, { "QList<QByteArray>", sizeof("QList<QByteArray>") - 1, QMetaType::QByteArrayList }, | - | ||||||||||||||||||||||||
| 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 | - | |||||||||||||||||||||||||
| 33 | class QCustomTypeInfo : public QMetaTypeInterface | - | ||||||||||||||||||||||||
| 34 | { | - | ||||||||||||||||||||||||
| 35 | public: | - | ||||||||||||||||||||||||
| 36 | QCustomTypeInfo() | - | ||||||||||||||||||||||||
| 37 | : alias(-1) | - | ||||||||||||||||||||||||
| 38 | { | - | ||||||||||||||||||||||||
| 39 | QMetaTypeInterface empty = { (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 | } | - | ||||||||||||||||||||||||
| 42 | QByteArray typeName; | - | ||||||||||||||||||||||||
| 43 | int alias; | - | ||||||||||||||||||||||||
| 44 | }; | - | ||||||||||||||||||||||||
| 45 | - | |||||||||||||||||||||||||
| 46 | template<typename T, typename Key> | - | ||||||||||||||||||||||||
| 47 | class QMetaTypeFunctionRegistry | - | ||||||||||||||||||||||||
| 48 | { | - | ||||||||||||||||||||||||
| 49 | public: | - | ||||||||||||||||||||||||
| 50 | ~QMetaTypeFunctionRegistry() | - | ||||||||||||||||||||||||
| 51 | { | - | ||||||||||||||||||||||||
| 52 | const QWriteLocker locker(&lock); | - | ||||||||||||||||||||||||
| 53 | map.clear(); | - | ||||||||||||||||||||||||
| 54 | } | - | ||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | bool contains(Key k) const | - | ||||||||||||||||||||||||
| 57 | { | - | ||||||||||||||||||||||||
| 58 | const QReadLocker locker(&lock); | - | ||||||||||||||||||||||||
| 59 | return map.contains(k); | - | ||||||||||||||||||||||||
| 60 | } | - | ||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | bool insertIfNotContains(Key k, const T *f) | - | ||||||||||||||||||||||||
| 63 | { | - | ||||||||||||||||||||||||
| 64 | const QWriteLocker locker(&lock); | - | ||||||||||||||||||||||||
| 65 | const T* &fun = map[k]; | - | ||||||||||||||||||||||||
| 66 | if (fun != 0) | - | ||||||||||||||||||||||||
| 67 | return false; | - | ||||||||||||||||||||||||
| 68 | fun = f; | - | ||||||||||||||||||||||||
| 69 | return true; | - | ||||||||||||||||||||||||
| 70 | } | - | ||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||
| 72 | const T *function(Key k) const | - | ||||||||||||||||||||||||
| 73 | { | - | ||||||||||||||||||||||||
| 74 | const QReadLocker locker(&lock); | - | ||||||||||||||||||||||||
| 75 | return map.value(k, 0); | - | ||||||||||||||||||||||||
| 76 | } | - | ||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | void remove(int from, int to) | - | ||||||||||||||||||||||||
| 79 | { | - | ||||||||||||||||||||||||
| 80 | const Key k(from, to); | - | ||||||||||||||||||||||||
| 81 | const QWriteLocker locker(&lock); | - | ||||||||||||||||||||||||
| 82 | map.remove(k); | - | ||||||||||||||||||||||||
| 83 | } | - | ||||||||||||||||||||||||
| 84 | private: | - | ||||||||||||||||||||||||
| 85 | mutable QReadWriteLock lock; | - | ||||||||||||||||||||||||
| 86 | QHash<Key, const T *> map; | - | ||||||||||||||||||||||||
| 87 | }; | - | ||||||||||||||||||||||||
| 88 | - | |||||||||||||||||||||||||
| 89 | typedef QMetaTypeFunctionRegistry<QtPrivate::AbstractConverterFunction,QPair<int,int> > | - | ||||||||||||||||||||||||
| 90 | QMetaTypeConverterRegistry; | - | ||||||||||||||||||||||||
| 91 | typedef QMetaTypeFunctionRegistry<QtPrivate::AbstractComparatorFunction,int> | - | ||||||||||||||||||||||||
| 92 | QMetaTypeComparatorRegistry; | - | ||||||||||||||||||||||||
| 93 | typedef QMetaTypeFunctionRegistry<QtPrivate::AbstractDebugStreamFunction,int> | - | ||||||||||||||||||||||||
| 94 | QMetaTypeDebugStreamRegistry; | - | ||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||
| 96 | namespace | - | ||||||||||||||||||||||||
| 97 | { | - | ||||||||||||||||||||||||
| 98 | union CheckThatItIsPod | - | ||||||||||||||||||||||||
| 99 | { | - | ||||||||||||||||||||||||
| 100 | QMetaTypeInterface iface; | - | ||||||||||||||||||||||||
| 101 | }; | - | ||||||||||||||||||||||||
| 102 | } | - | ||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||
| 104 | template<> class QTypeInfo<QCustomTypeInfo > { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isRelocatable = !isStatic || ((Q_MOVABLE_TYPE) & Q_RELOCATABLE_TYPE), isLarge = (sizeof(QCustomTypeInfo)>sizeof(void*)), isPointer = false, isIntegral = QtPrivate::is_integral< QCustomTypeInfo >::value, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QCustomTypeInfo) }; static inline const char *name() { return "QCustomTypeInfo"; } }; | - | ||||||||||||||||||||||||
| 105 | namespace { namespace Q_QGS_customTypes { typedef QVector<QCustomTypeInfo> Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QVector<QCustomTypeInfo>, Q_QGS_customTypes::innerFunction, Q_QGS_customTypes::guard> customTypes; | - | ||||||||||||||||||||||||
| 106 | namespace { namespace Q_QGS_customTypesLock { typedef QReadWriteLock Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QReadWriteLock, Q_QGS_customTypesLock::innerFunction, Q_QGS_customTypesLock::guard> customTypesLock; | - | ||||||||||||||||||||||||
| 107 | namespace { namespace Q_QGS_customTypesConversionRegistry { typedef QMetaTypeConverterRegistry Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QMetaTypeConverterRegistry, Q_QGS_customTypesConversionRegistry::innerFunction, Q_QGS_customTypesConversionRegistry::guard> customTypesConversionRegistry; | - | ||||||||||||||||||||||||
| 108 | namespace { namespace Q_QGS_customTypesComparatorRegistry { typedef QMetaTypeComparatorRegistry Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QMetaTypeComparatorRegistry, Q_QGS_customTypesComparatorRegistry::innerFunction, Q_QGS_customTypesComparatorRegistry::guard> customTypesComparatorRegistry; | - | ||||||||||||||||||||||||
| 109 | namespace { namespace Q_QGS_customTypesDebugStreamRegistry { typedef QMetaTypeDebugStreamRegistry Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QMetaTypeDebugStreamRegistry, Q_QGS_customTypesDebugStreamRegistry::innerFunction, Q_QGS_customTypesDebugStreamRegistry::guard> customTypesDebugStreamRegistry; | - | ||||||||||||||||||||||||
| 110 | bool QMetaType::registerConverterFunction(const QtPrivate::AbstractConverterFunction *f, int from, int to) | - | ||||||||||||||||||||||||
| 111 | { | - | ||||||||||||||||||||||||
| 112 | if (!customTypesConversionRegistry()->insertIfNotContains(qMakePair(from, to), f)) { | - | ||||||||||||||||||||||||
| 113 | QMessageLogger(__FILE__, 642648, __PRETTY_FUNCTION__).warning("Type conversion already registered from type %s to type %s", | - | ||||||||||||||||||||||||
| 114 | QMetaType::typeName(from), QMetaType::typeName(to)); | - | ||||||||||||||||||||||||
| 115 | return false; | - | ||||||||||||||||||||||||
| 116 | } | - | ||||||||||||||||||||||||
| 117 | return true; | - | ||||||||||||||||||||||||
| 118 | } | - | ||||||||||||||||||||||||
| 119 | - | |||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||
| 125 | void QMetaType::unregisterConverterFunction(int from, int to) | - | ||||||||||||||||||||||||
| 126 | { | - | ||||||||||||||||||||||||
| 127 | if (customTypesConversionRegistry.isDestroyed()) | - | ||||||||||||||||||||||||
| 128 | return; | - | ||||||||||||||||||||||||
| 129 | customTypesConversionRegistry()->remove(from, to); | - | ||||||||||||||||||||||||
| 130 | } | - | ||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||
| 132 | bool QMetaType::registerComparatorFunction(const QtPrivate::AbstractComparatorFunction *f, int type) | - | ||||||||||||||||||||||||
| 133 | { | - | ||||||||||||||||||||||||
| 134 | if (!customTypesComparatorRegistry()->insertIfNotContains(type, f)) { | - | ||||||||||||||||||||||||
| 135 | QMessageLogger(__FILE__, 664670, __PRETTY_FUNCTION__).warning("Comparators already registered for type %s", QMetaType::typeName(type)); | - | ||||||||||||||||||||||||
| 136 | return false; | - | ||||||||||||||||||||||||
| 137 | } | - | ||||||||||||||||||||||||
| 138 | return true; | - | ||||||||||||||||||||||||
| 139 | } | - | ||||||||||||||||||||||||
| 140 | bool QMetaType::hasRegisteredComparators(int typeId) | - | ||||||||||||||||||||||||
| 141 | { | - | ||||||||||||||||||||||||
| 142 | return customTypesComparatorRegistry()->contains(typeId); | - | ||||||||||||||||||||||||
| 143 | } | - | ||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||
| 146 | bool QMetaType::registerDebugStreamOperatorFunction(const QtPrivate::AbstractDebugStreamFunction *f, | - | ||||||||||||||||||||||||
| 147 | int type) | - | ||||||||||||||||||||||||
| 148 | { | - | ||||||||||||||||||||||||
| 149 | if (!customTypesDebugStreamRegistry()->insertIfNotContains(type, f)) { | - | ||||||||||||||||||||||||
| 150 | QMessageLogger(__FILE__, 690696, __PRETTY_FUNCTION__).warning("Debug stream operator already registered for type %s", QMetaType::typeName(type)); | - | ||||||||||||||||||||||||
| 151 | return false; | - | ||||||||||||||||||||||||
| 152 | } | - | ||||||||||||||||||||||||
| 153 | return true; | - | ||||||||||||||||||||||||
| 154 | } | - | ||||||||||||||||||||||||
| 155 | bool QMetaType::hasRegisteredDebugStreamOperator(int typeId) | - | ||||||||||||||||||||||||
| 156 | { | - | ||||||||||||||||||||||||
| 157 | return customTypesDebugStreamRegistry()->contains(typeId); | - | ||||||||||||||||||||||||
| 158 | } | - | ||||||||||||||||||||||||
| 159 | - | |||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||
| 161 | - | |||||||||||||||||||||||||
| 162 | - | |||||||||||||||||||||||||
| 163 | - | |||||||||||||||||||||||||
| 164 | - | |||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||
| 166 | bool QMetaType::convert(const void *from, int fromTypeId, void *to, int toTypeId) | - | ||||||||||||||||||||||||
| 167 | { | - | ||||||||||||||||||||||||
| 168 | const QtPrivate::AbstractConverterFunction * const f = | - | ||||||||||||||||||||||||
| 169 | customTypesConversionRegistry()->function(qMakePair(fromTypeId, toTypeId)); | - | ||||||||||||||||||||||||
| 170 | return f && f->convert(f, from, to); | - | ||||||||||||||||||||||||
| 171 | } | - | ||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||
| 173 | - | |||||||||||||||||||||||||
| 174 | - | |||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||
| 176 | - | |||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||
| 178 | - | |||||||||||||||||||||||||
| 179 | bool QMetaType::compare(const void *lhs, const void *rhs, int typeId, int* result) | - | ||||||||||||||||||||||||
| 180 | { | - | ||||||||||||||||||||||||
| 181 | const QtPrivate::AbstractComparatorFunction * const f = | - | ||||||||||||||||||||||||
| 182 | customTypesComparatorRegistry()->function(typeId); | - | ||||||||||||||||||||||||
| 183 | if (!f) | - | ||||||||||||||||||||||||
| 184 | return false; | - | ||||||||||||||||||||||||
| 185 | if (f->equals(f, lhs, rhs)) | - | ||||||||||||||||||||||||
| 186 | *result = 0; | - | ||||||||||||||||||||||||
| 187 | else if (f->lessThan) | - | ||||||||||||||||||||||||
| 188 | *result = f->lessThan(f, lhs, rhs) ? -1 : 1; | - | ||||||||||||||||||||||||
| 189 | else | - | ||||||||||||||||||||||||
| 190 | return false; | - | ||||||||||||||||||||||||
| 191 | return true; | - | ||||||||||||||||||||||||
| 192 | } | - | ||||||||||||||||||||||||
| 193 | - | |||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||
| 197 | - | |||||||||||||||||||||||||
| 198 | - | |||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||
| 200 | bool QMetaType::equals(const void *lhs, const void *rhs, int typeId, int *result) | - | ||||||||||||||||||||||||
| 201 | { | - | ||||||||||||||||||||||||
| 202 | const QtPrivate::AbstractComparatorFunction * const f | - | ||||||||||||||||||||||||
| 203 | = customTypesComparatorRegistry()->function(typeId); | - | ||||||||||||||||||||||||
| 204 | if (!f) | - | ||||||||||||||||||||||||
| 205 | return false; | - | ||||||||||||||||||||||||
| 206 | if (f->equals(f, lhs, rhs)) | - | ||||||||||||||||||||||||
| 207 | *result = 0; | - | ||||||||||||||||||||||||
| 208 | else | - | ||||||||||||||||||||||||
| 209 | *result = -1; | - | ||||||||||||||||||||||||
| 210 | return true; | - | ||||||||||||||||||||||||
| 211 | } | - | ||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||
| 214 | - | |||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||
| 216 | - | |||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||
| 218 | bool QMetaType::debugStream(QDebug& dbg, const void *rhs, int typeId) | - | ||||||||||||||||||||||||
| 219 | { | - | ||||||||||||||||||||||||
| 220 | const QtPrivate::AbstractDebugStreamFunction * const f = customTypesDebugStreamRegistry()->function(typeId); | - | ||||||||||||||||||||||||
| 221 | if (!f) | - | ||||||||||||||||||||||||
| 222 | return false; | - | ||||||||||||||||||||||||
| 223 | f->stream(f, dbg, rhs); | - | ||||||||||||||||||||||||
| 224 | return true; | - | ||||||||||||||||||||||||
| 225 | } | - | ||||||||||||||||||||||||
| 226 | bool QMetaType::hasRegisteredConverterFunction(int fromTypeId, int toTypeId) | - | ||||||||||||||||||||||||
| 227 | { | - | ||||||||||||||||||||||||
| 228 | return customTypesConversionRegistry()->contains(qMakePair(fromTypeId, toTypeId)); | - | ||||||||||||||||||||||||
| 229 | } | - | ||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||
| 231 | - | |||||||||||||||||||||||||
| 232 | - | |||||||||||||||||||||||||
| 233 | - | |||||||||||||||||||||||||
| 234 | - | |||||||||||||||||||||||||
| 235 | void QMetaType::registerStreamOperators(const char *typeName, SaveOperator saveOp, | - | ||||||||||||||||||||||||
| 236 | LoadOperator loadOp) | - | ||||||||||||||||||||||||
| 237 | { | - | ||||||||||||||||||||||||
| 238 | registerStreamOperators(type(typeName), saveOp, loadOp); | - | ||||||||||||||||||||||||
| 239 | } | - | ||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||
| 241 | - | |||||||||||||||||||||||||
| 242 | - | |||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||
| 244 | void QMetaType::registerStreamOperators(int idx, SaveOperator saveOp, | - | ||||||||||||||||||||||||
| 245 | LoadOperator loadOp) | - | ||||||||||||||||||||||||
| 246 | { | - | ||||||||||||||||||||||||
| 247 | if (idx < User) | - | ||||||||||||||||||||||||
| 248 | return; | - | ||||||||||||||||||||||||
| 249 | QVector<QCustomTypeInfo> *ct = customTypes(); | - | ||||||||||||||||||||||||
| 250 | if (!ct) | - | ||||||||||||||||||||||||
| 251 | return; | - | ||||||||||||||||||||||||
| 252 | QWriteLocker locker(customTypesLock()); | - | ||||||||||||||||||||||||
| 253 | QCustomTypeInfo &inf = (*ct)[idx - User]; | - | ||||||||||||||||||||||||
| 254 | inf.saveOp = saveOp; | - | ||||||||||||||||||||||||
| 255 | inf.loadOp = loadOp; | - | ||||||||||||||||||||||||
| 256 | } | - | ||||||||||||||||||||||||
| 257 | const char *QMetaType::typeName(int typeId) | - | ||||||||||||||||||||||||
| 258 | { | - | ||||||||||||||||||||||||
| 259 | const uint type = typeId; | - | ||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||
| 262 | - | |||||||||||||||||||||||||
| 263 | static const char *namesCache[QMetaType::HighestInternalId + 1]; | - | ||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||
| 265 | const char *result; | - | ||||||||||||||||||||||||
| 266 | if (type <= QMetaType::HighestInternalId
| 4684-44294 | ||||||||||||||||||||||||
| 267 | return executed 39610 times by 238 tests: resultreturn result;Executed by:
executed 39610 times by 238 tests: return result;Executed by:
executed 39610 times by 238 tests: ;return result;Executed by:
executed 39610 times by 238 tests: return result;Executed by:
| 39610 | ||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||
| 269 | - | |||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||
| 271 | - | |||||||||||||||||||||||||
| 272 | switch (QMetaType::Type(type)) { | - | ||||||||||||||||||||||||
| 273 | case executed 6 times by 6 tests: QMetaType::Void:case QMetaType::Void:Executed by:
executed 6 times by 6 tests: returnresult = "void"; break;case QMetaType::Void:Executed by:
executed 6 times by 6 tests: casebreak;Executed by:
executed 369 times by 169 tests: QMetaType::Bool:case QMetaType::Bool:Executed by:
executed 369 times by 169 tests: returnresult = "bool"; break;case QMetaType::Bool:Executed by:
executed 369 times by 169 tests: casebreak;Executed by:
executed 428 times by 204 tests: QMetaType::Int:case QMetaType::Int:Executed by:
executed 428 times by 204 tests: returnresult = "int"; break;case QMetaType::Int:Executed by:
executed 428 times by 204 tests: casebreak;Executed by:
executed 369 times by 169 tests: QMetaType::UInt:case QMetaType::UInt:Executed by:
executed 369 times by 169 tests: returnresult = "uint"; break;case QMetaType::UInt:Executed by:
executed 369 times by 169 tests: casebreak;Executed by:
executed 376 times by 176 tests: QMetaType::LongLong:case QMetaType::LongLong:Executed by:
executed 376 times by 176 tests: returnresult = "qlonglong"; break;case QMetaType::LongLong:Executed by:
executed 376 times by 176 tests: casebreak;Executed by:
executed 369 times by 169 tests: QMetaType::ULongLong:case QMetaType::ULongLong:Executed by:
executed 369 times by 169 tests: returnresult = "qulonglong"; break;case QMetaType::ULongLong:Executed by:
executed 369 times by 169 tests: casebreak;Executed by:
executed 372 times by 172 tests: QMetaType::Double:case QMetaType::Double:Executed by:
executed 372 times by 172 tests: returnresult = "double"; break;case QMetaType::Double:Executed by:
executed 372 times by 172 tests: casebreak;Executed by:
executed 4 times by 4 tests: QMetaType::Long:case QMetaType::Long:Executed by:
executed 4 times by 4 tests: returnresult = "long"; break;case QMetaType::Long:Executed by:
executed 4 times by 4 tests: casebreak;Executed by:
executed 368 times by 168 tests: QMetaType::Short:case QMetaType::Short:Executed by:
executed 368 times by 168 tests: returnresult = "short"; break;case QMetaType::Short:Executed by:
executed 368 times by 168 tests: casebreak;Executed by:
executed 3 times by 3 tests: QMetaType::Char:case QMetaType::Char:Executed by:
executed 3 times by 3 tests: returnresult = "char"; break;case QMetaType::Char:Executed by:
executed 3 times by 3 tests: casebreak;Executed by:
executed 3 times by 3 tests: QMetaType::ULong:case QMetaType::ULong:Executed by:
executed 3 times by 3 tests: returnresult = "ulong"; break;case QMetaType::ULong:Executed by:
executed 3 times by 3 tests: casebreak;Executed by:
executed 369 times by 169 tests: QMetaType::UShort:case QMetaType::UShort:Executed by:
executed 369 times by 169 tests: returnresult = "ushort"; break;case QMetaType::UShort:Executed by:
executed 369 times by 169 tests: casebreak;Executed by:
executed 12 times by 7 tests: QMetaType::UChar:case QMetaType::UChar:Executed by:
executed 12 times by 7 tests: returnresult = "uchar"; break;case QMetaType::UChar:Executed by:
executed 12 times by 7 tests: casebreak;Executed by:
executed 3 times by 3 tests: QMetaType::Float:case QMetaType::Float:Executed by:
executed 3 times by 3 tests: returnresult = "float"; break;case QMetaType::Float:Executed by:
executed 3 times by 3 tests: casebreak;Executed by:
executed 2 times by 2 tests: QMetaType::SChar:case QMetaType::SChar:Executed by:
executed 2 times by 2 tests: returnresult = "signed char"; break;case QMetaType::SChar:Executed by:
executed 2 times by 2 tests: casebreak;Executed by:
executed 168 times by 163 tests: QMetaType::VoidStar:case QMetaType::VoidStar:Executed by:
executed 168 times by 163 tests: returnresult = "void*"; break;case QMetaType::VoidStar:Executed by:
executed 168 times by 163 tests: casebreak;Executed by:
executed 3 times by 3 tests: QMetaType::QChar:case QMetaType::QChar:Executed by:
executed 3 times by 3 tests: returnresult = "QChar"; break;case QMetaType::QChar:Executed by:
executed 3 times by 3 tests: casebreak;Executed by:
executed 219 times by 181 tests: QMetaType::QString:case QMetaType::QString:Executed by:
executed 219 times by 181 tests: returnresult = "QString"; break;case QMetaType::QString:Executed by:
executed 219 times by 181 tests: casebreak;Executed by:
executed 31 times by 26 tests: QMetaType::QStringList:case QMetaType::QStringList:Executed by:
executed 31 times by 26 tests: returnresult = "QStringList"; break;case QMetaType::QStringList:Executed by:
executed 31 times by 26 tests: casebreak;Executed by:
executed 24 times by 19 tests: QMetaType::QByteArray:case QMetaType::QByteArray:Executed by:
executed 24 times by 19 tests: returnresult = "QByteArray"; break;case QMetaType::QByteArray:Executed by:
executed 24 times by 19 tests: casebreak;Executed by:
executed 2 times by 2 tests: QMetaType::QBitArray:case QMetaType::QBitArray:Executed by:
executed 2 times by 2 tests: returnresult = "QBitArray"; break;case QMetaType::QBitArray:Executed by:
executed 2 times by 2 tests: casebreak;Executed by:
executed 57 times by 5 tests: QMetaType::QDate:case QMetaType::QDate:Executed by:
executed 57 times by 5 tests: returnresult = "QDate"; break;case QMetaType::QDate:Executed by:
executed 57 times by 5 tests: casebreak;Executed by:
executed 57 times by 5 tests: QMetaType::QTime:case QMetaType::QTime:Executed by:
executed 57 times by 5 tests: returnresult = "QTime"; break;case QMetaType::QTime:Executed by:
executed 57 times by 5 tests: casebreak;Executed by:
executed 60 times by 8 tests: QMetaType::QDateTime:case QMetaType::QDateTime:Executed by:
executed 60 times by 8 tests: returnresult = "QDateTime"; break;case QMetaType::QDateTime:Executed by:
executed 60 times by 8 tests: casebreak;Executed by:
executed 8 times by 8 tests: QMetaType::QUrl:case QMetaType::QUrl:Executed by:
executed 8 times by 8 tests: returnresult = "QUrl"; break;case QMetaType::QUrl:Executed by:
executed 8 times by 8 tests: casebreak;Executed by:
executed 3 times by 3 tests: QMetaType::QLocale:case QMetaType::QLocale:Executed by:
executed 3 times by 3 tests: returnresult = "QLocale"; break;case QMetaType::QLocale:Executed by:
executed 3 times by 3 tests: casebreak;Executed by:
executed 68 times by 16 tests: QMetaType::QRect:case QMetaType::QRect:Executed by:
executed 68 times by 16 tests: returnresult = "QRect"; break;case QMetaType::QRect:Executed by:
executed 68 times by 16 tests: casebreak;Executed by:
executed 60 times by 8 tests: QMetaType::QRectF:case QMetaType::QRectF:Executed by:
executed 60 times by 8 tests: returnresult = "QRectF"; break;case QMetaType::QRectF:Executed by:
executed 60 times by 8 tests: casebreak;Executed by:
executed 58 times by 6 tests: QMetaType::QSize:case QMetaType::QSize:Executed by:
executed 58 times by 6 tests: returnresult = "QSize"; break;case QMetaType::QSize:Executed by:
executed 58 times by 6 tests: casebreak;Executed by:
executed 57 times by 5 tests: QMetaType::QSizeF:case QMetaType::QSizeF:Executed by:
executed 57 times by 5 tests: returnresult = "QSizeF"; break;case QMetaType::QSizeF:Executed by:
executed 57 times by 5 tests: casebreak;Executed by:
executed 56 times by 4 tests: QMetaType::QLine:case QMetaType::QLine:Executed by:
executed 56 times by 4 tests: returnresult = "QLine"; break;case QMetaType::QLine:Executed by:
executed 56 times by 4 tests: casebreak;Executed by:
executed 56 times by 4 tests: QMetaType::QLineF:case QMetaType::QLineF:Executed by:
executed 56 times by 4 tests: returnresult = "QLineF"; break;case QMetaType::QLineF:Executed by:
executed 56 times by 4 tests: casebreak;Executed by:
executed 65 times by 13 tests: QMetaType::QPoint:case QMetaType::QPoint:Executed by:
executed 65 times by 13 tests: returnresult = "QPoint"; break;case QMetaType::QPoint:Executed by:
executed 65 times by 13 tests: casebreak;Executed by:
executed 59 times by 7 tests: QMetaType::QPointF:case QMetaType::QPointF:Executed by:
executed 59 times by 7 tests: returnresult = "QPointF"; break;case QMetaType::QPointF:Executed by:
executed 59 times by 7 tests: casebreak;Executed by:
executed 2 times by 2 tests: QMetaType::QRegExp:case QMetaType::QRegExp:Executed by:
executed 2 times by 2 tests: returnresult = "QRegExp"; break;case QMetaType::QRegExp:Executed by:
executed 2 times by 2 tests: casebreak;Executed by:
executed 3 times by 3 tests: QMetaType::QEasingCurve:case QMetaType::QEasingCurve:Executed by:
executed 3 times by 3 tests: returnresult = "QEasingCurve"; break;case QMetaType::QEasingCurve:Executed by:
executed 3 times by 3 tests: casebreak;Executed by:
executed 2 times by 2 tests: QMetaType::QUuid:case QMetaType::QUuid:Executed by:
executed 2 times by 2 tests: returnresult = "QUuid"; break;case QMetaType::QUuid:Executed by:
executed 2 times by 2 tests: casebreak;Executed by:
executed 119 times by 95 tests: QMetaType::QVariant:case QMetaType::QVariant:Executed by:
executed 119 times by 95 tests: returnresult = "QVariant"; break;case QMetaType::QVariant:Executed by:
executed 119 times by 95 tests: casebreak;Executed by:
executed 12 times by 12 tests: QMetaType::QModelIndex:case QMetaType::QModelIndex:Executed by:
executed 12 times by 12 tests: returnresult = "QModelIndex"; break;case QMetaType::QModelIndex:Executed by:
executed 12 times by 12 tests: casebreak;Executed by:
executed 2 times by 2 tests: QMetaType::QRegularExpression:case QMetaType::QRegularExpression:Executed by:
executed 2 times by 2 tests: returnresult = "QRegularExpression"; break;case QMetaType::QRegularExpression:Executed by:
executed 2 times by 2 tests: casebreak;Executed by:
executed 2 times by 2 tests: QMetaType::QJsonValue:case QMetaType::QJsonValue:Executed by:
executed 2 times by 2 tests: returnresult = "QJsonValue"; break;case QMetaType::QJsonValue:Executed by:
executed 2 times by 2 tests: casebreak;Executed by:
executed 2 times by 2 tests: QMetaType::QJsonObject:case QMetaType::QJsonObject:Executed by:
executed 2 times by 2 tests: returnresult = "QJsonObject"; break;case QMetaType::QJsonObject:Executed by:
executed 2 times by 2 tests: casebreak;Executed by:
executed 2 times by 2 tests: QMetaType::QJsonArray:case QMetaType::QJsonArray:Executed by:
executed 2 times by 2 tests: returnresult = "QJsonArray"; break;case QMetaType::QJsonArray:Executed by:
executed 2 times by 2 tests: casebreak;Executed by:
executed 2 times by 2 tests: QMetaType::QJsonDocument:case QMetaType::QJsonDocument:Executed by:
executed 2 times by 2 tests: returnresult = "QJsonDocument"; break;case QMetaType::QJsonDocument:Executed by:
executed 2 times by 2 tests: casebreak;Executed by:
executed 3 times by 3 tests: QMetaType::QPersistentModelIndex:case QMetaType::QPersistentModelIndex:Executed by:
executed 3 times by 3 tests: returnresult = "QPersistentModelIndex"; break;case QMetaType::QPersistentModelIndex:Executed by:
executed 3 times by 3 tests: casebreak;Executed by:
executed 20 times by 20 tests: QMetaType::QObjectStar:case QMetaType::QObjectStar:Executed by:
executed 20 times by 20 tests: returnresult = "QObject*"; break;case QMetaType::QObjectStar:Executed by:
executed 20 times by 20 tests: casebreak;Executed by:
executed 75 times by 22 tests: QMetaType::QVariantMap:case QMetaType::QVariantMap:Executed by:
executed 75 times by 22 tests: returnresult = "QVariantMap"; break;case QMetaType::QVariantMap:Executed by:
executed 75 times by 22 tests: casebreak;Executed by:
executed 18 times by 13 tests: QMetaType::QVariantList:case QMetaType::QVariantList:Executed by:
executed 18 times by 13 tests: returnresult = "QVariantList"; break;case QMetaType::QVariantList:Executed by:
executed 18 times by 13 tests: casebreak;Executed by:
executed 83 times by 7 tests: QMetaType::QVariantHash:case QMetaType::QVariantHash:Executed by:
executed 83 times by 7 tests: returnresult = "QVariantHash"; break;case QMetaType::QVariantHash:Executed by:
executed 83 times by 7 tests: casebreak;Executed by:
executed 2 times by 2 tests: QMetaType::QByteArrayList:case QMetaType::QByteArrayList:Executed by:
executed 2 times by 2 tests: returnresult = "QByteArrayList"; break;case QMetaType::QByteArrayList:Executed by:
executed 2 times by 2 tests: casebreak;Executed by:
executed 4 times by 4 tests: QMetaType::QFont:case QMetaType::QFont:Executed by:
executed 4 times by 4 tests: returnresult = "QFont"; break;case QMetaType::QFont:Executed by:
executed 4 times by 4 tests: casebreak;Executed by:
executed 4 times by 4 tests: QMetaType::QPixmap:case QMetaType::QPixmap:Executed by:
executed 4 times by 4 tests: returnresult = "QPixmap"; break;case QMetaType::QPixmap:Executed by:
executed 4 times by 4 tests: casebreak;Executed by:
executed 4 times by 4 tests: QMetaType::QBrush:case QMetaType::QBrush:Executed by:
executed 4 times by 4 tests: returnresult = "QBrush"; break;case QMetaType::QBrush:Executed by:
executed 4 times by 4 tests: casebreak;Executed by:
executed 4 times by 4 tests: QMetaType::QColor:case QMetaType::QColor:Executed by:
executed 4 times by 4 tests: returnresult = "QColor"; break;case QMetaType::QColor:Executed by:
executed 4 times by 4 tests: casebreak;Executed by:
executed 5 times by 5 tests: QMetaType::QPalette:case QMetaType::QPalette:Executed by:
executed 5 times by 5 tests: returnresult = "QPalette"; break;case QMetaType::QPalette:Executed by:
executed 5 times by 5 tests: casebreak;Executed by:
executed 11 times by 11 tests: QMetaType::QIcon:case QMetaType::QIcon:Executed by:
executed 11 times by 11 tests: returnresult = "QIcon"; break;case QMetaType::QIcon:Executed by:
executed 11 times by 11 tests: casebreak;Executed by:
executed 5 times by 5 tests: QMetaType::QImage:case QMetaType::QImage:Executed by:
executed 5 times by 5 tests: returnresult = "QImage"; break;case QMetaType::QImage:Executed by:
executed 5 times by 5 tests: casebreak;Executed by:
executed 4 times by 4 tests: QMetaType::QPolygon:case QMetaType::QPolygon:Executed by:
executed 4 times by 4 tests: returnresult = "QPolygon"; break;case QMetaType::QPolygon:Executed by:
executed 4 times by 4 tests: casebreak;Executed by:
executed 4 times by 4 tests: QMetaType::QRegion:case QMetaType::QRegion:Executed by:
executed 4 times by 4 tests: returnresult = "QRegion"; break;case QMetaType::QRegion:Executed by:
executed 4 times by 4 tests: casebreak;Executed by:
executed 4 times by 4 tests: QMetaType::QBitmap:case QMetaType::QBitmap:Executed by:
executed 4 times by 4 tests: returnresult = "QBitmap"; break;case QMetaType::QBitmap:Executed by:
executed 4 times by 4 tests: casebreak;Executed by:
executed 4 times by 4 tests: QMetaType::QCursor:case QMetaType::QCursor:Executed by:
executed 4 times by 4 tests: returnresult = "QCursor"; break;case QMetaType::QCursor:Executed by:
executed 4 times by 4 tests: casebreak;Executed by:
executed 5 times by 5 tests: QMetaType::QKeySequence:case QMetaType::QKeySequence:Executed by:
executed 5 times by 5 tests: returnresult = "QKeySequence"; break;case QMetaType::QKeySequence:Executed by:
executed 5 times by 5 tests: casebreak;Executed by:
executed 4 times by 4 tests: QMetaType::QPen:case QMetaType::QPen:Executed by:
executed 4 times by 4 tests: returnresult = "QPen"; break;case QMetaType::QPen:Executed by:
executed 4 times by 4 tests: casebreak;Executed by:
executed 4 times by 4 tests: QMetaType::QTextLength:case QMetaType::QTextLength:Executed by:
executed 4 times by 4 tests: returnresult = "QTextLength"; break;case QMetaType::QTextLength:Executed by:
executed 4 times by 4 tests: casebreak;Executed by:
executed 4 times by 4 tests: QMetaType::QTextFormat:case QMetaType::QTextFormat:Executed by:
executed 4 times by 4 tests: returnresult = "QTextFormat"; break;case QMetaType::QTextFormat:Executed by:
executed 4 times by 4 tests: casebreak;Executed by:
executed 5 times by 5 tests: QMetaType::QMatrix:case QMetaType::QMatrix:Executed by:
executed 5 times by 5 tests: returnresult = "QMatrix"; break;case QMetaType::QMatrix:Executed by:
executed 5 times by 5 tests: casebreak;Executed by:
executed 5 times by 5 tests: QMetaType::QTransform:case QMetaType::QTransform:Executed by:
executed 5 times by 5 tests: returnresult = "QTransform"; break;case QMetaType::QTransform:Executed by:
executed 5 times by 5 tests: casebreak;Executed by:
executed 5 times by 5 tests: QMetaType::QMatrix4x4:case QMetaType::QMatrix4x4:Executed by:
executed 5 times by 5 tests: returnresult = "QMatrix4x4"; break;case QMetaType::QMatrix4x4:Executed by:
executed 5 times by 5 tests: casebreak;Executed by:
executed 5 times by 5 tests: QMetaType::QVector2D:case QMetaType::QVector2D:Executed by:
executed 5 times by 5 tests: returnresult = "QVector2D"; break;case QMetaType::QVector2D:Executed by:
executed 5 times by 5 tests: casebreak;Executed by:
executed 5 times by 5 tests: QMetaType::QVector3D:case QMetaType::QVector3D:Executed by:
executed 5 times by 5 tests: returnresult = "QVector3D"; break;case QMetaType::QVector3D:Executed by:
executed 5 times by 5 tests: casebreak;Executed by:
executed 5 times by 5 tests: QMetaType::QVector4D:case QMetaType::QVector4D:Executed by:
executed 5 times by 5 tests: returnresult = "QVector4D"; break;case QMetaType::QVector4D:Executed by:
executed 5 times by 5 tests: casebreak;Executed by:
executed 5 times by 5 tests: QMetaType::QQuaternion:case QMetaType::QQuaternion:Executed by:
executed 5 times by 5 tests: returnresult = "QQuaternion"; break;case QMetaType::QQuaternion:Executed by:
executed 5 times by 5 tests: casebreak;Executed by:
executed 3 times by 3 tests: QMetaType::QPolygonF:case QMetaType::QPolygonF:Executed by:
executed 3 times by 3 tests: returnresult = "QPolygonF"; break;case QMetaType::QPolygonF:Executed by:
executed 3 times by 3 tests: casebreak;Executed by:
executed 3 times by 3 tests: QMetaType::QSizePolicy:case QMetaType::QSizePolicy:Executed by:
executed 3 times by 3 tests: returnresult = "QSizePolicy"; break;case QMetaType::QSizePolicy:Executed by:
executed 3 times by 3 tests: break;Executed by:
| 2-428 | ||||||||||||||||||||||||
| 274 | - | |||||||||||||||||||||||||
| 275 | case QMetaType::UnknownType: | 7779 | ||||||||||||||||||||||||
| case QMetaType::Userdefault executed 7779 times by 197 tests: default:Executed by:
executed 7779 times by 197 tests: :default:Executed by:
executed 7779 times by 197 tests: break;default:Executed by:
| ||||||||||||||||||||||||||
| }{ | ||||||||||||||||||||||||||
| 276 | if (__builtin_expect(!!(type < QMetaType::User), false)
| 962-6817 | ||||||||||||||||||||||||
| 277 | return executed 962 times by 5 tests: nullptr0;return 0;Executed by:
executed 962 times by 5 tests: return 0;Executed by:
| 962 | ||||||||||||||||||||||||
| 278 | } else { | - | ||||||||||||||||||||||||
| 279 | const QVector<QCustomTypeInfo> * const ct = customTypes(); | - | ||||||||||||||||||||||||
| 280 | QReadLocker locker(customTypesLock()); | - | ||||||||||||||||||||||||
| 281 | return executed 6817 times by 195 tests: ct && uint(ct->count()) > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty()return ct && uint(ct->count()) > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty() ? ct->at(type - QMetaType::User).typeName.constData() : 0;Executed by:
executed 6817 times by 195 tests: return ct && uint(ct->count()) > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty() ? ct->at(type - QMetaType::User).typeName.constData() : 0;Executed by:
| 6817 | ||||||||||||||||||||||||
| 282 | ? ct->at(type - QMetaType::User).typeName.constData() executed 6817 times by 195 tests: return ct && uint(ct->count()) > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty() ? ct->at(type - QMetaType::User).typeName.constData() : 0;Executed by:
| 6817 | ||||||||||||||||||||||||
| 283 | : nullptr0; executed 6817 times by 195 tests: return ct && uint(ct->count()) > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty() ? ct->at(type - QMetaType::User).typeName.constData() : 0;Executed by:
| 6817 | ||||||||||||||||||||||||
| 284 | } | - | ||||||||||||||||||||||||
| 285 | } | - | ||||||||||||||||||||||||
| 286 | } | - | ||||||||||||||||||||||||
| 287 | - | |||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||
| 289 | ((!(type <= QMetaType::HighestInternalId)) ? qt_assert("type <= QMetaType::HighestInternalId",__FILE__,868) : qt_noop()); | - | ||||||||||||||||||||||||
| 290 | namesCache[type] = result; | - | ||||||||||||||||||||||||
| 291 | return executed 4624 times by 241 tests: resultreturn result;Executed by:
executed 4624 times by 241 tests: return result;Executed by:
executed 4624 times by 241 tests: ;return result;Executed by:
executed 4624 times by 241 tests: return result;Executed by:
| 4624 | ||||||||||||||||||||||||
| 292 | } | - | ||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||
| 295 | - | |||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||
| 297 | - | |||||||||||||||||||||||||
| 298 | static inline int qMetaTypeStaticType(const char *typeName, int length) | - | ||||||||||||||||||||||||
| 299 | { | - | ||||||||||||||||||||||||
| 300 | int i = 0; | - | ||||||||||||||||||||||||
| 301 | while (types[i].typeName && ((length != types[i].typeNameLength) | - | ||||||||||||||||||||||||
| 302 | || memcmp(typeName, types[i].typeName, length))) { | - | ||||||||||||||||||||||||
| 303 | ++i; | - | ||||||||||||||||||||||||
| 304 | } | - | ||||||||||||||||||||||||
| 305 | return types[i].type; | - | ||||||||||||||||||||||||
| 306 | } | - | ||||||||||||||||||||||||
| 307 | static int qMetaTypeCustomType_unlocked(const char *typeName, int length, int *firstInvalidIndex = 0) | - | ||||||||||||||||||||||||
| 308 | { | - | ||||||||||||||||||||||||
| 309 | const QVector<QCustomTypeInfo> * const ct = customTypes(); | - | ||||||||||||||||||||||||
| 310 | if (!ct) | - | ||||||||||||||||||||||||
| 311 | return QMetaType::UnknownType; | - | ||||||||||||||||||||||||
| 312 | - | |||||||||||||||||||||||||
| 313 | if (firstInvalidIndex) | - | ||||||||||||||||||||||||
| 314 | *firstInvalidIndex = -1; | - | ||||||||||||||||||||||||
| 315 | for (int v = 0; v < ct->count(); ++v) { | - | ||||||||||||||||||||||||
| 316 | const QCustomTypeInfo &customInfo = ct->at(v); | - | ||||||||||||||||||||||||
| 317 | if ((length == customInfo.typeName.size()) | - | ||||||||||||||||||||||||
| 318 | && !memcmp(typeName, customInfo.typeName.constData(), length)) { | - | ||||||||||||||||||||||||
| 319 | if (customInfo.alias >= 0) | - | ||||||||||||||||||||||||
| 320 | return customInfo.alias; | - | ||||||||||||||||||||||||
| 321 | return v + QMetaType::User; | - | ||||||||||||||||||||||||
| 322 | } | - | ||||||||||||||||||||||||
| 323 | if (firstInvalidIndex && (*firstInvalidIndex < 0) && customInfo.typeName.isEmpty()) | - | ||||||||||||||||||||||||
| 324 | *firstInvalidIndex = v; | - | ||||||||||||||||||||||||
| 325 | } | - | ||||||||||||||||||||||||
| 326 | return QMetaType::UnknownType; | - | ||||||||||||||||||||||||
| 327 | } | - | ||||||||||||||||||||||||
| 328 | - | |||||||||||||||||||||||||
| 329 | - | |||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||
| 332 | - | |||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||
| 335 | int QMetaType::registerType(const char *typeName, Deleter deleter, | - | ||||||||||||||||||||||||
| 336 | Creator creator) | - | ||||||||||||||||||||||||
| 337 | { | - | ||||||||||||||||||||||||
| 338 | return registerType(typeName, deleter, creator, | - | ||||||||||||||||||||||||
| 339 | QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Destruct, | - | ||||||||||||||||||||||||
| 340 | QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Construct, 0, TypeFlags(), 0); | - | ||||||||||||||||||||||||
| 341 | } | - | ||||||||||||||||||||||||
| 342 | bool QMetaType::unregisterType(int type) | - | ||||||||||||||||||||||||
| 343 | { | - | ||||||||||||||||||||||||
| 344 | QWriteLocker locker(customTypesLock()); | - | ||||||||||||||||||||||||
| 345 | QVector<QCustomTypeInfo> *ct = customTypes(); | - | ||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||
| 348 | if ((type < User) || ((type - User) >= ct->size())) | - | ||||||||||||||||||||||||
| 349 | return false; | - | ||||||||||||||||||||||||
| 350 | - | |||||||||||||||||||||||||
| 351 | - | |||||||||||||||||||||||||
| 352 | if (ct->data()[type - User].flags & WasDeclaredAsMetaType) | - | ||||||||||||||||||||||||
| 353 | return false; | - | ||||||||||||||||||||||||
| 354 | - | |||||||||||||||||||||||||
| 355 | - | |||||||||||||||||||||||||
| 356 | for (int v = 0; v < ct->count(); ++v) { | - | ||||||||||||||||||||||||
| 357 | if (((v + User) == type) || (ct->at(v).alias == type)) | - | ||||||||||||||||||||||||
| 358 | ct->data()[v].typeName.clear(); | - | ||||||||||||||||||||||||
| 359 | } | - | ||||||||||||||||||||||||
| 360 | return true; | - | ||||||||||||||||||||||||
| 361 | } | - | ||||||||||||||||||||||||
| 362 | int QMetaType::registerType(const char *typeName, Deleter deleter, | - | ||||||||||||||||||||||||
| 363 | Creator creator, | - | ||||||||||||||||||||||||
| 364 | Destructor destructor, | - | ||||||||||||||||||||||||
| 365 | Constructor constructor, | - | ||||||||||||||||||||||||
| 366 | int size, TypeFlags flags, const QMetaObject *metaObject) | - | ||||||||||||||||||||||||
| 367 | { | - | ||||||||||||||||||||||||
| 368 | - | |||||||||||||||||||||||||
| 369 | - | |||||||||||||||||||||||||
| 370 | - | |||||||||||||||||||||||||
| 371 | ::QByteArray normalizedTypeName = QMetaObject::normalizedType(typeName); | - | ||||||||||||||||||||||||
| 372 | - | |||||||||||||||||||||||||
| 373 | - | |||||||||||||||||||||||||
| 374 | return registerNormalizedType(normalizedTypeName, deleter, creator, destructor, constructor, size, flags, metaObject); | - | ||||||||||||||||||||||||
| 375 | } | - | ||||||||||||||||||||||||
| 376 | int QMetaType::registerNormalizedType(const ::QByteArray &normalizedTypeName, Deleter deleter, | - | ||||||||||||||||||||||||
| 377 | Creator creator, | - | ||||||||||||||||||||||||
| 378 | Destructor destructor, | - | ||||||||||||||||||||||||
| 379 | Constructor constructor, | - | ||||||||||||||||||||||||
| 380 | int size, TypeFlags flags, const QMetaObject *metaObject) | - | ||||||||||||||||||||||||
| 381 | { | - | ||||||||||||||||||||||||
| 382 | (void)deleter;; | - | ||||||||||||||||||||||||
| 383 | (void)creator;; | - | ||||||||||||||||||||||||
| 384 | return registerNormalizedType(normalizedTypeName, destructor, constructor, size, flags, metaObject); | - | ||||||||||||||||||||||||
| 385 | } | - | ||||||||||||||||||||||||
| 386 | int QMetaType::registerNormalizedType(const ::QByteArray &normalizedTypeName, | - | ||||||||||||||||||||||||
| 387 | Destructor destructor, | - | ||||||||||||||||||||||||
| 388 | Constructor constructor, | - | ||||||||||||||||||||||||
| 389 | int size, TypeFlags flags, const QMetaObject *metaObject) | - | ||||||||||||||||||||||||
| 390 | { | - | ||||||||||||||||||||||||
| 391 | QVector<QCustomTypeInfo> *ct = customTypes(); | - | ||||||||||||||||||||||||
| 392 | if (!ct
| 0-24484 | ||||||||||||||||||||||||
| 393 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 394 | - | |||||||||||||||||||||||||
| 395 | int idx = qMetaTypeStaticType(normalizedTypeName.constData(), | - | ||||||||||||||||||||||||
| 396 | normalizedTypeName.size()); | - | ||||||||||||||||||||||||
| 397 | - | |||||||||||||||||||||||||
| 398 | int previousSize = 0; | - | ||||||||||||||||||||||||
| 399 | int previousFlags = 0; | - | ||||||||||||||||||||||||
| 400 | if (idx == UnknownType
| 0-24484 | ||||||||||||||||||||||||
| 401 | QWriteLocker locker(customTypesLock()); | - | ||||||||||||||||||||||||
| 402 | int posInVector = -1; | - | ||||||||||||||||||||||||
| 403 | idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), | - | ||||||||||||||||||||||||
| 404 | normalizedTypeName.size(), | - | ||||||||||||||||||||||||
| 405 | &posInVector); | - | ||||||||||||||||||||||||
| 406 | if (idx == UnknownType
| 12024-12460 | ||||||||||||||||||||||||
| 407 | QCustomTypeInfo inf; | - | ||||||||||||||||||||||||
| 408 | inf.typeName = normalizedTypeName; | - | ||||||||||||||||||||||||
| 409 | - | |||||||||||||||||||||||||
| 410 | inf.loadOp = 0; | - | ||||||||||||||||||||||||
| 411 | inf.saveOp = 0; | - | ||||||||||||||||||||||||
| 412 | - | |||||||||||||||||||||||||
| 413 | inf.alias = -1; | - | ||||||||||||||||||||||||
| 414 | inf.constructor = constructor; | - | ||||||||||||||||||||||||
| 415 | inf.destructor = destructor; | - | ||||||||||||||||||||||||
| 416 | inf.size = size; | - | ||||||||||||||||||||||||
| 417 | inf.flags = flags; | - | ||||||||||||||||||||||||
| 418 | inf.metaObject = metaObject; | - | ||||||||||||||||||||||||
| 419 | if (posInVector == -1
| 3-12021 | ||||||||||||||||||||||||
| 420 | idx = ct->size() + User; | - | ||||||||||||||||||||||||
| 421 | ct->append(inf); | - | ||||||||||||||||||||||||
| 422 | } executed 12021 times by 321 tests: else {end of blockExecuted by:
| 12021 | ||||||||||||||||||||||||
| 423 | idx = posInVector + User; | - | ||||||||||||||||||||||||
| 424 | ct->data()[posInVector] = inf; | - | ||||||||||||||||||||||||
| 425 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 426 | return executed 12024 times by 321 tests: idx;return idx;Executed by:
executed 12024 times by 321 tests: return idx;Executed by:
| 12024 | ||||||||||||||||||||||||
| 427 | } | - | ||||||||||||||||||||||||
| 428 | - | |||||||||||||||||||||||||
| 429 | if (idx >= User
| 0-12460 | ||||||||||||||||||||||||
| 430 | previousSize = ct->at(idx - User).size; | - | ||||||||||||||||||||||||
| 431 | previousFlags = ct->at(idx - User).flags; | - | ||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||
| 435 | - | |||||||||||||||||||||||||
| 436 | if (flags != previousFlags
| 0-12460 | ||||||||||||||||||||||||
| 437 | QCustomTypeInfo &inf = ct->data()[idx - User]; | - | ||||||||||||||||||||||||
| 438 | inf.flags |= flags; | - | ||||||||||||||||||||||||
| 439 | if (metaObject
| 0 | ||||||||||||||||||||||||
| 440 | inf.metaObject = metaObject; never executed: inf.metaObject = metaObject; | 0 | ||||||||||||||||||||||||
| 441 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 442 | } executed 12460 times by 83 tests: end of blockExecuted by:
| 12460 | ||||||||||||||||||||||||
| 443 | } executed 12460 times by 83 tests: end of blockExecuted by:
| 12460 | ||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||
| 445 | if (idx < User
| 0-12460 | ||||||||||||||||||||||||
| 446 | previousSize = QMetaType::sizeOf(idx); | - | ||||||||||||||||||||||||
| 447 | previousFlags = QMetaType::typeFlags(idx); | - | ||||||||||||||||||||||||
| 448 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 449 | - | |||||||||||||||||||||||||
| 450 | if (__builtin_expect(!!(
| 0-12460 | ||||||||||||||||||||||||
| 451 | QMessageLogger(__FILE__, 10671084, __PRETTY_FUNCTION__).fatal("QMetaType::registerType: Binary compatibility break " | - | ||||||||||||||||||||||||
| 452 | "-- Size mismatch for type '%s' [%i]. Previously registered " | - | ||||||||||||||||||||||||
| 453 | "size %i, now registering size %i.", | - | ||||||||||||||||||||||||
| 454 | normalizedTypeName.constData(), idx, previousSize, size); | - | ||||||||||||||||||||||||
| 455 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||
| 458 | const int binaryCompatibilityFlag = PointerToQObject | IsEnumeration | SharedPointerToQObject | - | ||||||||||||||||||||||||
| 459 | | WeakPointerToQObject | TrackingPointerToQObject; | - | ||||||||||||||||||||||||
| 460 | if (((__builtin_expect(!!((
| 0-12460 | ||||||||||||||||||||||||
| 461 | - | |||||||||||||||||||||||||
| 462 | const char *msg = "QMetaType::registerType: Binary compatibility break. " | - | ||||||||||||||||||||||||
| 463 | "\nType flags for type '%s' [%i] don't match. Previously " | - | ||||||||||||||||||||||||
| 464 | "registered TypeFlags(0x%x), now registering TypeFlags(0x%x). "; | - | ||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||
| 466 | QMessageLogger(__FILE__, 10821099, __PRETTY_FUNCTION__).fatal(msg, normalizedTypeName.constData(), idx, previousFlags, int(flags)); | - | ||||||||||||||||||||||||
| 467 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 468 | - | |||||||||||||||||||||||||
| 469 | return executed 12460 times by 83 tests: idx;return idx;Executed by:
executed 12460 times by 83 tests: return idx;Executed by:
| 12460 | ||||||||||||||||||||||||
| 470 | } | - | ||||||||||||||||||||||||
| 471 | - | |||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||
| 473 | - | |||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||
| 475 | - | |||||||||||||||||||||||||
| 476 | - | |||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||
| 478 | int QMetaType::registerTypedef(const char* typeName, int aliasId) | - | ||||||||||||||||||||||||
| 479 | { | - | ||||||||||||||||||||||||
| 480 | - | |||||||||||||||||||||||||
| 481 | - | |||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||
| 483 | ::QByteArray normalizedTypeName = QMetaObject::normalizedType(typeName); | - | ||||||||||||||||||||||||
| 484 | - | |||||||||||||||||||||||||
| 485 | - | |||||||||||||||||||||||||
| 486 | return registerNormalizedTypedef(normalizedTypeName, aliasId); | - | ||||||||||||||||||||||||
| 487 | } | - | ||||||||||||||||||||||||
| 488 | int QMetaType::registerNormalizedTypedef(const ::QByteArray &normalizedTypeName, int aliasId) | - | ||||||||||||||||||||||||
| 489 | { | - | ||||||||||||||||||||||||
| 490 | QVector<QCustomTypeInfo> *ct = customTypes(); | - | ||||||||||||||||||||||||
| 491 | if (!ct || normalizedTypeName.isEmpty()) | - | ||||||||||||||||||||||||
| 492 | return -1; | - | ||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||
| 494 | int idx = qMetaTypeStaticType(normalizedTypeName.constData(), | - | ||||||||||||||||||||||||
| 495 | normalizedTypeName.size()); | - | ||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||
| 497 | if (idx == UnknownType) { | - | ||||||||||||||||||||||||
| 498 | QWriteLocker locker(customTypesLock()); | - | ||||||||||||||||||||||||
| 499 | int posInVector = -1; | - | ||||||||||||||||||||||||
| 500 | idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), | - | ||||||||||||||||||||||||
| 501 | normalizedTypeName.size(), | - | ||||||||||||||||||||||||
| 502 | &posInVector); | - | ||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||
| 504 | if (idx == UnknownType) { | - | ||||||||||||||||||||||||
| 505 | QCustomTypeInfo inf; | - | ||||||||||||||||||||||||
| 506 | inf.typeName = normalizedTypeName; | - | ||||||||||||||||||||||||
| 507 | inf.alias = aliasId; | - | ||||||||||||||||||||||||
| 508 | if (posInVector == -1) | - | ||||||||||||||||||||||||
| 509 | ct->append(inf); | - | ||||||||||||||||||||||||
| 510 | else | - | ||||||||||||||||||||||||
| 511 | ct->data()[posInVector] = inf; | - | ||||||||||||||||||||||||
| 512 | return aliasId; | - | ||||||||||||||||||||||||
| 513 | } | - | ||||||||||||||||||||||||
| 514 | } | - | ||||||||||||||||||||||||
| 515 | - | |||||||||||||||||||||||||
| 516 | if (idx != aliasId) { | - | ||||||||||||||||||||||||
| 517 | QMessageLogger(__FILE__, 11421159, __PRETTY_FUNCTION__).warning("QMetaType::registerTypedef: " | - | ||||||||||||||||||||||||
| 518 | "-- Type name '%s' previously registered as typedef of '%s' [%i], " | - | ||||||||||||||||||||||||
| 519 | "now registering as typedef of '%s' [%i].", | - | ||||||||||||||||||||||||
| 520 | normalizedTypeName.constData(), QMetaType::typeName(idx), idx, | - | ||||||||||||||||||||||||
| 521 | QMetaType::typeName(aliasId), aliasId); | - | ||||||||||||||||||||||||
| 522 | } | - | ||||||||||||||||||||||||
| 523 | return idx; | - | ||||||||||||||||||||||||
| 524 | } | - | ||||||||||||||||||||||||
| 525 | - | |||||||||||||||||||||||||
| 526 | - | |||||||||||||||||||||||||
| 527 | - | |||||||||||||||||||||||||
| 528 | - | |||||||||||||||||||||||||
| 529 | - | |||||||||||||||||||||||||
| 530 | - | |||||||||||||||||||||||||
| 531 | - | |||||||||||||||||||||||||
| 532 | bool QMetaType::isRegistered(int type) | - | ||||||||||||||||||||||||
| 533 | { | - | ||||||||||||||||||||||||
| 534 | - | |||||||||||||||||||||||||
| 535 | if ((type >= FirstCoreType && type <= LastCoreType) | - | ||||||||||||||||||||||||
| 536 | || (type >= FirstGuiType && type <= LastGuiType) | - | ||||||||||||||||||||||||
| 537 | || (type >= FirstWidgetsType && type <= LastWidgetsType)) { | - | ||||||||||||||||||||||||
| 538 | return true; | - | ||||||||||||||||||||||||
| 539 | } | - | ||||||||||||||||||||||||
| 540 | - | |||||||||||||||||||||||||
| 541 | QReadLocker locker(customTypesLock()); | - | ||||||||||||||||||||||||
| 542 | const QVector<QCustomTypeInfo> * const ct = customTypes(); | - | ||||||||||||||||||||||||
| 543 | return ((type >= User) && (ct && ct->count() > type - User) && !ct->at(type - User).typeName.isEmpty()); | - | ||||||||||||||||||||||||
| 544 | } | - | ||||||||||||||||||||||||
| 545 | - | |||||||||||||||||||||||||
| 546 | template <bool tryNormalizedType> | - | ||||||||||||||||||||||||
| 547 | static inline int qMetaTypeTypeImpl(const char *typeName, int length) | - | ||||||||||||||||||||||||
| 548 | { | - | ||||||||||||||||||||||||
| 549 | if (!length) | - | ||||||||||||||||||||||||
| 550 | return QMetaType::UnknownType; | - | ||||||||||||||||||||||||
| 551 | int type = qMetaTypeStaticType(typeName, length); | - | ||||||||||||||||||||||||
| 552 | if (type == QMetaType::UnknownType) { | - | ||||||||||||||||||||||||
| 553 | QReadLocker locker(customTypesLock()); | - | ||||||||||||||||||||||||
| 554 | type = qMetaTypeCustomType_unlocked(typeName, length); | - | ||||||||||||||||||||||||
| 555 | - | |||||||||||||||||||||||||
| 556 | if ((type == QMetaType::UnknownType) && tryNormalizedType) { | - | ||||||||||||||||||||||||
| 557 | const ::QByteArray normalizedTypeName = QMetaObject::normalizedType(typeName); | - | ||||||||||||||||||||||||
| 558 | type = qMetaTypeStaticType(normalizedTypeName.constData(), | - | ||||||||||||||||||||||||
| 559 | normalizedTypeName.size()); | - | ||||||||||||||||||||||||
| 560 | if (type == QMetaType::UnknownType) { | - | ||||||||||||||||||||||||
| 561 | type = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), | - | ||||||||||||||||||||||||
| 562 | normalizedTypeName.size()); | - | ||||||||||||||||||||||||
| 563 | } | - | ||||||||||||||||||||||||
| 564 | } | - | ||||||||||||||||||||||||
| 565 | - | |||||||||||||||||||||||||
| 566 | } | - | ||||||||||||||||||||||||
| 567 | return type; | - | ||||||||||||||||||||||||
| 568 | } | - | ||||||||||||||||||||||||
| 569 | - | |||||||||||||||||||||||||
| 570 | - | |||||||||||||||||||||||||
| 571 | - | |||||||||||||||||||||||||
| 572 | - | |||||||||||||||||||||||||
| 573 | - | |||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||
| 575 | - | |||||||||||||||||||||||||
| 576 | int QMetaType::type(const char *typeName) | - | ||||||||||||||||||||||||
| 577 | { | - | ||||||||||||||||||||||||
| 578 | return qMetaTypeTypeImpl< true>(typeName, qstrlen(typeName)); | - | ||||||||||||||||||||||||
| 579 | } | - | ||||||||||||||||||||||||
| 580 | int qMetaTypeTypeInternal(const char *typeName) | - | ||||||||||||||||||||||||
| 581 | { | - | ||||||||||||||||||||||||
| 582 | return qMetaTypeTypeImpl< false>(typeName, qstrlen(typeName)); | - | ||||||||||||||||||||||||
| 583 | } | - | ||||||||||||||||||||||||
| 584 | int QMetaType::type(const ::QByteArray &typeName) | - | ||||||||||||||||||||||||
| 585 | { | - | ||||||||||||||||||||||||
| 586 | return qMetaTypeTypeImpl< true>(typeName.constData(), typeName.size()); | - | ||||||||||||||||||||||||
| 587 | } | - | ||||||||||||||||||||||||
| 588 | bool QMetaType::save(QDataStream &stream, int type, const void *data) | - | ||||||||||||||||||||||||
| 589 | { | - | ||||||||||||||||||||||||
| 590 | if (!data || !isRegistered(type)) | - | ||||||||||||||||||||||||
| 591 | return false; | - | ||||||||||||||||||||||||
| 592 | - | |||||||||||||||||||||||||
| 593 | switch(type) { | - | ||||||||||||||||||||||||
| 594 | case QMetaType::UnknownType: | - | ||||||||||||||||||||||||
| 595 | case QMetaType::Void: | - | ||||||||||||||||||||||||
| 596 | case QMetaType::VoidStar: | - | ||||||||||||||||||||||||
| 597 | case QMetaType::QObjectStar: | - | ||||||||||||||||||||||||
| 598 | case QMetaType::QModelIndex: | - | ||||||||||||||||||||||||
| 599 | case QMetaType::QPersistentModelIndex: | - | ||||||||||||||||||||||||
| 600 | case QMetaType::QJsonValue: | - | ||||||||||||||||||||||||
| 601 | case QMetaType::QJsonObject: | - | ||||||||||||||||||||||||
| 602 | case QMetaType::QJsonArray: | - | ||||||||||||||||||||||||
| 603 | case QMetaType::QJsonDocument: | - | ||||||||||||||||||||||||
| 604 | return false; | - | ||||||||||||||||||||||||
| 605 | case QMetaType::Long: | - | ||||||||||||||||||||||||
| 606 | stream << qlonglong(*static_cast<const long *>(data)); | - | ||||||||||||||||||||||||
| 607 | break; | - | ||||||||||||||||||||||||
| 608 | case QMetaType::Int: | - | ||||||||||||||||||||||||
| 609 | stream << *static_cast<const int *>(data); | - | ||||||||||||||||||||||||
| 610 | break; | - | ||||||||||||||||||||||||
| 611 | case QMetaType::Short: | - | ||||||||||||||||||||||||
| 612 | stream << *static_cast<const short *>(data); | - | ||||||||||||||||||||||||
| 613 | break; | - | ||||||||||||||||||||||||
| 614 | case QMetaType::Char: | - | ||||||||||||||||||||||||
| 615 | - | |||||||||||||||||||||||||
| 616 | stream << *static_cast<const signed char *>(data); | - | ||||||||||||||||||||||||
| 617 | break; | - | ||||||||||||||||||||||||
| 618 | case QMetaType::ULong: | - | ||||||||||||||||||||||||
| 619 | stream << qulonglong(*static_cast<const ulong *>(data)); | - | ||||||||||||||||||||||||
| 620 | break; | - | ||||||||||||||||||||||||
| 621 | case QMetaType::UInt: | - | ||||||||||||||||||||||||
| 622 | stream << *static_cast<const uint *>(data); | - | ||||||||||||||||||||||||
| 623 | break; | - | ||||||||||||||||||||||||
| 624 | case QMetaType::LongLong: | - | ||||||||||||||||||||||||
| 625 | stream << *static_cast<const qlonglong *>(data); | - | ||||||||||||||||||||||||
| 626 | break; | - | ||||||||||||||||||||||||
| 627 | case QMetaType::ULongLong: | - | ||||||||||||||||||||||||
| 628 | stream << *static_cast<const qulonglong *>(data); | - | ||||||||||||||||||||||||
| 629 | break; | - | ||||||||||||||||||||||||
| 630 | case QMetaType::UShort: | - | ||||||||||||||||||||||||
| 631 | stream << *static_cast<const ushort *>(data); | - | ||||||||||||||||||||||||
| 632 | break; | - | ||||||||||||||||||||||||
| 633 | case QMetaType::SChar: | - | ||||||||||||||||||||||||
| 634 | stream << *static_cast<const signed char *>(data); | - | ||||||||||||||||||||||||
| 635 | break; | - | ||||||||||||||||||||||||
| 636 | case QMetaType::UChar: | - | ||||||||||||||||||||||||
| 637 | stream << *static_cast<const uchar *>(data); | - | ||||||||||||||||||||||||
| 638 | break; | - | ||||||||||||||||||||||||
| 639 | case QMetaType::Bool: | - | ||||||||||||||||||||||||
| 640 | stream << qint8(*static_cast<const bool *>(data)); | - | ||||||||||||||||||||||||
| 641 | break; | - | ||||||||||||||||||||||||
| 642 | case QMetaType::Float: | - | ||||||||||||||||||||||||
| 643 | stream << *static_cast<const float *>(data); | - | ||||||||||||||||||||||||
| 644 | break; | - | ||||||||||||||||||||||||
| 645 | case QMetaType::Double: | - | ||||||||||||||||||||||||
| 646 | stream << *static_cast<const double *>(data); | - | ||||||||||||||||||||||||
| 647 | break; | - | ||||||||||||||||||||||||
| 648 | case QMetaType::QChar: | - | ||||||||||||||||||||||||
| 649 | stream << *static_cast<const ::QChar *>(data); | - | ||||||||||||||||||||||||
| 650 | break; | - | ||||||||||||||||||||||||
| 651 | - | |||||||||||||||||||||||||
| 652 | case QMetaType::QVariantMap: | - | ||||||||||||||||||||||||
| 653 | stream << *static_cast<const ::QVariantMap*>(data); | - | ||||||||||||||||||||||||
| 654 | break; | - | ||||||||||||||||||||||||
| 655 | case QMetaType::QVariantHash: | - | ||||||||||||||||||||||||
| 656 | stream << *static_cast<const ::QVariantHash*>(data); | - | ||||||||||||||||||||||||
| 657 | break; | - | ||||||||||||||||||||||||
| 658 | case QMetaType::QVariantList: | - | ||||||||||||||||||||||||
| 659 | stream << *static_cast<const ::QVariantList*>(data); | - | ||||||||||||||||||||||||
| 660 | break; | - | ||||||||||||||||||||||||
| 661 | case QMetaType::QVariant: | - | ||||||||||||||||||||||||
| 662 | stream << *static_cast<const ::QVariant*>(data); | - | ||||||||||||||||||||||||
| 663 | break; | - | ||||||||||||||||||||||||
| 664 | case QMetaType::QByteArrayList: | - | ||||||||||||||||||||||||
| 665 | stream << *static_cast<const ::QByteArrayList*>(data); | - | ||||||||||||||||||||||||
| 666 | break; | - | ||||||||||||||||||||||||
| 667 | - | |||||||||||||||||||||||||
| 668 | case QMetaType::QByteArray: | - | ||||||||||||||||||||||||
| 669 | stream << *static_cast<const ::QByteArray*>(data); | - | ||||||||||||||||||||||||
| 670 | break; | - | ||||||||||||||||||||||||
| 671 | case QMetaType::QString: | - | ||||||||||||||||||||||||
| 672 | stream << *static_cast<const ::QString*>(data); | - | ||||||||||||||||||||||||
| 673 | break; | - | ||||||||||||||||||||||||
| 674 | case QMetaType::QStringList: | - | ||||||||||||||||||||||||
| 675 | stream << *static_cast<const ::QStringList*>(data); | - | ||||||||||||||||||||||||
| 676 | break; | - | ||||||||||||||||||||||||
| 677 | - | |||||||||||||||||||||||||
| 678 | case QMetaType::QBitArray: | - | ||||||||||||||||||||||||
| 679 | stream << *static_cast<const ::QBitArray*>(data); | - | ||||||||||||||||||||||||
| 680 | break; | - | ||||||||||||||||||||||||
| 681 | - | |||||||||||||||||||||||||
| 682 | case QMetaType::QDate: | - | ||||||||||||||||||||||||
| 683 | stream << *static_cast<const ::QDate*>(data); | - | ||||||||||||||||||||||||
| 684 | break; | - | ||||||||||||||||||||||||
| 685 | case QMetaType::QTime: | - | ||||||||||||||||||||||||
| 686 | stream << *static_cast<const ::QTime*>(data); | - | ||||||||||||||||||||||||
| 687 | break; | - | ||||||||||||||||||||||||
| 688 | case QMetaType::QDateTime: | - | ||||||||||||||||||||||||
| 689 | stream << *static_cast<const ::QDateTime*>(data); | - | ||||||||||||||||||||||||
| 690 | break; | - | ||||||||||||||||||||||||
| 691 | - | |||||||||||||||||||||||||
| 692 | case QMetaType::QUrl: | - | ||||||||||||||||||||||||
| 693 | stream << *static_cast<const ::QUrl*>(data); | - | ||||||||||||||||||||||||
| 694 | break; | - | ||||||||||||||||||||||||
| 695 | - | |||||||||||||||||||||||||
| 696 | case QMetaType::QLocale: | - | ||||||||||||||||||||||||
| 697 | stream << *static_cast<const ::QLocale*>(data); | - | ||||||||||||||||||||||||
| 698 | break; | - | ||||||||||||||||||||||||
| 699 | - | |||||||||||||||||||||||||
| 700 | case QMetaType::QRect: | - | ||||||||||||||||||||||||
| 701 | stream << *static_cast<const ::QRect*>(data); | - | ||||||||||||||||||||||||
| 702 | break; | - | ||||||||||||||||||||||||
| 703 | case QMetaType::QRectF: | - | ||||||||||||||||||||||||
| 704 | stream << *static_cast<const ::QRectF*>(data); | - | ||||||||||||||||||||||||
| 705 | break; | - | ||||||||||||||||||||||||
| 706 | case QMetaType::QSize: | - | ||||||||||||||||||||||||
| 707 | stream << *static_cast<const ::QSize*>(data); | - | ||||||||||||||||||||||||
| 708 | break; | - | ||||||||||||||||||||||||
| 709 | case QMetaType::QSizeF: | - | ||||||||||||||||||||||||
| 710 | stream << *static_cast<const ::QSizeF*>(data); | - | ||||||||||||||||||||||||
| 711 | break; | - | ||||||||||||||||||||||||
| 712 | case QMetaType::QLine: | - | ||||||||||||||||||||||||
| 713 | stream << *static_cast<const ::QLine*>(data); | - | ||||||||||||||||||||||||
| 714 | break; | - | ||||||||||||||||||||||||
| 715 | case QMetaType::QLineF: | - | ||||||||||||||||||||||||
| 716 | stream << *static_cast<const ::QLineF*>(data); | - | ||||||||||||||||||||||||
| 717 | break; | - | ||||||||||||||||||||||||
| 718 | case QMetaType::QPoint: | - | ||||||||||||||||||||||||
| 719 | stream << *static_cast<const ::QPoint*>(data); | - | ||||||||||||||||||||||||
| 720 | break; | - | ||||||||||||||||||||||||
| 721 | case QMetaType::QPointF: | - | ||||||||||||||||||||||||
| 722 | stream << *static_cast<const ::QPointF*>(data); | - | ||||||||||||||||||||||||
| 723 | break; | - | ||||||||||||||||||||||||
| 724 | - | |||||||||||||||||||||||||
| 725 | - | |||||||||||||||||||||||||
| 726 | case QMetaType::QRegExp: | - | ||||||||||||||||||||||||
| 727 | stream << *static_cast<const ::QRegExp*>(data); | - | ||||||||||||||||||||||||
| 728 | break; | - | ||||||||||||||||||||||||
| 729 | - | |||||||||||||||||||||||||
| 730 | - | |||||||||||||||||||||||||
| 731 | - | |||||||||||||||||||||||||
| 732 | case QMetaType::QRegularExpression: | - | ||||||||||||||||||||||||
| 733 | stream << *static_cast<const ::QRegularExpression*>(data); | - | ||||||||||||||||||||||||
| 734 | break; | - | ||||||||||||||||||||||||
| 735 | - | |||||||||||||||||||||||||
| 736 | case QMetaType::QEasingCurve: | - | ||||||||||||||||||||||||
| 737 | stream << *static_cast<const ::QEasingCurve*>(data); | - | ||||||||||||||||||||||||
| 738 | break; | - | ||||||||||||||||||||||||
| 739 | - | |||||||||||||||||||||||||
| 740 | case QMetaType::QFont: | - | ||||||||||||||||||||||||
| 741 | case QMetaType::QPixmap: | - | ||||||||||||||||||||||||
| 742 | case QMetaType::QBrush: | - | ||||||||||||||||||||||||
| 743 | case QMetaType::QColor: | - | ||||||||||||||||||||||||
| 744 | case QMetaType::QPalette: | - | ||||||||||||||||||||||||
| 745 | case QMetaType::QImage: | - | ||||||||||||||||||||||||
| 746 | case QMetaType::QPolygon: | - | ||||||||||||||||||||||||
| 747 | case QMetaType::QPolygonF: | - | ||||||||||||||||||||||||
| 748 | case QMetaType::QRegion: | - | ||||||||||||||||||||||||
| 749 | case QMetaType::QBitmap: | - | ||||||||||||||||||||||||
| 750 | case QMetaType::QCursor: | - | ||||||||||||||||||||||||
| 751 | case QMetaType::QKeySequence: | - | ||||||||||||||||||||||||
| 752 | case QMetaType::QPen: | - | ||||||||||||||||||||||||
| 753 | case QMetaType::QTextLength: | - | ||||||||||||||||||||||||
| 754 | case QMetaType::QTextFormat: | - | ||||||||||||||||||||||||
| 755 | case QMetaType::QMatrix: | - | ||||||||||||||||||||||||
| 756 | case QMetaType::QTransform: | - | ||||||||||||||||||||||||
| 757 | case QMetaType::QMatrix4x4: | - | ||||||||||||||||||||||||
| 758 | case QMetaType::QVector2D: | - | ||||||||||||||||||||||||
| 759 | case QMetaType::QVector3D: | - | ||||||||||||||||||||||||
| 760 | case QMetaType::QVector4D: | - | ||||||||||||||||||||||||
| 761 | case QMetaType::QQuaternion: | - | ||||||||||||||||||||||||
| 762 | case QMetaType::QIcon: | - | ||||||||||||||||||||||||
| 763 | if (!qMetaTypeGuiHelper) | - | ||||||||||||||||||||||||
| 764 | return false; | - | ||||||||||||||||||||||||
| 765 | qMetaTypeGuiHelper[type - FirstGuiType].saveOp(stream, data); | - | ||||||||||||||||||||||||
| 766 | break; | - | ||||||||||||||||||||||||
| 767 | case QMetaType::QSizePolicy: | - | ||||||||||||||||||||||||
| 768 | if (!qMetaTypeWidgetsHelper) | - | ||||||||||||||||||||||||
| 769 | return false; | - | ||||||||||||||||||||||||
| 770 | qMetaTypeWidgetsHelper[type - FirstWidgetsType].saveOp(stream, data); | - | ||||||||||||||||||||||||
| 771 | break; | - | ||||||||||||||||||||||||
| 772 | case QMetaType::QUuid: | - | ||||||||||||||||||||||||
| 773 | stream << *static_cast<const ::QUuid*>(data); | - | ||||||||||||||||||||||||
| 774 | break; | - | ||||||||||||||||||||||||
| 775 | default: { | - | ||||||||||||||||||||||||
| 776 | const QVector<QCustomTypeInfo> * const ct = customTypes(); | - | ||||||||||||||||||||||||
| 777 | if (!ct) | - | ||||||||||||||||||||||||
| 778 | return false; | - | ||||||||||||||||||||||||
| 779 | - | |||||||||||||||||||||||||
| 780 | SaveOperator saveOp = 0; | - | ||||||||||||||||||||||||
| 781 | { | - | ||||||||||||||||||||||||
| 782 | QReadLocker locker(customTypesLock()); | - | ||||||||||||||||||||||||
| 783 | saveOp = ct->at(type - User).saveOp; | - | ||||||||||||||||||||||||
| 784 | } | - | ||||||||||||||||||||||||
| 785 | - | |||||||||||||||||||||||||
| 786 | if (!saveOp) | - | ||||||||||||||||||||||||
| 787 | return false; | - | ||||||||||||||||||||||||
| 788 | saveOp(stream, data); | - | ||||||||||||||||||||||||
| 789 | break; } | - | ||||||||||||||||||||||||
| 790 | } | - | ||||||||||||||||||||||||
| 791 | - | |||||||||||||||||||||||||
| 792 | return true; | - | ||||||||||||||||||||||||
| 793 | } | - | ||||||||||||||||||||||||
| 794 | bool QMetaType::load(QDataStream &stream, int type, void *data) | - | ||||||||||||||||||||||||
| 795 | { | - | ||||||||||||||||||||||||
| 796 | if (!data || !isRegistered(type)) | - | ||||||||||||||||||||||||
| 797 | return false; | - | ||||||||||||||||||||||||
| 798 | - | |||||||||||||||||||||||||
| 799 | switch(type) { | - | ||||||||||||||||||||||||
| 800 | case QMetaType::UnknownType: | - | ||||||||||||||||||||||||
| 801 | case QMetaType::Void: | - | ||||||||||||||||||||||||
| 802 | case QMetaType::VoidStar: | - | ||||||||||||||||||||||||
| 803 | case QMetaType::QObjectStar: | - | ||||||||||||||||||||||||
| 804 | case QMetaType::QModelIndex: | - | ||||||||||||||||||||||||
| 805 | case QMetaType::QPersistentModelIndex: | - | ||||||||||||||||||||||||
| 806 | case QMetaType::QJsonValue: | - | ||||||||||||||||||||||||
| 807 | case QMetaType::QJsonObject: | - | ||||||||||||||||||||||||
| 808 | case QMetaType::QJsonArray: | - | ||||||||||||||||||||||||
| 809 | case QMetaType::QJsonDocument: | - | ||||||||||||||||||||||||
| 810 | return false; | - | ||||||||||||||||||||||||
| 811 | case QMetaType::Long: { | - | ||||||||||||||||||||||||
| 812 | qlonglong l; | - | ||||||||||||||||||||||||
| 813 | stream >> l; | - | ||||||||||||||||||||||||
| 814 | *static_cast<long *>(data) = long(l); | - | ||||||||||||||||||||||||
| 815 | break; } | - | ||||||||||||||||||||||||
| 816 | case QMetaType::Int: | - | ||||||||||||||||||||||||
| 817 | stream >> *static_cast<int *>(data); | - | ||||||||||||||||||||||||
| 818 | break; | - | ||||||||||||||||||||||||
| 819 | case QMetaType::Short: | - | ||||||||||||||||||||||||
| 820 | stream >> *static_cast<short *>(data); | - | ||||||||||||||||||||||||
| 821 | break; | - | ||||||||||||||||||||||||
| 822 | case QMetaType::Char: | - | ||||||||||||||||||||||||
| 823 | - | |||||||||||||||||||||||||
| 824 | stream >> *static_cast<signed char *>(data); | - | ||||||||||||||||||||||||
| 825 | break; | - | ||||||||||||||||||||||||
| 826 | case QMetaType::ULong: { | - | ||||||||||||||||||||||||
| 827 | qulonglong ul; | - | ||||||||||||||||||||||||
| 828 | stream >> ul; | - | ||||||||||||||||||||||||
| 829 | *static_cast<ulong *>(data) = ulong(ul); | - | ||||||||||||||||||||||||
| 830 | break; } | - | ||||||||||||||||||||||||
| 831 | case QMetaType::UInt: | - | ||||||||||||||||||||||||
| 832 | stream >> *static_cast<uint *>(data); | - | ||||||||||||||||||||||||
| 833 | break; | - | ||||||||||||||||||||||||
| 834 | case QMetaType::LongLong: | - | ||||||||||||||||||||||||
| 835 | stream >> *static_cast<qlonglong *>(data); | - | ||||||||||||||||||||||||
| 836 | break; | - | ||||||||||||||||||||||||
| 837 | case QMetaType::ULongLong: | - | ||||||||||||||||||||||||
| 838 | stream >> *static_cast<qulonglong *>(data); | - | ||||||||||||||||||||||||
| 839 | break; | - | ||||||||||||||||||||||||
| 840 | case QMetaType::UShort: | - | ||||||||||||||||||||||||
| 841 | stream >> *static_cast<ushort *>(data); | - | ||||||||||||||||||||||||
| 842 | break; | - | ||||||||||||||||||||||||
| 843 | case QMetaType::SChar: | - | ||||||||||||||||||||||||
| 844 | stream >> *static_cast<signed char *>(data); | - | ||||||||||||||||||||||||
| 845 | break; | - | ||||||||||||||||||||||||
| 846 | case QMetaType::UChar: | - | ||||||||||||||||||||||||
| 847 | stream >> *static_cast<uchar *>(data); | - | ||||||||||||||||||||||||
| 848 | break; | - | ||||||||||||||||||||||||
| 849 | case QMetaType::Bool: { | - | ||||||||||||||||||||||||
| 850 | qint8 b; | - | ||||||||||||||||||||||||
| 851 | stream >> b; | - | ||||||||||||||||||||||||
| 852 | *static_cast<bool *>(data) = b; | - | ||||||||||||||||||||||||
| 853 | break; } | - | ||||||||||||||||||||||||
| 854 | case QMetaType::Float: | - | ||||||||||||||||||||||||
| 855 | stream >> *static_cast<float *>(data); | - | ||||||||||||||||||||||||
| 856 | break; | - | ||||||||||||||||||||||||
| 857 | case QMetaType::Double: | - | ||||||||||||||||||||||||
| 858 | stream >> *static_cast<double *>(data); | - | ||||||||||||||||||||||||
| 859 | break; | - | ||||||||||||||||||||||||
| 860 | case QMetaType::QChar: | - | ||||||||||||||||||||||||
| 861 | stream >> *static_cast< ::QChar*>(data); | - | ||||||||||||||||||||||||
| 862 | break; | - | ||||||||||||||||||||||||
| 863 | - | |||||||||||||||||||||||||
| 864 | case QMetaType::QVariantMap: | - | ||||||||||||||||||||||||
| 865 | stream >> *static_cast< ::QVariantMap*>(data); | - | ||||||||||||||||||||||||
| 866 | break; | - | ||||||||||||||||||||||||
| 867 | case QMetaType::QVariantHash: | - | ||||||||||||||||||||||||
| 868 | stream >> *static_cast< ::QVariantHash*>(data); | - | ||||||||||||||||||||||||
| 869 | break; | - | ||||||||||||||||||||||||
| 870 | case QMetaType::QVariantList: | - | ||||||||||||||||||||||||
| 871 | stream >> *static_cast< ::QVariantList*>(data); | - | ||||||||||||||||||||||||
| 872 | break; | - | ||||||||||||||||||||||||
| 873 | case QMetaType::QVariant: | - | ||||||||||||||||||||||||
| 874 | stream >> *static_cast< ::QVariant*>(data); | - | ||||||||||||||||||||||||
| 875 | break; | - | ||||||||||||||||||||||||
| 876 | case QMetaType::QByteArrayList: | - | ||||||||||||||||||||||||
| 877 | stream >> *static_cast< ::QByteArrayList*>(data); | - | ||||||||||||||||||||||||
| 878 | break; | - | ||||||||||||||||||||||||
| 879 | - | |||||||||||||||||||||||||
| 880 | case QMetaType::QByteArray: | - | ||||||||||||||||||||||||
| 881 | stream >> *static_cast< ::QByteArray*>(data); | - | ||||||||||||||||||||||||
| 882 | break; | - | ||||||||||||||||||||||||
| 883 | case QMetaType::QString: | - | ||||||||||||||||||||||||
| 884 | stream >> *static_cast< ::QString*>(data); | - | ||||||||||||||||||||||||
| 885 | break; | - | ||||||||||||||||||||||||
| 886 | case QMetaType::QStringList: | - | ||||||||||||||||||||||||
| 887 | stream >> *static_cast< ::QStringList*>(data); | - | ||||||||||||||||||||||||
| 888 | break; | - | ||||||||||||||||||||||||
| 889 | - | |||||||||||||||||||||||||
| 890 | case QMetaType::QBitArray: | - | ||||||||||||||||||||||||
| 891 | stream >> *static_cast< ::QBitArray*>(data); | - | ||||||||||||||||||||||||
| 892 | break; | - | ||||||||||||||||||||||||
| 893 | - | |||||||||||||||||||||||||
| 894 | case QMetaType::QDate: | - | ||||||||||||||||||||||||
| 895 | stream >> *static_cast< ::QDate*>(data); | - | ||||||||||||||||||||||||
| 896 | break; | - | ||||||||||||||||||||||||
| 897 | case QMetaType::QTime: | - | ||||||||||||||||||||||||
| 898 | stream >> *static_cast< ::QTime*>(data); | - | ||||||||||||||||||||||||
| 899 | break; | - | ||||||||||||||||||||||||
| 900 | case QMetaType::QDateTime: | - | ||||||||||||||||||||||||
| 901 | stream >> *static_cast< ::QDateTime*>(data); | - | ||||||||||||||||||||||||
| 902 | break; | - | ||||||||||||||||||||||||
| 903 | - | |||||||||||||||||||||||||
| 904 | case QMetaType::QUrl: | - | ||||||||||||||||||||||||
| 905 | stream >> *static_cast< ::QUrl*>(data); | - | ||||||||||||||||||||||||
| 906 | break; | - | ||||||||||||||||||||||||
| 907 | - | |||||||||||||||||||||||||
| 908 | case QMetaType::QLocale: | - | ||||||||||||||||||||||||
| 909 | stream >> *static_cast< ::QLocale*>(data); | - | ||||||||||||||||||||||||
| 910 | break; | - | ||||||||||||||||||||||||
| 911 | - | |||||||||||||||||||||||||
| 912 | case QMetaType::QRect: | - | ||||||||||||||||||||||||
| 913 | stream >> *static_cast< ::QRect*>(data); | - | ||||||||||||||||||||||||
| 914 | break; | - | ||||||||||||||||||||||||
| 915 | case QMetaType::QRectF: | - | ||||||||||||||||||||||||
| 916 | stream >> *static_cast< ::QRectF*>(data); | - | ||||||||||||||||||||||||
| 917 | break; | - | ||||||||||||||||||||||||
| 918 | case QMetaType::QSize: | - | ||||||||||||||||||||||||
| 919 | stream >> *static_cast< ::QSize*>(data); | - | ||||||||||||||||||||||||
| 920 | break; | - | ||||||||||||||||||||||||
| 921 | case QMetaType::QSizeF: | - | ||||||||||||||||||||||||
| 922 | stream >> *static_cast< ::QSizeF*>(data); | - | ||||||||||||||||||||||||
| 923 | break; | - | ||||||||||||||||||||||||
| 924 | case QMetaType::QLine: | - | ||||||||||||||||||||||||
| 925 | stream >> *static_cast< ::QLine*>(data); | - | ||||||||||||||||||||||||
| 926 | break; | - | ||||||||||||||||||||||||
| 927 | case QMetaType::QLineF: | - | ||||||||||||||||||||||||
| 928 | stream >> *static_cast< ::QLineF*>(data); | - | ||||||||||||||||||||||||
| 929 | break; | - | ||||||||||||||||||||||||
| 930 | case QMetaType::QPoint: | - | ||||||||||||||||||||||||
| 931 | stream >> *static_cast< ::QPoint*>(data); | - | ||||||||||||||||||||||||
| 932 | break; | - | ||||||||||||||||||||||||
| 933 | case QMetaType::QPointF: | - | ||||||||||||||||||||||||
| 934 | stream >> *static_cast< ::QPointF*>(data); | - | ||||||||||||||||||||||||
| 935 | break; | - | ||||||||||||||||||||||||
| 936 | - | |||||||||||||||||||||||||
| 937 | - | |||||||||||||||||||||||||
| 938 | case QMetaType::QRegExp: | - | ||||||||||||||||||||||||
| 939 | stream >> *static_cast< ::QRegExp*>(data); | - | ||||||||||||||||||||||||
| 940 | break; | - | ||||||||||||||||||||||||
| 941 | - | |||||||||||||||||||||||||
| 942 | - | |||||||||||||||||||||||||
| 943 | - | |||||||||||||||||||||||||
| 944 | case QMetaType::QRegularExpression: | - | ||||||||||||||||||||||||
| 945 | stream >> *static_cast< ::QRegularExpression*>(data); | - | ||||||||||||||||||||||||
| 946 | break; | - | ||||||||||||||||||||||||
| 947 | - | |||||||||||||||||||||||||
| 948 | case QMetaType::QEasingCurve: | - | ||||||||||||||||||||||||
| 949 | stream >> *static_cast< ::QEasingCurve*>(data); | - | ||||||||||||||||||||||||
| 950 | break; | - | ||||||||||||||||||||||||
| 951 | - | |||||||||||||||||||||||||
| 952 | case QMetaType::QFont: | - | ||||||||||||||||||||||||
| 953 | case QMetaType::QPixmap: | - | ||||||||||||||||||||||||
| 954 | case QMetaType::QBrush: | - | ||||||||||||||||||||||||
| 955 | case QMetaType::QColor: | - | ||||||||||||||||||||||||
| 956 | case QMetaType::QPalette: | - | ||||||||||||||||||||||||
| 957 | case QMetaType::QImage: | - | ||||||||||||||||||||||||
| 958 | case QMetaType::QPolygon: | - | ||||||||||||||||||||||||
| 959 | case QMetaType::QPolygonF: | - | ||||||||||||||||||||||||
| 960 | case QMetaType::QRegion: | - | ||||||||||||||||||||||||
| 961 | case QMetaType::QBitmap: | - | ||||||||||||||||||||||||
| 962 | case QMetaType::QCursor: | - | ||||||||||||||||||||||||
| 963 | case QMetaType::QKeySequence: | - | ||||||||||||||||||||||||
| 964 | case QMetaType::QPen: | - | ||||||||||||||||||||||||
| 965 | case QMetaType::QTextLength: | - | ||||||||||||||||||||||||
| 966 | case QMetaType::QTextFormat: | - | ||||||||||||||||||||||||
| 967 | case QMetaType::QMatrix: | - | ||||||||||||||||||||||||
| 968 | case QMetaType::QTransform: | - | ||||||||||||||||||||||||
| 969 | case QMetaType::QMatrix4x4: | - | ||||||||||||||||||||||||
| 970 | case QMetaType::QVector2D: | - | ||||||||||||||||||||||||
| 971 | case QMetaType::QVector3D: | - | ||||||||||||||||||||||||
| 972 | case QMetaType::QVector4D: | - | ||||||||||||||||||||||||
| 973 | case QMetaType::QQuaternion: | - | ||||||||||||||||||||||||
| 974 | case QMetaType::QIcon: | - | ||||||||||||||||||||||||
| 975 | if (!qMetaTypeGuiHelper) | - | ||||||||||||||||||||||||
| 976 | return false; | - | ||||||||||||||||||||||||
| 977 | qMetaTypeGuiHelper[type - FirstGuiType].loadOp(stream, data); | - | ||||||||||||||||||||||||
| 978 | break; | - | ||||||||||||||||||||||||
| 979 | case QMetaType::QSizePolicy: | - | ||||||||||||||||||||||||
| 980 | if (!qMetaTypeWidgetsHelper) | - | ||||||||||||||||||||||||
| 981 | return false; | - | ||||||||||||||||||||||||
| 982 | qMetaTypeWidgetsHelper[type - FirstWidgetsType].loadOp(stream, data); | - | ||||||||||||||||||||||||
| 983 | break; | - | ||||||||||||||||||||||||
| 984 | case QMetaType::QUuid: | - | ||||||||||||||||||||||||
| 985 | stream >> *static_cast< ::QUuid*>(data); | - | ||||||||||||||||||||||||
| 986 | break; | - | ||||||||||||||||||||||||
| 987 | default: { | - | ||||||||||||||||||||||||
| 988 | const QVector<QCustomTypeInfo> * const ct = customTypes(); | - | ||||||||||||||||||||||||
| 989 | if (!ct) | - | ||||||||||||||||||||||||
| 990 | return false; | - | ||||||||||||||||||||||||
| 991 | - | |||||||||||||||||||||||||
| 992 | LoadOperator loadOp = 0; | - | ||||||||||||||||||||||||
| 993 | { | - | ||||||||||||||||||||||||
| 994 | QReadLocker locker(customTypesLock()); | - | ||||||||||||||||||||||||
| 995 | loadOp = ct->at(type - User).loadOp; | - | ||||||||||||||||||||||||
| 996 | } | - | ||||||||||||||||||||||||
| 997 | - | |||||||||||||||||||||||||
| 998 | if (!loadOp) | - | ||||||||||||||||||||||||
| 999 | return false; | - | ||||||||||||||||||||||||
| 1000 | loadOp(stream, data); | - | ||||||||||||||||||||||||
| 1001 | break; } | - | ||||||||||||||||||||||||
| 1002 | } | - | ||||||||||||||||||||||||
| 1003 | return true; | - | ||||||||||||||||||||||||
| 1004 | } | - | ||||||||||||||||||||||||
| 1005 | void *QMetaType::create(int type, const void *copy) | - | ||||||||||||||||||||||||
| 1006 | { | - | ||||||||||||||||||||||||
| 1007 | QMetaType info(type); | - | ||||||||||||||||||||||||
| 1008 | if (int size = info.sizeOf()) | - | ||||||||||||||||||||||||
| 1009 | return info.construct(operator new(size), copy); | - | ||||||||||||||||||||||||
| 1010 | return 0; | - | ||||||||||||||||||||||||
| 1011 | } | - | ||||||||||||||||||||||||
| 1012 | - | |||||||||||||||||||||||||
| 1013 | - | |||||||||||||||||||||||||
| 1014 | - | |||||||||||||||||||||||||
| 1015 | - | |||||||||||||||||||||||||
| 1016 | - | |||||||||||||||||||||||||
| 1017 | - | |||||||||||||||||||||||||
| 1018 | void QMetaType::destroy(int type, void *data) | - | ||||||||||||||||||||||||
| 1019 | { | - | ||||||||||||||||||||||||
| 1020 | QMetaType info(type); | - | ||||||||||||||||||||||||
| 1021 | info.destruct(data); | - | ||||||||||||||||||||||||
| 1022 | operator delete(data); | - | ||||||||||||||||||||||||
| 1023 | } | - | ||||||||||||||||||||||||
| 1024 | - | |||||||||||||||||||||||||
| 1025 | namespace { | - | ||||||||||||||||||||||||
| 1026 | class TypeConstructor { | - | ||||||||||||||||||||||||
| 1027 | template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> | - | ||||||||||||||||||||||||
| 1028 | struct ConstructorImpl { | - | ||||||||||||||||||||||||
| 1029 | static void *Construct(const int , void *where, const void *copy) { return QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Construct(where, copy); } | - | ||||||||||||||||||||||||
| 1030 | }; | - | ||||||||||||||||||||||||
| 1031 | template<typename T> | - | ||||||||||||||||||||||||
| 1032 | struct ConstructorImpl<T, false> { | - | ||||||||||||||||||||||||
| 1033 | static void *Construct(const int type, void *where, const void *copy) | - | ||||||||||||||||||||||||
| 1034 | { | - | ||||||||||||||||||||||||
| 1035 | if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) | - | ||||||||||||||||||||||||
| 1036 | return __builtin_expect(!!(qMetaTypeGuiHelper), true) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].constructor(where, copy) : 0; | - | ||||||||||||||||||||||||
| 1037 | - | |||||||||||||||||||||||||
| 1038 | if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) | - | ||||||||||||||||||||||||
| 1039 | return __builtin_expect(!!(qMetaTypeWidgetsHelper), true) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].constructor(where, copy) : 0; | - | ||||||||||||||||||||||||
| 1040 | - | |||||||||||||||||||||||||
| 1041 | - | |||||||||||||||||||||||||
| 1042 | - | |||||||||||||||||||||||||
| 1043 | return 0; | - | ||||||||||||||||||||||||
| 1044 | } | - | ||||||||||||||||||||||||
| 1045 | }; | - | ||||||||||||||||||||||||
| 1046 | public: | - | ||||||||||||||||||||||||
| 1047 | TypeConstructor(const int type, void *where) | - | ||||||||||||||||||||||||
| 1048 | : m_type(type) | - | ||||||||||||||||||||||||
| 1049 | , m_where(where) | - | ||||||||||||||||||||||||
| 1050 | {} | - | ||||||||||||||||||||||||
| 1051 | - | |||||||||||||||||||||||||
| 1052 | template<typename T> | - | ||||||||||||||||||||||||
| 1053 | void *delegate(const T *copy) { return ConstructorImpl<T>::Construct(m_type, m_where, copy); } | - | ||||||||||||||||||||||||
| 1054 | void *delegate(const void *) { return m_where; } | - | ||||||||||||||||||||||||
| 1055 | void *delegate(const QMetaTypeSwitcher::UnknownType*) { return m_where; } | - | ||||||||||||||||||||||||
| 1056 | void *delegate(const QMetaTypeSwitcher::NotBuiltinType *copy) { return customTypeConstructor(m_type, m_where, copy); } | - | ||||||||||||||||||||||||
| 1057 | - | |||||||||||||||||||||||||
| 1058 | private: | - | ||||||||||||||||||||||||
| 1059 | static void *customTypeConstructor(const int type, void *where, const void *copy) | - | ||||||||||||||||||||||||
| 1060 | { | - | ||||||||||||||||||||||||
| 1061 | QMetaType::Constructor ctor; | - | ||||||||||||||||||||||||
| 1062 | const QVector<QCustomTypeInfo> * const ct = customTypes(); | - | ||||||||||||||||||||||||
| 1063 | { | - | ||||||||||||||||||||||||
| 1064 | QReadLocker locker(customTypesLock()); | - | ||||||||||||||||||||||||
| 1065 | if (__builtin_expect(!!(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User), false)) | - | ||||||||||||||||||||||||
| 1066 | return 0; | - | ||||||||||||||||||||||||
| 1067 | ctor = ct->at(type - QMetaType::User).constructor; | - | ||||||||||||||||||||||||
| 1068 | } | - | ||||||||||||||||||||||||
| 1069 | ((!(ctor)) ? qt_assert_x("void *QMetaType::construct(int type, void *where, const void *copy)", "The type was not properly registered",__FILE__,17511768) : qt_noop()); | - | ||||||||||||||||||||||||
| 1070 | return ctor(where, copy); | - | ||||||||||||||||||||||||
| 1071 | } | - | ||||||||||||||||||||||||
| 1072 | - | |||||||||||||||||||||||||
| 1073 | const int m_type; | - | ||||||||||||||||||||||||
| 1074 | void *m_where; | - | ||||||||||||||||||||||||
| 1075 | }; | - | ||||||||||||||||||||||||
| 1076 | } | - | ||||||||||||||||||||||||
| 1077 | void *QMetaType::construct(int type, void *where, const void *copy) | - | ||||||||||||||||||||||||
| 1078 | { | - | ||||||||||||||||||||||||
| 1079 | if (!where) | - | ||||||||||||||||||||||||
| 1080 | return 0; | - | ||||||||||||||||||||||||
| 1081 | TypeConstructor constructor(type, where); | - | ||||||||||||||||||||||||
| 1082 | return QMetaTypeSwitcher::switcher<void*>(constructor, type, copy); | - | ||||||||||||||||||||||||
| 1083 | } | - | ||||||||||||||||||||||||
| 1084 | - | |||||||||||||||||||||||||
| 1085 | - | |||||||||||||||||||||||||
| 1086 | namespace { | - | ||||||||||||||||||||||||
| 1087 | class TypeDestructor { | - | ||||||||||||||||||||||||
| 1088 | template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> | - | ||||||||||||||||||||||||
| 1089 | struct DestructorImpl { | - | ||||||||||||||||||||||||
| 1090 | static void Destruct(const int , void *where) { QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Destruct(where); } | - | ||||||||||||||||||||||||
| 1091 | }; | - | ||||||||||||||||||||||||
| 1092 | template<typename T> | - | ||||||||||||||||||||||||
| 1093 | struct DestructorImpl<T, false> { | - | ||||||||||||||||||||||||
| 1094 | static void Destruct(const int type, void *where) | - | ||||||||||||||||||||||||
| 1095 | { | - | ||||||||||||||||||||||||
| 1096 | if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) { | - | ||||||||||||||||||||||||
| 1097 | if (__builtin_expect(!!(qMetaTypeGuiHelper), true)) | - | ||||||||||||||||||||||||
| 1098 | qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].destructor(where); | - | ||||||||||||||||||||||||
| 1099 | return; | - | ||||||||||||||||||||||||
| 1100 | } | - | ||||||||||||||||||||||||
| 1101 | if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) { | - | ||||||||||||||||||||||||
| 1102 | if (__builtin_expect(!!(qMetaTypeWidgetsHelper), true)) | - | ||||||||||||||||||||||||
| 1103 | qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].destructor(where); | - | ||||||||||||||||||||||||
| 1104 | return; | - | ||||||||||||||||||||||||
| 1105 | } | - | ||||||||||||||||||||||||
| 1106 | - | |||||||||||||||||||||||||
| 1107 | - | |||||||||||||||||||||||||
| 1108 | } | - | ||||||||||||||||||||||||
| 1109 | }; | - | ||||||||||||||||||||||||
| 1110 | public: | - | ||||||||||||||||||||||||
| 1111 | TypeDestructor(const int type) | - | ||||||||||||||||||||||||
| 1112 | : m_type(type) | - | ||||||||||||||||||||||||
| 1113 | {} | - | ||||||||||||||||||||||||
| 1114 | - | |||||||||||||||||||||||||
| 1115 | template<typename T> | - | ||||||||||||||||||||||||
| 1116 | void delegate(const T *where) { DestructorImpl<T>::Destruct(m_type, const_cast<T*>(where)); } | - | ||||||||||||||||||||||||
| 1117 | void delegate(const void *) {} | - | ||||||||||||||||||||||||
| 1118 | void delegate(const QMetaTypeSwitcher::UnknownType*) {} | - | ||||||||||||||||||||||||
| 1119 | void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) | - | ||||||||||||||||||||||||
| 1120 | { customTypeDestructor(m_type, const_cast<void *>(static_cast<const void *>(where))); } | - | ||||||||||||||||||||||||
| 1121 | - | |||||||||||||||||||||||||
| 1122 | private: | - | ||||||||||||||||||||||||
| 1123 | static void customTypeDestructor(const int type, void *where) | - | ||||||||||||||||||||||||
| 1124 | { | - | ||||||||||||||||||||||||
| 1125 | QMetaType::Destructor dtor; | - | ||||||||||||||||||||||||
| 1126 | const QVector<QCustomTypeInfo> * const ct = customTypes(); | - | ||||||||||||||||||||||||
| 1127 | { | - | ||||||||||||||||||||||||
| 1128 | QReadLocker locker(customTypesLock()); | - | ||||||||||||||||||||||||
| 1129 | if (__builtin_expect(!!(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User), false)) | - | ||||||||||||||||||||||||
| 1130 | return; | - | ||||||||||||||||||||||||
| 1131 | dtor = ct->at(type - QMetaType::User).destructor; | - | ||||||||||||||||||||||||
| 1132 | } | - | ||||||||||||||||||||||||
| 1133 | ((!(dtor)) ? qt_assert_x("void QMetaType::destruct(int type, void *where)", "The type was not properly registered",__FILE__,18421859) : qt_noop()); | - | ||||||||||||||||||||||||
| 1134 | dtor(where); | - | ||||||||||||||||||||||||
| 1135 | } | - | ||||||||||||||||||||||||
| 1136 | - | |||||||||||||||||||||||||
| 1137 | const int m_type; | - | ||||||||||||||||||||||||
| 1138 | }; | - | ||||||||||||||||||||||||
| 1139 | } | - | ||||||||||||||||||||||||
| 1140 | void QMetaType::destruct(int type, void *where) | - | ||||||||||||||||||||||||
| 1141 | { | - | ||||||||||||||||||||||||
| 1142 | if (!where) | - | ||||||||||||||||||||||||
| 1143 | return; | - | ||||||||||||||||||||||||
| 1144 | TypeDestructor destructor(type); | - | ||||||||||||||||||||||||
| 1145 | QMetaTypeSwitcher::switcher<void>(destructor, type, where); | - | ||||||||||||||||||||||||
| 1146 | } | - | ||||||||||||||||||||||||
| 1147 | - | |||||||||||||||||||||||||
| 1148 | - | |||||||||||||||||||||||||
| 1149 | namespace { | - | ||||||||||||||||||||||||
| 1150 | class SizeOf { | - | ||||||||||||||||||||||||
| 1151 | template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> | - | ||||||||||||||||||||||||
| 1152 | struct SizeOfImpl { | - | ||||||||||||||||||||||||
| 1153 | static int Size(const int) { return QTypeInfo<T>::sizeOf; } | - | ||||||||||||||||||||||||
| 1154 | }; | - | ||||||||||||||||||||||||
| 1155 | template<typename T> | - | ||||||||||||||||||||||||
| 1156 | struct SizeOfImpl<T, false> { | - | ||||||||||||||||||||||||
| 1157 | static int Size(const int type) | - | ||||||||||||||||||||||||
| 1158 | { | - | ||||||||||||||||||||||||
| 1159 | if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) | - | ||||||||||||||||||||||||
| 1160 | return __builtin_expect(!!(qMetaTypeGuiHelper), true) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].size : 0; | - | ||||||||||||||||||||||||
| 1161 | - | |||||||||||||||||||||||||
| 1162 | if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) | - | ||||||||||||||||||||||||
| 1163 | return __builtin_expect(!!(qMetaTypeWidgetsHelper), true) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].size : 0; | - | ||||||||||||||||||||||||
| 1164 | - | |||||||||||||||||||||||||
| 1165 | - | |||||||||||||||||||||||||
| 1166 | - | |||||||||||||||||||||||||
| 1167 | return 0; | - | ||||||||||||||||||||||||
| 1168 | } | - | ||||||||||||||||||||||||
| 1169 | }; | - | ||||||||||||||||||||||||
| 1170 | - | |||||||||||||||||||||||||
| 1171 | public: | - | ||||||||||||||||||||||||
| 1172 | SizeOf(int type) | - | ||||||||||||||||||||||||
| 1173 | : m_type(type) | - | ||||||||||||||||||||||||
| 1174 | {} | - | ||||||||||||||||||||||||
| 1175 | - | |||||||||||||||||||||||||
| 1176 | template<typename T> | - | ||||||||||||||||||||||||
| 1177 | int delegate(const T*) { return SizeOfImpl<T>::Size(m_type); } | - | ||||||||||||||||||||||||
| 1178 | int delegate(const QMetaTypeSwitcher::UnknownType*) { return 0; } | - | ||||||||||||||||||||||||
| 1179 | int delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customTypeSizeOf(m_type); } | - | ||||||||||||||||||||||||
| 1180 | private: | - | ||||||||||||||||||||||||
| 1181 | static int customTypeSizeOf(const int type) | - | ||||||||||||||||||||||||
| 1182 | { | - | ||||||||||||||||||||||||
| 1183 | const QVector<QCustomTypeInfo> * const ct = customTypes(); | - | ||||||||||||||||||||||||
| 1184 | QReadLocker locker(customTypesLock()); | - | ||||||||||||||||||||||||
| 1185 | if (__builtin_expect(!!(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User), false)) | - | ||||||||||||||||||||||||
| 1186 | return 0; | - | ||||||||||||||||||||||||
| 1187 | return ct->at(type - QMetaType::User).size; | - | ||||||||||||||||||||||||
| 1188 | } | - | ||||||||||||||||||||||||
| 1189 | - | |||||||||||||||||||||||||
| 1190 | const int m_type; | - | ||||||||||||||||||||||||
| 1191 | }; | - | ||||||||||||||||||||||||
| 1192 | } | - | ||||||||||||||||||||||||
| 1193 | int QMetaType::sizeOf(int type) | - | ||||||||||||||||||||||||
| 1194 | { | - | ||||||||||||||||||||||||
| 1195 | SizeOf sizeOf(type); | - | ||||||||||||||||||||||||
| 1196 | return QMetaTypeSwitcher::switcher<int>(sizeOf, type, 0); | - | ||||||||||||||||||||||||
| 1197 | } | - | ||||||||||||||||||||||||
| 1198 | - | |||||||||||||||||||||||||
| 1199 | namespace { | - | ||||||||||||||||||||||||
| 1200 | class Flags | - | ||||||||||||||||||||||||
| 1201 | { | - | ||||||||||||||||||||||||
| 1202 | template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> | - | ||||||||||||||||||||||||
| 1203 | struct FlagsImpl | - | ||||||||||||||||||||||||
| 1204 | { | - | ||||||||||||||||||||||||
| 1205 | static quint32 Flags(const int ) | - | ||||||||||||||||||||||||
| 1206 | { | - | ||||||||||||||||||||||||
| 1207 | return QtPrivate::QMetaTypeTypeFlags<T>::Flags; | - | ||||||||||||||||||||||||
| 1208 | } | - | ||||||||||||||||||||||||
| 1209 | }; | - | ||||||||||||||||||||||||
| 1210 | template<typename T> | - | ||||||||||||||||||||||||
| 1211 | struct FlagsImpl<T, false> | - | ||||||||||||||||||||||||
| 1212 | { | - | ||||||||||||||||||||||||
| 1213 | static quint32 Flags(const int type) | - | ||||||||||||||||||||||||
| 1214 | { | - | ||||||||||||||||||||||||
| 1215 | if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) | - | ||||||||||||||||||||||||
| 1216 | return __builtin_expect(!!(qMetaTypeGuiHelper), true) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].flags : 0; | - | ||||||||||||||||||||||||
| 1217 | - | |||||||||||||||||||||||||
| 1218 | if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) | - | ||||||||||||||||||||||||
| 1219 | return __builtin_expect(!!(qMetaTypeWidgetsHelper), true) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].flags : 0; | - | ||||||||||||||||||||||||
| 1220 | - | |||||||||||||||||||||||||
| 1221 | - | |||||||||||||||||||||||||
| 1222 | - | |||||||||||||||||||||||||
| 1223 | return 0; | - | ||||||||||||||||||||||||
| 1224 | } | - | ||||||||||||||||||||||||
| 1225 | }; | - | ||||||||||||||||||||||||
| 1226 | public: | - | ||||||||||||||||||||||||
| 1227 | Flags(const int type) | - | ||||||||||||||||||||||||
| 1228 | : m_type(type) | - | ||||||||||||||||||||||||
| 1229 | {} | - | ||||||||||||||||||||||||
| 1230 | template<typename T> | - | ||||||||||||||||||||||||
| 1231 | quint32 delegate(const T*) { return FlagsImpl<T>::Flags(m_type); } | - | ||||||||||||||||||||||||
| 1232 | quint32 delegate(const void*) { return 0; } | - | ||||||||||||||||||||||||
| 1233 | quint32 delegate(const QMetaTypeSwitcher::UnknownType*) { return 0; } | - | ||||||||||||||||||||||||
| 1234 | quint32 delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customTypeFlags(m_type); } | - | ||||||||||||||||||||||||
| 1235 | private: | - | ||||||||||||||||||||||||
| 1236 | const int m_type; | - | ||||||||||||||||||||||||
| 1237 | static quint32 customTypeFlags(const int type) | - | ||||||||||||||||||||||||
| 1238 | { | - | ||||||||||||||||||||||||
| 1239 | const QVector<QCustomTypeInfo> * const ct = customTypes(); | - | ||||||||||||||||||||||||
| 1240 | if (__builtin_expect(!!(!ct || type < QMetaType::User), false)) | - | ||||||||||||||||||||||||
| 1241 | return 0; | - | ||||||||||||||||||||||||
| 1242 | QReadLocker locker(customTypesLock()); | - | ||||||||||||||||||||||||
| 1243 | if (__builtin_expect(!!(ct->count() <= type - QMetaType::User), false)) | - | ||||||||||||||||||||||||
| 1244 | return 0; | - | ||||||||||||||||||||||||
| 1245 | return ct->at(type - QMetaType::User).flags; | - | ||||||||||||||||||||||||
| 1246 | } | - | ||||||||||||||||||||||||
| 1247 | }; | - | ||||||||||||||||||||||||
| 1248 | } | - | ||||||||||||||||||||||||
| 1249 | QMetaType::TypeFlags QMetaType::typeFlags(int type) | - | ||||||||||||||||||||||||
| 1250 | { | - | ||||||||||||||||||||||||
| 1251 | Flags flags(type); | - | ||||||||||||||||||||||||
| 1252 | return static_cast<QMetaType::TypeFlags>(QMetaTypeSwitcher::switcher<quint32>(flags, type, 0)); | - | ||||||||||||||||||||||||
| 1253 | } | - | ||||||||||||||||||||||||
| 1254 | - | |||||||||||||||||||||||||
| 1255 | - | |||||||||||||||||||||||||
| 1256 | namespace { | - | ||||||||||||||||||||||||
| 1257 | class MetaObject | - | ||||||||||||||||||||||||
| 1258 | { | - | ||||||||||||||||||||||||
| 1259 | public: | - | ||||||||||||||||||||||||
| 1260 | MetaObject(const int type) | - | ||||||||||||||||||||||||
| 1261 | : m_type(type) | - | ||||||||||||||||||||||||
| 1262 | {} | - | ||||||||||||||||||||||||
| 1263 | - | |||||||||||||||||||||||||
| 1264 | template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> | - | ||||||||||||||||||||||||
| 1265 | struct MetaObjectImpl | - | ||||||||||||||||||||||||
| 1266 | { | - | ||||||||||||||||||||||||
| 1267 | static const QMetaObject *MetaObject(int ) | - | ||||||||||||||||||||||||
| 1268 | { return QtPrivate::MetaObjectForType<T>::value(); } | - | ||||||||||||||||||||||||
| 1269 | }; | - | ||||||||||||||||||||||||
| 1270 | template<typename T> | - | ||||||||||||||||||||||||
| 1271 | struct MetaObjectImpl<T, false> | - | ||||||||||||||||||||||||
| 1272 | { | - | ||||||||||||||||||||||||
| 1273 | static const QMetaObject *MetaObject(int type) { | - | ||||||||||||||||||||||||
| 1274 | if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) | - | ||||||||||||||||||||||||
| 1275 | return __builtin_expect(!!(qMetaTypeGuiHelper), true) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].metaObject : 0; | - | ||||||||||||||||||||||||
| 1276 | if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) | - | ||||||||||||||||||||||||
| 1277 | return __builtin_expect(!!(qMetaTypeWidgetsHelper), true) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].metaObject : 0; | - | ||||||||||||||||||||||||
| 1278 | return 0; | - | ||||||||||||||||||||||||
| 1279 | } | - | ||||||||||||||||||||||||
| 1280 | }; | - | ||||||||||||||||||||||||
| 1281 | - | |||||||||||||||||||||||||
| 1282 | template <typename T> | - | ||||||||||||||||||||||||
| 1283 | const QMetaObject *delegate(const T *) { return MetaObjectImpl<T>::MetaObject(m_type); } | - | ||||||||||||||||||||||||
| 1284 | const QMetaObject *delegate(const void*) { return 0; } | - | ||||||||||||||||||||||||
| 1285 | const QMetaObject *delegate(const QMetaTypeSwitcher::UnknownType*) { return 0; } | - | ||||||||||||||||||||||||
| 1286 | const QMetaObject *delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customMetaObject(m_type); } | - | ||||||||||||||||||||||||
| 1287 | private: | - | ||||||||||||||||||||||||
| 1288 | const int m_type; | - | ||||||||||||||||||||||||
| 1289 | static const QMetaObject *customMetaObject(const int type) | - | ||||||||||||||||||||||||
| 1290 | { | - | ||||||||||||||||||||||||
| 1291 | const QVector<QCustomTypeInfo> * const ct = customTypes(); | - | ||||||||||||||||||||||||
| 1292 | if (__builtin_expect(!!(!ct || type < QMetaType::User), false)) | - | ||||||||||||||||||||||||
| 1293 | return 0; | - | ||||||||||||||||||||||||
| 1294 | QReadLocker locker(customTypesLock()); | - | ||||||||||||||||||||||||
| 1295 | if (__builtin_expect(!!(ct->count() <= type - QMetaType::User), false)) | - | ||||||||||||||||||||||||
| 1296 | return 0; | - | ||||||||||||||||||||||||
| 1297 | return ct->at(type - QMetaType::User).metaObject; | - | ||||||||||||||||||||||||
| 1298 | } | - | ||||||||||||||||||||||||
| 1299 | }; | - | ||||||||||||||||||||||||
| 1300 | } | - | ||||||||||||||||||||||||
| 1301 | const QMetaObject *QMetaType::metaObjectForType(int type) | - | ||||||||||||||||||||||||
| 1302 | { | - | ||||||||||||||||||||||||
| 1303 | - | |||||||||||||||||||||||||
| 1304 | MetaObject mo(type); | - | ||||||||||||||||||||||||
| 1305 | return QMetaTypeSwitcher::switcher<const QMetaObject*>(mo, type, 0); | - | ||||||||||||||||||||||||
| 1306 | - | |||||||||||||||||||||||||
| 1307 | - | |||||||||||||||||||||||||
| 1308 | - | |||||||||||||||||||||||||
| 1309 | - | |||||||||||||||||||||||||
| 1310 | } | - | ||||||||||||||||||||||||
| 1311 | namespace { | - | ||||||||||||||||||||||||
| 1312 | class TypeInfo { | - | ||||||||||||||||||||||||
| 1313 | template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted> | - | ||||||||||||||||||||||||
| 1314 | struct TypeInfoImpl | - | ||||||||||||||||||||||||
| 1315 | { | - | ||||||||||||||||||||||||
| 1316 | TypeInfoImpl(const uint , QMetaTypeInterface &info) | - | ||||||||||||||||||||||||
| 1317 | { | - | ||||||||||||||||||||||||
| 1318 | QMetaTypeInterface tmp = { 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()) }; | - | ||||||||||||||||||||||||
| 1319 | info = tmp; | - | ||||||||||||||||||||||||
| 1320 | } | - | ||||||||||||||||||||||||
| 1321 | }; | - | ||||||||||||||||||||||||
| 1322 | - | |||||||||||||||||||||||||
| 1323 | template<typename T> | - | ||||||||||||||||||||||||
| 1324 | struct TypeInfoImpl<T, false> | - | ||||||||||||||||||||||||
| 1325 | { | - | ||||||||||||||||||||||||
| 1326 | TypeInfoImpl(const uint type, QMetaTypeInterface &info) | - | ||||||||||||||||||||||||
| 1327 | { | - | ||||||||||||||||||||||||
| 1328 | if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) { | - | ||||||||||||||||||||||||
| 1329 | if (__builtin_expect(!!(qMetaTypeGuiHelper), true)) | - | ||||||||||||||||||||||||
| 1330 | info = qMetaTypeGuiHelper[type - QMetaType::FirstGuiType]; | - | ||||||||||||||||||||||||
| 1331 | return; | - | ||||||||||||||||||||||||
| 1332 | } | - | ||||||||||||||||||||||||
| 1333 | if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) { | - | ||||||||||||||||||||||||
| 1334 | if (__builtin_expect(!!(qMetaTypeWidgetsHelper), true)) | - | ||||||||||||||||||||||||
| 1335 | info = qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType]; | - | ||||||||||||||||||||||||
| 1336 | return; | - | ||||||||||||||||||||||||
| 1337 | } | - | ||||||||||||||||||||||||
| 1338 | } | - | ||||||||||||||||||||||||
| 1339 | }; | - | ||||||||||||||||||||||||
| 1340 | public: | - | ||||||||||||||||||||||||
| 1341 | QMetaTypeInterface info; | - | ||||||||||||||||||||||||
| 1342 | TypeInfo(const uint type) | - | ||||||||||||||||||||||||
| 1343 | : m_type(type) | - | ||||||||||||||||||||||||
| 1344 | { | - | ||||||||||||||||||||||||
| 1345 | QMetaTypeInterface tmp = { 0, 0, 0, 0, 0, 0, 0 }; | - | ||||||||||||||||||||||||
| 1346 | info = tmp; | - | ||||||||||||||||||||||||
| 1347 | } | - | ||||||||||||||||||||||||
| 1348 | template<typename T> | - | ||||||||||||||||||||||||
| 1349 | void delegate(const T*) { TypeInfoImpl<T>(m_type, info); } | - | ||||||||||||||||||||||||
| 1350 | void delegate(const QMetaTypeSwitcher::UnknownType*) {} | - | ||||||||||||||||||||||||
| 1351 | void delegate(const QMetaTypeSwitcher::NotBuiltinType*) { customTypeInfo(m_type); } | - | ||||||||||||||||||||||||
| 1352 | private: | - | ||||||||||||||||||||||||
| 1353 | void customTypeInfo(const uint type) | - | ||||||||||||||||||||||||
| 1354 | { | - | ||||||||||||||||||||||||
| 1355 | const QVector<QCustomTypeInfo> * const ct = customTypes(); | - | ||||||||||||||||||||||||
| 1356 | if (__builtin_expect(!!(!ct), false)) | - | ||||||||||||||||||||||||
| 1357 | return; | - | ||||||||||||||||||||||||
| 1358 | QReadLocker locker(customTypesLock()); | - | ||||||||||||||||||||||||
| 1359 | if (__builtin_expect(!!(uint(ct->count()) > type - QMetaType::User), true)) | - | ||||||||||||||||||||||||
| 1360 | info = ct->at(type - QMetaType::User); | - | ||||||||||||||||||||||||
| 1361 | } | - | ||||||||||||||||||||||||
| 1362 | - | |||||||||||||||||||||||||
| 1363 | const uint m_type; | - | ||||||||||||||||||||||||
| 1364 | }; | - | ||||||||||||||||||||||||
| 1365 | } | - | ||||||||||||||||||||||||
| 1366 | - | |||||||||||||||||||||||||
| 1367 | - | |||||||||||||||||||||||||
| 1368 | - | |||||||||||||||||||||||||
| 1369 | - | |||||||||||||||||||||||||
| 1370 | - | |||||||||||||||||||||||||
| 1371 | QMetaType QMetaType::typeInfo(const int type) | - | ||||||||||||||||||||||||
| 1372 | { | - | ||||||||||||||||||||||||
| 1373 | TypeInfo typeInfo(type); | - | ||||||||||||||||||||||||
| 1374 | QMetaTypeSwitcher::switcher<void>(typeInfo, type, 0); | - | ||||||||||||||||||||||||
| 1375 | return typeInfo.info.constructor ? QMetaType(static_cast<ExtensionFlag>(QMetaType::CreateEx | QMetaType::DestroyEx) | - | ||||||||||||||||||||||||
| 1376 | , static_cast<const QMetaTypeInterface *>(0) | - | ||||||||||||||||||||||||
| 1377 | , 0 | - | ||||||||||||||||||||||||
| 1378 | , 0 | - | ||||||||||||||||||||||||
| 1379 | , typeInfo.info.saveOp | - | ||||||||||||||||||||||||
| 1380 | , typeInfo.info.loadOp | - | ||||||||||||||||||||||||
| 1381 | , typeInfo.info.constructor | - | ||||||||||||||||||||||||
| 1382 | , typeInfo.info.destructor | - | ||||||||||||||||||||||||
| 1383 | , typeInfo.info.size | - | ||||||||||||||||||||||||
| 1384 | , typeInfo.info.flags | - | ||||||||||||||||||||||||
| 1385 | , type | - | ||||||||||||||||||||||||
| 1386 | , typeInfo.info.metaObject) | - | ||||||||||||||||||||||||
| 1387 | : QMetaType(UnknownType); | - | ||||||||||||||||||||||||
| 1388 | } | - | ||||||||||||||||||||||||
| 1389 | - | |||||||||||||||||||||||||
| 1390 | - | |||||||||||||||||||||||||
| 1391 | - | |||||||||||||||||||||||||
| 1392 | - | |||||||||||||||||||||||||
| 1393 | - | |||||||||||||||||||||||||
| 1394 | - | |||||||||||||||||||||||||
| 1395 | - | |||||||||||||||||||||||||
| 1396 | QMetaType::QMetaType(const int typeId) | - | ||||||||||||||||||||||||
| 1397 | : m_typeId(typeId) | - | ||||||||||||||||||||||||
| 1398 | { | - | ||||||||||||||||||||||||
| 1399 | if (__builtin_expect(!!(typeId == UnknownType), false)) { | - | ||||||||||||||||||||||||
| 1400 | - | |||||||||||||||||||||||||
| 1401 | m_extensionFlags = 0xffffffff; | - | ||||||||||||||||||||||||
| 1402 | ((!(!isValid())) ? qt_assert("!isValid()",__FILE__,22822299) : qt_noop()); | - | ||||||||||||||||||||||||
| 1403 | } else { | - | ||||||||||||||||||||||||
| 1404 | - | |||||||||||||||||||||||||
| 1405 | *this = QMetaType::typeInfo(typeId); | - | ||||||||||||||||||||||||
| 1406 | if (m_typeId == UnknownType) | - | ||||||||||||||||||||||||
| 1407 | m_extensionFlags = 0xffffffff; | - | ||||||||||||||||||||||||
| 1408 | else if (m_typeId == QMetaType::Void) | - | ||||||||||||||||||||||||
| 1409 | m_extensionFlags = CreateEx | DestroyEx | ConstructEx | DestructEx; | - | ||||||||||||||||||||||||
| 1410 | } | - | ||||||||||||||||||||||||
| 1411 | } | - | ||||||||||||||||||||||||
| 1412 | - | |||||||||||||||||||||||||
| 1413 | - | |||||||||||||||||||||||||
| 1414 | - | |||||||||||||||||||||||||
| 1415 | - | |||||||||||||||||||||||||
| 1416 | - | |||||||||||||||||||||||||
| 1417 | - | |||||||||||||||||||||||||
| 1418 | - | |||||||||||||||||||||||||
| 1419 | QMetaType::QMetaType(const QMetaType &other) | - | ||||||||||||||||||||||||
| 1420 | : m_creator_unused(other.m_creator_unused) | - | ||||||||||||||||||||||||
| 1421 | , m_deleter_unused(other.m_deleter_unused) | - | ||||||||||||||||||||||||
| 1422 | , m_saveOp(other.m_saveOp) | - | ||||||||||||||||||||||||
| 1423 | , m_loadOp(other.m_loadOp) | - | ||||||||||||||||||||||||
| 1424 | , m_constructor(other.m_constructor) | - | ||||||||||||||||||||||||
| 1425 | , m_destructor(other.m_destructor) | - | ||||||||||||||||||||||||
| 1426 | , m_extension(other.m_extension) | - | ||||||||||||||||||||||||
| 1427 | , m_size(other.m_size) | - | ||||||||||||||||||||||||
| 1428 | , m_typeFlags(other.m_typeFlags) | - | ||||||||||||||||||||||||
| 1429 | , m_extensionFlags(other.m_extensionFlags) | - | ||||||||||||||||||||||||
| 1430 | , m_typeId(other.m_typeId) | - | ||||||||||||||||||||||||
| 1431 | , m_metaObject(other.m_metaObject) | - | ||||||||||||||||||||||||
| 1432 | {} | - | ||||||||||||||||||||||||
| 1433 | - | |||||||||||||||||||||||||
| 1434 | QMetaType &QMetaType::operator =(const QMetaType &other) | - | ||||||||||||||||||||||||
| 1435 | { | - | ||||||||||||||||||||||||
| 1436 | m_creator_unused = other.m_creator_unused; | - | ||||||||||||||||||||||||
| 1437 | m_deleter_unused = other.m_deleter_unused; | - | ||||||||||||||||||||||||
| 1438 | m_saveOp = other.m_saveOp; | - | ||||||||||||||||||||||||
| 1439 | m_loadOp = other.m_loadOp; | - | ||||||||||||||||||||||||
| 1440 | m_constructor = other.m_constructor; | - | ||||||||||||||||||||||||
| 1441 | m_destructor = other.m_destructor; | - | ||||||||||||||||||||||||
| 1442 | m_size = other.m_size; | - | ||||||||||||||||||||||||
| 1443 | m_typeFlags = other.m_typeFlags; | - | ||||||||||||||||||||||||
| 1444 | m_extensionFlags = other.m_extensionFlags; | - | ||||||||||||||||||||||||
| 1445 | m_extension = other.m_extension; | - | ||||||||||||||||||||||||
| 1446 | m_typeId = other.m_typeId; | - | ||||||||||||||||||||||||
| 1447 | m_metaObject = other.m_metaObject; | - | ||||||||||||||||||||||||
| 1448 | return *this; | - | ||||||||||||||||||||||||
| 1449 | } | - | ||||||||||||||||||||||||
| 1450 | void QMetaType::ctor(const QMetaTypeInterface *info) | - | ||||||||||||||||||||||||
| 1451 | { | - | ||||||||||||||||||||||||
| 1452 | - | |||||||||||||||||||||||||
| 1453 | - | |||||||||||||||||||||||||
| 1454 | - | |||||||||||||||||||||||||
| 1455 | ((!(m_typeId == QMetaType::Void)) ? qt_assert("m_typeId == QMetaType::Void",__FILE__,23442361) : qt_noop()); | - | ||||||||||||||||||||||||
| 1456 | (void)info;; | - | ||||||||||||||||||||||||
| 1457 | m_extensionFlags = CreateEx | DestroyEx | ConstructEx | DestructEx; | - | ||||||||||||||||||||||||
| 1458 | } | - | ||||||||||||||||||||||||
| 1459 | void QMetaType::dtor() | - | ||||||||||||||||||||||||
| 1460 | {} | - | ||||||||||||||||||||||||
| 1461 | void *QMetaType::createExtended(const void *copy) const | - | ||||||||||||||||||||||||
| 1462 | { | - | ||||||||||||||||||||||||
| 1463 | if (m_typeId == QMetaType::UnknownType) | - | ||||||||||||||||||||||||
| 1464 | return 0; | - | ||||||||||||||||||||||||
| 1465 | return m_constructor(operator new(m_size), copy); | - | ||||||||||||||||||||||||
| 1466 | } | - | ||||||||||||||||||||||||
| 1467 | void QMetaType::destroyExtended(void *data) const | - | ||||||||||||||||||||||||
| 1468 | { | - | ||||||||||||||||||||||||
| 1469 | m_destructor(data); | - | ||||||||||||||||||||||||
| 1470 | operator delete(data); | - | ||||||||||||||||||||||||
| 1471 | } | - | ||||||||||||||||||||||||
| 1472 | void *QMetaType::constructExtended(void *where, const void *copy) const | - | ||||||||||||||||||||||||
| 1473 | { | - | ||||||||||||||||||||||||
| 1474 | (void)where;; | - | ||||||||||||||||||||||||
| 1475 | (void)copy;; | - | ||||||||||||||||||||||||
| 1476 | return 0; | - | ||||||||||||||||||||||||
| 1477 | } | - | ||||||||||||||||||||||||
| 1478 | void QMetaType::destructExtended(void *data) const | - | ||||||||||||||||||||||||
| 1479 | { | - | ||||||||||||||||||||||||
| 1480 | (void)data;; | - | ||||||||||||||||||||||||
| 1481 | } | - | ||||||||||||||||||||||||
| 1482 | uint QMetaType::sizeExtended() const | - | ||||||||||||||||||||||||
| 1483 | { | - | ||||||||||||||||||||||||
| 1484 | return 0; | - | ||||||||||||||||||||||||
| 1485 | } | - | ||||||||||||||||||||||||
| 1486 | QMetaType::TypeFlags QMetaType::flagsExtended() const | - | ||||||||||||||||||||||||
| 1487 | { | - | ||||||||||||||||||||||||
| 1488 | return 0; | - | ||||||||||||||||||||||||
| 1489 | } | - | ||||||||||||||||||||||||
| 1490 | const QMetaObject *QMetaType::metaObjectExtended() const | - | ||||||||||||||||||||||||
| 1491 | { | - | ||||||||||||||||||||||||
| 1492 | return 0; | - | ||||||||||||||||||||||||
| 1493 | } | - | ||||||||||||||||||||||||
| 1494 | - | |||||||||||||||||||||||||
| 1495 | - | |||||||||||||||||||||||||
| 1496 | namespace QtPrivate | - | ||||||||||||||||||||||||
| 1497 | { | - | ||||||||||||||||||||||||
| 1498 | const QMetaObject *metaObjectForQWidget() | - | ||||||||||||||||||||||||
| 1499 | { | - | ||||||||||||||||||||||||
| 1500 | if (!qMetaTypeWidgetsHelper) | - | ||||||||||||||||||||||||
| 1501 | return 0; | - | ||||||||||||||||||||||||
| 1502 | return qMetaObjectWidgetsHelper; | - | ||||||||||||||||||||||||
| 1503 | } | - | ||||||||||||||||||||||||
| 1504 | } | - | ||||||||||||||||||||||||
| 1505 | - | |||||||||||||||||||||||||
| 1506 | namespace QtMetaTypePrivate { | - | ||||||||||||||||||||||||
| 1507 | const bool VectorBoolElements::true_element = true; | - | ||||||||||||||||||||||||
| 1508 | const bool VectorBoolElements::false_element = false; | - | ||||||||||||||||||||||||
| 1509 | } | - | ||||||||||||||||||||||||
| 1510 | - | |||||||||||||||||||||||||
| 1511 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |