diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-07-27 11:36:43 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-07-31 17:08:57 +0000 |
commit | 77449db6e086e8ac6594c432fede027656be0da0 (patch) | |
tree | 7bc9daff55d4480148488030f797ed517233736e /src/qml/compiler/qv4compileddata_p.h | |
parent | 71c66d4b41be95b44ffa0d9bbbf04164f74bd23a (diff) |
Encapsulate access to CompiledData::Object and CompiledData::Import
This will make it easier to move the data out of CompiledData::Unit and
into a separate data structure.
Change-Id: I32e6233a66f2279b44cc06ef7c3505db4a565f98
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compileddata_p.h')
-rw-r--r-- | src/qml/compiler/qv4compileddata_p.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h index dd0d92b0fa..54c7a242de 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/compiler/qv4compileddata_p.h @@ -814,11 +814,11 @@ struct Unit bool verifyHeader(QDateTime expectedSourceTimeStamp, QString *errorString) const; - const Import *importAt(int idx) const { + const Import *importAtInternal(int idx) const { return reinterpret_cast<const Import*>((reinterpret_cast<const char *>(this)) + offsetToImports + idx * sizeof(Import)); } - const Object *objectAt(int idx) const { + const Object *objectAtInternal(int idx) const { const quint32_le *offsetTable = reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + offsetToObjects); const quint32_le offset = offsetTable[idx]; return reinterpret_cast<const Object*>(reinterpret_cast<const char*>(this) + offset); @@ -1086,7 +1086,9 @@ public: // --- interface for QQmlPropertyCacheCreator typedef Object CompiledObject; int objectCount() const { return data->nObjects; } - const Object *objectAt(int index) const { return data->objectAt(index); } + const Object *objectAt(int index) const { return data->objectAtInternal(index); } + int importCount() const { return data->nImports; } + const Import *importAt(int index) const { return data->importAtInternal(index); } QString stringAt(int index) const { if (backingUnit) { |