diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-02-18 20:36:06 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-29 12:50:14 +0100 |
commit | 3f7a222414fc9d3e9f2e2cfdd05f33740c5afb7e (patch) | |
tree | 55f95e0291331be96349ad2909ab99bfd128ae78 /src/corelib/kernel/qobjectdefs.h | |
parent | 02c1863485ec26ab6756fd7ec85d60d3bce68eb3 (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 <lars.knoll@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/corelib/kernel/qobjectdefs.h')
-rw-r--r-- | src/corelib/kernel/qobjectdefs.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index ec51251531..6c40733877 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -50,11 +50,12 @@ QT_BEGIN_NAMESPACE class QByteArray; +struct QByteArrayData; class QString; #ifndef Q_MOC_OUTPUT_REVISION -#define Q_MOC_OUTPUT_REVISION 64 +#define Q_MOC_OUTPUT_REVISION 65 #endif // The following macros are our "extensions" to C++ @@ -437,7 +438,7 @@ struct Q_CORE_EXPORT QMetaObject struct { // private data const QMetaObject *superdata; - const char *stringdata; + const QByteArrayData *stringdata; const uint *data; const void *extradata; } d; @@ -478,9 +479,6 @@ struct QMetaObjectExtraData StaticMetacallFunction static_metacall; }; -inline const char *QMetaObject::className() const -{ return d.stringdata; } - inline const QMetaObject *QMetaObject::superClass() const { return d.superdata; } |