summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-11-23 07:09:39 (GMT)
committerTobias Markmann <tm@ayena.de>2016-11-23 11:30:02 (GMT)
commite405ff3561be3d3c0bd79d7d5173923a8828cf02 (patch)
tree9118ef838ebfaec1df90ec24761944b5d833774c /Swiften/Elements
parent8a71b91be885652f37c5aab5e1ecf25af4599fbc (diff)
downloadswift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.zip
swift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.tar.bz2
Migrate remaining Swiften/Base/foreach.h use to range-based for loop
Test-Information: Build on macOS 10.12.1 and all tests pass. Change-Id: Iedaa3fa7e7672c77909fd0568bf30e9393cb87e0
Diffstat (limited to 'Swiften/Elements')
-rw-r--r--Swiften/Elements/Form.cpp6
-rw-r--r--Swiften/Elements/RosterItemExchangePayload.cpp2
-rw-r--r--Swiften/Elements/RosterPayload.cpp4
-rw-r--r--Swiften/Elements/Stanza.cpp5
-rw-r--r--Swiften/Elements/VCard.cpp6
5 files changed, 7 insertions, 16 deletions
diff --git a/Swiften/Elements/Form.cpp b/Swiften/Elements/Form.cpp
index f8414b2..dc4bd72 100644
--- a/Swiften/Elements/Form.cpp
+++ b/Swiften/Elements/Form.cpp
@@ -6,8 +6,6 @@
#include <Swiften/Elements/Form.h>
-#include <Swiften/Base/foreach.h>
-
namespace Swift {
std::string Form::getFormType() const {
@@ -19,7 +17,7 @@ std::string Form::getFormType() const {
}
FormField::ref Form::getField(const std::string& name) const {
- foreach(FormField::ref field, fields_) {
+ for (const auto& field : fields_) {
if (field->getName() == name) {
return field;
}
@@ -45,7 +43,7 @@ const std::vector<Form::FormItem>& Form::getItems() const {
void Form::clearEmptyTextFields() {
std::vector<FormField::ref> populatedFields;
- foreach (FormField::ref field, fields_) {
+ for (const auto& field : fields_) {
if (field->getType() == FormField::TextSingleType) {
if (!field->getTextSingleValue().empty()) {
populatedFields.push_back(field);
diff --git a/Swiften/Elements/RosterItemExchangePayload.cpp b/Swiften/Elements/RosterItemExchangePayload.cpp
index 1890811..79d0371 100644
--- a/Swiften/Elements/RosterItemExchangePayload.cpp
+++ b/Swiften/Elements/RosterItemExchangePayload.cpp
@@ -12,8 +12,6 @@
#include <Swiften/Elements/RosterItemExchangePayload.h>
-#include <Swiften/Base/foreach.h>
-
namespace Swift {
RosterItemExchangePayload::Item::Item(Action action) : action(action) {
diff --git a/Swiften/Elements/RosterPayload.cpp b/Swiften/Elements/RosterPayload.cpp
index b4be7d1..d745357 100644
--- a/Swiften/Elements/RosterPayload.cpp
+++ b/Swiften/Elements/RosterPayload.cpp
@@ -6,12 +6,10 @@
#include <Swiften/Elements/RosterPayload.h>
-#include <Swiften/Base/foreach.h>
-
namespace Swift {
boost::optional<RosterItemPayload> RosterPayload::getItem(const JID& jid) const {
- foreach(const RosterItemPayload& item, items_) {
+ for (const auto& item : items_) {
// FIXME: MSVC rejects this. Find out why.
//if (item.getJID() == jid) {
if (item.getJID().equals(jid, JID::WithResource)) {
diff --git a/Swiften/Elements/Stanza.cpp b/Swiften/Elements/Stanza.cpp
index f5a1b58..0ff6b3c 100644
--- a/Swiften/Elements/Stanza.cpp
+++ b/Swiften/Elements/Stanza.cpp
@@ -10,7 +10,6 @@
#include <boost/bind.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/Delay.h>
namespace Swift {
@@ -23,7 +22,7 @@ Stanza::~Stanza() {
}
void Stanza::updatePayload(std::shared_ptr<Payload> payload) {
- foreach (std::shared_ptr<Payload>& i, payloads_) {
+ for (auto&& i : payloads_) {
if (typeid(*i.get()) == typeid(*payload.get())) {
i = payload;
return;
@@ -43,7 +42,7 @@ void Stanza::removePayloadOfSameType(std::shared_ptr<Payload> payload) {
}
std::shared_ptr<Payload> Stanza::getPayloadOfSameType(std::shared_ptr<Payload> payload) const {
- foreach (const std::shared_ptr<Payload>& i, payloads_) {
+ for (const auto& i : payloads_) {
if (typeid(*i.get()) == typeid(*payload.get())) {
return i;
}
diff --git a/Swiften/Elements/VCard.cpp b/Swiften/Elements/VCard.cpp
index f541d06..571ead4 100644
--- a/Swiften/Elements/VCard.cpp
+++ b/Swiften/Elements/VCard.cpp
@@ -1,17 +1,15 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swiften/Elements/VCard.h>
-#include <Swiften/Base/foreach.h>
-
namespace Swift {
VCard::EMailAddress VCard::getPreferredEMailAddress() const {
- foreach(const EMailAddress& address, emailAddresses_) {
+ for (const auto& address : emailAddresses_) {
if (address.isPreferred) {
return address;
}