diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-07-24 12:39:01 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-07-26 08:34:51 +0000 |
commit | da870b829cc860ca394af836733dbcc002016061 (patch) | |
tree | f9e1dc0774f43b2f621eac7654ec139ab00ba285 /src/plugins/geoservices/esri/placemanagerengine_esri.cpp | |
parent | 7c00aa7aa1476fc45adc5abf54185545ecc4c14e (diff) | |
download | qtlocation-da870b829cc860ca394af836733dbcc002016061.tar.gz |
Replace foreach with ranged for and set QT_NO_FOREACH
Make containers const where they obviously should be, iterate over
references where it's clearly possible.
Cherry-pick of 2c8c5dca44aba5612cc67b04dd3c7e5fc4919b19.
Change-Id: Ie55a58873b48bbb60ac49790db612f85777e6ceb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/plugins/geoservices/esri/placemanagerengine_esri.cpp')
-rw-r--r-- | src/plugins/geoservices/esri/placemanagerengine_esri.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/plugins/geoservices/esri/placemanagerengine_esri.cpp b/src/plugins/geoservices/esri/placemanagerengine_esri.cpp index 8f1e7dbc..b367a428 100644 --- a/src/plugins/geoservices/esri/placemanagerengine_esri.cpp +++ b/src/plugins/geoservices/esri/placemanagerengine_esri.cpp @@ -132,7 +132,7 @@ QPlaceSearchReply *PlaceManagerEngineEsri::search(const QPlaceSearchRequest &req QStringList categories; if (!request.categories().isEmpty()) { - foreach (const QPlaceCategory &placeCategory, request.categories()) + for (const QPlaceCategory &placeCategory : request.categories()) categories.append(placeCategory.categoryId()); queryItems.addQueryItem("category", categories.join(",")); } @@ -236,21 +236,21 @@ QPlaceCategory PlaceManagerEngineEsri::category(const QString &categoryId) const QList<QPlaceCategory> PlaceManagerEngineEsri::childCategories(const QString &parentId) const { QList<QPlaceCategory> categories; - foreach (const QString &id, m_subcategories.value(parentId)) + for (const QString &id : m_subcategories.value(parentId)) categories.append(m_categories.value(id)); return categories; } void PlaceManagerEngineEsri::finishCategories() { - foreach (PlaceCategoriesReplyEsri *reply, m_pendingCategoriesReply) + for (PlaceCategoriesReplyEsri *reply : m_pendingCategoriesReply) reply->emitFinished(); m_pendingCategoriesReply.clear(); } void PlaceManagerEngineEsri::errorCaterogies(const QString &error) { - foreach (PlaceCategoriesReplyEsri *reply, m_pendingCategoriesReply) + for (PlaceCategoriesReplyEsri *reply : m_pendingCategoriesReply) reply->setError(QPlaceReply::CommunicationError, error); } @@ -271,8 +271,7 @@ QString PlaceManagerEngineEsri::localizedName(const QJsonObject &jsonObject) { const QJsonObject localizedNames = jsonObject.value(kLocalizedNamesKey).toObject(); - foreach (const QLocale &locale, m_locales) - { + for (const QLocale &locale : qAsConst(m_locales)) { const QString localeStr = locale.name(); if (localizedNames.contains(localeStr)) { |