summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qmetatype.h
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-02-11 07:02:13 +0100
committerJędrzej Nowacki <jedrzej.nowacki@digia.com>2014-10-31 12:17:57 +0100
commit0678d7c43c1658d2d2ec984be5844054031649a2 (patch)
tree4d31d02a75ab78befa8553abbe1de26a4ed3e848 /src/corelib/kernel/qmetatype.h
parent3de0f442b5857915f26be6600bc8e54d1af08208 (diff)
Add QMetaType::type(QByteArray) function
QMetaType::type(const char *) requires that the string argument is 0-terminated. This new overload makes it possible to query the type of a string with an explicit length. In particular, QByteArrays constructed by QByteArray::fromRawData(), for example from a substring of a normalized method signature (the "int" part of "mySlot(int"), can now be queried without making a copy of the string. Also, Qt5 meta-objects represent type names as QByteArray literals, which can be fed directly to this new QMetaType::type() overload (no need to call strlen). Change-Id: I60d35aa6bdc0f77e0997f98b0e30e12fd3d5e100 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qmetatype.h')
-rw-r--r--src/corelib/kernel/qmetatype.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 08b2fb083a..947bf77796 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -472,6 +472,11 @@ public:
static int registerTypedef(const char *typeName, int aliasId);
static int registerNormalizedTypedef(const QT_PREPEND_NAMESPACE(QByteArray) &normalizedTypeName, int aliasId);
static int type(const char *typeName);
+#ifndef Q_QDOC
+ static int type(const QT_PREPEND_NAMESPACE(QByteArray) &typeName);
+#else
+ static int type(const QByteArray &typeName);
+#endif
static const char *typeName(int type);
static int sizeOf(int type);
static TypeFlags typeFlags(int type);