TConsoleInputHandler

TConsoleInputHandler manages a number of Command Handlers (see TCommandHandler and is able to find the correct (if existant) Command Handler for the execution of a specified command.

Available functionality (users) Available functionality (developers)


RegisterCommandHandler

procedure RegisterCommandHandler(ACommandHandler: TCommandHandler);

Adds a Command Handler to the internal Command Handler list. If the Execute function is called, the newly registred Command Handler will be included into the search for valid Command Handlers to be able to deal with the given command.


UnregisterCommandHandler

funciton UnregisterCommandHandler(ACommandHandler: TCommandHandler): Boolean;

Removes a Command Handler from the internal Command Handler list so that this Command Handler will not be included into the search for valid Command Handlers during the next Execute function. Returns true if the Command Handler could be successfully removed, false if it could not be found.


Execute

function Execute(ACommand: String; AParameterList: TStringArray): THandlerResult;

Executes the given command by trying to find a Command Handler which is able to handle the given command and calling its executor function. Returns the error code and/or additional data from the executor function or HR_NO_HANDLER_FOUND if no handler could be found to deal with the command given.


FFindCommandHandler

function FFindCommandHandler(ACommand: String): TCommandHandler;

Returns a Command Handler which can handle the given command or nil if no appropriate Command Handler could be found.