#ifndef BANDIT_MATCHPROXY_H #define BANDIT_MATCHPROXY_H #include "MatcherException.h" namespace bandit { namespace Matchers { template class ValueProxy; template class MatchProxy { private: template MatchProxy(const MatchProxy&); template MatchProxy& operator=(const MatchProxy&); public: explicit MatchProxy(const ValueProxy& value, bool negate_ = false) : _value(value), _negate(negate_) {} template void operator()(const MatcherType& matcher) const { if( matcher.matches(_value._value) == _negate ) { throw MatcherException(_value._filename, _value._lineNumber, matcher.failure_message(_value._value, _negate)); } } MatchProxy negate() const { return MatchProxy(_value, !_negate); } private: const ValueProxy& _value; bool _negate; }; }} #endif // BANDIT_MATCHPROXY_H