summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-06-18 22:10:47 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-06-18 22:10:49 +0200
commita628d05ced75d0666bd462f94807d3d600ca25d2 (patch)
treebf23328804affd0928fe0440ce563c83ccfaed85 /src
parentb91c44ee859b8e1e09b8c20acabbed7a523b076b (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: If50aade7e5a57f247ec8c0e77103dfd2d2160c3c Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/nfc/qnearfieldtagtype2.cpp7
-rw-r--r--src/nfc/qnearfieldtarget.cpp9
-rw-r--r--src/nfc/qqmlndefrecord.cpp5
3 files changed, 8 insertions, 13 deletions
diff --git a/src/nfc/qnearfieldtagtype2.cpp b/src/nfc/qnearfieldtagtype2.cpp
index 24ff8280..492dc5e3 100644
--- a/src/nfc/qnearfieldtagtype2.cpp
+++ b/src/nfc/qnearfieldtagtype2.cpp
@@ -307,9 +307,7 @@ void QNearFieldTagType2::timerEvent(QTimerEvent *event)
killTimer(event->timerId());
- QMutableMapIterator<QNearFieldTarget::RequestId, SectorSelectState> i(d->m_pendingSectorSelectCommands);
- while (i.hasNext()) {
- i.next();
+ for (auto i = d->m_pendingSectorSelectCommands.begin(), end = d->m_pendingSectorSelectCommands.end(); i != end; ++i) {
SectorSelectState &state = i.value();
@@ -318,8 +316,7 @@ void QNearFieldTagType2::timerEvent(QTimerEvent *event)
setResponseForRequest(i.key(), true);
- i.remove();
-
+ d->m_pendingSectorSelectCommands.erase(i);
break;
}
}
diff --git a/src/nfc/qnearfieldtarget.cpp b/src/nfc/qnearfieldtarget.cpp
index de32223c..7d83db78 100644
--- a/src/nfc/qnearfieldtarget.cpp
+++ b/src/nfc/qnearfieldtarget.cpp
@@ -497,13 +497,12 @@ void QNearFieldTarget::setResponseForRequest(const QNearFieldTarget::RequestId &
{
Q_D(QNearFieldTarget);
- QMutableMapIterator<RequestId, QVariant> i(d->m_decodedResponses);
- while (i.hasNext()) {
- i.next();
-
+ for (auto i = d->m_decodedResponses.begin(), end = d->m_decodedResponses.end(); i != end; /* erasing */) {
// no more external references
if (i.key().refCount() == 1)
- i.remove();
+ i = d->m_decodedResponses.erase(i);
+ else
+ ++i;
}
d->m_decodedResponses.insert(id, response);
diff --git a/src/nfc/qqmlndefrecord.cpp b/src/nfc/qqmlndefrecord.cpp
index bc3667fe..5a96bec8 100644
--- a/src/nfc/qqmlndefrecord.cpp
+++ b/src/nfc/qqmlndefrecord.cpp
@@ -215,10 +215,9 @@ QQmlNdefRecord *qNewDeclarativeNdefRecordForNdefRecord(const QNdefRecord &record
{
const QString urn = urnForRecordType(record.typeNameFormat(), record.type());
- QMapIterator<QString, const QMetaObject *> i(*registeredNdefRecordTypes());
- while (i.hasNext()) {
- i.next();
+ const auto *rt = registeredNdefRecordTypes();
+ for (auto i = rt->cbegin(), end = rt->cend(); i != end; ++i) {
QRegularExpression rx(QRegularExpression::anchoredPattern(i.key()));
if (!rx.match(urn).hasMatch())
continue;