diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-08-06 17:26:37 +0300 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-08-13 17:14:56 +0000 |
commit | d08db1100874fdc36ea169d34a8902133186b84b (patch) | |
tree | f51b50129afa4ab4f448badf9d2a934f507e040a /src/tools/uic/cpp/cppwritedeclaration.cpp | |
parent | 9c016cefe9a81de3b01019cb1eb1363b05e3b448 (diff) |
Remove last uses of Java-style (non-mutable) iterators from QtBase
Change-Id: I7531ffd4f2d5b2193bb6231c743ff0a074618b99
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/tools/uic/cpp/cppwritedeclaration.cpp')
-rw-r--r-- | src/tools/uic/cpp/cppwritedeclaration.cpp | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/tools/uic/cpp/cppwritedeclaration.cpp b/src/tools/uic/cpp/cppwritedeclaration.cpp index 4c9d2db6df..3aadc878e3 100644 --- a/src/tools/uic/cpp/cppwritedeclaration.cpp +++ b/src/tools/uic/cpp/cppwritedeclaration.cpp @@ -44,27 +44,16 @@ QT_BEGIN_NAMESPACE namespace { void openNameSpaces(const QStringList &namespaceList, QTextStream &output) { - if (namespaceList.empty()) - return; - const QStringList::const_iterator cend = namespaceList.constEnd(); - for (QStringList::const_iterator it = namespaceList.constBegin(); it != cend; ++it) { - if (!it->isEmpty()) { + for (auto it = namespaceList.begin(), end = namespaceList.end(); it != end; ++it) { + if (!it->isEmpty()) output << "namespace " << *it << " {\n"; - } } } void closeNameSpaces(const QStringList &namespaceList, QTextStream &output) { - if (namespaceList.empty()) - return; - - QListIterator<QString> it(namespaceList); - it.toBack(); - while (it.hasPrevious()) { - const QString ns = it.previous(); - if (!ns.isEmpty()) { - output << "} // namespace " << ns << "\n"; - } + for (auto it = namespaceList.rbegin(), end = namespaceList.rend(); it != end; ++it) { + if (!it->isEmpty()) + output << "} // namespace " << *it << "\n"; } } |