39 lines
810 B
C++
39 lines
810 B
C++
#include "CommandList.h"
|
|
|
|
namespace core {
|
|
|
|
CommandList::CommandList() {}
|
|
|
|
CommandList::~CommandList() {}
|
|
|
|
void CommandList::add(Command &command, std::string name) {
|
|
command.setName(name);
|
|
commands.push_back(&command);
|
|
}
|
|
|
|
void CommandList::remove(Command &command) {
|
|
|
|
}
|
|
|
|
bool CommandList::processRequest(std::string request, Session *session) {
|
|
bool found = false;
|
|
for(auto *command : commands) {
|
|
if(command->check(request)) {
|
|
command->processCommand(request, session);
|
|
found = true;
|
|
break;
|
|
}
|
|
}
|
|
return found;
|
|
}
|
|
|
|
int CommandList::processCommand(std::string request, Session *session) {
|
|
for(Command *command : commands)
|
|
session->out << command->getName() << std::endl;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|