starprocessor.h

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

H
45
字号
/**
 * StarProcessor - Retrieves value of the wildcard in the
 *		input pattern
 *
 * @author	Jonathan Roewen
 */
#ifndef STAR_PROCESSOR_H
#define STAR_PROCESSOR_H

#include "AimlProcessor.h"

#include <string>

using namespace std;

#include "Utils.h"

class StarProcessor : public AimlProcessor
{
public:
	~StarProcessor() { }
	
	string getName() const {
		return "star";
	}
	string getVersion() const {
		return "1.0";
	}
	string process(Match *m, PElement e, Responder *, const string &) {
		string index = e->getAttribute("index");
		if (index.empty()) {
			index = "1";
		}
		//	replace all this crap with atoi .. which header tho?
		int realIndex = 0;
		for (unsigned int ix = 0; ix < index.length(); ++ix) {
			realIndex *= 10;
			realIndex += index[ix] - '0';
		}
		return m->getInputStar(realIndex);
	}
};

#endif

⌨️ 快捷键说明

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