aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlimport.cpp
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-09-16 10:23:34 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-09-17 07:48:54 +0000
commit67fe97be1580058ec06de60ab4db7337ba30ff32 (patch)
tree78ad45ab23cbd559bb35c6c4deaa0e7b7c2f907f /src/qml/qml/qqmlimport.cpp
parent372082dd8e5d66048b09c8fd0091294a60cde42a (diff)
QQmlImportNamespace: mark findImport() method as const
This method does not modify the object. While touching the code, port loop to C++11 'range for', and replace 0 with nullptr Change-Id: I3695f3aa162daf0da396a0991d96ac4c438c1221 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlimport.cpp')
-rw-r--r--src/qml/qml/qqmlimport.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index f3de82b5ab..d9592f7649 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -229,7 +229,7 @@ public:
};
QList<Import *> imports;
- Import *findImport(const QString &uri);
+ Import *findImport(const QString &uri) const;
bool resolveType(QQmlTypeLoader *typeLoader, const QHashedStringRef& type,
int *vmajor, int *vminor, QQmlType** type_return,
@@ -784,14 +784,13 @@ bool QQmlImportsPrivate::resolveType(const QHashedStringRef& type, int *vmajor,
return false;
}
-QQmlImportNamespace::Import *QQmlImportNamespace::findImport(const QString &uri)
+QQmlImportNamespace::Import *QQmlImportNamespace::findImport(const QString &uri) const
{
- for (QList<Import *>::iterator it = imports.begin(), end = imports.end(); it != end; ++it) {
- if ((*it)->uri == uri)
- return *it;
+ for (Import *import : imports) {
+ if (import->uri == uri)
+ return import;
}
-
- return 0;
+ return nullptr;
}
bool QQmlImportNamespace::resolveType(QQmlTypeLoader *typeLoader, const QHashedStringRef &type,