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
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')
-rw-r--r--Swiften/Base/foreach.h13
-rw-r--r--Swiften/Chat/UnitTest/ChatStateNotifierTest.cpp5
-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
-rw-r--r--Swiften/Disco/CapsInfoGenerator.cpp11
-rw-r--r--Swiften/Disco/DiscoServiceWalker.cpp9
-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
-rw-r--r--Swiften/EventLoop/EventLoop.cpp3
-rw-r--r--Swiften/EventLoop/SimpleEventLoop.cpp2
-rw-r--r--Swiften/EventLoop/SingleThreadedEventLoop.cpp5
-rw-r--r--Swiften/Examples/MUCListAndJoin/MUCListAndJoin.cpp3
-rw-r--r--Swiften/Examples/SendFile/ReceiveFile.cpp4
-rw-r--r--Swiften/FileTransfer/DefaultFileTransferTransporter.cpp3
-rw-r--r--Swiften/FileTransfer/IncomingJingleFileTransfer.cpp5
-rw-r--r--Swiften/FileTransfer/JingleFileTransfer.cpp3
-rw-r--r--Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp3
-rw-r--r--Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp3
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp4
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp1
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServer.cpp5
-rw-r--r--Swiften/Jingle/JingleSession.cpp3
-rw-r--r--Swiften/Jingle/JingleSessionManager.cpp3
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp5
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp23
-rw-r--r--Swiften/LinkLocal/OutgoingLinkLocalSession.cpp3
-rw-r--r--Swiften/MUC/MUCBookmarkManager.cpp9
-rw-r--r--Swiften/Network/BOSHConnectionPool.cpp13
-rw-r--r--Swiften/Network/ChainedConnector.cpp1
-rw-r--r--Swiften/Network/DummyTimerFactory.cpp3
-rw-r--r--Swiften/Network/HTTPConnectProxiedConnection.cpp7
-rw-r--r--Swiften/Network/NetworkEnvironment.cpp5
-rw-r--r--Swiften/Network/PlatformDomainNameServiceQuery.cpp3
-rw-r--r--Swiften/Network/UnixProxyProvider.cpp1
-rw-r--r--Swiften/Network/WindowsNetworkEnvironment.cpp5
-rw-r--r--Swiften/Parser/PayloadParsers/BytestreamsParser.cpp4
-rw-r--r--Swiften/Parser/PayloadParsers/FormParser.cpp10
-rw-r--r--Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp5
-rw-r--r--Swiften/Parser/PayloadParsers/IBBParser.cpp1
-rw-r--r--Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.cpp5
-rw-r--r--Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.cpp4
-rw-r--r--Swiften/Parser/PayloadParsers/MUCUserPayloadParser.cpp3
-rw-r--r--Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp4
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp3
-rw-r--r--Swiften/Parser/PayloadParsers/VCardParser.cpp3
-rw-r--r--Swiften/Parser/SerializingParser.cpp3
-rw-r--r--Swiften/Parser/Tree/TreeReparser.cpp3
-rw-r--r--Swiften/Presence/DirectedPresenceSender.cpp4
-rw-r--r--Swiften/Presence/SubscriptionManager.cpp3
-rw-r--r--Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp1
-rw-r--r--Swiften/QA/FileTransferTest/FileTransferTest.cpp9
-rw-r--r--Swiften/QA/ProxyProviderTest/ProxyProviderTest.cpp1
-rw-r--r--Swiften/Queries/IQRouter.cpp3
-rw-r--r--Swiften/Roster/XMPPRosterController.cpp7
-rw-r--r--Swiften/Roster/XMPPRosterImpl.cpp8
-rw-r--r--Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp7
-rw-r--r--Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/FormSerializer.cpp39
-rw-r--r--Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp1
-rw-r--r--Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp1
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.cpp1
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.cpp1
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp1
-rw-r--r--Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.cpp1
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp1
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp1
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.cpp7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp1
-rw-r--r--Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp23
-rw-r--r--Swiften/Serializer/StanzaSerializer.cpp3
-rw-r--r--Swiften/Serializer/StreamFeaturesSerializer.cpp5
-rw-r--r--Swiften/Serializer/XML/XMLElement.cpp6
-rw-r--r--Swiften/Serializer/XMPPSerializer.cpp1
-rw-r--r--Swiften/Session/BOSHSessionStream.cpp1
-rw-r--r--Swiften/StreamStack/StreamStack.cpp1
-rw-r--r--Swiften/TLS/ServerIdentityVerifier.cpp9
-rw-r--r--Swiften/Whiteboard/WhiteboardSessionManager.cpp3
110 files changed, 185 insertions, 338 deletions
diff --git a/Swiften/Base/foreach.h b/Swiften/Base/foreach.h
deleted file mode 100644
index 3e8ec43..0000000
--- a/Swiften/Base/foreach.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 2010 Isode Limited.
- * All rights reserved.
- * See the COPYING file for more information.
- */
-
-#pragma once
-
-#include <boost/foreach.hpp>
-
-#undef foreach
-#define foreach BOOST_FOREACH
-#define reverse_foreach BOOST_REVERSE_FOREACH
diff --git a/Swiften/Chat/UnitTest/ChatStateNotifierTest.cpp b/Swiften/Chat/UnitTest/ChatStateNotifierTest.cpp
index 278068a..7eeb531 100644
--- a/Swiften/Chat/UnitTest/ChatStateNotifierTest.cpp
+++ b/Swiften/Chat/UnitTest/ChatStateNotifierTest.cpp
@@ -9,7 +9,6 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Chat/ChatStateNotifier.h>
#include <Swiften/Client/DummyStanzaChannel.h>
#include <Swiften/Disco/DummyEntityCapsProvider.h>
@@ -142,7 +141,7 @@ public:
int getComposingCount() const {
int result = 0;
- foreach(std::shared_ptr<Stanza> stanza, stanzaChannel->sentStanzas) {
+ for (auto&& stanza : stanzaChannel->sentStanzas) {
if (stanza->getPayload<ChatState>() && stanza->getPayload<ChatState>()->getChatState() == ChatState::Composing) {
result++;
}
@@ -152,7 +151,7 @@ public:
int getActiveCount() const {
int result = 0;
- foreach(std::shared_ptr<Stanza> stanza, stanzaChannel->sentStanzas) {
+ for (auto&& stanza : stanzaChannel->sentStanzas) {
if (stanza->getPayload<ChatState>() && stanza->getPayload<ChatState>()->getChatState() == ChatState::Active) {
result++;
}
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 << "=";
diff --git a/Swiften/Disco/CapsInfoGenerator.cpp b/Swiften/Disco/CapsInfoGenerator.cpp
index b4637c7..961ef43 100644
--- a/Swiften/Disco/CapsInfoGenerator.cpp
+++ b/Swiften/Disco/CapsInfoGenerator.cpp
@@ -8,7 +8,6 @@
#include <algorithm>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Crypto/CryptoProvider.h>
#include <Swiften/Elements/DiscoInfo.h>
#include <Swiften/Elements/FormField.h>
@@ -30,28 +29,28 @@ CapsInfo CapsInfoGenerator::generateCapsInfo(const DiscoInfo& discoInfo) const {
std::vector<DiscoInfo::Identity> identities(discoInfo.getIdentities());
std::sort(identities.begin(), identities.end());
- foreach (const DiscoInfo::Identity& identity, identities) {
+ for (const auto& identity : identities) {
serializedCaps += identity.getCategory() + "/" + identity.getType() + "/" + identity.getLanguage() + "/" + identity.getName() + "<";
}
std::vector<std::string> features(discoInfo.getFeatures());
std::sort(features.begin(), features.end());
- foreach (const std::string& feature, features) {
+ for (const auto& feature : features) {
serializedCaps += feature + "<";
}
- foreach(Form::ref extension, discoInfo.getExtensions()) {
+ for (const auto& extension : discoInfo.getExtensions()) {
serializedCaps += extension->getFormType() + "<";
std::vector<FormField::ref> fields(extension->getFields());
std::sort(fields.begin(), fields.end(), &compareFields);
- foreach(FormField::ref field, fields) {
+ for (const auto& field : fields) {
if (field->getName() == "FORM_TYPE") {
continue;
}
serializedCaps += field->getName() + "<";
std::vector<std::string> values(field->getValues());
std::sort(values.begin(), values.end());
- foreach(const std::string& value, values) {
+ for (const auto& value : values) {
serializedCaps += value + "<";
}
}
diff --git a/Swiften/Disco/DiscoServiceWalker.cpp b/Swiften/Disco/DiscoServiceWalker.cpp
index 761e6ab..a3f95d2 100644
--- a/Swiften/Disco/DiscoServiceWalker.cpp
+++ b/Swiften/Disco/DiscoServiceWalker.cpp
@@ -9,7 +9,6 @@
#include <boost/bind.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
namespace Swift {
@@ -28,10 +27,10 @@ void DiscoServiceWalker::beginWalk() {
void DiscoServiceWalker::endWalk() {
if (active_) {
SWIFT_LOG(debug) << "Ending walk to " << service_ << std::endl;
- foreach (GetDiscoInfoRequest::ref request, pendingDiscoInfoRequests_) {
+ for (auto&& request : pendingDiscoInfoRequests_) {
request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoInfoResponse, this, _1, _2, request));
}
- foreach (GetDiscoItemsRequest::ref request, pendingDiscoItemsRequests_) {
+ for (auto&& request : pendingDiscoItemsRequests_) {
request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoItemsResponse, this, _1, _2, request));
}
active_ = false;
@@ -65,7 +64,7 @@ void DiscoServiceWalker::handleDiscoInfoResponse(std::shared_ptr<DiscoInfo> info
}
bool couldContainServices = false;
- foreach (DiscoInfo::Identity identity, info->getIdentities()) {
+ for (const auto& identity : info->getIdentities()) {
if (identity.getCategory() == "server") {
couldContainServices = true;
}
@@ -98,7 +97,7 @@ void DiscoServiceWalker::handleDiscoItemsResponse(std::shared_ptr<DiscoItems> it
handleDiscoError(request->getReceiver(), error);
return;
}
- foreach (DiscoItems::Item item, items->getItems()) {
+ for (auto&& item : items->getItems()) {
if (item.getNode().empty()) {
/* Don't look at noded items. It's possible that this will exclude some services,
* but I've never seen one in the wild, and it's an easy fix for not looping.
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;
}
diff --git a/Swiften/EventLoop/EventLoop.cpp b/Swiften/EventLoop/EventLoop.cpp
index eefbf65..186616f 100644
--- a/Swiften/EventLoop/EventLoop.cpp
+++ b/Swiften/EventLoop/EventLoop.cpp
@@ -16,7 +16,6 @@
#include <boost/optional.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
namespace lambda = boost::lambda;
@@ -61,7 +60,7 @@ void EventLoop::handleNextEvents() {
callEventPosted = !events_.empty();
}
if (!nextEvents.empty()) {
- foreach (const Event& event, nextEvents) {
+ for (const auto& event : nextEvents) {
invokeCallback(event);
}
}
diff --git a/Swiften/EventLoop/SimpleEventLoop.cpp b/Swiften/EventLoop/SimpleEventLoop.cpp
index 2397016..cac04e4 100644
--- a/Swiften/EventLoop/SimpleEventLoop.cpp
+++ b/Swiften/EventLoop/SimpleEventLoop.cpp
@@ -8,8 +8,6 @@
#include <boost/bind.hpp>
-#include <Swiften/Base/foreach.h>
-
namespace Swift {
SimpleEventLoop::SimpleEventLoop() : isRunning_(true), eventAvailable_(false) {
diff --git a/Swiften/EventLoop/SingleThreadedEventLoop.cpp b/Swiften/EventLoop/SingleThreadedEventLoop.cpp
index acb6e4d..0542f37 100644
--- a/Swiften/EventLoop/SingleThreadedEventLoop.cpp
+++ b/Swiften/EventLoop/SingleThreadedEventLoop.cpp
@@ -16,8 +16,6 @@
#include <boost/bind.hpp>
-#include <Swiften/Base/foreach.h>
-
namespace Swift {
SingleThreadedEventLoop::SingleThreadedEventLoop()
@@ -35,8 +33,9 @@ void SingleThreadedEventLoop::waitForEvents() {
eventAvailableCondition_.wait(lock);
}
- if (shouldShutDown_)
+ if (shouldShutDown_) {
throw EventLoopCanceledException();
+ }
}
void SingleThreadedEventLoop::handleEvents() {
diff --git a/Swiften/Examples/MUCListAndJoin/MUCListAndJoin.cpp b/Swiften/Examples/MUCListAndJoin/MUCListAndJoin.cpp
index c3983f1..10b0b40 100644
--- a/Swiften/Examples/MUCListAndJoin/MUCListAndJoin.cpp
+++ b/Swiften/Examples/MUCListAndJoin/MUCListAndJoin.cpp
@@ -9,7 +9,6 @@
#include <boost/optional.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Client/Client.h>
#include <Swiften/Client/ClientXMLTracer.h>
#include <Swiften/Disco/GetDiscoItemsRequest.h>
@@ -47,7 +46,7 @@ static void handleRoomsItemsResponse(std::shared_ptr<DiscoItems> items, ErrorPay
int roomCount = 0;
cout << "List of rooms at " << mucJID.toString() << endl;
- foreach (DiscoItems::Item item, items->getItems()) {
+ for (auto&& item : items->getItems()) {
roomCount++;
cout << "\t" << roomCount << ". " << item.getJID().getNode() << " - " << item.getName() << std::endl;
if (roomCount == 1) {
diff --git a/Swiften/Examples/SendFile/ReceiveFile.cpp b/Swiften/Examples/SendFile/ReceiveFile.cpp
index 0b61987..193c1b7 100644
--- a/Swiften/Examples/SendFile/ReceiveFile.cpp
+++ b/Swiften/Examples/SendFile/ReceiveFile.cpp
@@ -11,7 +11,6 @@
#include <boost/filesystem.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Client/Client.h>
#include <Swiften/Client/ClientXMLTracer.h>
#include <Swiften/Disco/ClientDiscoManager.h>
@@ -56,7 +55,8 @@ class FileReceiver {
}
void stop() {
- foreach(const IncomingFileTransfer::ref transfer, incomingFileTransfers) {
+ for (const auto& transfer : incomingFileTransfers) {
+ (void)transfer;
//transfer->stop();
}
client->disconnect();
diff --git a/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp b/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp
index aefafd9..c6987c0 100644
--- a/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp
+++ b/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp
@@ -11,7 +11,6 @@
#include <boost/bind.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Crypto/CryptoProvider.h>
#include <Swiften/FileTransfer/FailingTransportSession.h>
#include <Swiften/FileTransfer/FileTransferOptions.h>
@@ -295,7 +294,7 @@ void DefaultFileTransferTransporter::closeLocalSession() {
s5bRegistry->setHasBytestream(getSOCKS5DstAddr(), false);
if (s5bServerManager->getServer()) {
std::vector<std::shared_ptr<SOCKS5BytestreamServerSession> > serverSessions = s5bServerManager->getServer()->getSessions(getSOCKS5DstAddr());
- foreach(std::shared_ptr<SOCKS5BytestreamServerSession> session, serverSessions) {
+ for (auto&& session : serverSessions) {
session->stop();
}
}
diff --git a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
index f73cd38..d5de5e4 100644
--- a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
+++ b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
@@ -12,7 +12,6 @@
#include <boost/bind.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/JingleFileTransferDescription.h>
#include <Swiften/Elements/JingleFileTransferHash.h>
#include <Swiften/Elements/JingleIBBTransportPayload.h>
@@ -130,7 +129,7 @@ void IncomingJingleFileTransfer::handleLocalTransportCandidatesGenerated(
transport->setSessionID(s5bSessionID);
transport->setMode(JingleS5BTransportPayload::TCPMode);
transport->setDstAddr(dstAddr);
- foreach(JingleS5BTransportPayload::Candidate candidate, candidates) {
+ for (auto&& candidate : candidates) {
transport->addCandidate(candidate);
}
session->sendAccept(getContentID(), initialContent->getDescriptions()[0], transport);
@@ -197,7 +196,7 @@ void IncomingJingleFileTransfer::checkIfAllDataReceived() {
if (receivedBytes == getFileSizeInBytes()) {
SWIFT_LOG(debug) << "All data received." << std::endl;
bool hashInfoAvailable = false;
- foreach(const JingleFileTransferFileInfo::HashElementMap::value_type& hashElement, hashes) {
+ for (const auto& hashElement : hashes) {
hashInfoAvailable |= !hashElement.second.empty();
}
diff --git a/Swiften/FileTransfer/JingleFileTransfer.cpp b/Swiften/FileTransfer/JingleFileTransfer.cpp
index 36725de..62c3a53 100644
--- a/Swiften/FileTransfer/JingleFileTransfer.cpp
+++ b/Swiften/FileTransfer/JingleFileTransfer.cpp
@@ -9,7 +9,6 @@
#include <boost/typeof/typeof.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Crypto/CryptoProvider.h>
#include <Swiften/FileTransfer/FileTransferTransporter.h>
#include <Swiften/JID/JID.h>
@@ -39,7 +38,7 @@ JingleFileTransfer::~JingleFileTransfer() {
void JingleFileTransfer::fillCandidateMap(CandidateMap& map, const std::vector<JingleS5BTransportPayload::Candidate>& candidates) {
map.clear();
- foreach (JingleS5BTransportPayload::Candidate candidate, candidates) {
+ for (auto&& candidate : candidates) {
map[candidate.cid] = candidate;
}
}
diff --git a/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp b/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
index fcc160a..367fc97 100644
--- a/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
+++ b/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
@@ -24,7 +24,6 @@
#include <Swiften/Base/IDGenerator.h>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Crypto/CryptoProvider.h>
#include <Swiften/Elements/JingleFileTransferDescription.h>
#include <Swiften/Elements/JingleFileTransferHash.h>
@@ -215,7 +214,7 @@ void OutgoingJingleFileTransfer::handleLocalTransportCandidatesGenerated(
s5bTransport->setSessionID(s5bSessionID);
s5bTransport->setMode(JingleS5BTransportPayload::TCPMode);
s5bTransport->setDstAddr(dstAddr);
- foreach(JingleS5BTransportPayload::Candidate candidate, candidates) {
+ for (auto&& candidate : candidates) {
s5bTransport->addCandidate(candidate);
SWIFT_LOG(debug) << "\t" << "S5B candidate: " << candidate.hostPort.toString() << std::endl;
}
diff --git a/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp b/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp
index a0e7a6f..56013ca 100644
--- a/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp
+++ b/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp
@@ -18,7 +18,6 @@
#include <boost/signals2.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/JingleS5BTransportPayload.h>
#include <Swiften/FileTransfer/SOCKS5BytestreamRegistry.h>
#include <Swiften/Network/ConnectionFactory.h>
@@ -39,7 +38,7 @@ RemoteJingleTransportCandidateSelector::~RemoteJingleTransportCandidateSelector(
void RemoteJingleTransportCandidateSelector::addCandidates(
const std::vector<JingleS5BTransportPayload::Candidate>& candidates) {
- foreach(JingleS5BTransportPayload::Candidate c, candidates) {
+ for (auto&& c : candidates) {
this->candidates.push(c);
}
}
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp b/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp
index 9624d4c..90c42dd 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp
@@ -17,7 +17,6 @@
#include <boost/bind.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/S5BProxyRequest.h>
#include <Swiften/Queries/GenericRequest.h>
#include <Swiften/Queries/IQRouter.h>
@@ -38,8 +37,7 @@ void SOCKS5BytestreamProxyFinder::start() {
}
void SOCKS5BytestreamProxyFinder::stop() {
- typedef std::shared_ptr<GenericRequest<S5BProxyRequest> > S5BProxyRequestGenericRequest;
- foreach (S5BProxyRequestGenericRequest requester, pendingRequests) {
+ for (auto&& requester : pendingRequests) {
requester->onResponse.disconnect(boost::bind(&SOCKS5BytestreamProxyFinder::handleProxyResponse, this, requester, _1, _2));
}
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp
index 1591e24..9e214fc 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp
@@ -10,7 +10,6 @@
#include <Swiften/Base/Algorithm.h>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
namespace Swift {
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp
index b68bd58..483ea18 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp
@@ -9,7 +9,6 @@
#include <boost/bind.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Crypto/CryptoProvider.h>
#include <Swiften/FileTransfer/SOCKS5BytestreamRegistry.h>
#include <Swiften/FileTransfer/SOCKS5BytestreamServerSession.h>
@@ -30,7 +29,7 @@ void SOCKS5BytestreamServer::start() {
void SOCKS5BytestreamServer::stop() {
connectionServer->onNewConnection.disconnect(boost::bind(&SOCKS5BytestreamServer::handleNewConnection, this, _1));
- foreach (std::shared_ptr<SOCKS5BytestreamServerSession> session, sessions) {
+ for (auto&& session : sessions) {
session->onFinished.disconnect(boost::bind(&SOCKS5BytestreamServer::handleSessionFinished, this, session));
session->stop();
}
@@ -52,7 +51,7 @@ HostAddressPort SOCKS5BytestreamServer::getAddressPort() const {
std::vector< std::shared_ptr<SOCKS5BytestreamServerSession> > SOCKS5BytestreamServer::getSessions(
const std::string& streamID) const {
std::vector< std::shared_ptr<SOCKS5BytestreamServerSession> > result;
- foreach (std::shared_ptr<SOCKS5BytestreamServerSession> session, sessions) {
+ for (auto&& session : sessions) {
if (session->getStreamID() == streamID) {
result.push_back(session);
}
diff --git a/Swiften/Jingle/JingleSession.cpp b/Swiften/Jingle/JingleSession.cpp
index 778ee1d..b5cfbef 100644
--- a/Swiften/Jingle/JingleSession.cpp
+++ b/Swiften/Jingle/JingleSession.cpp
@@ -7,12 +7,11 @@
#include <Swiften/Jingle/JingleSession.h>
#include <algorithm>
+#include <cassert>
#include <memory>
#include <boost/function.hpp>
-#include <Swiften/Base/foreach.h>
-
using namespace Swift;
JingleSession::JingleSession(const JID& initiator, const std::string& id) : initiator(initiator), id(id) {
diff --git a/Swiften/Jingle/JingleSessionManager.cpp b/Swiften/Jingle/JingleSessionManager.cpp
index ca6cebb..f7ed58e 100644
--- a/Swiften/Jingle/JingleSessionManager.cpp
+++ b/Swiften/Jingle/JingleSessionManager.cpp
@@ -8,7 +8,6 @@
#include <Swiften/Base/Algorithm.h>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Jingle/IncomingJingleSessionHandler.h>
#include <Swiften/Jingle/JingleResponder.h>
@@ -44,7 +43,7 @@ void JingleSessionManager::registerOutgoingSession(const JID& initiator, JingleS
void JingleSessionManager::handleIncomingSession(const JID& initiator, const JID& recipient, JingleSessionImpl::ref session, const std::vector<JingleContentPayload::ref>& contents) {
sessions.insert(std::make_pair(JIDSession(initiator, session->getID()), session));
- foreach (IncomingJingleSessionHandler* handler, incomingSessionHandlers) {
+ for (auto handler : incomingSessionHandlers) {
if (handler->handleIncomingJingleSession(session, contents, recipient)) {
return;
}
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp
index 9cfe3cd..0906ffc 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp
@@ -11,7 +11,6 @@
#include <unistd.h>
#include <Swiften/Base/Algorithm.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h>
#include <Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h>
#include <Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h>
@@ -106,7 +105,7 @@ void BonjourQuerier::run() {
maxSocket = interruptSelectReadSocket;
FD_SET(interruptSelectReadSocket, &fdSet);
- foreach(const std::shared_ptr<BonjourQuery>& query, runningQueries) {
+ for (const auto& query : runningQueries) {
int socketID = query->getSocketID();
maxSocket = std::max(maxSocket, socketID);
FD_SET(socketID, &fdSet);
@@ -124,7 +123,7 @@ void BonjourQuerier::run() {
{
std::lock_guard<std::mutex> lock(runningQueriesMutex);
- foreach(std::shared_ptr<BonjourQuery> query, runningQueries) {
+ for (auto&& query : runningQueries) {
if (FD_ISSET(query->getSocketID(), &fdSet)) {
query->processResult();
}
diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp
index 63ad3b8..c17f8b2 100644
--- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp
+++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp
@@ -11,7 +11,6 @@
#include <boost/bind.hpp>
#include <Swiften/Base/Algorithm.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/EventLoop/EventLoop.h>
#include <Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDBrowseQuery.h>
#include <Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h>
@@ -49,14 +48,14 @@ void FakeDNSSDQuerier::addRunningQuery(std::shared_ptr<FakeDNSSDQuery> query) {
runningQueries.push_back(query);
allQueriesEverRun.push_back(query);
if (std::shared_ptr<FakeDNSSDBrowseQuery> browseQuery = std::dynamic_pointer_cast<FakeDNSSDBrowseQuery>(query)) {
- foreach(const DNSSDServiceID& service, services) {
+ for (const auto& service : services) {
eventLoop->postEvent(boost::bind(boost::ref(browseQuery->onServiceAdded), service), shared_from_this());
}
}
else if (std::shared_ptr<FakeDNSSDResolveServiceQuery> resolveQuery = std::dynamic_pointer_cast<FakeDNSSDResolveServiceQuery>(query)) {
- for(ServiceInfoMap::const_iterator i = serviceInfo.begin(); i != serviceInfo.end(); ++i) {
- if (i->first == resolveQuery->service) {
- eventLoop->postEvent(boost::bind(boost::ref(resolveQuery->onServiceResolved), i->second), shared_from_this());
+ for (const auto& i : serviceInfo) {
+ if (i.first == resolveQuery->service) {
+ eventLoop->postEvent(boost::bind(boost::ref(resolveQuery->onServiceResolved), i.second), shared_from_this());
}
}
}
@@ -81,7 +80,7 @@ void FakeDNSSDQuerier::removeRunningQuery(std::shared_ptr<FakeDNSSDQuery> query)
void FakeDNSSDQuerier::addService(const DNSSDServiceID& id) {
services.insert(id);
- foreach(const std::shared_ptr<FakeDNSSDBrowseQuery>& query, getQueries<FakeDNSSDBrowseQuery>()) {
+ for (const auto& query : getQueries<FakeDNSSDBrowseQuery>()) {
eventLoop->postEvent(boost::bind(boost::ref(query->onServiceAdded), id), shared_from_this());
}
}
@@ -89,7 +88,7 @@ void FakeDNSSDQuerier::addService(const DNSSDServiceID& id) {
void FakeDNSSDQuerier::removeService(const DNSSDServiceID& id) {
services.erase(id);
serviceInfo.erase(id);
- foreach(const std::shared_ptr<FakeDNSSDBrowseQuery>& query, getQueries<FakeDNSSDBrowseQuery>()) {
+ for (const auto& query : getQueries<FakeDNSSDBrowseQuery>()) {
eventLoop->postEvent(boost::bind(boost::ref(query->onServiceRemoved), id), shared_from_this());
}
}
@@ -99,7 +98,7 @@ void FakeDNSSDQuerier::setServiceInfo(const DNSSDServiceID& id, const DNSSDResol
if (!r.second) {
r.first->second = info;
}
- foreach(const std::shared_ptr<FakeDNSSDResolveServiceQuery>& query, getQueries<FakeDNSSDResolveServiceQuery>()) {
+ for (const auto& query : getQueries<FakeDNSSDResolveServiceQuery>()) {
if (query->service == id) {
eventLoop->postEvent(boost::bind(boost::ref(query->onServiceResolved), info), shared_from_this());
}
@@ -107,7 +106,7 @@ void FakeDNSSDQuerier::setServiceInfo(const DNSSDServiceID& id, const DNSSDResol
}
bool FakeDNSSDQuerier::isServiceRegistered(const std::string& name, int port, const ByteArray& info) {
- foreach(const std::shared_ptr<FakeDNSSDRegisterQuery>& query, getQueries<FakeDNSSDRegisterQuery>()) {
+ for (const auto& query : getQueries<FakeDNSSDRegisterQuery>()) {
if (query->name == name && query->port == port && query->info == info) {
return true;
}
@@ -116,20 +115,20 @@ bool FakeDNSSDQuerier::isServiceRegistered(const std::string& name, int port, co
}
void FakeDNSSDQuerier::setBrowseError() {
- foreach(const std::shared_ptr<FakeDNSSDBrowseQuery>& query, getQueries<FakeDNSSDBrowseQuery>()) {
+ for (const auto& query : getQueries<FakeDNSSDBrowseQuery>()) {
eventLoop->postEvent(boost::ref(query->onError), shared_from_this());
}
}
void FakeDNSSDQuerier::setRegisterError() {
- foreach(const std::shared_ptr<FakeDNSSDRegisterQuery>& query, getQueries<FakeDNSSDRegisterQuery>()) {
+ for (const auto& query : getQueries<FakeDNSSDRegisterQuery>()) {
eventLoop->postEvent(boost::bind(boost::ref(query->onRegisterFinished), boost::optional<DNSSDServiceID>()), shared_from_this());
}
}
void FakeDNSSDQuerier::setAddress(const std::string& hostname, boost::optional<HostAddress> address) {
addresses[hostname] = address;
- foreach(const std::shared_ptr<FakeDNSSDResolveHostnameQuery>& query, getQueries<FakeDNSSDResolveHostnameQuery>()) {
+ for (const auto& query : getQueries<FakeDNSSDResolveHostnameQuery>()) {
if (query->hostname == hostname) {
eventLoop->postEvent(boost::bind(
boost::ref(query->onHostnameResolved), address), shared_from_this());
diff --git a/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp b/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp
index f97d9a1..a639ec5 100644
--- a/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp
+++ b/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp
@@ -8,7 +8,6 @@
#include <boost/bind.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/IQ.h>
#include <Swiften/Elements/ProtocolHeader.h>
#include <Swiften/Elements/StreamFeatures.h>
@@ -35,7 +34,7 @@ void OutgoingLinkLocalSession::handleSessionStarted() {
}
void OutgoingLinkLocalSession::handleStreamStart(const ProtocolHeader&) {
- foreach(const std::shared_ptr<ToplevelElement>& stanza, queuedElements_) {
+ for (const auto& stanza : queuedElements_) {
sendElement(stanza);
}
queuedElements_.clear();
diff --git a/Swiften/MUC/MUCBookmarkManager.cpp b/Swiften/MUC/MUCBookmarkManager.cpp
index a06a0a2..9f8ae77 100644
--- a/Swiften/MUC/MUCBookmarkManager.cpp
+++ b/Swiften/MUC/MUCBookmarkManager.cpp
@@ -10,7 +10,6 @@
#include <boost/bind.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Queries/IQRouter.h>
#include <Swiften/Queries/Requests/GetPrivateStorageRequest.h>
#include <Swiften/Queries/Requests/SetPrivateStorageRequest.h>
@@ -36,12 +35,12 @@ void MUCBookmarkManager::handleBookmarksReceived(std::shared_ptr<Storage> payloa
storage = payload;
std::vector<MUCBookmark> receivedBookmarks;
- foreach (Storage::Room room, payload->getRooms()) {
+ for (const auto& room : payload->getRooms()) {
receivedBookmarks.push_back(MUCBookmark(room));
}
std::vector<MUCBookmark> newBookmarks;
- foreach (const MUCBookmark& oldBookmark, bookmarks_) {
+ for (const auto& oldBookmark : bookmarks_) {
if (containsEquivalent(receivedBookmarks, oldBookmark)) {
newBookmarks.push_back(oldBookmark);
} else {
@@ -49,7 +48,7 @@ void MUCBookmarkManager::handleBookmarksReceived(std::shared_ptr<Storage> payloa
}
}
- foreach (const MUCBookmark& newBookmark, receivedBookmarks) {
+ for (const auto& newBookmark : receivedBookmarks) {
if (!containsEquivalent(bookmarks_, newBookmark)) {
newBookmarks.push_back(newBookmark);
onBookmarkAdded(newBookmark);
@@ -102,7 +101,7 @@ void MUCBookmarkManager::flush() {
}
// Update the storage element
storage->clearRooms();
- foreach(const MUCBookmark& bookmark, bookmarks_) {
+ for (const auto& bookmark : bookmarks_) {
storage->addRoom(bookmark.toStorage());
}
diff --git a/Swiften/Network/BOSHConnectionPool.cpp b/Swiften/Network/BOSHConnectionPool.cpp
index 9ce40d3..e4ca471 100644
--- a/Swiften/Network/BOSHConnectionPool.cpp
+++ b/Swiften/Network/BOSHConnectionPool.cpp
@@ -12,7 +12,6 @@
#include <Swiften/Base/Log.h>
#include <Swiften/Base/SafeString.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Network/CachingDomainNameResolver.h>
#include <Swiften/Network/HTTPConnectProxiedConnectionFactory.h>
@@ -40,13 +39,13 @@ BOSHConnectionPool::BOSHConnectionPool(const URL& boshURL, DomainNameResolver* r
BOSHConnectionPool::~BOSHConnectionPool() {
/* Don't do a normal close here. Instead kill things forcibly, as close() or writeFooter() will already have been called */
std::vector<BOSHConnection::ref> connectionCopies = connections;
- foreach (BOSHConnection::ref connection, connectionCopies) {
+ for (auto&& connection : connectionCopies) {
if (connection) {
destroyConnection(connection);
connection->disconnect();
}
}
- foreach (ConnectionFactory* factory, myConnectionFactories) {
+ for (auto factory : myConnectionFactories) {
delete factory;
}
delete resolver;
@@ -116,7 +115,7 @@ void BOSHConnectionPool::close() {
else {
pendingTerminate = true;
std::vector<BOSHConnection::ref> connectionCopies = connections;
- foreach (BOSHConnection::ref connection, connectionCopies) {
+ for (auto&& connection : connectionCopies) {
if (connection) {
connection->disconnect();
}
@@ -157,7 +156,7 @@ void BOSHConnectionPool::handleConnectFinished(bool error, BOSHConnection::ref c
BOSHConnection::ref BOSHConnectionPool::getSuitableConnection() {
BOSHConnection::ref suitableConnection;
- foreach (BOSHConnection::ref connection, connections) {
+ for (auto&& connection : connections) {
if (connection->isReadyToSend()) {
suitableConnection = connection;
break;
@@ -187,7 +186,7 @@ void BOSHConnectionPool::tryToSendQueuedData() {
rid++;
suitableConnection->setRID(rid);
SafeByteArray data;
- foreach (const SafeByteArray& datum, dataQueue) {
+ for (const auto& datum : dataQueue) {
data.insert(data.end(), datum.begin(), datum.end());
}
suitableConnection->write(data);
@@ -204,7 +203,7 @@ void BOSHConnectionPool::tryToSendQueuedData() {
if (!pendingTerminate) {
/* Ensure there's always a session waiting to read data for us */
bool pending = false;
- foreach (BOSHConnection::ref connection, connections) {
+ for (auto&& connection : connections) {
if (connection && !connection->isReadyToSend()) {
pending = true;
}
diff --git a/Swiften/Network/ChainedConnector.cpp b/Swiften/Network/ChainedConnector.cpp
index fbea868..ea55db3 100644
--- a/Swiften/Network/ChainedConnector.cpp
+++ b/Swiften/Network/ChainedConnector.cpp
@@ -11,7 +11,6 @@
#include <boost/bind.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Network/ConnectionFactory.h>
#include <Swiften/Network/Connector.h>
diff --git a/Swiften/Network/DummyTimerFactory.cpp b/Swiften/Network/DummyTimerFactory.cpp
index cdc776c..0bad7be 100644
--- a/Swiften/Network/DummyTimerFactory.cpp
+++ b/Swiften/Network/DummyTimerFactory.cpp
@@ -8,7 +8,6 @@
#include <algorithm>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Network/Timer.h>
namespace Swift {
@@ -49,7 +48,7 @@ std::shared_ptr<Timer> DummyTimerFactory::createTimer(int milliseconds) {
void DummyTimerFactory::setTime(int time) {
assert(time > currentTime);
- foreach(std::shared_ptr<DummyTimer> timer, timers) {
+ for (auto&& timer : timers) {
if (timer->getAlarmTime() > currentTime && timer->getAlarmTime() <= time && timer->isRunning) {
timer->onTick();
}
diff --git a/Swiften/Network/HTTPConnectProxiedConnection.cpp b/Swiften/Network/HTTPConnectProxiedConnection.cpp
index b9ab604..b5e521b 100644
--- a/Swiften/Network/HTTPConnectProxiedConnection.cpp
+++ b/Swiften/Network/HTTPConnectProxiedConnection.cpp
@@ -24,7 +24,6 @@
#include <Swiften/Base/ByteArray.h>
#include <Swiften/Base/Log.h>
#include <Swiften/Base/String.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Network/ConnectionFactory.h>
#include <Swiften/Network/HTTPTrafficFilter.h>
#include <Swiften/Network/HostAddressPort.h>
@@ -68,8 +67,7 @@ void HTTPConnectProxiedConnection::initializeProxy() {
append(data, createSafeByteArray("\r\n"));
}
else if (!nextHTTPRequestHeaders_.empty()) {
- typedef std::pair<std::string, std::string> StringPair;
- foreach(const StringPair& headerField, nextHTTPRequestHeaders_) {
+ for (const auto& headerField : nextHTTPRequestHeaders_) {
append(data, createSafeByteArray(headerField.first));
append(data, createSafeByteArray(": "));
append(data, createSafeByteArray(headerField.second));
@@ -101,11 +99,10 @@ void HTTPConnectProxiedConnection::parseHTTPHeader(const std::string& data, std:
}
void HTTPConnectProxiedConnection::sendHTTPRequest(const std::string& statusLine, const std::vector<std::pair<std::string, std::string> >& headerFields) {
- typedef std::pair<std::string, std::string> HTTPHeaderField;
std::stringstream request;
request << statusLine << "\r\n";
- foreach (const HTTPHeaderField& field, headerFields) {
+ for (const auto& field : headerFields) {
request << field.first << ":" << field.second << "\r\n";
}
request << "\r\n";
diff --git a/Swiften/Network/NetworkEnvironment.cpp b/Swiften/Network/NetworkEnvironment.cpp
index 19f727c..87883c1 100644
--- a/Swiften/Network/NetworkEnvironment.cpp
+++ b/Swiften/Network/NetworkEnvironment.cpp
@@ -6,7 +6,6 @@
#include <Swiften/Network/NetworkEnvironment.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Network/HostAddress.h>
#include <Swiften/Network/NetworkInterface.h>
@@ -17,9 +16,9 @@ NetworkEnvironment::~NetworkEnvironment() {
HostAddress NetworkEnvironment::getLocalAddress() const {
std::vector<NetworkInterface> networkInterfaces = getNetworkInterfaces();
- foreach (const NetworkInterface& iface, networkInterfaces) {
+ for (const auto& iface : networkInterfaces) {
if (!iface.isLoopback()) {
- foreach (const HostAddress& address, iface.getAddresses()) {
+ for (const auto& address : iface.getAddresses()) {
if (address.getRawAddress().is_v4()) {
return address;
}
diff --git a/Swiften/Network/PlatformDomainNameServiceQuery.cpp b/Swiften/Network/PlatformDomainNameServiceQuery.cpp
index 71611f5..5cffcdb 100644
--- a/Swiften/Network/PlatformDomainNameServiceQuery.cpp
+++ b/Swiften/Network/PlatformDomainNameServiceQuery.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -29,7 +29,6 @@
#include <Swiften/Base/ByteArray.h>
#include <Swiften/EventLoop/EventLoop.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Base/BoostRandomGenerator.h>
#include <Swiften/Base/Log.h>
#include <Swiften/Network/PlatformDomainNameResolver.h>
diff --git a/Swiften/Network/UnixProxyProvider.cpp b/Swiften/Network/UnixProxyProvider.cpp
index 6c23add..e6afa3d 100644
--- a/Swiften/Network/UnixProxyProvider.cpp
+++ b/Swiften/Network/UnixProxyProvider.cpp
@@ -12,7 +12,6 @@
#include <Swiften/Network/UnixProxyProvider.h>
-#include <Swiften/Base/foreach.h>
#if defined(HAVE_GCONF)
# include "Swiften/Network/GConfProxyProvider.h"
#endif
diff --git a/Swiften/Network/WindowsNetworkEnvironment.cpp b/Swiften/Network/WindowsNetworkEnvironment.cpp
index 6ce41de..e90a5c6 100644
--- a/Swiften/Network/WindowsNetworkEnvironment.cpp
+++ b/Swiften/Network/WindowsNetworkEnvironment.cpp
@@ -22,7 +22,6 @@
#include <winsock2.h>
#include <Swiften/Base/ByteArray.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Network/HostAddress.h>
#include <Swiften/Network/NetworkInterface.h>
@@ -65,8 +64,8 @@ std::vector<NetworkInterface> WindowsNetworkEnvironment::getNetworkInterfaces()
}
}
- for (std::map<std::string,NetworkInterface>::const_iterator i = interfaces.begin(); i != interfaces.end(); ++i) {
- result.push_back(i->second);
+ for (const auto& interface : interfaces) {
+ result.push_back(interface.second);
}
return result;
}
diff --git a/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp b/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp
index 8a0ecd2..405c593 100644
--- a/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp
+++ b/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -8,8 +8,6 @@
#include <boost/lexical_cast.hpp>
-#include <Swiften/Base/foreach.h>
-
namespace Swift {
BytestreamsParser::BytestreamsParser() : level(TopLevel) {
diff --git a/Swiften/Parser/PayloadParsers/FormParser.cpp b/Swiften/Parser/PayloadParsers/FormParser.cpp
index 5ea75c5..dff45df 100644
--- a/Swiften/Parser/PayloadParsers/FormParser.cpp
+++ b/Swiften/Parser/PayloadParsers/FormParser.cpp
@@ -7,8 +7,6 @@
#include <map>
-#include <Swiften/Base/foreach.h>
-
namespace Swift {
FormParser::FormParser() : level_(TopLevel), parsingItem_(false), parsingReported_(false), parsingOption_(false), hasReportedRef_(false){
@@ -190,15 +188,15 @@ void FormParser::handleEndElement(const std::string& element, const std::string&
}
else {
if (currentPages_.size() > 0) {
- foreach (std::shared_ptr<FormPage> page, currentPages_) {
- foreach (std::string pageRef, page->getFieldRefs()) {
+ for (const auto& page : currentPages_) {
+ for (const auto& pageRef : page->getFieldRefs()) {
if (pageRef == currentField_->getName()) {
page->addField(currentField_);
}
}
}
- foreach (std::shared_ptr<FormSection> section, currentSections_) {
- foreach (std::string sectionRef, section->getFieldRefs()) {
+ for (const auto& section : currentSections_) {
+ for (const auto& sectionRef : section->getFieldRefs()) {
if (sectionRef == currentField_->getName()) {
section->addField(currentField_);
}
diff --git a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp
index a231397..b67556e 100644
--- a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp
+++ b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp
@@ -6,7 +6,6 @@
#include <Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/BlockListPayload.h>
#include <Swiften/Elements/BlockPayload.h>
#include <Swiften/Elements/UnblockPayload.h>
@@ -167,7 +166,7 @@ FullPayloadParserFactoryCollection::FullPayloadParserFactoryCollection() {
factories_.push_back(std::make_shared<GenericPayloadParserFactory2<CarbonsSentParser> >("sent", "urn:xmpp:carbons:2", this));
factories_.push_back(std::make_shared<GenericPayloadParserFactory<CarbonsPrivateParser> >("private", "urn:xmpp:carbons:2"));
- foreach(std::shared_ptr<PayloadParserFactory> factory, factories_) {
+ for (auto& factory : factories_) {
addFactory(factory.get());
}
defaultFactory_ = new RawXMLPayloadParserFactory();
@@ -177,7 +176,7 @@ FullPayloadParserFactoryCollection::FullPayloadParserFactoryCollection() {
FullPayloadParserFactoryCollection::~FullPayloadParserFactoryCollection() {
setDefaultFactory(nullptr);
delete defaultFactory_;
- foreach(std::shared_ptr<PayloadParserFactory> factory, factories_) {
+ for (auto& factory : factories_) {
removeFactory(factory.get());
}
}
diff --git a/Swiften/Parser/PayloadParsers/IBBParser.cpp b/Swiften/Parser/PayloadParsers/IBBParser.cpp
index 4a6b841..9b6babc 100644
--- a/Swiften/Parser/PayloadParsers/IBBParser.cpp
+++ b/Swiften/Parser/PayloadParsers/IBBParser.cpp
@@ -8,7 +8,6 @@
#include <boost/lexical_cast.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/StringCodecs/Base64.h>
namespace Swift {
diff --git a/Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.cpp b/Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.cpp
index 1fbff1c..bac2a78 100644
--- a/Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -8,13 +8,12 @@
#include <boost/lexical_cast.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/MUCOccupant.h>
namespace Swift {
void MUCAdminPayloadParser::handleTree(ParserElement::ref root) {
- foreach (ParserElement::ref itemElement, root->getChildren("item", "http://jabber.org/protocol/muc#admin")) {
+ for (const auto& itemElement : root->getChildren("item", "http://jabber.org/protocol/muc#admin")) {
MUCItem item = MUCItemParser::itemFromTree(itemElement);
getPayloadInternal()->addItem(item);
}
diff --git a/Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.cpp b/Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.cpp
index 95ff8c5..46bc9c5 100644
--- a/Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.cpp
@@ -1,13 +1,11 @@
/*
- * Copyright (c) 2011 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.h>
-#include <Swiften/Base/foreach.h>
-
namespace Swift {
void MUCDestroyPayloadParser::handleTree(ParserElement::ref root) {
diff --git a/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.cpp b/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.cpp
index 00a5d4f..b1bf78e 100644
--- a/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.cpp
@@ -8,7 +8,6 @@
#include <boost/lexical_cast.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/MUCOccupant.h>
#include <Swiften/Parser/PayloadParserFactory.h>
#include <Swiften/Parser/PayloadParserFactoryCollection.h>
@@ -17,7 +16,7 @@
namespace Swift {
void MUCUserPayloadParser::handleTree(ParserElement::ref root) {
- foreach (ParserElement::ref child, root->getAllChildren()) {
+ for (const auto& child : root->getAllChildren()) {
if (child->getName() == "item" && child->getNamespace() == root->getNamespace()) {
MUCItem item = MUCItemParser::itemFromTree(child);
getPayloadInternal()->addItem(item);
diff --git a/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp b/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp
index 1b0c95d..ad66b3f 100644
--- a/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp
+++ b/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp
@@ -13,8 +13,6 @@
#include <Swiften/Parser/PayloadParsers/FormParserFactory.h>
#include <Swiften/Parser/PayloadParsers/FormParser.h>
-#include <Swiften/Base/foreach.h>
-
#define FILE_TRANSFER_NS "http://jabber.org/protocol/si/profile/file-transfer"
#define FEATURE_NEG_NS "http://jabber.org/protocol/feature-neg"
@@ -93,7 +91,7 @@ void StreamInitiationParser::handleEndElement(const std::string& element, const
FormField::ref field = std::dynamic_pointer_cast<FormField>(form->getField("stream-method"));
if (field) {
if (form->getType() == Form::FormType) {
- foreach (const FormField::Option& option, field->getOptions()) {
+ for (const auto& option : field->getOptions()) {
getPayloadInternal()->addProvidedMethod(option.value);
}
}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp
index 18597bd..f0cf68d 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp
@@ -7,7 +7,6 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/MUCDestroyPayload.h>
#include <Swiften/Parser/PayloadParsers/MUCUserPayloadParser.h>
#include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h>
@@ -36,7 +35,7 @@ class MUCUserPayloadParserTest : public CppUnit::TestFixture
MUCUserPayload::ref payload = std::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload());
- foreach (MUCUserPayload::StatusCode status, payload->getStatusCodes()) {
+ for (const auto& status : payload->getStatusCodes()) {
if (status.code == 110) found110 = true;
if (status.code == 210) found210 = true;
}
diff --git a/Swiften/Parser/PayloadParsers/VCardParser.cpp b/Swiften/Parser/PayloadParsers/VCardParser.cpp
index 7867b2c..f8779d1 100644
--- a/Swiften/Parser/PayloadParsers/VCardParser.cpp
+++ b/Swiften/Parser/PayloadParsers/VCardParser.cpp
@@ -9,7 +9,6 @@
#include <cassert>
#include <Swiften/Base/DateTime.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Parser/SerializingParser.h>
#include <Swiften/StringCodecs/Base64.h>
@@ -282,7 +281,7 @@ void VCardParser::handleCharacterData(const std::string& text) {
std::string VCardParser::getElementHierarchy() const {
std::string result;
- foreach(const std::string& element, elementStack_) {
+ for (const auto& element : elementStack_) {
result += "/" + element;
}
return result;
diff --git a/Swiften/Parser/SerializingParser.cpp b/Swiften/Parser/SerializingParser.cpp
index ad794aa..85b0dd4 100644
--- a/Swiften/Parser/SerializingParser.cpp
+++ b/Swiften/Parser/SerializingParser.cpp
@@ -9,7 +9,6 @@
#include <cassert>
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
namespace Swift {
@@ -20,7 +19,7 @@ SerializingParser::SerializingParser() {
void SerializingParser::handleStartElement(const std::string& tag, const std::string& ns, const AttributeMap& attributes) {
std::shared_ptr<XMLElement> element = std::make_shared<XMLElement>(tag, ns);
// FIXME: Ignoring attribute namespace
- foreach (const AttributeMap::Entry& e, attributes.getEntries()) {
+ for (const auto& e : attributes.getEntries()) {
element->setAttribute(e.getAttribute().getName(), e.getValue());
}
diff --git a/Swiften/Parser/Tree/TreeReparser.cpp b/Swiften/Parser/Tree/TreeReparser.cpp
index 7fc74cf..6993d73 100644
--- a/Swiften/Parser/Tree/TreeReparser.cpp
+++ b/Swiften/Parser/Tree/TreeReparser.cpp
@@ -11,7 +11,6 @@
#include <boost/lexical_cast.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/MUCOccupant.h>
#include <Swiften/Parser/PayloadParser.h>
#include <Swiften/Parser/PayloadParserFactory.h>
@@ -31,7 +30,7 @@ std::shared_ptr<Payload> TreeReparser::parseTree(ParserElement::ref root, Payloa
if (current.second) {
stack.push_back(ElementState(current.first, false));
parser->handleStartElement(current.first->getName(), current.first->getNamespace(), current.first->getAttributes());
- foreach(ParserElement::ref child, current.first->getAllChildren()) {
+ for (const auto& child : current.first->getAllChildren()) {
stack.push_back(ElementState(child, true));
}
} else {
diff --git a/Swiften/Presence/DirectedPresenceSender.cpp b/Swiften/Presence/DirectedPresenceSender.cpp
index c1ce3a0..c1134c7 100644
--- a/Swiften/Presence/DirectedPresenceSender.cpp
+++ b/Swiften/Presence/DirectedPresenceSender.cpp
@@ -6,8 +6,6 @@
#include <Swiften/Presence/DirectedPresenceSender.h>
-#include <Swiften/Base/foreach.h>
-
namespace Swift {
DirectedPresenceSender::DirectedPresenceSender(PresenceSender* sender) : sender(sender) {
@@ -22,7 +20,7 @@ void DirectedPresenceSender::sendPresence(std::shared_ptr<Presence> presence) {
if (!presence->getTo().isValid()) {
std::shared_ptr<Presence> presenceCopy(new Presence(*presence));
- foreach(const JID& jid, directedPresenceReceivers) {
+ for (const auto& jid : directedPresenceReceivers) {
presenceCopy->setTo(jid);
sender->sendPresence(presenceCopy);
}
diff --git a/Swiften/Presence/SubscriptionManager.cpp b/Swiften/Presence/SubscriptionManager.cpp
index 8de152c..83009e9 100644
--- a/Swiften/Presence/SubscriptionManager.cpp
+++ b/Swiften/Presence/SubscriptionManager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -8,7 +8,6 @@
#include <boost/bind.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Client/StanzaChannel.h>
namespace Swift {
diff --git a/Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp b/Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp
index 8122c63..664a87b 100644
--- a/Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp
+++ b/Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp
@@ -14,7 +14,6 @@
#include <Swiften/Base/BoostRandomGenerator.h>
#include <Swiften/Base/Debug.h>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Base/sleep.h>
#include <Swiften/Client/Client.h>
#include <Swiften/Client/ClientXMLTracer.h>
diff --git a/Swiften/QA/FileTransferTest/FileTransferTest.cpp b/Swiften/QA/FileTransferTest/FileTransferTest.cpp
index 4cf4048..b627b30 100644
--- a/Swiften/QA/FileTransferTest/FileTransferTest.cpp
+++ b/Swiften/QA/FileTransferTest/FileTransferTest.cpp
@@ -13,7 +13,6 @@
#include <Swiften/Base/BoostRandomGenerator.h>
#include <Swiften/Base/Debug.h>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Base/sleep.h>
#include <Swiften/Client/Client.h>
#include <Swiften/Client/ClientXMLTracer.h>
@@ -346,7 +345,7 @@ int main(int argc, char** argv) {
std::vector<std::string> configurations;
std::string configs_env = std::string(getenv("SWIFT_FILETRANSFERTEST_CONFIG"));
boost::split(configurations, configs_env, boost::is_any_of("|"));
- foreach(const std::string& config, configurations) {
+ for (const auto& config : configurations) {
std::vector<std::string> split_config;
boost::split(split_config, config, boost::is_any_of(":"));
assert(split_config.size() == 2);
@@ -360,8 +359,7 @@ int main(int argc, char** argv) {
}
}
- typedef std::pair<int, int> IntPair;
- foreach(IntPair failedTest, failedTestPairs) {
+ for (auto&& failedTest : failedTestPairs) {
std::cout << "Failed test: " << "( " << failedTest.first << ", " << failedTest.second << ") " << std::endl;
}
}
@@ -377,8 +375,7 @@ int main(int argc, char** argv) {
}
}
- typedef std::pair<int, int> IntPair;
- foreach(IntPair failedTest, failedTestPairs) {
+ for (auto&& failedTest : failedTestPairs) {
std::cout << "Failed test: " << "( " << failedTest.first << ", " << failedTest.second << ") " << std::endl;
}
}
diff --git a/Swiften/QA/ProxyProviderTest/ProxyProviderTest.cpp b/Swiften/QA/ProxyProviderTest/ProxyProviderTest.cpp
index 2b6bfa8..53f9e60 100644
--- a/Swiften/QA/ProxyProviderTest/ProxyProviderTest.cpp
+++ b/Swiften/QA/ProxyProviderTest/ProxyProviderTest.cpp
@@ -12,7 +12,6 @@
#include <iostream>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Network/PlatformProxyProvider.h>
using namespace Swift;
diff --git a/Swiften/Queries/IQRouter.cpp b/Swiften/Queries/IQRouter.cpp
index e28c2f4..286b65f 100644
--- a/Swiften/Queries/IQRouter.cpp
+++ b/Swiften/Queries/IQRouter.cpp
@@ -9,7 +9,6 @@
#include <boost/bind.hpp>
#include <Swiften/Base/Algorithm.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/ErrorPayload.h>
#include <Swiften/Queries/IQChannel.h>
#include <Swiften/Queries/IQHandler.h>
@@ -53,7 +52,7 @@ void IQRouter::handleIQ(std::shared_ptr<IQ> iq) {
}
void IQRouter::processPendingRemoves() {
- foreach(std::shared_ptr<IQHandler> handler, queuedRemoves_) {
+ for (auto&& handler : queuedRemoves_) {
erase(handlers_, handler);
}
queuedRemoves_.clear();
diff --git a/Swiften/Roster/XMPPRosterController.cpp b/Swiften/Roster/XMPPRosterController.cpp
index 57b0645..8ee9755 100644
--- a/Swiften/Roster/XMPPRosterController.cpp
+++ b/Swiften/Roster/XMPPRosterController.cpp
@@ -9,7 +9,6 @@
#include <boost/bind.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/RosterItemPayload.h>
#include <Swiften/Queries/IQRouter.h>
#include <Swiften/Roster/GetRosterRequest.h>
@@ -51,7 +50,7 @@ void XMPPRosterController::requestRoster() {
void XMPPRosterController::handleRosterReceived(std::shared_ptr<RosterPayload> rosterPayload, bool initial, std::shared_ptr<RosterPayload> previousRoster) {
if (rosterPayload) {
- foreach(const RosterItemPayload& item, rosterPayload->getItems()) {
+ for (const auto& item : rosterPayload->getItems()) {
//Don't worry about the updated case, the XMPPRoster sorts that out.
if (item.getSubscription() == RosterItemPayload::Remove) {
xmppRoster_->removeContact(item.getJID());
@@ -62,7 +61,7 @@ void XMPPRosterController::handleRosterReceived(std::shared_ptr<RosterPayload> r
}
else if (previousRoster) {
// The cached version hasn't changed; emit all items
- foreach(const RosterItemPayload& item, previousRoster->getItems()) {
+ for (const auto& item : previousRoster->getItems()) {
if (item.getSubscription() != RosterItemPayload::Remove) {
xmppRoster_->addContact(item.getJID(), item.getName(), item.getGroups(), item.getSubscription());
}
@@ -83,7 +82,7 @@ void XMPPRosterController::saveRoster(const std::string& version) {
std::vector<XMPPRosterItem> items = xmppRoster_->getItems();
std::shared_ptr<RosterPayload> roster(new RosterPayload());
roster->setVersion(version);
- foreach(const XMPPRosterItem& item, items) {
+ for (const auto& item : items) {
roster->addItem(RosterItemPayload(item.getJID(), item.getName(), item.getSubscription(), item.getGroups()));
}
rosterStorage_->setRoster(roster);
diff --git a/Swiften/Roster/XMPPRosterImpl.cpp b/Swiften/Roster/XMPPRosterImpl.cpp
index 9a2ea7a..74f634f 100644
--- a/Swiften/Roster/XMPPRosterImpl.cpp
+++ b/Swiften/Roster/XMPPRosterImpl.cpp
@@ -1,13 +1,11 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swiften/Roster/XMPPRosterImpl.h>
-#include <Swiften/Base/foreach.h>
-
namespace Swift {
XMPPRosterImpl::XMPPRosterImpl() {
@@ -78,7 +76,7 @@ RosterItemPayload::Subscription XMPPRosterImpl::getSubscriptionStateForJID(const
std::vector<XMPPRosterItem> XMPPRosterImpl::getItems() const {
std::vector<XMPPRosterItem> result;
- foreach(const RosterMap::value_type& entry, entries_) {
+ for (const auto& entry : entries_) {
result.push_back(entry.second);
}
return result;
@@ -96,7 +94,7 @@ boost::optional<XMPPRosterItem> XMPPRosterImpl::getItem(const JID& jid) const {
std::set<std::string> XMPPRosterImpl::getGroups() const {
std::set<std::string> result;
- foreach(const RosterMap::value_type& entry, entries_) {
+ for (const auto& entry : entries_) {
std::vector<std::string> groups = entry.second.getGroups();
result.insert(groups.begin(), groups.end());
}
diff --git a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp
index 93eab75..78bb0eb 100644
--- a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp
@@ -10,7 +10,6 @@
#include <boost/lexical_cast.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -22,7 +21,7 @@ BytestreamsSerializer::BytestreamsSerializer() {
std::string BytestreamsSerializer::serializePayload(std::shared_ptr<Bytestreams> bytestreams) const {
XMLElement queryElement("query", "http://jabber.org/protocol/bytestreams");
queryElement.setAttribute("sid", bytestreams->getStreamID());
- foreach(const Bytestreams::StreamHost& streamHost, bytestreams->getStreamHosts()) {
+ for (const auto& streamHost : bytestreams->getStreamHosts()) {
std::shared_ptr<XMLElement> streamHostElement(new XMLElement("streamhost"));
streamHostElement->setAttribute("host", streamHost.host);
streamHostElement->setAttribute("jid", streamHost.jid.toString());
diff --git a/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp
index e1dd6ed..25a70f6 100644
--- a/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
@@ -50,14 +49,14 @@ std::string CommandSerializer::serializePayload(std::shared_ptr<Command> command
actions += " execute='" + executeAction + "'";
}
actions += ">";
- foreach (Command::Action action, command->getAvailableActions()) {
+ for (const auto& action : command->getAvailableActions()) {
actions += "<" + actionToString(action) + "/>";
}
actions += "</actions>";
commandElement.addNode(std::make_shared<XMLRawTextNode>(actions));
}
- foreach (Command::Note note, command->getNotes()) {
+ for (const auto& note : command->getNotes()) {
std::shared_ptr<XMLElement> noteElement(new XMLElement("note"));
std::string type;
switch (note.type) {
diff --git a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp
index 73e2585..06cad2b 100644
--- a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
@@ -23,7 +22,7 @@ std::string DiscoInfoSerializer::serializePayload(std::shared_ptr<DiscoInfo> dis
if (!discoInfo->getNode().empty()) {
queryElement.setAttribute("node", discoInfo->getNode());
}
- foreach(const DiscoInfo::Identity& identity, discoInfo->getIdentities()) {
+ for (const auto& identity : discoInfo->getIdentities()) {
std::shared_ptr<XMLElement> identityElement(new XMLElement("identity"));
if (!identity.getLanguage().empty()) {
identityElement->setAttribute("xml:lang", identity.getLanguage());
@@ -33,12 +32,12 @@ std::string DiscoInfoSerializer::serializePayload(std::shared_ptr<DiscoInfo> dis
identityElement->setAttribute("type", identity.getType());
queryElement.addNode(identityElement);
}
- foreach(const std::string& feature, discoInfo->getFeatures()) {
+ for (const auto& feature : discoInfo->getFeatures()) {
std::shared_ptr<XMLElement> featureElement(new XMLElement("feature"));
featureElement->setAttribute("var", feature);
queryElement.addNode(featureElement);
}
- foreach(const Form::ref extension, discoInfo->getExtensions()) {
+ for (const auto& extension : discoInfo->getExtensions()) {
queryElement.addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(extension)));
}
return queryElement.serialize();
diff --git a/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp
index 1b734dc..a8eafef 100644
--- a/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
@@ -21,7 +20,7 @@ std::string DiscoItemsSerializer::serializePayload(std::shared_ptr<DiscoItems> d
if (!discoItems->getNode().empty()) {
queryElement.setAttribute("node", discoItems->getNode());
}
- foreach(const DiscoItems::Item& item, discoItems->getItems()) {
+ for (const auto& item : discoItems->getItems()) {
std::shared_ptr<XMLElement> itemElement(new XMLElement("item"));
itemElement->setAttribute("name", item.getName());
itemElement->setAttribute("jid", item.getJID());
diff --git a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp
index ed010b4..f723ead 100644
--- a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp
@@ -11,7 +11,6 @@
#include <Swiften/Base/Algorithm.h>
#include <Swiften/Base/String.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -52,33 +51,33 @@ std::string FormSerializer::serializePayload(std::shared_ptr<Form> form) const
if (!form->getInstructions().empty()) {
multiLineify(form->getInstructions(), "instructions", formElement);
}
- foreach(std::shared_ptr<FormPage> page, form->getPages()) {
+ for (const auto& page : form->getPages()) {
formElement->addNode(pageToXML(page));
}
- foreach(std::shared_ptr<FormField> field, form->getFields()) {
+ for (const auto& field : form->getFields()) {
formElement->addNode(fieldToXML(field, true));
}
if (!form->getReportedFields().empty()) {
std::shared_ptr<XMLElement> reportedElement(new XMLElement("reported"));
- foreach(FormField::ref field, form->getReportedFields()) {
+ for (const auto& field : form->getReportedFields()) {
reportedElement->addNode(fieldToXML(field, true));
}
formElement->addNode(reportedElement);
}
- foreach(Form::FormItem item, form->getItems()) {
+ for (const auto& item : form->getItems()) {
std::shared_ptr<XMLElement> itemElement(new XMLElement("item"));
- foreach(FormField::ref field, item) {
+ for (const auto& field : item) {
itemElement->addNode(fieldToXML(field, false));
}
formElement->addNode(itemElement);
}
- foreach(const FormText::text text, form->getTextElements()) {
+ for (const auto& text : form->getTextElements()) {
formElement->addNode(textToXML(text));
}
- foreach (std::shared_ptr<FormField> field, fields_) {
+ for (const auto& field : fields_) {
formElement->addNode(fieldToXML(field,true));
}
@@ -103,17 +102,18 @@ std::shared_ptr<XMLElement> FormSerializer::pageToXML(std::shared_ptr<FormPage>
if (!page->getLabel().empty()) {
pageElement->setAttribute("label", page->getLabel());
}
- foreach(const FormText::text text, page->getTextElements()) {
+ for (const auto& text : page->getTextElements()) {
pageElement->addNode(textToXML(text));
}
- foreach (const std::shared_ptr<FormField> field, page->getFields()) {
+ for (const auto& field : page->getFields()) {
pageElement->addNode(fieldRefToXML(field->getName()));
fields_.push_back(field);
}
- foreach(const FormReportedRef::ref reportedRef, page->getReportedRefs()) {
+ for (const auto& reportedRef: page->getReportedRefs()) {
+ (void)reportedRef;
pageElement->addNode(std::make_shared<XMLElement>("reportedref"));
}
- foreach(const FormSection::section section, page->getChildSections()) {
+ for (const auto& section : page->getChildSections()) {
pageElement->addNode(sectionToXML(section));
}
return pageElement;
@@ -124,17 +124,18 @@ std::shared_ptr<XMLElement> FormSerializer::sectionToXML(std::shared_ptr<FormSec
if (!section->getLabel().empty()) {
sectionElement->setAttribute("label", section->getLabel());
}
- foreach(const FormText::text text, section->getTextElements()) {
+ for (const auto& text : section->getTextElements()) {
sectionElement->addNode(textToXML(text));
}
- foreach(const std::shared_ptr<FormField> field, section->getFields()) {
+ for (const auto& field : section->getFields()) {
sectionElement->addNode(fieldRefToXML(field->getName()));
fields_.push_back(field);
}
- foreach(const FormReportedRef::ref reportedRef, section->getReportedRefs()) {
+ for (const auto& reportedRef : section->getReportedRefs()) {
+ (void)reportedRef;
sectionElement->addNode(std::make_shared<XMLElement>("reportedref"));
}
- foreach(const FormSection::section childSection, section->getChildSections()) {
+ for (const auto& childSection : section->getChildSections()) {
sectionElement->addNode(sectionToXML(childSection));
}
return sectionElement;
@@ -175,13 +176,13 @@ std::shared_ptr<XMLElement> FormSerializer::fieldToXML(std::shared_ptr<FormField
if (!fieldType.empty() && withTypeAttribute) {
fieldElement->setAttribute("type", fieldType);
}
- foreach (const std::string& value, field->getValues()) {
+ for (const auto& value : field->getValues()) {
std::shared_ptr<XMLElement> valueElement = std::make_shared<XMLElement>("value");
valueElement->addNode(std::make_shared<XMLTextNode>(value));
fieldElement->addNode(valueElement);
}
- foreach (const FormField::Option& option, field->getOptions()) {
+ for (const auto& option : field->getOptions()) {
std::shared_ptr<XMLElement> optionElement(new XMLElement("option"));
if (!option.label.empty()) {
optionElement->setAttribute("label", option.label);
@@ -199,7 +200,7 @@ void FormSerializer::multiLineify(const std::string& text, const std::string& el
std::string unRdText(text);
erase(unRdText, '\r');
std::vector<std::string> lines = String::split(unRdText, '\n');
- foreach (std::string line, lines) {
+ for (const auto& line : lines) {
std::shared_ptr<XMLElement> lineElement(new XMLElement(elementName));
lineElement->addNode(std::make_shared<XMLTextNode>(line));
element->addNode(lineElement);
diff --git a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
index 175de1e..cf0b54c 100644
--- a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
+++ b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
@@ -6,7 +6,6 @@
#include <Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/BlockListPayload.h>
#include <Swiften/Elements/BlockPayload.h>
#include <Swiften/Elements/UnblockPayload.h>
@@ -165,13 +164,13 @@ FullPayloadSerializerCollection::FullPayloadSerializerCollection() {
serializers_.push_back(new IsodeIQDelegationSerializer(this));
- foreach(PayloadSerializer* serializer, serializers_) {
+ for (auto serializer : serializers_) {
addSerializer(serializer);
}
}
FullPayloadSerializerCollection::~FullPayloadSerializerCollection() {
- foreach(PayloadSerializer* serializer, serializers_) {
+ for (auto serializer : serializers_) {
removeSerializer(serializer);
delete serializer;
}
diff --git a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp
index 36d82a2..e41ff8c 100644
--- a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp
@@ -11,7 +11,6 @@
#include <boost/lexical_cast.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
#include <Swiften/StringCodecs/Base64.h>
diff --git a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp
index 31b023f..04b7c56 100644
--- a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
diff --git a/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp
index 02e0f2a..39eb149 100644
--- a/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp
@@ -15,7 +15,6 @@
#include <memory>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h>
@@ -38,7 +37,7 @@ std::string JingleContentPayloadSerializer::serializePayload(std::shared_ptr<Jin
JingleFileTransferDescriptionSerializer ftSerializer;
JingleFileTransferDescription::ref filetransfer;
- foreach(JingleDescription::ref desc, payload->getDescriptions()) {
+ for (auto&& desc : payload->getDescriptions()) {
if ((filetransfer = std::dynamic_pointer_cast<JingleFileTransferDescription>(desc))) {
payloadXML.addNode(std::make_shared<XMLRawTextNode>(ftSerializer.serializePayload(filetransfer)));
}
@@ -54,7 +53,7 @@ std::string JingleContentPayloadSerializer::serializePayload(std::shared_ptr<Jin
JingleS5BTransportPayloadSerializer s5bSerializer;
JingleS5BTransportPayload::ref s5b;
- foreach(JingleTransportPayload::ref transport, payload->getTransports()) {
+ for (auto&& transport : payload->getTransports()) {
if ((ibb = std::dynamic_pointer_cast<JingleIBBTransportPayload>(transport))) {
payloadXML.addNode(std::make_shared<XMLRawTextNode>(ibbSerializer.serializePayload(ibb)));
} else if ((s5b = std::dynamic_pointer_cast<JingleS5BTransportPayload>(transport))) {
diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.cpp
index b002482..27e3b33 100644
--- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.cpp
@@ -17,7 +17,6 @@
#include <boost/lexical_cast.hpp>
#include <Swiften/Base/DateTime.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLNode.h>
diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp
index d78d7df..35a0a6e 100644
--- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp
@@ -11,7 +11,6 @@
#include <boost/lexical_cast.hpp>
#include <Swiften/Base/DateTime.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -54,7 +53,7 @@ std::string JingleFileTransferFileInfoSerializer::serializePayload(std::shared_p
fileElement.addNode(std::make_shared<XMLElement>("size", "", boost::lexical_cast<std::string>(fileInfo->getSize())));
}
- foreach (JingleFileTransferFileInfo::HashElementMap::value_type hashElement, fileInfo->getHashes()) {
+ for (const auto& hashElement : fileInfo->getHashes()) {
std::shared_ptr<XMLElement> hash = std::make_shared<XMLElement>("hash", "urn:xmpp:hashes:1", Base64::encode(hashElement.second));
hash->setAttribute("algo", hashElement.first);
fileElement.addNode(hash);
diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.cpp
index 1f6ead7..7629721 100644
--- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.cpp
@@ -16,7 +16,6 @@
#include <memory>
#include <string>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLNode.h>
diff --git a/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp
index 52e6c16..9930e44 100644
--- a/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp
@@ -16,7 +16,6 @@
#include <boost/lexical_cast.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLNode.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
diff --git a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp
index 8b37929..aaac757 100644
--- a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp
@@ -15,7 +15,6 @@
#include <memory>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/JingleContentPayload.h>
#include <Swiften/Elements/JingleFileTransferDescription.h>
#include <Swiften/Elements/JingleFileTransferHash.h>
@@ -41,7 +40,7 @@ std::string JinglePayloadSerializer::serializePayload(std::shared_ptr<JinglePayl
std::vector<std::shared_ptr<Payload> > payloads = payload->getPayloads();
if (!payloads.empty()) {
- foreach(std::shared_ptr<Payload> subPayload, payloads) {
+ for (auto&& subPayload : payloads) {
PayloadSerializer* serializer = serializers->getPayloadSerializer(subPayload);
if (serializer) {
jinglePayload.addNode(std::make_shared<XMLRawTextNode>(serializer->serialize(subPayload)));
diff --git a/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp
index 61447cd..5e74d8e 100644
--- a/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp
@@ -17,7 +17,6 @@
#include <boost/lexical_cast.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLNode.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
@@ -35,7 +34,7 @@ std::string JingleS5BTransportPayloadSerializer::serializePayload(std::shared_pt
payloadXML.setAttribute("dstaddr", payload->getDstAddr());
}
- foreach(JingleS5BTransportPayload::Candidate candidate, payload->getCandidates()) {
+ for (const auto& candidate : payload->getCandidates()) {
std::shared_ptr<XMLElement> candidateXML = std::make_shared<XMLElement>("candidate");
candidateXML->setAttribute("cid", candidate.cid);
candidateXML->setAttribute("host", candidate.hostPort.getAddress().toString());
diff --git a/Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.cpp
index 385c181..157c99e 100644
--- a/Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.cpp
@@ -9,7 +9,6 @@
#include <memory>
#include <sstream>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -21,7 +20,7 @@ MUCAdminPayloadSerializer::MUCAdminPayloadSerializer() : GenericPayloadSerialize
std::string MUCAdminPayloadSerializer::serializePayload(std::shared_ptr<MUCAdminPayload> payload) const {
XMLElement mucElement("query", "http://jabber.org/protocol/muc#admin");
- foreach (const MUCItem& item, payload->getItems()) {
+ for (const auto& item : payload->getItems()) {
mucElement.addNode(MUCItemSerializer::itemToElement(item));
}
return mucElement.serialize();
diff --git a/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.cpp
index 3d807be..96116c7 100644
--- a/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
diff --git a/Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp
index 4b978af..2004f4c 100644
--- a/Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
diff --git a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp
index 52ab489..f0f3cfa 100644
--- a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp
@@ -9,7 +9,6 @@
#include <memory>
#include <sstream>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -23,14 +22,14 @@ MUCUserPayloadSerializer::MUCUserPayloadSerializer(PayloadSerializerCollection*
std::string MUCUserPayloadSerializer::serializePayload(std::shared_ptr<MUCUserPayload> payload) const {
XMLElement mucElement("x", "http://jabber.org/protocol/muc#user");
- foreach (const MUCUserPayload::StatusCode statusCode, payload->getStatusCodes()) {
+ for (const auto& statusCode : payload->getStatusCodes()) {
std::shared_ptr<XMLElement> statusElement(new XMLElement("status"));
std::ostringstream code;
code << statusCode.code;
statusElement->setAttribute("code", code.str());
mucElement.addNode(statusElement);
}
- foreach (const MUCItem& item, payload->getItems()) {
+ for (const auto& item : payload->getItems()) {
mucElement.addNode(MUCItemSerializer::itemToElement(item));
}
diff --git a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp
index 87a2eeb..fc410fb 100644
--- a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp
index 07b427c..9c810da 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp
@@ -4,13 +4,10 @@
* See the COPYING file for more information.
*/
-
-
#include <Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.h>
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -32,7 +29,7 @@ std::string PubSubAffiliationsSerializer::serializePayload(std::shared_ptr<PubSu
if (payload->getNode()) {
element.setAttribute("node", *payload->getNode());
}
- foreach(std::shared_ptr<PubSubAffiliation> item, payload->getAffiliations()) {
+ for (const auto& item : payload->getAffiliations()) {
element.addNode(std::make_shared<XMLRawTextNode>(PubSubAffiliationSerializer(serializers).serialize(item)));
}
return element.serialize();
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.cpp
index 61b6cb5..2743ff6 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.cpp
@@ -4,13 +4,10 @@
* See the COPYING file for more information.
*/
-
-
#include <Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.h>
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
@@ -34,7 +31,7 @@ std::string PubSubEventItemSerializer::serializePayload(std::shared_ptr<PubSubEv
if (payload->getPublisher()) {
element.setAttribute("publisher", *payload->getPublisher());
}
- foreach(std::shared_ptr<Payload> item, payload->getData()) {
+ for (const auto& item : payload->getData()) {
element.addNode(std::make_shared<XMLRawTextNode>(serializers->getPayloadSerializer(item)->serialize(item)));
}
if (payload->getID()) {
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.cpp
index c8704ea..67d611b 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.cpp
@@ -4,13 +4,10 @@
* See the COPYING file for more information.
*/
-
-
#include <Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.h>
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.h>
@@ -31,10 +28,10 @@ std::string PubSubEventItemsSerializer::serializePayload(std::shared_ptr<PubSubE
}
XMLElement element("items", "http://jabber.org/protocol/pubsub#event");
element.setAttribute("node", payload->getNode());
- foreach(std::shared_ptr<PubSubEventItem> item, payload->getItems()) {
+ for (const auto& item : payload->getItems()) {
element.addNode(std::make_shared<XMLRawTextNode>(PubSubEventItemSerializer(serializers).serialize(item)));
}
- foreach(std::shared_ptr<PubSubEventRetract> item, payload->getRetracts()) {
+ for (const auto& item : payload->getRetracts()) {
element.addNode(std::make_shared<XMLRawTextNode>(PubSubEventRetractSerializer(serializers).serialize(item)));
}
return element.serialize();
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.cpp
index d0b14ae..51b8b46 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.h>
@@ -38,7 +37,7 @@ std::string PubSubEventSerializer::serializePayload(std::shared_ptr<PubSubEvent>
}
XMLElement element("event", "http://jabber.org/protocol/pubsub#event");
std::shared_ptr<PubSubEventPayload> p = payload->getPayload();
- foreach(std::shared_ptr<PayloadSerializer> serializer, pubsubSerializers) {
+ for (const auto& serializer : pubsubSerializers) {
if (serializer->canSerialize(p)) {
element.addNode(std::make_shared<XMLRawTextNode>(serializer->serialize(p)));
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.cpp
index d2e5977..a202c88 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.cpp
@@ -4,13 +4,10 @@
* See the COPYING file for more information.
*/
-
-
#include <Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.h>
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
@@ -28,7 +25,7 @@ std::string PubSubItemSerializer::serializePayload(std::shared_ptr<PubSubItem> p
return "";
}
XMLElement element("item", "http://jabber.org/protocol/pubsub");
- foreach(std::shared_ptr<Payload> item, payload->getData()) {
+ for (const auto& item : payload->getData()) {
element.addNode(std::make_shared<XMLRawTextNode>(serializers->getPayloadSerializer(item)->serialize(item)));
}
if (!payload->getID().empty()) {
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp
index ae6433a..9786f51 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp
@@ -4,8 +4,6 @@
* See the COPYING file for more information.
*/
-
-
#include <Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.h>
#include <memory>
@@ -13,7 +11,6 @@
#include <boost/lexical_cast.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -36,7 +33,7 @@ std::string PubSubItemsSerializer::serializePayload(std::shared_ptr<PubSubItems>
SWIFT_LOG(warning) << "Serializing PubSubItems with empty node attribute";
}
element.setAttribute("node", payload->getNode());
- foreach(std::shared_ptr<PubSubItem> item, payload->getItems()) {
+ for (const auto& item : payload->getItems()) {
element.addNode(std::make_shared<XMLRawTextNode>(PubSubItemSerializer(serializers).serialize(item)));
}
if (payload->getMaximumItems()) {
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.cpp
index 7810e2f..b9f6bcc 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.cpp
@@ -6,10 +6,8 @@
#include <Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.h>
-#include <cassert>
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -29,7 +27,7 @@ std::string PubSubOwnerAffiliationsSerializer::serializePayload(std::shared_ptr<
}
XMLElement element("affiliations", "http://jabber.org/protocol/pubsub#owner");
element.setAttribute("node", payload->getNode());
- foreach(std::shared_ptr<PubSubOwnerAffiliation> item, payload->getAffiliations()) {
+ for (const auto& item : payload->getAffiliations()) {
element.addNode(std::make_shared<XMLRawTextNode>(PubSubOwnerAffiliationSerializer(serializers).serialize(item)));
}
return element.serialize();
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.cpp
index cacd8d9..b2dfd21 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.h>
@@ -38,7 +37,7 @@ std::string PubSubOwnerPubSubSerializer::serializePayload(std::shared_ptr<PubSub
}
XMLElement element("pubsub", "http://jabber.org/protocol/pubsub#owner");
std::shared_ptr<PubSubOwnerPayload> p = payload->getPayload();
- foreach(std::shared_ptr<PayloadSerializer> serializer, pubsubSerializers) {
+ for (const auto& serializer : pubsubSerializers) {
if (serializer->canSerialize(p)) {
element.addNode(std::make_shared<XMLRawTextNode>(serializer->serialize(p)));
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.cpp
index 9a6ca32..a5940f6 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.cpp
@@ -6,10 +6,8 @@
#include <Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.h>
-#include <cassert>
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -29,7 +27,7 @@ std::string PubSubOwnerSubscriptionsSerializer::serializePayload(std::shared_ptr
}
XMLElement element("subscriptions", "http://jabber.org/protocol/pubsub#owner");
element.setAttribute("node", payload->getNode());
- foreach(std::shared_ptr<PubSubOwnerSubscription> item, payload->getSubscriptions()) {
+ for (const auto& item : payload->getSubscriptions()) {
element.addNode(std::make_shared<XMLRawTextNode>(PubSubOwnerSubscriptionSerializer(serializers).serialize(item)));
}
return element.serialize();
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.cpp
index 871845f..ce8706d 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.cpp
@@ -4,13 +4,10 @@
* See the COPYING file for more information.
*/
-
-
#include <Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.h>
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -30,7 +27,7 @@ std::string PubSubPublishSerializer::serializePayload(std::shared_ptr<PubSubPubl
}
XMLElement element("publish", "http://jabber.org/protocol/pubsub");
element.setAttribute("node", payload->getNode());
- foreach(std::shared_ptr<PubSubItem> item, payload->getItems()) {
+ for (const auto& item : payload->getItems()) {
element.addNode(std::make_shared<XMLRawTextNode>(PubSubItemSerializer(serializers).serialize(item)));
}
return element.serialize();
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.cpp
index 99b425e..c82089a 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -28,7 +27,7 @@ std::string PubSubRetractSerializer::serializePayload(std::shared_ptr<PubSubRetr
}
XMLElement element("retract", "http://jabber.org/protocol/pubsub");
element.setAttribute("node", payload->getNode());
- foreach(std::shared_ptr<PubSubItem> item, payload->getItems()) {
+ for (const auto& item : payload->getItems()) {
element.addNode(std::make_shared<XMLRawTextNode>(PubSubItemSerializer(serializers).serialize(item)));
}
if (payload->isNotify().is_initialized()) {
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp
index dbef36e..648c5a3 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp
@@ -4,13 +4,10 @@
* See the COPYING file for more information.
*/
-
-
#include <Swiften/Serializer/PayloadSerializers/PubSubSerializer.h>
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.h>
@@ -52,7 +49,7 @@ std::string PubSubSerializer::serializePayload(std::shared_ptr<PubSub> payload)
}
XMLElement element("pubsub", "http://jabber.org/protocol/pubsub");
std::shared_ptr<PubSubPayload> p = payload->getPayload();
- foreach(std::shared_ptr<PayloadSerializer> serializer, pubsubSerializers) {
+ for (const auto& serializer : pubsubSerializers) {
if (serializer->canSerialize(p)) {
element.addNode(std::make_shared<XMLRawTextNode>(serializer->serialize(p)));
if (std::shared_ptr<PubSubCreate> create = std::dynamic_pointer_cast<PubSubCreate>(p)) {
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.cpp
index e154109..6e01881 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -30,7 +29,7 @@ std::string PubSubSubscriptionsSerializer::serializePayload(std::shared_ptr<PubS
if (payload->getNode()) {
element.setAttribute("node", *payload->getNode());
}
- foreach(std::shared_ptr<PubSubSubscription> item, payload->getSubscriptions()) {
+ for (const auto& item : payload->getSubscriptions()) {
element.addNode(std::make_shared<XMLRawTextNode>(PubSubSubscriptionSerializer(serializers).serialize(item)));
}
return element.serialize();
diff --git a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp
index 24cc301..c7fdc5b 100644
--- a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp
@@ -14,7 +14,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -26,7 +25,7 @@ RosterItemExchangeSerializer::RosterItemExchangeSerializer() : GenericPayloadSer
std::string RosterItemExchangeSerializer::serializePayload(std::shared_ptr<RosterItemExchangePayload> roster) const {
XMLElement queryElement("x", "http://jabber.org/protocol/rosterx");
- foreach(const RosterItemExchangePayload::Item& item, roster->getItems()) {
+ for (const auto& item : roster->getItems()) {
std::shared_ptr<XMLElement> itemElement(new XMLElement("item"));
itemElement->setAttribute("jid", item.getJID());
itemElement->setAttribute("name", item.getName());
@@ -37,7 +36,7 @@ std::string RosterItemExchangeSerializer::serializePayload(std::shared_ptr<Roste
case RosterItemExchangePayload::Item::Delete: itemElement->setAttribute("action", "delete"); break;
}
- foreach(const std::string& group, item.getGroups()) {
+ for (const auto& group : item.getGroups()) {
std::shared_ptr<XMLElement> groupElement(new XMLElement("group"));
groupElement->addNode(std::make_shared<XMLTextNode>(group));
itemElement->addNode(groupElement);
diff --git a/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp b/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp
index 8c857ab..e706542 100644
--- a/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -23,7 +22,7 @@ std::string RosterSerializer::serializePayload(std::shared_ptr<RosterPayload> ro
if (roster->getVersion()) {
queryElement.setAttribute("ver", *roster->getVersion());
}
- foreach(const RosterItemPayload& item, roster->getItems()) {
+ for (const auto& item : roster->getItems()) {
std::shared_ptr<XMLElement> itemElement(new XMLElement("item"));
itemElement->setAttribute("jid", item.getJID());
itemElement->setAttribute("name", item.getName());
@@ -40,7 +39,7 @@ std::string RosterSerializer::serializePayload(std::shared_ptr<RosterPayload> ro
itemElement->setAttribute("ask", "subscribe");
}
- foreach(const std::string& group, item.getGroups()) {
+ for (const auto& group : item.getGroups()) {
std::shared_ptr<XMLElement> groupElement(new XMLElement("group"));
groupElement->addNode(std::make_shared<XMLTextNode>(group));
itemElement->addNode(groupElement);
diff --git a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp
index 6e55f46..befd76d 100644
--- a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
@@ -41,7 +40,7 @@ std::string SearchPayloadSerializer::serializePayload(std::shared_ptr<SearchPayl
searchElement.addNode(XMLElement::ref(new XMLElement("email", "", *searchPayload->getEMail())));
}
- foreach(const SearchPayload::Item& item, searchPayload->getItems()) {
+ for (const auto& item : searchPayload->getItems()) {
XMLElement::ref itemElement(new XMLElement("item"));
itemElement->setAttribute("jid", item.jid);
itemElement->addNode(XMLElement::ref(new XMLElement("first", "", item.first)));
diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp
index 97c5411..b8faf73 100644
--- a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -36,7 +35,7 @@ std::string SecurityLabelSerializer::serializePayload(std::shared_ptr<SecurityLa
labelElement->addNode(std::make_shared<XMLRawTextNode>(label->getLabel()));
element.addNode(labelElement);
- foreach(const std::string& equivalentLabel, label->getEquivalentLabels()) {
+ for (const auto& equivalentLabel : label->getEquivalentLabels()) {
std::shared_ptr<XMLElement> equivalentLabelElement(new XMLElement("equivalentlabel"));
equivalentLabelElement->addNode(std::make_shared<XMLRawTextNode>(equivalentLabel));
element.addNode(equivalentLabelElement);
diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp
index e8d2a1b..36401a6 100644
--- a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
@@ -29,7 +28,7 @@ std::string SecurityLabelsCatalogSerializer::serializePayload(std::shared_ptr<Se
if (!catalog->getDescription().empty()) {
element.setAttribute("desc", catalog->getDescription());
}
- foreach (const SecurityLabelsCatalog::Item& item, catalog->getItems()) {
+ for (const auto& item : catalog->getItems()) {
std::shared_ptr<XMLElement> itemElement(new XMLElement("item"));
itemElement->setAttribute("selector", item.getSelector());
if (item.getIsDefault()) {
diff --git a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp
index 31720f7..ffebcf4 100644
--- a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -20,7 +19,7 @@ StorageSerializer::StorageSerializer() : GenericPayloadSerializer<Storage>() {
std::string StorageSerializer::serializePayload(std::shared_ptr<Storage> storage) const {
XMLElement storageElement("storage", "storage:bookmarks");
- foreach(const Storage::Room& room, storage->getRooms()) {
+ for (const auto& room : storage->getRooms()) {
std::shared_ptr<XMLElement> conferenceElement(new XMLElement("conference"));
conferenceElement->setAttribute("name", room.name);
conferenceElement->setAttribute("jid", room.jid);
@@ -38,7 +37,7 @@ std::string StorageSerializer::serializePayload(std::shared_ptr<Storage> storage
storageElement.addNode(conferenceElement);
}
- foreach(const Storage::URL& url, storage->getURLs()) {
+ for (const auto& url : storage->getURLs()) {
std::shared_ptr<XMLElement> urlElement(new XMLElement("url"));
urlElement->setAttribute("name", url.name);
urlElement->setAttribute("url", url.url);
diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp
index e15ab77..ba296f9 100644
--- a/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp
@@ -17,7 +17,6 @@
#include <boost/lexical_cast.hpp>
#include <Swiften/Base/DateTime.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp
index fcfb063..3faa5b7 100644
--- a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp
@@ -10,7 +10,6 @@
#include <memory>
#include <boost/lexical_cast.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
@@ -54,7 +53,7 @@ std::string StreamInitiationSerializer::serializePayload(std::shared_ptr<StreamI
Form::ref form(new Form(Form::FormType));
FormField::ref field = std::make_shared<FormField>(FormField::ListSingleType);
field->setName("stream-method");
- foreach(const std::string& method, streamInitiation->getProvidedMethods()) {
+ for (const auto& method : streamInitiation->getProvidedMethods()) {
field->addOption(FormField::Option("", method));
}
form->addField(field);
diff --git a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp
index a1393cb..725d125 100644
--- a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/DateTime.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -47,7 +46,7 @@ std::string VCardSerializer::serializePayload(std::shared_ptr<VCard> vcard) con
}
queryElement.addNode(nameElement);
}
- foreach(const VCard::EMailAddress& emailAddress, vcard->getEMailAddresses()) {
+ for (const auto& emailAddress : vcard->getEMailAddresses()) {
std::shared_ptr<XMLElement> emailElement(new XMLElement("EMAIL"));
emailElement->addNode(std::make_shared<XMLElement>("USERID", "", emailAddress.address));
if (emailAddress.isHome) {
@@ -84,7 +83,7 @@ std::string VCardSerializer::serializePayload(std::shared_ptr<VCard> vcard) con
queryElement.addNode(std::make_shared<XMLElement>("BDAY", "", dateTimeToString(vcard->getBirthday())));
}
- foreach(const VCard::Telephone& telephone, vcard->getTelephones()) {
+ for (const auto& telephone : vcard->getTelephones()) {
std::shared_ptr<XMLElement> telElement(new XMLElement("TEL"));
telElement->addNode(std::make_shared<XMLElement>("NUMBER", "", telephone.number));
if (telephone.isHome) {
@@ -129,7 +128,7 @@ std::string VCardSerializer::serializePayload(std::shared_ptr<VCard> vcard) con
queryElement.addNode(telElement);
}
- foreach(const VCard::Address& address, vcard->getAddresses()) {
+ for (const auto& address : vcard->getAddresses()) {
std::shared_ptr<XMLElement> adrElement = std::make_shared<XMLElement>("ADR");
if (!address.poBox.empty()) {
adrElement->addNode(std::make_shared<XMLElement>("POBOX", "", address.poBox));
@@ -177,10 +176,10 @@ std::string VCardSerializer::serializePayload(std::shared_ptr<VCard> vcard) con
queryElement.addNode(adrElement);
}
- foreach(const VCard::AddressLabel& addressLabel, vcard->getAddressLabels()) {
+ for (const auto& addressLabel : vcard->getAddressLabels()) {
std::shared_ptr<XMLElement> labelElement = std::make_shared<XMLElement>("LABEL");
- foreach(const std::string& line, addressLabel.lines) {
+ for (const auto& line : addressLabel.lines) {
labelElement->addNode(std::make_shared<XMLElement>("LINE", "", line));
}
@@ -208,7 +207,7 @@ std::string VCardSerializer::serializePayload(std::shared_ptr<VCard> vcard) con
queryElement.addNode(labelElement);
}
- foreach(const JID& jid, vcard->getJIDs()) {
+ for (const auto& jid : vcard->getJIDs()) {
queryElement.addNode(std::make_shared<XMLElement>("JID", "", jid.toString()));
}
@@ -216,28 +215,28 @@ std::string VCardSerializer::serializePayload(std::shared_ptr<VCard> vcard) con
queryElement.addNode(std::make_shared<XMLElement>("DESC", "", vcard->getDescription()));
}
- foreach(const VCard::Organization& org, vcard->getOrganizations()) {
+ for (const auto& org : vcard->getOrganizations()) {
std::shared_ptr<XMLElement> orgElement = std::make_shared<XMLElement>("ORG");
if (!org.name.empty()) {
orgElement->addNode(std::make_shared<XMLElement>("ORGNAME", "", org.name));
}
if (!org.units.empty()) {
- foreach(const std::string& unit, org.units) {
+ for (const auto& unit : org.units) {
orgElement->addNode(std::make_shared<XMLElement>("ORGUNIT", "", unit));
}
}
queryElement.addNode(orgElement);
}
- foreach(const std::string& title, vcard->getTitles()) {
+ for (const auto& title : vcard->getTitles()) {
queryElement.addNode(std::make_shared<XMLElement>("TITLE", "", title));
}
- foreach(const std::string& role, vcard->getRoles()) {
+ for (const auto& role : vcard->getRoles()) {
queryElement.addNode(std::make_shared<XMLElement>("ROLE", "", role));
}
- foreach(const std::string& url, vcard->getURLs()) {
+ for (const auto& url : vcard->getURLs()) {
queryElement.addNode(std::make_shared<XMLElement>("URL", "", url));
}
diff --git a/Swiften/Serializer/StanzaSerializer.cpp b/Swiften/Serializer/StanzaSerializer.cpp
index 6440fbb..f2f5529 100644
--- a/Swiften/Serializer/StanzaSerializer.cpp
+++ b/Swiften/Serializer/StanzaSerializer.cpp
@@ -10,7 +10,6 @@
#include <typeinfo>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/Stanza.h>
#include <Swiften/Serializer/PayloadSerializer.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
@@ -47,7 +46,7 @@ SafeByteArray StanzaSerializer::serialize(std::shared_ptr<ToplevelElement> eleme
setStanzaSpecificAttributes(stanza, stanzaElement);
std::string serializedPayloads;
- foreach (const std::shared_ptr<Payload>& payload, stanza->getPayloads()) {
+ for (const auto& payload : stanza->getPayloads()) {
PayloadSerializer* serializer = payloadSerializers_->getPayloadSerializer(payload);
if (serializer) {
serializedPayloads += serializer->serialize(payload);
diff --git a/Swiften/Serializer/StreamFeaturesSerializer.cpp b/Swiften/Serializer/StreamFeaturesSerializer.cpp
index 820b96c..2534db0 100644
--- a/Swiften/Serializer/StreamFeaturesSerializer.cpp
+++ b/Swiften/Serializer/StreamFeaturesSerializer.cpp
@@ -8,7 +8,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -26,7 +25,7 @@ SafeByteArray StreamFeaturesSerializer::serialize(std::shared_ptr<ToplevelElemen
}
if (!streamFeatures->getCompressionMethods().empty()) {
std::shared_ptr<XMLElement> compressionElement(new XMLElement("compression", "http://jabber.org/features/compress"));
- foreach(const std::string& method, streamFeatures->getCompressionMethods()) {
+ for (const auto& method : streamFeatures->getCompressionMethods()) {
std::shared_ptr<XMLElement> methodElement(new XMLElement("method"));
methodElement->addNode(std::make_shared<XMLTextNode>(method));
compressionElement->addNode(methodElement);
@@ -35,7 +34,7 @@ SafeByteArray StreamFeaturesSerializer::serialize(std::shared_ptr<ToplevelElemen
}
if (!streamFeatures->getAuthenticationMechanisms().empty()) {
std::shared_ptr<XMLElement> mechanismsElement(new XMLElement("mechanisms", "urn:ietf:params:xml:ns:xmpp-sasl"));
- foreach(const std::string& mechanism, streamFeatures->getAuthenticationMechanisms()) {
+ for (const auto& mechanism : streamFeatures->getAuthenticationMechanisms()) {
std::shared_ptr<XMLElement> mechanismElement(new XMLElement("mechanism"));
mechanismElement->addNode(std::make_shared<XMLTextNode>(mechanism));
mechanismsElement->addNode(mechanismElement);
diff --git a/Swiften/Serializer/XML/XMLElement.cpp b/Swiften/Serializer/XML/XMLElement.cpp
index 4a874ab..f2397ca 100644
--- a/Swiften/Serializer/XML/XMLElement.cpp
+++ b/Swiften/Serializer/XML/XMLElement.cpp
@@ -6,7 +6,6 @@
#include <Swiften/Serializer/XML/XMLElement.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
namespace Swift {
@@ -23,14 +22,13 @@ XMLElement::XMLElement(const std::string& tag, const std::string& xmlns, const s
std::string XMLElement::serialize() {
std::string result;
result += "<" + tag_;
- typedef std::pair<std::string,std::string> Pair;
- foreach(const Pair& p, attributes_) {
+ for (const auto& p : attributes_) {
result += " " + p.first + "=\"" + p.second + "\"";
}
if (!childNodes_.empty()) {
result += ">";
- foreach (std::shared_ptr<XMLNode> node, childNodes_) {
+ for (auto& node : childNodes_) {
result += node->serialize();
}
result += "</" + tag_ + ">";
diff --git a/Swiften/Serializer/XMPPSerializer.cpp b/Swiften/Serializer/XMPPSerializer.cpp
index 08b5485..9cde777 100644
--- a/Swiften/Serializer/XMPPSerializer.cpp
+++ b/Swiften/Serializer/XMPPSerializer.cpp
@@ -12,7 +12,6 @@
#include <boost/bind.hpp>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/ProtocolHeader.h>
#include <Swiften/Serializer/AuthChallengeSerializer.h>
#include <Swiften/Serializer/AuthFailureSerializer.h>
diff --git a/Swiften/Session/BOSHSessionStream.cpp b/Swiften/Session/BOSHSessionStream.cpp
index 635fd69..4c7bdee 100644
--- a/Swiften/Session/BOSHSessionStream.cpp
+++ b/Swiften/Session/BOSHSessionStream.cpp
@@ -12,7 +12,6 @@
#include <boost/random/uniform_int.hpp>
#include <boost/random/variate_generator.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/StreamType.h>
#include <Swiften/EventLoop/EventLoop.h>
#include <Swiften/StreamStack/CompressionLayer.h>
diff --git a/Swiften/StreamStack/StreamStack.cpp b/Swiften/StreamStack/StreamStack.cpp
index 0bcd1b3..44a018d 100644
--- a/Swiften/StreamStack/StreamStack.cpp
+++ b/Swiften/StreamStack/StreamStack.cpp
@@ -8,7 +8,6 @@
#include <boost/bind.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/StreamStack/LowLayer.h>
#include <Swiften/StreamStack/StreamLayer.h>
#include <Swiften/StreamStack/XMPPLayer.h>
diff --git a/Swiften/TLS/ServerIdentityVerifier.cpp b/Swiften/TLS/ServerIdentityVerifier.cpp
index 872717b..226e94b 100644
--- a/Swiften/TLS/ServerIdentityVerifier.cpp
+++ b/Swiften/TLS/ServerIdentityVerifier.cpp
@@ -8,7 +8,6 @@
#include <boost/algorithm/string.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/IDN/IDNConverter.h>
namespace Swift {
@@ -30,7 +29,7 @@ bool ServerIdentityVerifier::certificateVerifies(Certificate::ref certificate) {
}
// DNS names
std::vector<std::string> dnsNames = certificate->getDNSNames();
- foreach (const std::string& dnsName, dnsNames) {
+ for (const auto& dnsName : dnsNames) {
if (matchesDomain(dnsName)) {
return true;
}
@@ -39,7 +38,7 @@ bool ServerIdentityVerifier::certificateVerifies(Certificate::ref certificate) {
// SRV names
std::vector<std::string> srvNames = certificate->getSRVNames();
- foreach (const std::string& srvName, srvNames) {
+ for (const auto& srvName : srvNames) {
// Only match SRV names that begin with the service; this isn't required per
// spec, but we're being purist about this.
if (boost::starts_with(srvName, "_xmpp-client.") && matchesDomain(srvName.substr(std::string("_xmpp-client.").size(), srvName.npos))) {
@@ -50,7 +49,7 @@ bool ServerIdentityVerifier::certificateVerifies(Certificate::ref certificate) {
// XmppAddr
std::vector<std::string> xmppAddresses = certificate->getXMPPAddresses();
- foreach (const std::string& xmppAddress, xmppAddresses) {
+ for (const auto& xmppAddress : xmppAddresses) {
if (matchesAddress(xmppAddress)) {
return true;
}
@@ -60,7 +59,7 @@ bool ServerIdentityVerifier::certificateVerifies(Certificate::ref certificate) {
// CommonNames. Only check this if there was no SAN (according to spec).
if (!hasSAN) {
std::vector<std::string> commonNames = certificate->getCommonNames();
- foreach (const std::string& commonName, commonNames) {
+ for (const auto& commonName : commonNames) {
if (matchesDomain(commonName)) {
return true;
}
diff --git a/Swiften/Whiteboard/WhiteboardSessionManager.cpp b/Swiften/Whiteboard/WhiteboardSessionManager.cpp
index 66b5ef8..59f6c47 100644
--- a/Swiften/Whiteboard/WhiteboardSessionManager.cpp
+++ b/Swiften/Whiteboard/WhiteboardSessionManager.cpp
@@ -17,7 +17,6 @@
#include <boost/bind.hpp>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Disco/EntityCapsProvider.h>
#include <Swiften/Presence/PresenceOracle.h>
#include <Swiften/Queries/IQRouter.h>
@@ -80,7 +79,7 @@ namespace Swift {
std::vector<Presence::ref> presences = presenceOracle_->getAllPresence(bareJID);
//iterate over them
- foreach(Presence::ref pres, presences) {
+ for (const auto& pres : presences) {
if (pres->getPriority() > priority) {
// look up caps from the jid
DiscoInfo::ref info = capsProvider_->getCaps(pres->getFrom());