#include "commands.h" using namespace Cmds; Commands::Commands() { if(created) throw CommandsAlreadyCreatedException(); created=true; //add builtin commands add(new Command("cd", &cdExecute)); add(new Command("exit", &exitExecute)); add(new Command("help", &helpExecute)); } void Commands::add(Command* cmd){ commands.push_back(cmd); } size_t Commands::howMany(){ return commands.size(); } int Commands::launch(const vector* args){ for(int i=0; igetName())==args->operator [](0)){ return commands[i]->execute(args); } } throw CommandNotFoundException(); } bool Commands::created = false; //builtin commands