diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-09-30 08:13:04 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-05 02:39:03 (GMT) |
commit | dff7f0593d86e90eb14c805a96ebbda778f45a82 (patch) | |
tree | e2c8c52170bf2884b4c8d138627492739944966b /src/declarative/qml/qmlpropertycache_p.h | |
parent | 49527e854a9edb0a92e64264d6efac6be46cf0ed (diff) | |
download | Qt-dff7f0593d86e90eb14c805a96ebbda778f45a82.zip Qt-dff7f0593d86e90eb14c805a96ebbda778f45a82.tar.gz Qt-dff7f0593d86e90eb14c805a96ebbda778f45a82.tar.bz2 |
Improve script lookup caching
Diffstat (limited to 'src/declarative/qml/qmlpropertycache_p.h')
-rw-r--r-- | src/declarative/qml/qmlpropertycache_p.h | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/src/declarative/qml/qmlpropertycache_p.h b/src/declarative/qml/qmlpropertycache_p.h index c10fafa..21c8ef3 100644 --- a/src/declarative/qml/qmlpropertycache_p.h +++ b/src/declarative/qml/qmlpropertycache_p.h @@ -67,33 +67,50 @@ public: QmlPropertyCache(); virtual ~QmlPropertyCache(); - struct Data : public QmlRefCount { - Data() : isFunction(false) {} + struct Data { + inline Data(); - bool isFunction; + enum Flag { IsFunction = 0x00000001, + IsQObjectDerived = 0x00000002, + IsConstant = 0x00000004 }; + Q_DECLARE_FLAGS(Flags, Flag) + + Flags flags; int propType; int coreIndex; + int notifyIndex; QString name; }; static QmlPropertyCache *create(QmlEngine *, const QMetaObject *); - Data *property(const QScriptDeclarativeClass::Identifier &id) const { - return identifierCache.value(id); - } - + inline Data *property(const QScriptDeclarativeClass::Identifier &id) const; Data *property(const QString &) const; Data *property(int) const; private: - typedef QVector<QScriptDeclarativeClass::PersistentIdentifier<Data> *> IndexCache; - typedef QHash<QString, QScriptDeclarativeClass::PersistentIdentifier<Data> *> StringCache; - typedef QHash<QScriptDeclarativeClass::Identifier, QScriptDeclarativeClass::PersistentIdentifier<Data> *> IdentifierCache; + struct RData : public Data, public QmlRefCount {}; + + typedef QVector<QScriptDeclarativeClass::PersistentIdentifier<RData> *> IndexCache; + typedef QHash<QString, QScriptDeclarativeClass::PersistentIdentifier<RData> *> StringCache; + typedef QHash<QScriptDeclarativeClass::Identifier, QScriptDeclarativeClass::PersistentIdentifier<RData> *> IdentifierCache; IndexCache indexCache; StringCache stringCache; IdentifierCache identifierCache; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QmlPropertyCache::Data::Flags); + +QmlPropertyCache::Data::Data() +: flags(0), propType(0), coreIndex(-1), notifyIndex(-1) +{ +} + +QmlPropertyCache::Data * +QmlPropertyCache::property(const QScriptDeclarativeClass::Identifier &id) const +{ + return identifierCache.value(id); +} QT_END_NAMESPACE |