path: root/src/corelib/kernel/qmetaobject_p.h
diff options
authorKent Hansen <>2012-02-18 20:36:06 +0100
committerQt by Nokia <>2012-02-29 12:50:14 +0100
commit3f7a222414fc9d3e9f2e2cfdd05f33740c5afb7e (patch)
tree55f95e0291331be96349ad2909ab99bfd128ae78 /src/corelib/kernel/qmetaobject_p.h
parent02c1863485ec26ab6756fd7ec85d60d3bce68eb3 (diff)
Change the representation of meta-object string data
Up to and including meta-object revision 6, string data have been stored as 0-terminated C-style strings, that were made directly accessible as const char pointers through the public API (QMetaMethod and friends). This commit changes moc to generate an array of QByteArrayData instead, and adapts the QObject kernel accordingly. Generating an array of QByteArrayData (byte array literals) means that the strings can now be returned from public (or private) API as QByteArrays, rather than const char *, with zero allocation or copying. Also, the string length is now computed at compile time (it's part of the QByteArrayData). This commit only changes the internal representation, and does not affect existing public API. The actual (C) string data that the byte array literals reference still consists of zero-terminated strings. The benefit of having the QByteArrayData array will only become apparent in the upcoming meta-object data format change, which changes the format of property and method descriptors. Support for the old meta-object string data format was kept; the codepaths for old revisions (6 and below) will be removed in a separate commit, once all the other meta-object changes are done and affected code has been adapted accordingly. Task-number: QTBUG-24154 Change-Id: I4ec3b363bbc31b8192e5d8915ef091c442c2efad Reviewed-by: Lars Knoll <> Reviewed-by: Olivier Goffart <> Reviewed-by: João Abecasis <> Reviewed-by: Bradley T. Hughes <>
Diffstat (limited to 'src/corelib/kernel/qmetaobject_p.h')
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h
index 59a5c5f280..d789711bb4 100644
--- a/src/corelib/kernel/qmetaobject_p.h
+++ b/src/corelib/kernel/qmetaobject_p.h
@@ -109,7 +109,7 @@ class QMutex;
struct QMetaObjectPrivate
- enum { OutputRevision = 6 }; // Used by moc and qmetaobjectbuilder
+ enum { OutputRevision = 7 }; // Used by moc, qmetaobjectbuilder and qdbus
int revision;
int className;
@@ -122,10 +122,13 @@ struct QMetaObjectPrivate
int signalCount; //since revision 4
// revision 5 introduces changes in normalized signatures, no new members
// revision 6 added qt_static_metacall as a member of each Q_OBJECT and inside QMetaObject itself
+ // revision 7 is Qt 5
static inline const QMetaObjectPrivate *get(const QMetaObject *metaobject)
{ return reinterpret_cast<const QMetaObjectPrivate*>(metaobject->; }
+ static const char *rawStringData(const QMetaObject *mo, int index);
static int indexOfSignalRelative(const QMetaObject **baseObject,
const char* name,
bool normalizeStringData);