From d08db1100874fdc36ea169d34a8902133186b84b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 6 Aug 2016 17:26:37 +0300 Subject: Remove last uses of Java-style (non-mutable) iterators from QtBase Change-Id: I7531ffd4f2d5b2193bb6231c743ff0a074618b99 Reviewed-by: Lars Knoll --- src/tools/uic/cpp/cppwritedeclaration.cpp | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'src/tools/uic/cpp/cppwritedeclaration.cpp') diff --git a/src/tools/uic/cpp/cppwritedeclaration.cpp b/src/tools/uic/cpp/cppwritedeclaration.cpp index 4c9d2db6dfb..3aadc878e36 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 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"; } } -- cgit v1.2.3