#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 = ""); /// /// Remove a command object from the command list. /// void remove(Command &command); /// /// Use this method to apply a parsed PString to the command set and execute /// the matching parameter. The selected command will return a true on a call /// to check(). If there is a handler that has a grab on the process handler /// then control is given to the process handler holding the grab on the input. /// bool processRequest(std::string request, TCPSession *session, std::stringstream &data); /// /// Use grabInput() within a Command object to force the requesting handler to receive /// all further input from the socket. Use releaseGrab() method to release the session /// back to normal command processing. /// bool grabInput(TCPSession *session, Command &command); /// /// /// void clearGrab(TCPSession *session); /// /// /// int processCommand(std::string request, TCPSession *session, std::stringstream &data); protected: /// /// The vector of all registered commands. /// std::vector commands; }; } #endif