Working Version
This commit is contained in:
1 parent
46f98dff69
commit
20d5c99517
10 files changed
+82
-84
No files matched your search
@@ -9,36 +9,36 @@
|
||||
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:
|
||||
|
||||
|
||||
public:
|
||||
|
||||
///
|
||||
/// Implement check method to provide a special check rule upon the request to see
|
||||
/// if the command should be processed.
|
||||
/// if the command should be processed.
|
||||
///
|
||||
/// The default rule is to verify that the first token in the request string matches
|
||||
/// the name given on the registration of the command to the CommandList. This can
|
||||
/// be overridden by implementing the check() method to perform the test and return
|
||||
/// the condition of the command.
|
||||
///
|
||||
/// @param request The request passed to the parser to check the rule.
|
||||
/// @param request The request passed to the parser to check the rule.
|
||||
/// @return Return true to execute the command. Returning false will cause no action
|
||||
/// on this command.
|
||||
///
|
||||
|
||||
|
||||
virtual bool check(coreutils::ZString request);
|
||||
|
||||
|
||||
///
|
||||
/// This method is used to implement the functionality of the requested command.
|
||||
/// This pure virtual function must be implemented in your inheriting object.
|
||||
@@ -49,17 +49,17 @@ namespace core {
|
||||
/// @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(Session *session);
|
||||
|
||||
|
||||
virtual void output(std::stringstream &out);
|
||||
|
||||
///
|
||||
/// Set the name of this command used in default rule checking during request parsing.
|
||||
/// NOTE: You do not need to call this under normal conditions as adding a Command
|
||||
@@ -68,16 +68,16 @@ namespace core {
|
||||
///
|
||||
/// @param name Specify the name of this command for default parsing.
|
||||
///
|
||||
|
||||
|
||||
void setName(std::string name);
|
||||
|
||||
|
||||
std::string getName();
|
||||
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
|
||||
std::string name;
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user