Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / src / declarative / qml / qdeclarativetypenamecache_p.h
index 68f6044..9cf52f9 100644 (file)
@@ -1,7 +1,6 @@
 /****************************************************************************
 **
 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
 ** Contact: http://www.qt-project.org/
 **
 ** This file is part of the QtDeclarative module of the Qt Toolkit.
@@ -35,6 +34,7 @@
 **
 **
 **
+**
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
@@ -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;