diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-02-21 13:06:35 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-17 16:57:23 +0200 |
commit | 405bf8f7b8e1b1174b80d64a5aeba39ed4e797ca (patch) | |
tree | 928a33d31d301d823b21e67e45d400b866c11600 /src/script/bridge/qscriptqobject.cpp | |
parent | 80451ee3dcb4b50f591759018edad27098eeb371 (diff) | |
download | qtscript-405bf8f7b8e1b1174b80d64a5aeba39ed4e797ca.tar.gz |
Adapt qtscript to QMetaMethod::signature() renaming
QMetaMethod::methodSignature() should be used instead, and it returns
a QByteArray.
Change-Id: I81150e238dab7eda26d0466ac407a4f3ba79a7c7
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/script/bridge/qscriptqobject.cpp')
-rw-r--r-- | src/script/bridge/qscriptqobject.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index ffc0ba7..415e9e7 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -168,11 +168,11 @@ static bool isEnumerableMetaProperty(const QMetaProperty &prop, */ static inline int methodNameLength(const QMetaMethod &method) { - const char *signature = method.signature(); - const char *s = signature; + QByteArray signature = method.methodSignature(); + const char *s = signature.constData(); while (*s && (*s != '(')) ++s; - return s - signature; + return s - signature.constData(); } /*! \internal @@ -191,10 +191,10 @@ static inline QByteArray methodName(const char *signature, int nameLength) false. */ static inline bool methodNameEquals(const QMetaMethod &method, - const char *signature, int nameLength) + const QByteArray &signature, int nameLength) { - const char *otherSignature = method.signature(); - return !qstrncmp(otherSignature, signature, nameLength) + QByteArray otherSignature = method.methodSignature(); + return !qstrncmp(otherSignature.constData(), signature.constData(), nameLength) && (otherSignature[nameLength] == '('); } @@ -320,7 +320,7 @@ QList<int> QScript::QtFunction::overloadedIndexes() const QMetaMethod method = meta->method(initialIndex()); int nameLength = methodNameLength(method); for (int index = mostGeneralMethod() - 1; index >= 0; --index) { - if (methodNameEquals(meta->method(index), method.signature(), nameLength)) + if (methodNameEquals(meta->method(index), method.methodSignature(), nameLength)) result.append(index); } return result; @@ -499,14 +499,14 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c QVector<int> conversionFailed; int index; int nameLength = 0; - const char *initialMethodSignature = 0; + QByteArray initialMethodSignature; exec->clearException(); QScriptEnginePrivate *engine = QScript::scriptEngineFromExec(exec); for (index = initialIndex; index >= 0; --index) { QMetaMethod method = metaMethod(meta, callType, index); if (index == initialIndex) { - initialMethodSignature = method.signature(); + initialMethodSignature = method.methodSignature(); nameLength = methodNameLength(method); } else { if (!methodNameEquals(method, initialMethodSignature, nameLength)) @@ -836,7 +836,7 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c if (i > 0) message += QLatin1String("\n"); QMetaMethod mtd = metaMethod(meta, callType, conversionFailed.at(i)); - message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.signature())); + message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.methodSignature().constData())); } result = JSC::throwError(exec, JSC::TypeError, message); } else if (!unresolved.isEmpty()) { @@ -863,7 +863,7 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c if (i > 0) message += QLatin1String("\n"); QMetaMethod mtd = metaMethod(meta, callType, tooFewArgs.at(i)); - message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.signature())); + message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.methodSignature().constData())); } result = JSC::throwError(exec, JSC::SyntaxError, message); } @@ -881,7 +881,7 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c if (i > 0) message += QLatin1String("\n"); QMetaMethod mtd = metaMethod(meta, callType, candidates.at(i).index); - message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.signature())); + message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.methodSignature().constData())); } result = JSC::throwError(exec, JSC::TypeError, message); } else { @@ -1594,7 +1594,7 @@ void QObjectDelegate::getOwnPropertyNames(QScriptObject *object, JSC::ExecState QMetaMethod method = meta->method(i); if (hasMethodAccess(method, i, opt)) { QMetaMethod method = meta->method(i); - QString sig = QString::fromLatin1(method.signature()); + QString sig = QString::fromLatin1(method.methodSignature().constData()); propertyNames.add(JSC::Identifier(exec, sig)); } } @@ -2120,7 +2120,7 @@ void QObjectConnectionManager::execute(int slotIndex, void **argv) if (!argType) { qWarning("QScriptEngine: Unable to handle unregistered datatype '%s' " "when invoking handler of signal %s::%s", - typeName.constData(), meta->className(), method.signature()); + typeName.constData(), meta->className(), method.methodSignature().constData()); actual = JSC::jsUndefined(); } else if (argType == QMetaType::QVariant) { actual = QScriptEnginePrivate::jscValueFromVariant(exec, *reinterpret_cast<QVariant*>(arg)); @@ -2196,7 +2196,7 @@ bool QObjectConnectionManager::addSignalHandler( QMetaMethod signal = sender->metaObject()->method(signalIndex); QByteArray signalString; signalString.append('2'); // signal code - signalString.append(signal.signature()); + signalString.append(signal.methodSignature()); static_cast<QObjectNotifyCaller*>(sender)->callConnectNotify(signalString); } return ok; @@ -2219,7 +2219,7 @@ bool QObjectConnectionManager::removeSignalHandler( QMetaMethod signal = sender->metaObject()->method(signalIndex); QByteArray signalString; signalString.append('2'); // signal code - signalString.append(signal.signature()); + signalString.append(signal.methodSignature()); static_cast<QScript::QObjectNotifyCaller*>(sender)->callDisconnectNotify(signalString); } return ok; |