QMetaObject: export the invokeImpl inner method

For other modules that wrap invokeMethod and equivalent, like
qtwebchannel.

Task-number: QTBUG-105596
Change-Id: Ic6547f8247454b47baa8fffd170bbca806b04d8f
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Thiago Macieira 2022-08-15 22:37:41 -07:00
parent 86bb62f2e7
commit 73dbc1fdf6
2 changed files with 32 additions and 27 deletions

View File

@ -166,7 +166,7 @@ static inline int typeFromTypeInfo(const QMetaObject *mo, uint typeInfo)
}
namespace {
class QMetaMethodPrivate : public QMetaMethod
class QMetaMethodPrivate : public QMetaMethodInvoker
{
public:
static const QMetaMethodPrivate *get(const QMetaMethod *q)
@ -191,31 +191,6 @@ public:
inline int ownMethodIndex() const;
inline int ownConstructorMethodIndex() const;
// shadows the public function
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,
};
static InvokeFailReason
invokeImpl(QMetaMethod self, void *target, Qt::ConnectionType, qsizetype paramCount,
const void *const *parameters, const char *const *typeNames);
private:
QMetaMethodPrivate();
};
@ -2411,7 +2386,7 @@ bool QMetaMethod::invoke(QObject *object,
return false;
}
auto QMetaMethodPrivate::invokeImpl(QMetaMethod self, void *target,
auto QMetaMethodInvoker::invokeImpl(QMetaMethod self, void *target,
Qt::ConnectionType connectionType,
qsizetype paramCount, const void *const *parameters,
const char *const *typeNames) -> InvokeFailReason

View File

@ -132,6 +132,36 @@ Q_DECLARE_TYPEINFO(QArgumentType, Q_RELOCATABLE_TYPE);
typedef QVarLengthArray<QArgumentType, 10> QArgumentTypeArray;
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);
};
struct QMetaObjectPrivate
{