TShell

From Ultibo.org
Jump to: navigation, search

Return to Unit Shell


Description


To be documented

Class definitions



TShell = class(TListObject)

public
constructor Create;  
destructor Destroy; override;  
private
FManager:TShellManager;  
FAuthenticator:TAuthenticator;  
 
FLock:TCriticalSectionHandle;  
 
FSessions:TLinkedList;  
FCommands:TLinkedList;  
 
FBanner:String;  
FPrompt:String;  
FError:String;  
 
FName:String;  
FHash:LongWord;  
FFlags:LongWord;  
 
procedure SetAuthenticator(AAuthenticator:TAuthenticator);  
 
function GetBanner:String;  
procedure SetBanner(const ABanner:String);  
function GetPrompt:String;  
procedure SetPrompt(const APrompt:String);  
function GetError:String;  
procedure SetError(const AError:String);  
 
function GetName:String;  
procedure SetName(const AName:String);  
procedure SetFlags(AFlags:LongWord);  
protected
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
public
property Manager:TShellManager read FManager;  
property Authenticator:TAuthenticator read FAuthenticator write SetAuthenticator;  
 
property Banner:String read GetBanner write SetBanner;  
property Prompt:String read GetPrompt write SetPrompt;  
property Error:String read GetError write SetError;  
 
property Name:String read GetName write SetName;  
property Hash:LongWord read FHash;  
property Flags:LongWord read FFlags write SetFlags;  
 
function DoReset(ASession:TShellSession):Boolean; virtual;  
 
function DoClear(ASession:TShellSession):Boolean; virtual;  
 
function DoBanner(ASession:TShellSession):Boolean; virtual;  
function DoPrompt(ASession:TShellSession):Boolean; virtual;  
function DoError(ASession:TShellSession):Boolean; virtual;  
 
function DoInput(ASession:TShellSession; var AInput:String):Boolean; virtual;  
 
function DoOutput(ASession:TShellSession; const AOutput:String):Boolean; virtual;  
function DoOutputEx(ASession:TShellSession; const AOutput:String; AReturn:Boolean):Boolean; virtual;  
 
function DoGetSize(ASession:TShellSession; var ARows,ACols:LongWord):Boolean; virtual;  
function DoSetSize(ASession:TShellSession; ARows,ACols:LongWord):Boolean; virtual;  
 
function DoGetCursor(ASession:TShellSession; var ARow,ACol:LongWord):Boolean; virtual;  
function DoSetCursor(ASession:TShellSession; ARow,ACol:LongWord):Boolean; virtual;  
 
function DoGetColors(ASession:TShellSession; var AForecolor,ABackcolor:LongWord):Boolean; virtual;  
function DoSetColors(ASession:TShellSession; AForecolor,ABackcolor:LongWord):Boolean; virtual;  
 
function DoGetCoordinates(ASession:TShellSession; var ARow,ACol:LongWord):Boolean; virtual;  
function DoSetCoordinates(ASession:TShellSession; ARow,ACol:LongWord):Boolean; virtual;  
 
function DoGetCursorMode(ASession:TShellSession; var AMode:LongWord):Boolean; virtual;  
function DoSetCursorMode(ASession:TShellSession; AMode:LongWord):Boolean; virtual;  
 
function DoGetCursorShape(ASession:TShellSession; var AShape:LongWord):Boolean; virtual;  
function DoSetCursorShape(ASession:TShellSession; AShape:LongWord):Boolean; virtual;  
 
function GetSession(APrevious:TShellSession; ALock,AUnlock:Boolean):TShellSession;  
function FindSession(AIdentifier:LongWord):TShellSession;  
 
function CreateSession(AIdentifier:LongWord):TShellSession;  
function DestroySession(ASession:TShellSession):Boolean;  
 
function RegisterSession(ASession:TShellSession):Boolean;  
function DeregisterSession(ASession:TShellSession):Boolean;  
 
function GetCommand(APrevious:TShellCommand; ALock,AUnlock:Boolean):TShellCommand;  
function FindCommand(const AName:String):TShellCommand;  
function DefaultCommand:TShellCommand;  
 
function RegisterCommand(ACommand:TShellCommand):Boolean;  
function DeregisterCommand(ACommand:TShellCommand):Boolean;  
 
function MatchCommand(const ACommand:String; var AName:String; var AParameters:TStrings; var AContinue:Boolean):TShellCommand; virtual;  
function CompleteCommand(ASession:TShellSession; const ACommand:String; var AError:Boolean):String; virtual;  
 
function ProcessCommand(ASession:TShellSession; const ACommand:String):Boolean; virtual;  
 
function CommandName(const ACommand:String):String;  
function CommandSplit(const ACommand:String):TStrings;  
function CommandJoin(AParameters:TStrings):String;  
function CommandParse(const ACommand:String; var AName:String; var AParameters:TStrings):Boolean;  
function CommandConcat(const AName:String; AParameters:TStrings):String;  
function CommandIndex(AIndex:Integer; const ACommand:String):String;  
 
function ParameterIndex(AIndex:Integer; AParameters:TStrings):String;  
function ParameterValue(const AParameter:String; AParameters:TStrings):String;  
function ParameterExists(const AParameter:String; AParameters:TStrings):Boolean;  
 
function ParameterValueEx(const AParameter:String; AParameters:TStrings; APlus,AMinus:Boolean):String;  
function ParameterExistsEx(const AParameter:String; AParameters:TStrings; APlus,AMinus:Boolean):Boolean;  
 
function AddOutput(var AOutput:String; ACol:LongWord; const AValue:String):Boolean;  


Function declarations



constructor TShell.Create;
Description: To be documented
Note None documented


destructor TShell.Destroy;
Description: To be documented
Note None documented


procedure TShell.SetAuthenticator(AAuthenticator:TAuthenticator);
Description: To be documented
Note None documented


function TShell.GetBanner:String;
Description: To be documented
Note None documented


procedure TShell.SetBanner(const ABanner:String);
Description: To be documented
Note None documented


function TShell.GetPrompt:String;
Description: To be documented
Note None documented


procedure TShell.SetPrompt(const APrompt:String);
Description: To be documented
Note None documented


function TShell.GetError:String;
Description: To be documented
Note None documented


procedure TShell.SetError(const AError:String);
Description: To be documented
Note None documented


function TShell.GetName:String;
Description: To be documented
Note None documented


procedure TShell.SetName(const AName:String);
Description: To be documented
Note None documented


procedure TShell.SetFlags(AFlags:LongWord);
Description: To be documented
Note None documented


function TShell.AcquireLock:Boolean;
Description: To be documented
Note None documented


function TShell.ReleaseLock:Boolean;
Description: To be documented
Note None documented


function TShell.DoReset(ASession:TShellSession):Boolean;
Description: To be documented
Note None documented


function TShell.DoClear(ASession:TShellSession):Boolean;
Description: To be documented
Note None documented


function TShell.DoBanner(ASession:TShellSession):Boolean;
Description: To be documented
Note None documented


function TShell.DoPrompt(ASession:TShellSession):Boolean;
Description: To be documented
Note None documented


function TShell.DoError(ASession:TShellSession):Boolean;
Description: To be documented
Note None documented


function TShell.DoInput(ASession:TShellSession; var AInput:String):Boolean;
Description: To be documented
Note None documented


function TShell.DoOutput(ASession:TShellSession; const AOutput:String):Boolean;
Description: To be documented
Note None documented


function TShell.DoOutputEx(ASession:TShellSession; const AOutput:String; AReturn:Boolean):Boolean;
Description: To be documented
Note None documented


function TShell.DoGetSize(ASession:TShellSession; var ARows,ACols:LongWord):Boolean;
Description: To be documented
Note None documented


function TShell.DoSetSize(ASession:TShellSession; ARows,ACols:LongWord):Boolean;
Description: To be documented
Note None documented


function TShell.DoGetCursor(ASession:TShellSession; var ARow,ACol:LongWord):Boolean;
Description: To be documented
Note None documented


function TShell.DoSetCursor(ASession:TShellSession; ARow,ACol:LongWord):Boolean;
Description: To be documented
Note None documented


function TShell.DoGetColors(ASession:TShellSession; var AForecolor,ABackcolor:LongWord):Boolean;
Description: To be documented
Note None documented


function TShell.DoSetColors(ASession:TShellSession; AForecolor,ABackcolor:LongWord):Boolean;
Description: To be documented
Note None documented


function TShell.DoGetCoordinates(ASession:TShellSession; var ARow,ACol:LongWord):Boolean;
Description: To be documented
Note None documented


function TShell.DoSetCoordinates(ASession:TShellSession; ARow,ACol:LongWord):Boolean;
Description: To be documented
Note None documented


function TShell.DoGetCursorMode(ASession:TShellSession; var AMode:LongWord):Boolean;
Description: To be documented
Note None documented


function TShell.DoSetCursorMode(ASession:TShellSession; AMode:LongWord):Boolean;
Description: To be documented
Note None documented


function TShell.DoGetCursorShape(ASession:TShellSession; var AShape:LongWord):Boolean;
Description: To be documented
Note None documented


function TShell.DoSetCursorShape(ASession:TShellSession; AShape:LongWord):Boolean;
Description: To be documented
Note None documented


function TShell.GetSession(APrevious:TShellSession; ALock,AUnlock:Boolean):TShellSession;
Description: To be documented
Note None documented


function TShell.FindSession(AIdentifier:LongWord):TShellSession;
Description: To be documented
Note None documented


function TShell.CreateSession(AIdentifier:LongWord):TShellSession;
Description: To be documented
Note None documented


function TShell.DestroySession(ASession:TShellSession):Boolean;
Description: To be documented
Note None documented


function TShell.RegisterSession(ASession:TShellSession):Boolean;
Description: To be documented
Note None documented


function TShell.DeregisterSession(ASession:TShellSession):Boolean;
Description: To be documented
Note None documented


function TShell.GetCommand(APrevious:TShellCommand; ALock,AUnlock:Boolean):TShellCommand;
Description: To be documented
Note None documented


function TShell.FindCommand(const AName:String):TShellCommand;
Description: To be documented
Note None documented


function TShell.DefaultCommand:TShellCommand;
Description: To be documented
Note None documented


function TShell.RegisterCommand(ACommand:TShellCommand):Boolean;
Description: To be documented
Note None documented


function TShell.DeregisterCommand(ACommand:TShellCommand):Boolean;
Description: To be documented
Note None documented


function TShell.MatchCommand(const ACommand:String; var AName:String; var AParameters:TStrings; var AContinue:Boolean):TShellCommand;
Description: Check the supplied command against registered commands, if matched return command as result
Command The command to match
Name The actual command name matched (May be an alias of the returned command)
Parameters The parameters parsed from the command line
Continue Returns true if more than one command matches and matching should be retried with more input


function TShell.CompleteCommand(ASession:TShellSession; const ACommand:String; var AError:Boolean):String;
Description: Attempt to complete the supplied command by matching an existing command and performing command completion
Command The command to complete
Error Returns true if there was on error in the supplied command


function TShell.ProcessCommand(ASession:TShellSession; const ACommand:String):Boolean;
Description: Process the supplied command against the registered commands
Command The command to process


function TShell.CommandName(const ACommand:String):String;
Description: Extract the command name from the command line
Note None documented


function TShell.CommandSplit(const ACommand:String):TStrings;
Description: Split the command line into individual parameters
Note Allows for quoted parameters which include spaces


function TShell.CommandJoin(AParameters:TStrings):String;
Description: Join the individual parameters into a command line
Note Allows for quoted parameters which include spaces


function TShell.CommandParse(const ACommand:String; var AName:String; var AParameters:TStrings):Boolean;
Description: Parse the command line into the command name and parameters
Note None documented


function TShell.CommandConcat(const AName:String; AParameters:TStrings):String;
Description: Concatenate the command name and parameters into a command line
Note None documented


function TShell.CommandIndex(AIndex:Integer; const ACommand:String):String;
Description: Return the command line parameter specified by Index (0 is the command name, 1 is the first parameter etc)
Note None documented


function TShell.ParameterIndex(AIndex:Integer; AParameters:TStrings):String;
Description: Return the command line parameter specified by Index (0 is the first parameter, 1 is the second etc)
Note None documented


function TShell.ParameterValue(const AParameter:String; AParameters:TStrings):String;
Description: To be documented
Note None documented


function TShell.ParameterExists(const AParameter:String; AParameters:TStrings):Boolean;
Description: To be documented
Note None documented


function TShell.ParameterValueEx(const AParameter:String; AParameters:TStrings; APlus,AMinus:Boolean):String;
Description: Return the value of the command line parameter specified by Parameter
Note Allows for parameters prefixed with Slash (/), Plus (+) or Minus (-)


function TShell.ParameterExistsEx(const AParameter:String; AParameters:TStrings; APlus,AMinus:Boolean):Boolean;
Description: Check for the existence of the command line parameter specified by Parameter
Note Allows for parameters prefixed with Slash (/), Plus (+) or Minus (-)


function TShell.AddOutput(var AOutput:String; ACol:LongWord; const AValue:String):Boolean;
Description: To be documented
Note None documented


Return to Unit Reference