diff options
Diffstat (limited to 'src/corelib/kernel/qmetaobject_p.h')
-rw-r--r-- | src/corelib/kernel/qmetaobject_p.h | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index 15c52ca663..d2c36fceb4 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -23,11 +23,14 @@ #ifndef QT_NO_QOBJECT #include <private/qobject_p.h> // For QObjectPrivate::Connection #endif +#include <private/qtools_p.h> #include <QtCore/qvarlengtharray.h> QT_BEGIN_NAMESPACE // ### TODO - QTBUG-87869: wrap in a proper Q_NAMESPACE and use scoped enums, to avoid name clashes +using namespace QtMiscUtils; + enum PropertyFlags { Invalid = 0x00000000, Readable = 0x00000001, @@ -131,7 +134,38 @@ Q_DECLARE_TYPEINFO(QArgumentType, Q_RELOCATABLE_TYPE); typedef QVarLengthArray<QArgumentType, 10> QArgumentTypeArray; -class QMetaMethodPrivate; +namespace { class QMetaMethodPrivate; } +class QMetaMethodInvoker : public QMetaMethod +{ + QMetaMethodInvoker() = delete; + +public: + enum class InvokeFailReason : int { + // negative values mean a match was found but the invocation failed + // (and a warning has been printed) + ReturnTypeMismatch = -1, + DeadLockDetected = -2, + CallViaVirtualFailed = -3, // no warning + ConstructorCallOnObject = -4, + ConstructorCallWithoutResult = -5, + ConstructorCallFailed = -6, // no warning + + CouldNotQueueParameter = -0x1000, + + // zero is success + None = 0, + + // positive values mean the parameters did not match + TooFewArguments, + FormalParameterMismatch = 0x1000, + }; + + // shadows the public function + static InvokeFailReason Q_CORE_EXPORT + invokeImpl(QMetaMethod self, void *target, Qt::ConnectionType, qsizetype paramCount, + const void *const *parameters, const char *const *typeNames, + const QtPrivate::QMetaTypeInterface *const *metaTypes); +}; struct QMetaObjectPrivate { @@ -140,7 +174,9 @@ struct QMetaObjectPrivate // revision 9 is Qt 6.0: It adds the metatype of properties and methods // revision 10 is Qt 6.2: The metatype of the metaobject is stored in the metatypes array // and metamethods store a flag stating whether they are const - enum { OutputRevision = 10 }; // Used by moc, qmetaobjectbuilder and qdbus + // revision 11 is Qt 6.5: The metatype for void is stored in the metatypes array + // revision 12 is Qt 6.6: It adds the metatype for enums + enum { OutputRevision = 12 }; // Used by moc, qmetaobjectbuilder and qdbus enum { IntsPerMethod = QMetaMethod::Data::Size }; enum { IntsPerEnum = QMetaEnum::Data::Size }; enum { IntsPerProperty = QMetaProperty::Data::Size }; @@ -176,6 +212,11 @@ struct QMetaObjectPrivate int argc, const QArgumentType *types); static int indexOfConstructor(const QMetaObject *m, const QByteArray &name, int argc, const QArgumentType *types); + + enum class Which { Name, Alias }; + static int indexOfEnumerator(const QMetaObject *m, QByteArrayView name, Which which); + static int indexOfEnumerator(const QMetaObject *m, QByteArrayView name); + Q_CORE_EXPORT static QMetaMethod signal(const QMetaObject *m, int signal_index); static inline int signalOffset(const QMetaObject *m) { @@ -233,11 +274,7 @@ enum { MetaObjectPrivateFieldCount = sizeof(QMetaObjectPrivate) / sizeof(int) }; // mirrored in moc's utils.h static inline bool is_ident_char(char s) { - return ((s >= 'a' && s <= 'z') - || (s >= 'A' && s <= 'Z') - || (s >= '0' && s <= '9') - || s == '_' - ); + return isAsciiLetterOrNumber(s) || s == '_'; } static inline bool is_space(char s) |