diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2012-01-25 14:43:07 +1000 |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2012-01-25 14:43:07 +1000 |
commit | c3601a8db91bc777ea859d6a796dfab6a218675e (patch) | |
tree | d2a4f6c83bec3cddcce020966cccac72be3aa04a /src/declarative/qml/qdeclarativetypenamecache_p.h | |
parent | 35794301d188b731a7b596d92fc632fff58586c0 (diff) | |
parent | 149f6afe321ce59aebe4ce2f9dddd1881d0ac22b (diff) |
Merge branch 'master' into animation-refactorwip/animation-refactor
Conflicts:
tests/auto/declarative/declarative.pro
Change-Id: Ie339be2989fac553d351f3077869f1847367b504
Diffstat (limited to 'src/declarative/qml/qdeclarativetypenamecache_p.h')
-rw-r--r-- | src/declarative/qml/qdeclarativetypenamecache_p.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/declarative/qml/qdeclarativetypenamecache_p.h b/src/declarative/qml/qdeclarativetypenamecache_p.h index 188e293830..8edc34d293 100644 --- a/src/declarative/qml/qdeclarativetypenamecache_p.h +++ b/src/declarative/qml/qdeclarativetypenamecache_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -73,7 +73,7 @@ public: inline bool isEmpty() const; - void add(const QHashedString &, int); + void add(const QHashedString &name, int sciptIndex = -1, const QHashedString &nameSpace = QHashedString()); struct Result { inline Result(); @@ -107,7 +107,35 @@ private: int scriptIndex; }; + template<typename Key> + Result query(const QStringHash<Import> &imports, Key key) + { + Import *i = imports.value(key); + if (i) { + if (i->scriptIndex != -1) { + return Result(i->scriptIndex); + } else { + return Result(static_cast<const void *>(i)); + } + } + + return Result(); + } + + template<typename Key> + Result typeSearch(const QVector<QDeclarativeTypeModuleVersion> &modules, Key key) + { + QVector<QDeclarativeTypeModuleVersion>::const_iterator end = modules.constEnd(); + for (QVector<QDeclarativeTypeModuleVersion>::const_iterator it = modules.constBegin(); it != end; ++it) { + if (QDeclarativeType *type = it->type(key)) + return Result(type); + } + + return Result(); + } + QStringHash<Import> m_namedImports; + QMap<const Import *, QStringHash<Import> > m_namespacedImports; QVector<QDeclarativeTypeModuleVersion> m_anonymousImports; QDeclarativeEngine *engine; @@ -144,7 +172,7 @@ bool QDeclarativeTypeNameCache::Result::isValid() const } QDeclarativeTypeNameCache::Import::Import() -: scriptIndex(-1) +: moduleApi(0), scriptIndex(-1) { } |