summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-06-18 12:19:22 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-07-03 15:31:16 +0200
commit2f76c112e90829f6c3dc278911a311a1ad0610ed (patch)
treed6b9df18404f852202f19e2294b19b69fd2a2c96
parent3d729fabf2740af247f302c450f0bece7b85f881 (diff)
Eradicate Java-style iterators and mark the module free of them
Java-style iterators are scheduled for deprecation, or at the very least banned from use in Qt code. Change-Id: I7a6e689e66ee4454658b9b52e7d444b7560a06fb Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-rw-r--r--.qmake.conf2
-rw-r--r--src/remoteobjects/qconnection_qnx_server.cpp7
-rw-r--r--src/remoteobjects/qremoteobjectnode.cpp5
-rw-r--r--src/repparser/qregexparser.h7
4 files changed, 10 insertions, 11 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 27134db..bfeba00 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,6 +1,8 @@
load(qt_build_config)
CONFIG += qt_example_installs
+DEFINES += QT_NO_JAVA_STYLE_ITERATORS
+
MODULE_VERSION = 5.14.0
QTRO_SOURCE_TREE = $$PWD
diff --git a/src/remoteobjects/qconnection_qnx_server.cpp b/src/remoteobjects/qconnection_qnx_server.cpp
index 2fdd0ed..0f760a3 100644
--- a/src/remoteobjects/qconnection_qnx_server.cpp
+++ b/src/remoteobjects/qconnection_qnx_server.cpp
@@ -415,11 +415,10 @@ void QQnxNativeServerPrivate::cleanupIOSource(QIOQnxSource *conn)
{
QSharedPointer<QIOQnxSource> io;
mutex.lock();
- QHashIterator<uint64_t, QSharedPointer<QIOQnxSource>> i(sources);
- while (i.hasNext()) {
- i.next();
+ for (auto i = sources.begin(), end = sources.end(); i != end; ++i) {
if (i.value().data() == conn) {
- io = sources.take(i.key());
+ io = std::move(i.value());
+ sources.erase(i);
break;
}
}
diff --git a/src/remoteobjects/qremoteobjectnode.cpp b/src/remoteobjects/qremoteobjectnode.cpp
index 127ed9d..fbd13b9 100644
--- a/src/remoteobjects/qremoteobjectnode.cpp
+++ b/src/remoteobjects/qremoteobjectnode.cpp
@@ -1108,9 +1108,8 @@ void QRemoteObjectNodePrivate::onRegistryInitialized()
{
qROPrivDebug() << "Registry Initialized" << remoteObjectAddresses();
- QHashIterator<QString, QRemoteObjectSourceLocationInfo> i(remoteObjectAddresses());
- while (i.hasNext()) {
- i.next();
+ const auto remotes = remoteObjectAddresses();
+ for (auto i = remotes.cbegin(), end = remotes.cend(); i != end; ++i) {
if (replicas.contains(i.key())) //We have a replica waiting on this remoteObject
{
QSharedPointer<QReplicaImplementationInterface> rep = replicas.value(i.key()).toStrongRef();
diff --git a/src/repparser/qregexparser.h b/src/repparser/qregexparser.h
index c09bb91..83627ec 100644
--- a/src/repparser/qregexparser.h
+++ b/src/repparser/qregexparser.h
@@ -450,11 +450,10 @@ int QRegexParser<_Parser, _Table>::nextToken()
setErrorString(QStringLiteral("Error generating tokens from file, next characters >%1<").arg(m_buffer.mid(m_loc, 15)));
return -1;
} else {
- QMapIterator<int, QString> iter(m_names.at(best));
- if (iter.hasNext())
+ const QMap<int, QString> &map = m_names.at(best);
+ if (!map.isEmpty())
m_captured.clear();
- while (iter.hasNext()) {
- iter.next();
+ for (auto iter = map.cbegin(), end = map.cend(); iter != end; ++iter) {
#ifdef QT_BOOTSTRAPPED
m_captured.insert(iter.value(), m_regexes.at(best).cap(iter.key()));
#else