From ce15b543b15fa0c1abd47c8cea1efa7729dfba92 Mon Sep 17 00:00:00 2001 From: Adam Wardynski <award@.(B-4.4.46a)> Date: Fri, 11 Mar 2011 16:21:49 +0100 Subject: [PATCH] MatchResult - return type for conditions of match operator. It's a tuple boolean/Match Value - "is it matched?"/"actual match" --- libwccl/ops/match/matchresult.h | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 libwccl/ops/match/matchresult.h diff --git a/libwccl/ops/match/matchresult.h b/libwccl/ops/match/matchresult.h new file mode 100644 index 0000000..5b3040d --- /dev/null +++ b/libwccl/ops/match/matchresult.h @@ -0,0 +1,50 @@ +#ifndef LIBWCCL_OPS_MATCH_MATCHRESULT_H +#define LIBWCCL_OPS_MATCH_MATCHRESULT_H + +#include <libwccl/values/bool.h> +#include <libwccl/values/match.h> + +namespace Wccl { + +/** + * Class that represents a result of MatchCondition + */ +class MatchResult +{ +public: + MatchResult(bool matched, const boost::shared_ptr<Match>& match); + MatchResult(); + boost::shared_ptr<Match> get_match() const; + bool matched() const; +private: + bool _matched; + boost::shared_ptr<Match> _match; + +}; + + +// --- Implementation details --- + +inline +MatchResult::MatchResult() : _matched(false), _match() { +} + +inline +MatchResult::MatchResult(bool matched, const boost::shared_ptr<Match>& match) + : _matched(matched), + _match(match) { +} + +inline +bool MatchResult::matched() const { + return _matched; +} + +inline +boost::shared_ptr<Match> MatchResult::get_match() const { + return _match; +} + +} /* end ns Wccl */ + +#endif // LIBWCCL_OPS_MATCH_MATCHRESULT_H -- GitLab