diff options
Diffstat (limited to 'project2/if.cpp')
-rw-r--r-- | project2/if.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/project2/if.cpp b/project2/if.cpp index 5fa7a8c..ed36bad 100644 --- a/project2/if.cpp +++ b/project2/if.cpp @@ -2,6 +2,7 @@ #include "logger.h" #include "xmlObjectLoader.h" #include <boost/foreach.hpp> +#include <boost/bind.hpp> #include <algorithm> DECLARE_LOADER("if", If); @@ -19,22 +20,22 @@ IfSet::IfSet(const xmlpp::Element * e) : template <class Range, class Pred> bool all(const Range & c, const Pred & p) { - return (std::find_if(c.begin(), c.end(), !p) == c.end()); + return (std::find_if(c.begin(), c.end(), !p) == c.end()); } template <class Range, class Pred> bool any(const Range & c, const Pred & p) { - return (std::find_if(c.begin(), c.end(), p) != c.end()); + return (std::find_if(c.begin(), c.end(), p) != c.end()); } bool IfSet::passes() const { if (mode == And) { - return all(checks.get<bySOOrder>(), boost::bind(&ParamChecker::performCheck, _1)); + return all(checks, boost::bind(&ParamChecker::performCheck, _1)); } else if (mode == Or) { - return any(checks.get<bySOOrder>(), boost::bind(&ParamChecker::performCheck, _1)); + return any(checks, boost::bind(&ParamChecker::performCheck, _1)); } throw IfModeIsNonsense(getName()); } @@ -74,12 +75,12 @@ If::execute() const if (passes()) { Logger()->message(LOG_DEBUG, "IfSet passed"); try { - BOOST_FOREACH(const SubNOEs::value_type & sq, normNOEs.get<bySOOrder>()) { + BOOST_FOREACH(const SubNOEs::value_type & sq, normNOEs) { sq->execute(); } } catch (...) { - BOOST_FOREACH(const SubNOEs::value_type & sq, errorNOEs.get<bySOOrder>()) { + BOOST_FOREACH(const SubNOEs::value_type & sq, errorNOEs) { sq->execute(); } if (!localErrorHandling) { |