⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nodemaster.cpp

📁 J-Alice是一个用C++实现的Ailcebot的克隆。它可以做为一个mini-http服务器在控制台或irc聊天。目前
💻 CPP
字号:
/**
 * Nodemaster - The real nodemapper ;-)
 *
 * @author	Jonathan Roewen
 */
#include "Nodemaster.h"

#include "Utils.h"

Nodemaster *Nodemaster::getChild(const string &key) {
	if (children.find(get_string(toUpper(key))) == children.end()) {
		return NULL;
	}
	return (*children.find(get_string(toUpper(key)))).second;
}

void Nodemaster::addChild(const string &key, Nodemaster *value) {
	children[get_string(toUpper(key))] = value;
}

//	Perhaps we do the automagic updating here?
string Nodemaster::getTemplate() {
/*	if (templates.empty()) {
		return "";
	}
	if (templates.size() == 1) {
		Template *t = templates[0];
		if (Template::reloadFile(t.filenameIx)) {
			t = templates[0];
		}
		return t.fetch();
	}
	lastIndex = rand() % templates.size();
	Template t = templates[lastIndex];
	return t.fetch();
*/
	if (templates == NULL) {
		return "";
	}
	Template::reloadFile(templates->filenameIx);
	return templates->fetch();
		
//	return templates->fetch();
}

void Nodemaster::addTemplate(Template *t) {
//	totalSize += (value.length() * sizeof(char)) + sizeof(string);
	if (templates != NULL) {
		delete templates;
	}
	templates = t;
//	templates = t;
}

bool Nodemaster::hasTemplate() {
	return templates != NULL;
}

⌨️ 快捷键说明

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