Ejemplo n.º 1
0
/**
 * Busca en todos los comandos posibles para autocomplar el texto.
 */
char* Console::Generator(const char* text, int state)
{
	 //Obtengo todos los comandos posibles.
	 tVecStr cmd = GetAllCommands();
     static int len;
     static size_t index;
     string empty = EMPTY;
     string name = EMPTY;

     if (!state) {
    	 index = 0;
         len = strlen (text);
     }

     while(index < cmd.size())
     {
    	 name = cmd[index];
    	 if(name.compare(0,len,text)==0)
    	 {
    		 index++;
    		 return StrToChar(name);
    	 }
    	 index++;
     }
     //Si ya verifico todos los comandos y no encontro nada
     //retorno null.
     return ((char *)NULL);
 }
void SpeechRecognition::Init()
{
	//add command manager words
	std::list<const MochaCommand*> commands;
	GetAllCommands(commands);
	for (const MochaCommand*& c : commands)
		wordList.push_back(std::wstring(c->name.toWideCharPointer()));

	RECThread = CreateThread(NULL,0, T_RecThread, 0,0,0);
}
Ejemplo n.º 3
0
	inline ConsoleCommand(char const *name, console_command_t command)
	{		
		m_name = name;
		m_command = command;
		GetAllCommands()->push_back(this);
	}