Implementation of Serice object into structure.
This commit is contained in:
1 parent
a2526dd3ed
commit
2cb1e3e2f2
23 files changed
+278
-293
No files matched your search
+29
-32
@@ -1,41 +1,38 @@
|
||||
#include "CommandList.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
CommandList::CommandList() {}
|
||||
|
||||
CommandList::~CommandList() {}
|
||||
|
||||
void CommandList::add(Command &command, std::string name) {
|
||||
command.setName(name);
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user