ServerCore/CommandList.h

42 lines
906 B
C++

#ifndef __CommandList_h__
#define __CommandList_h__
#include "TCPSession.h"
#include "Command.h"
#include "Log.h"
namespace core {
///
/// CommandList
///
/// This object organizes Command objects into a list that is used
/// to parse an input and run the process associated with the
/// selected command.
///
class CommandList : public Command {
public:
///
/// Add a new command to the command list and assign a default search value.
///
void add(Command &command, std::string name = "");
void remove(Command &command);
bool processRequest(std::string request, TCPSession *session, std::stringstream &data);
int processCommand(std::string request, TCPSession *session, std::stringstream &data);
protected:
std::vector<Command *> commands;
};
}
#endif