TCustomConsoleHandler

TCustomConsoleHandler is an abstract class which handles the parsing and executing of console input.

Available functionality (users) Available functionality (developers)


Create

constructor Create(AParser: TCustomConsoleInputParser; AnInputHandler: TConsoleInputHandler; InitialState: String = '');

Creates an instance of TCustomConsoleHandler. The AParser and AnInputHandler parameters will set the parser and the Input Handler for the Console Handler. Optionally, an initial state can be set by passing a string in InitialState.


Execute

function Execute(AnInput: String);

Parses and executes the given string (AnInput). The Execute function will parse the input and then execute the command with the parsed parameters using the Input Handler. Returns false if HR_REQUIRES_EXIT was returned by the executor of the Command Handler.


FPre_Execute

procedure Pre_Execute(AnInput: String);

Contains operations that need to be performed after parsing, but before executing. In TPrintableConsoleHandler p.e. this function is empty.


FPost_Execute

function FPost_Execute(AnOutput: THandlerResult): Boolean;

Contains operations that need to be performed after the command execution. This method should be used to react on various error codes or results (stored in AnOutput) to adapt the result in a readable form for the user (p.e. convert own data formats into text etc.).