diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-03-06 16:19:42 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-11 18:31:21 +0100 |
commit | 914b72418b7e766026f2679254fcee93fc920866 (patch) | |
tree | 202634bd203c830ddc7eeb7dab1d071ca506b8a3 /src/qml/compiler/qqmlcodegenerator_p.h | |
parent | af7ba8a6194b83fe7380b8d4ae027e2f04e21f17 (diff) |
Add support for resolving translation bindings at compile time
Simple calls to qsTr and qsTrId are detected at type compile time and
reduced to a special Translation and TranslationById binding type, which
avoids allocating a QML binding at type instantiation type just to perform
a translation.
Change-Id: I61e4f2db2a8092b5e6870e174b832d9c20cd62b5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qqmlcodegenerator_p.h')
-rw-r--r-- | src/qml/compiler/qqmlcodegenerator_p.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator_p.h b/src/qml/compiler/qqmlcodegenerator_p.h index 3b72e24bd2..583f8e1ed5 100644 --- a/src/qml/compiler/qqmlcodegenerator_p.h +++ b/src/qml/compiler/qqmlcodegenerator_p.h @@ -171,8 +171,8 @@ template <typename T> class FixedPoolArray { T *data; - int count; public: + int count; void init(QQmlJS::MemoryPool *pool, const QVector<T> &vector) { @@ -192,6 +192,12 @@ public: return data[index]; } + T &operator[](int index) { + Q_ASSERT(index >= 0 && index < count); + return data[index]; + } + + int indexOf(const T &value) const { for (int i = 0; i < count; ++i) if (data[i] == value) |