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/PreviousStatusStore.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/PreviousStatusStore.cpp')
-rw-r--r-- | Swift/Controllers/PreviousStatusStore.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Swift/Controllers/PreviousStatusStore.cpp b/Swift/Controllers/PreviousStatusStore.cpp index 4806f9c..0b2d437 100644 --- a/Swift/Controllers/PreviousStatusStore.cpp +++ b/Swift/Controllers/PreviousStatusStore.cpp @@ -1,53 +1,51 @@ /* * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swift/Controllers/PreviousStatusStore.h> -#include <Swiften/Base/foreach.h> - namespace Swift { PreviousStatusStore::PreviousStatusStore() { } PreviousStatusStore::~PreviousStatusStore() { } void PreviousStatusStore::addStatus(StatusShow::Type status, const std::string& message) { //FIXME: remove old entries store_.push_back(TypeStringPair(status, message)); } std::vector<TypeStringPair> PreviousStatusStore::exactMatchSuggestions(StatusShow::Type status, const std::string& message) { std::vector<TypeStringPair> suggestions; suggestions.push_back(TypeStringPair(status, message)); return suggestions; } std::vector<TypeStringPair> PreviousStatusStore::getSuggestions(const std::string& message) { std::vector<TypeStringPair> suggestions; - foreach (TypeStringPair status, store_) { + for (auto&& status : store_) { if (status.second == message) { suggestions.clear(); suggestions.push_back(status); break; } else if (status.second.find(message) != std::string::npos) { suggestions.push_back(status); } } if (suggestions.empty()) { TypeStringPair suggestion(StatusShow::Online, message); suggestions.push_back(suggestion); } if (suggestions.size() == 1) { suggestions = exactMatchSuggestions(suggestions[0].first, suggestions[0].second); } return suggestions; } } |