Class TOptionParser
Unit
PasDoc_OptionParser
Declaration
type TOptionParser = class(TObject)
Description
OptionParser — instantiate one of these for commandline parsing
This class is the main parsing class, although a lot of parsing is handled by TOption and its descendants instead.
Hierarchy
Overview
Fields
Methods
Properties
Description
Fields
|
FParams: TStringList; |
|
|
FOptions: TList; |
|
|
FLeftList: TStringList; |
|
|
FShortOptionChar: Char; |
|
|
FLongOptionString: string; |
|
Methods
|
function GetOption(const AIndex: Integer): TOption; |
|
|
function GetOptionsCount: Integer; |
|
|
function GetOptionByLongName(const AName: string): TOption; |
|
|
function GetOptionByShortname(const AName: char): TOption; |
|
|
constructor Create; virtual; |
Create without any options — this will parse the current command line
|
|
constructor CreateParams(const AParams: TStrings); virtual; |
Create with parameters to be used instead of command line
|
|
destructor Destroy; override; |
destroy the option parser object and all associated TOption objects
|
|
function AddOption(const AOption: TOption): TOption; |
Add a TOption descendant to be included in parsing the command line
|
|
procedure ParseOptions; |
Parse the specified command line, see also Create
|
|
procedure WriteExplanations; |
output explanations for all options to stdout, will nicely format the output and wrap explanations
|
Properties
|
property LeftList: TStringList read FLeftList; |
This StringList contains all the items from the command line that could not be parsed. Includes options that didn't accept their value and non-options like filenames specified on the command line
|
|
property OptionsCount: Integer read GetOptionsCount; |
The number of option objects that were added to this parser
|
|
property Options[constAIndex:Integer]: TOption read GetOption; |
retrieve an option by index — you can use this and OptionsCount to iterate through the options that this parser owns
|
|
property ByName[constAName:string]: TOption read GetOptionByLongName; |
retrieve an option by its long form. Case sensitivity of the options is taken into account!
|
|
property ByShortName[constAName:char]: TOption read GetOptionByShortname; |
retrieve an option by its short form. Case sensitivity of the options is taken into account!
|
Generated by PasDoc 0.15.0.
|