#include "shell.h" Shell::Commands::Commands(Shell* s) : commands(), threadCommands() { parent = s; if(created) throw CommandsAlreadyCreatedException(); created=true; } void Shell::Commands::add(Command* cmd, bool isthread){ if(!isthread) commands.push_back(cmd); else threadCommands.push_back(cmd); } size_t Shell::Commands::howMany() const{ return commands.size(); } int Shell::Commands::launch(const vector* args, bool launchThread){ for(unsigned int i=0; i<(launchThread ? threadCommands.size() : commands.size()); i++){ if((launchThread ? threadCommands[i]->getName() : commands[i]->getName())==args->operator [](0)){ return (launchThread ? threadCommands[i]->execute(args, parent) : commands[i]->execute(args, parent)); } } throw CommandNotFoundException(); } bool Shell::Commands::created = false;