Skip to content
Snippets Groups Projects
matchresult.h 1.6 KiB
Newer Older
#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:
Adam Wardynski's avatar
Adam Wardynski committed
	MatchResult(const boost::shared_ptr<Match>& match);
	MatchResult(const boost::shared_ptr<MatchData>& match);
	MatchResult(const boost::shared_ptr<MatchVector>& match);
	MatchResult(const boost::shared_ptr<TokenMatch>& match);
	MatchResult(const boost::shared_ptr<AnnotationMatch>& 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
Adam Wardynski's avatar
Adam Wardynski committed
MatchResult::MatchResult(const boost::shared_ptr<Match>& match)
	: _matched(true),
inline
MatchResult::MatchResult(const boost::shared_ptr<MatchData>& match)
	: _matched(true),
	  _match(new Match(match)) {
}

inline
MatchResult::MatchResult(const boost::shared_ptr<TokenMatch>& match)
	: _matched(true),
	  _match(new Match(match)) {
}

inline
MatchResult::MatchResult(const boost::shared_ptr<MatchVector>& match)
	: _matched(true),
	  _match(new Match(match)) {
}

inline
MatchResult::MatchResult(const boost::shared_ptr<AnnotationMatch>& match)
	: _matched(true),
	  _match(new 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