kernel.h

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

H
57
字号
/**
 * Kernel - Brains of the operation
 *
 * @author	Jonathan Roewen
 */
#ifndef KERNEL_H
#define KERNEL_H

#include <string>

using namespace std;

#include "Element.h"	//	?

#define	LOOP_EXCEPTION	0001
#define MATCH_EXCEPTION	0002

class Match;
class Responder;
class Nodemaster;
class StringTokenizer;

class Kernel
{
public:
	Kernel();

	static string bootstrap();
	static void load(const string &file);
	static void load10(const string &file, PElement &root);
	static void loadSubstitutions();
	static Nodemaster * add(const string &pattern, const string &that, const string &topic);
	static Nodemaster *add(const string &sentence, Nodemaster *parent);
	static Nodemaster *add(StringTokenizer &st, Nodemaster *parent, int count, const string &sentence);
	static Match *match(const string &input, const string &that, const string &topic);
	static Match *match(Nodemaster *node, Nodemaster *parent, int state, const string &input, const string &star, const string &path);
	static string process(Match *m, PElement e, Responder *, const string &id);
	static string respond(const string &input, const string &id);
	static string respond(const string &input, const string &id, bool srai);
	static string respond(const string &input, const string &id, Responder *);
	static string respond(const string &input, const string &id, int depth, bool srai);
	static string respond(const string &input, const string &id, Responder *, int depth, bool srai);
	
	static void convertTempAiml();
private:
	static void addStar(Match *, const string &, int);
	static void addPath(Match *, const string &, int);
	static bool lookup(const string &, const string &);
	static void loadTemporaryData();
	
	static Nodemaster *root;
	static const int INPUT, THAT, TOPIC;
	static const string constants;
};

#endif 

⌨️ 快捷键说明

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