diff options
author | Remko Tronçon <git@el-tramo.be> | 2012-12-23 16:01:45 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2012-12-23 16:48:15 (GMT) |
commit | 5ccbd7fc3de7afed6c06deb93be3967a7eb5fac2 (patch) | |
tree | d57334bf18662d6753a2cb14bff3b192ff3e7a76 /Swift/Controllers | |
parent | fe5b5e25eadbfe9f8bdaa152b987273ab77d4711 (diff) | |
download | swift-5ccbd7fc3de7afed6c06deb93be3967a7eb5fac2.zip swift-5ccbd7fc3de7afed6c06deb93be3967a7eb5fac2.tar.bz2 |
Replace functors and for loops by boost::lambdas.
Change-Id: I6d2364dc85464f238d95978793f35953a2947799
Diffstat (limited to 'Swift/Controllers')
-rw-r--r-- | Swift/Controllers/StatusCache.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Swift/Controllers/StatusCache.cpp b/Swift/Controllers/StatusCache.cpp index e77bd55..1569e26 100644 --- a/Swift/Controllers/StatusCache.cpp +++ b/Swift/Controllers/StatusCache.cpp @@ -9,11 +9,15 @@ #include <boost/algorithm/string.hpp> #include <boost/lexical_cast.hpp> #include <boost/filesystem/fstream.hpp> +#include <boost/lambda/lambda.hpp> +#include <boost/lambda/bind.hpp> #include <Swiften/Base/foreach.h> #include <Swiften/Base/ByteArray.h> #include <SwifTools/Application/ApplicationPathProvider.h> +namespace lambda = boost::lambda; + namespace Swift { static const size_t MAX_ENTRIES = 200; @@ -45,14 +49,7 @@ void StatusCache::addRecent(const std::string& text, StatusShow::Type type) { if (text.empty()) { return; } - for (std::list<PreviousStatus>::iterator i = previousStatuses_.begin(); i != previousStatuses_.end(); ) { - if ((*i).first == text && (*i).second == type) { - previousStatuses_.erase(i++); - } - else { - ++i; - } - } + previousStatuses_.remove_if(lambda::bind(&PreviousStatus::first, lambda::_1) == text && lambda::bind(&PreviousStatus::second, lambda::_1) == type); previousStatuses_.push_front(PreviousStatus(text, type)); for (size_t i = previousStatuses_.size(); i > MAX_ENTRIES; i--) { previousStatuses_.pop_back(); |