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/Client
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/Client')
-rw-r--r--Swiften/Client/BlockListImpl.cpp12
-rw-r--r--Swiften/Client/CoreClient.cpp3
-rw-r--r--Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp3
-rw-r--r--Swiften/Client/XMLBeautifier.cpp3
4 files changed, 8 insertions, 13 deletions
diff --git a/Swiften/Client/BlockListImpl.cpp b/Swiften/Client/BlockListImpl.cpp
index ebffff8..54dcdf5 100644
--- a/Swiften/Client/BlockListImpl.cpp
+++ b/Swiften/Client/BlockListImpl.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -8,8 +8,6 @@
#include <algorithm>
-#include <Swiften/Base/foreach.h>
-
using namespace Swift;
BlockListImpl::BlockListImpl() : state(Init) {
@@ -18,14 +16,14 @@ BlockListImpl::BlockListImpl() : state(Init) {
void BlockListImpl::setItems(const std::vector<JID>& newItems) {
// JIDs which are in the current list but not in the new list, are removed.
- foreach (const JID& jid, items) {
+ for (const auto& jid : items) {
if (std::find(newItems.begin(), newItems.end(), jid) == newItems.end()) {
onItemRemoved(jid);
}
}
// JIDs which are in the new list but not in the current list, are added.
- foreach (const JID& jid, newItems) {
+ for (const auto& jid : newItems) {
if (std::find(items.begin(), items.end(), jid) == items.end()) {
onItemAdded(jid);
}
@@ -56,14 +54,14 @@ void BlockListImpl::setState(State state) {
}
void BlockListImpl::addItems(const std::vector<JID>& items) {
- foreach (const JID& item, items) {
+ for (const auto& item : items) {
addItem(item);
}
}
void BlockListImpl::removeItems(const std::vector<JID>& items) {
std::vector<JID> itemsToRemove = items;
- foreach (const JID& item, itemsToRemove) {
+ for (const auto& item : itemsToRemove) {
removeItem(item);
}
}
diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp
index c2f8fd7..3d75d8b 100644
--- a/Swiften/Client/CoreClient.cpp
+++ b/Swiften/Client/CoreClient.cpp
@@ -14,7 +14,6 @@
#include <Swiften/Base/Algorithm.h>
#include <Swiften/Base/IDGenerator.h>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Client/ClientSession.h>
#include <Swiften/Client/ClientSessionStanzaChannel.h>
#include <Swiften/Network/ChainedConnector.h>
@@ -443,7 +442,7 @@ void CoreClient::purgePassword() {
void CoreClient::resetConnector() {
connector_->onConnectFinished.disconnect(boost::bind(&CoreClient::handleConnectorFinished, this, _1, _2));
connector_.reset();
- foreach(ConnectionFactory* f, proxyConnectionFactories) {
+ for (auto f : proxyConnectionFactories) {
delete f;
}
proxyConnectionFactories.clear();
diff --git a/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp b/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp
index aaf99e0..5d22cac 100644
--- a/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp
+++ b/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp
@@ -15,7 +15,6 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Client/ClientBlockListManager.h>
#include <Swiften/Client/DummyStanzaChannel.h>
#include <Swiften/Client/StanzaChannel.h>
@@ -171,7 +170,7 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture {
// build IQ response
std::shared_ptr<BlockListPayload> responsePayload = std::make_shared<BlockListPayload>();
- foreach(const JID& jid, blockedJids) {
+ for (const auto& jid : blockedJids) {
responsePayload->addItem(jid);
}
diff --git a/Swiften/Client/XMLBeautifier.cpp b/Swiften/Client/XMLBeautifier.cpp
index 9e9c4c5..e2cd58e 100644
--- a/Swiften/Client/XMLBeautifier.cpp
+++ b/Swiften/Client/XMLBeautifier.cpp
@@ -16,7 +16,6 @@
#include <stack>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Parser/PlatformXMLParserFactory.h>
namespace Swift {
@@ -99,7 +98,7 @@ void XMLBeautifier::handleStartElement(const std::string& element, const std::st
buffer << "\"" << (doColoring ? styleNamespace(ns) : ns) << "\"";
}
if (!attributes.getEntries().empty()) {
- foreach(AttributeMap::Entry entry, attributes.getEntries()) {
+ for (const auto& entry : attributes.getEntries()) {
buffer << " ";
buffer << (doColoring ? styleAttribute(entry.getAttribute().getName()) : entry.getAttribute().getName());
buffer << "=";