00001 #ifdef TEST
00002
00003 #include "headers.h"
00004
00005 CliParser::CliParser(CommandProcessor* cp) : CommandParser(cp)
00006 {}
00007
00008
00009 Command*
00010 CliParser::parse(string input) {
00011
00012 stringstream s(input);
00013 string name;
00014 s >> name;
00015
00016 debug(DEBUG_CMD, "Your command: %s\n", name.c_str());
00017
00018
00019 Command* command = m_commandProcessor->matchCommand(name);
00020 if (command == NULL) {
00021 return NULL;
00022 }
00023
00024 string arg;
00025 int i = 1;
00026 s >> arg;
00027 while (!s.eof()) {
00028 debug(DEBUG_CMD, "Arg #%d = \"%s\"\n", i, arg);
00029 command->setArg(i, arg);
00030 i++;
00031 s >> arg;
00032 }
00033
00034 return command;
00035 }
00036
00037 #endif
00038