ServerCore/Command.h
2024-07-10 13:30:18 -07:00

50 lines
1.3 KiB
C++

#ifndef __Command_h__
#define __Command_h__
#include "TCPSession.h"
#include "ZString.h"
namespace core {
class CommandList;
class Session;
///
/// Command
///
/// Use the Command object in combination with a CommandList object to maintain
/// a list of functions that can be invoked as a result of processing a request.
///
class Command {
public:
///
/// This method is used to implement the functionality of the requested command.
/// This pure virtual function must be implemented in your inheriting object.
///
/// @param request The request that was entered by the user to invoke this command.
/// @param session Specify the requesting session so that the execution of the
/// command process can return its output to the session.
/// @return Returns 0 if execution of the command was successful. Otherwise returns
/// a non-zero value indicating an error condition.
///
virtual int processCommand(coreutils::ZString &request, TCPSession &session);
///
/// Specify the output that will occur to the specified session.
///
/// @param session The session that will receive the output.
///
virtual void output(std::stringstream &out);
};
}
#endif