/* (C) 2003 XDA Developers * Author: Willem Jan Hengeveld * Web: http://www.xda-developers.com/ * * $Header$ */ #include "commandexecutor.h" #include "debug.h" #include "command.h" CommandExecutor g_executor; CommandExecutor::CommandExecutor() { m_commands["execute"]= new CmdExecute(); m_commands["spawn"]= new CmdSpawn(); m_commands["copy"]= new CmdCopy(); m_commands["rename"]= new CmdRename(); m_commands["delete"]= new CmdDelete(); m_commands["makelink"]= new CmdMakelink(); } CommandExecutor::~CommandExecutor() { for (CommandMap::iterator i= m_commands.begin(); i!=m_commands.end() ; ++i) { delete (*i).second; (*i).second= NULL; } } bool CommandExecutor::execute(const string& keyword, const StringList& parameters) { CommandMap::iterator i= m_commands.find(keyword); if (i==m_commands.end()) { debug("ERROR: command unknown\n"); return false; } return (*i).second->execute(parameters); }