match.cpp

来自「J-Alice是一个用C++实现的Ailcebot的克隆。它可以做为一个mini」· C++ 代码 · 共 98 行

CPP
98
字号
/**
 * Match - The foundation of matches
 *
 * @author	Jonathan Roewen
 */
#include "Match.h"

#include "Nodemaster.h"

void Match::addInputStar(const string &s) {
	inputStar.push_back(s);
}

void Match::addThatStar(const string &s) {
	thatStar.push_back(s);
}

void Match::addTopicStar(const string &s) {
	topicStar.push_back(s);
}

void Match::setInputPattern(const string &s) {
	inputPattern = s;
}

void Match::setThatPattern(const string &s) {
	thatPattern = s;
}

void Match::setTopicPattern(const string &s) {
	topicPattern = s;
}

string Match::getInputPattern() const {
	return inputPattern;
}

string Match::getThatPattern() const {
	return thatPattern;
}

string Match::getTopicPattern() const {
	return topicPattern;
}

void Match::setPath(const string &s) {
	path = s;
}

string Match::getPath() const {
	return path;
}

void Match::setNode(Nodemaster *n) {
	node = n;
}

Nodemaster *Match::getNode() const {
	return node;
}

string Match::getTemplate() const {
	return node->getTemplate();
}

string Match::getInputStar(unsigned int i) const {
	if (i < 1 || i > inputStar.size()) {
		return "";
	}
	return inputStar[inputStar.size() - i];
}

string Match::getThatStar(unsigned int i) const {
	if (i < 1 || i > thatStar.size()) {
		return "";
	}
	return thatStar[thatStar.size() - i];
}

string Match::getTopicStar(unsigned int i) const {
	if (i < 1 || i > topicStar.size()) {
		return "";
	}
	return topicStar[topicStar.size() - i];
}

unsigned int Match::getInputStarCount() const {
	return inputStar.size();
}

unsigned int Match::getThatStarCount() const {
	return thatStar.size();
}

unsigned int Match::getTopicStarCount() const {
	return topicStar.size();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?