summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-02-19 19:34:50 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-20 11:29:54 +0100
commit4a0565b4439b9bb71d0e7a77b15b85611a697f57 (patch)
tree5c7e8e5aca277d78f215fb66417e185d0478fafb
parentf83724a0f282862aa91a28baa20e555b1b64371c (diff)
downloadqtbase-4a0565b4439b9bb71d0e7a77b15b85611a697f57.tar.gz
Move QMetaMethod::parameterTypes() implementation to helper function
Because of an upcoming change to the meta-object data format, the ability to extract parameter types from a signature will be needed by meta-object builders (such as QMetaObjectBuilder) soon. Change-Id: I1f21b2be41761a5db2f1a05976fad29eb3aebb03 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/kernel/qmetaobject.cpp46
-rw-r--r--src/corelib/kernel/qmetaobject_p.h2
2 files changed, 30 insertions, 18 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 03fc90b620..d53ba707f7 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -1295,25 +1295,10 @@ const char *QMetaMethod::signature() const
*/
QList<QByteArray> QMetaMethod::parameterTypes() const
{
- QList<QByteArray> list;
if (!mobj)
- return list;
- const char *signature = mobj->d.stringdata + mobj->d.data[handle];
- while (*signature && *signature != '(')
- ++signature;
- while (*signature && *signature != ')' && *++signature != ')') {
- const char *begin = signature;
- int level = 0;
- while (*signature && (level > 0 || *signature != ',') && *signature != ')') {
- if (*signature == '<')
- ++level;
- else if (*signature == '>')
- --level;
- ++signature;
- }
- list += QByteArray(begin, signature - begin);
- }
- return list;
+ return QList<QByteArray>();
+ return QMetaObjectPrivate::parameterTypeNamesFromSignature(
+ mobj->d.stringdata + mobj->d.data[handle]);
}
/*!
@@ -2809,4 +2794,29 @@ int QMetaObjectPrivate::originalClone(const QMetaObject *mobj, int local_method_
return local_method_index;
}
+/*!
+ \internal
+
+ Returns the parameter type names extracted from the given \a signature.
+*/
+QList<QByteArray> QMetaObjectPrivate::parameterTypeNamesFromSignature(const char *signature)
+{
+ QList<QByteArray> list;
+ while (*signature && *signature != '(')
+ ++signature;
+ while (*signature && *signature != ')' && *++signature != ')') {
+ const char *begin = signature;
+ int level = 0;
+ while (*signature && (level > 0 || *signature != ',') && *signature != ')') {
+ if (*signature == '<')
+ ++level;
+ else if (*signature == '>')
+ --level;
+ ++signature;
+ }
+ list += QByteArray(begin, signature - begin);
+ }
+ return list;
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h
index d6e49b92d2..59a5c5f280 100644
--- a/src/corelib/kernel/qmetaobject_p.h
+++ b/src/corelib/kernel/qmetaobject_p.h
@@ -134,6 +134,8 @@ struct QMetaObjectPrivate
bool normalizeStringData);
static int originalClone(const QMetaObject *obj, int local_method_index);
+ static QList<QByteArray> parameterTypeNamesFromSignature(const char *signature);
+
#ifndef QT_NO_QOBJECT
//defined in qobject.cpp
enum DisconnectType { DisconnectAll, DisconnectOne };