#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: CommandList(std::string delimiter = ""); /// /// 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 ZString 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(coreutils::ZString &request, TCPSession &session); /// /// 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(coreutils::ZString &request, TCPSession &session); protected: /// /// The vector of all registered commands. /// std::map commands; std::string delimiter; }; } #endif