Newer
Older
#ifndef LIBWCCL_VALUES_TOKENMATCH_H
#define LIBWCCL_VALUES_TOKENMATCH_H
#include <libwccl/values/matchdata.h>
namespace Wccl {
class TokenMatch : public MatchData
{
public:
explicit TokenMatch(Position position)
: position_(position)
{
BOOST_ASSERT(position_.get_value() != Position::Nowhere);
}
explicit TokenMatch(int pos)
: position_(pos)
{
BOOST_ASSERT(position_.get_value() != Position::Nowhere);
}
/// MatchData override.
bool empty() const {
return false;
}
/// MatchData override.
Position first_token(const boost::shared_ptr<Corpus2::AnnotatedSentence>&) const {
return position_;
}
/// MatchData override.
Position last_token(const boost::shared_ptr<Corpus2::AnnotatedSentence>&) const {
return position_;
}
/// MatchData override
std::string to_raw_string() const;
protected:
/// MatchData override
TokenMatch* clone_internal() const {
return new TokenMatch(*this);
}