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/HighlightRule.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/HighlightRule.cpp')
-rw-r--r-- | Swift/Controllers/HighlightRule.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Swift/Controllers/HighlightRule.cpp b/Swift/Controllers/HighlightRule.cpp index 86ac5f7..a8cb7e4 100644 --- a/Swift/Controllers/HighlightRule.cpp +++ b/Swift/Controllers/HighlightRule.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -18,7 +18,6 @@ #include <boost/lambda/lambda.hpp> #include <Swiften/Base/Regex.h> -#include <Swiften/Base/foreach.h> namespace Swift { @@ -45,11 +44,11 @@ boost::regex HighlightRule::regexFromString(const std::string & s) const void HighlightRule::updateRegex() const { keywordRegex_.clear(); - foreach (const std::string & k, keywords_) { + for (const auto& k : keywords_) { keywordRegex_.push_back(regexFromString(k)); } senderRegex_.clear(); - foreach (const std::string & s, senders_) { + for (const auto& s : senders_) { senderRegex_.push_back(regexFromString(s)); } } @@ -79,7 +78,7 @@ bool HighlightRule::isMatch(const std::string& body, const std::string& sender, // check if a keyword matches if (!matchesKeyword && !keywords_.empty()) { - foreach (const boost::regex &keyword, keywordRegex_) { + for (const auto& keyword : keywordRegex_) { if (boost::regex_search(body, keyword)) { matchesKeyword = true; break; @@ -88,7 +87,7 @@ bool HighlightRule::isMatch(const std::string& body, const std::string& sender, } } - foreach (const boost::regex & rx, senderRegex_) { + for (const auto& rx : senderRegex_) { if (boost::regex_search(sender, rx)) { matchesSender = true; break; |