コード例 #1
0
void Notes::save()
{
	QList<QDomElement> notesList = noteModel_->getAllNotes();
	QString notes;
	foreach(const QDomElement& note, notesList) {
		QString tag = note.attribute("tags");
		QString text = note.firstChildElement("text").text();
		QString title = note.firstChildElement("title").text();
		tag = replaceSymbols(tag);
		text = replaceSymbols(text);
		title = replaceSymbols(title);
		notes+=QString("<note tags=\"%1\"><title>%2</title><text>%3</text></note>")
				.arg(tag)
				.arg(title)
				.arg(text);
	}
コード例 #2
0
ファイル: ALSpeech.cpp プロジェクト: Lrosias/nbites
void ALSpeech::say(std::string text)
{
    if (isEnabled){
        replaceSymbols(text);
        try {
            alProxy->say(text);
        } catch(AL::ALError &e) {
            std::cout << "Failed to say something in ALTextToSpeech"
                      << std::endl;
        }
    }
}
コード例 #3
0
ファイル: StatementExecutor.c プロジェクト: luning/tddrefcpp
void replaceSymbols(SymbolTable* symbolTable, SlimList* list) {
	int i;
	for (i=0; i<SlimList_GetLength(list); i++) {
		char* string = SlimList_GetStringAt(list, i);
		SlimList* embeddedList = SlimList_Deserialize(string);
		if (embeddedList == NULL) {
			char* replacedString = replaceString(symbolTable, string);
			SlimList_ReplaceAt(list, i, replacedString);
			free(replacedString);
		} else {
			replaceSymbols(symbolTable, embeddedList);
			char* serializedReplacedList = SlimList_Serialize(embeddedList);
			SlimList_ReplaceAt(list, i, serializedReplacedList);
			SlimList_Destroy(embeddedList);
			free(serializedReplacedList);
		}
	}
}
コード例 #4
0
ファイル: StatementExecutor.c プロジェクト: luning/tddrefcpp
char* StatementExecutor_Call(StatementExecutor* executor, const char* instanceName, const char* methodName, SlimList* args){
	InstanceNode* instanceNode = GetInstanceNode(executor, instanceName);
	if (instanceNode)
	{
		MethodNode* node;
		for (node = instanceNode->fixture->methods; node; node = node->next) {
			if (strcmp(methodName, node->name) == 0) {
				replaceSymbols(executor->symbolTable, args);
				char* retval =  node->method(instanceNode->instance, args);
				return retval;
			}
		}
		char * formatString = "__EXCEPTION__:message:<<NO_METHOD_IN_CLASS %.32s[%d] %.32s.>>";
		snprintf(executor->message, 120, formatString, methodName, SlimList_GetLength(args), instanceNode->fixture->name);
		return executor->message;
	}
	char * formatString = "__EXCEPTION__:message:<<NO_INSTANCE %.32s.>>";
	snprintf(executor->message, 120, formatString, instanceName);
	return executor->message;
}
コード例 #5
0
ファイル: StatementExecutor.c プロジェクト: luning/tddrefcpp
char* StatementExecutor_Make(StatementExecutor* executor, const char* instanceName, const char* className, SlimList* args){
	FixtureNode* fixtureNode = findFixture(executor, className);
	if (fixtureNode) {
		InstanceNode* instanceNode = malloc(sizeof(InstanceNode));
		instanceNode->next = executor->instances;
		executor->instances = instanceNode;
		instanceNode->name = instanceName;
		instanceNode->fixture = fixtureNode;
		replaceSymbols(executor->symbolTable, args);
		executor->userMessage = NULL;
		instanceNode->instance = (fixtureNode->constructor)(executor, args);
		if (instanceNode->instance != NULL) {	
			return "OK";
		} else {
			char * formatString = "__EXCEPTION__:message:<<COULD_NOT_INVOKE_CONSTRUCTOR %.32s %.32s.>>";
			snprintf(executor->message, 120, formatString, className, executor->userMessage ? executor->userMessage : "");	
			return executor->message;	
		}
	}
	char * formatString = "__EXCEPTION__:message:<<NO_CLASS %.32s.>>";
	snprintf(executor->message, 120, formatString, className);	
	return executor->message;	
}