diff options
author | Tobias Markmann <tm@ayena.de> | 2016-11-23 07:09:39 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-11-23 11:30:02 (GMT) |
commit | e405ff3561be3d3c0bd79d7d5173923a8828cf02 (patch) | |
tree | 9118ef838ebfaec1df90ec24761944b5d833774c /Swift/Controllers/BlockListController.cpp | |
parent | 8a71b91be885652f37c5aab5e1ecf25af4599fbc (diff) | |
download | swift-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 'Swift/Controllers/BlockListController.cpp')
-rw-r--r-- | Swift/Controllers/BlockListController.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Swift/Controllers/BlockListController.cpp b/Swift/Controllers/BlockListController.cpp index 560a3f3..37c536b 100644 --- a/Swift/Controllers/BlockListController.cpp +++ b/Swift/Controllers/BlockListController.cpp @@ -14,7 +14,6 @@ #include <boost/bind.hpp> -#include <Swiften/Base/foreach.h> #include <Swiften/Base/format.h> #include <Swiften/Client/ClientBlockListManager.h> @@ -40,13 +39,13 @@ BlockListController::~BlockListController() { } void BlockListController::blockListDifferences(const std::vector<JID> &newBlockList, std::vector<JID> &jidsToUnblock, std::vector<JID> &jidsToBlock) const { - foreach (const JID& jid, blockListBeforeEdit) { + for (const auto& jid : blockListBeforeEdit) { if (std::find(newBlockList.begin(), newBlockList.end(), jid) == newBlockList.end()) { jidsToUnblock.push_back(jid); } } - foreach (const JID& jid, newBlockList) { + for (const auto& jid : newBlockList) { if (std::find(blockListBeforeEdit.begin(), blockListBeforeEdit.end(), jid) == blockListBeforeEdit.end()) { jidsToBlock.push_back(jid); } @@ -169,13 +168,13 @@ void BlockListController::handleBlockListChanged() { blockListDifferences(blockListEditorWidget_->getCurrentBlockList(), jidsToUnblock, jidsToBlock); blockListBeforeEdit = blockListManager_->getBlockList()->getItems(); - foreach (const JID& jid, jidsToBlock) { + for (const auto& jid : jidsToBlock) { if (std::find(blockListBeforeEdit.begin(), blockListBeforeEdit.end(), jid) == blockListBeforeEdit.end()) { blockListBeforeEdit.push_back(jid); } } - foreach (const JID& jid, jidsToUnblock) { + for (const auto& jid : jidsToUnblock) { blockListBeforeEdit.erase(std::remove(blockListBeforeEdit.begin(), blockListBeforeEdit.end(), jid), blockListBeforeEdit.end()); } |