Class TOptionParser

Unit

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.

Source: source/component/PasDoc_OptionParser.pas (line 227).

Hierarchy

Overview

Fields

Protected FParams: TStringList;
Protected FOptions: TList;
Protected FLeftList: TStringList;
Protected FShortOptionChar: Char;
Protected FLongOptionString: string;
Protected FIncludeFileOptionName: string;
Protected FIncludeFileOptionExpl: string;

Methods

Protected function GetOption(const AIndex: Integer): TOption;
Protected function GetOptionsCount: Integer;
Protected function GetOptionByLongName(const AName: string): TOption;
Protected function GetOptionByShortname(const AName: char): TOption;
Public constructor Create; virtual;
Public constructor CreateParams(const AParams: TStrings); virtual;
Public destructor Destroy; override;
Public function AddOption(const AOption: TOption): TOption;
Public procedure ParseOptions;
Public procedure WriteExplanations;

Properties

Public property LeftList: TStringList read FLeftList;
Public property OptionsCount: Integer read GetOptionsCount;
Public property Options[const AIndex: Integer]: TOption read GetOption;
Public property ByName[const AName: string]: TOption read GetOptionByLongName;
Public property ByShortName[const AName: char]: TOption read GetOptionByShortname;
Public property ShortOptionStart: Char read FShortOptionChar write FShortOptionChar default DefShortOptionChar;
Public property LongOptionStart: String read FLongOptionString write FLongOptionString;
Public property IncludeFileOptionName: string read FIncludeFileOptionName write FIncludeFileOptionName;
Public property IncludeFileOptionExpl: string read FIncludeFileOptionExpl write FIncludeFileOptionExpl;

Description

Fields

Protected FParams: TStringList;

This item has no description.

Source: source/component/PasDoc_OptionParser.pas (line 229).

Protected FOptions: TList;

This item has no description.

Source: source/component/PasDoc_OptionParser.pas (line 230).

Protected FLeftList: TStringList;

This item has no description.

Source: source/component/PasDoc_OptionParser.pas (line 231).

Protected FShortOptionChar: Char;

This item has no description.

Source: source/component/PasDoc_OptionParser.pas (line 232).

Protected FLongOptionString: string;

This item has no description.

Source: source/component/PasDoc_OptionParser.pas (line 233).

Protected FIncludeFileOptionName: string;

This item has no description.

Source: source/component/PasDoc_OptionParser.pas (line 234).

Protected FIncludeFileOptionExpl: string;

This item has no description.

Source: source/component/PasDoc_OptionParser.pas (line 235).

Methods

Protected function GetOption(const AIndex: Integer): TOption;

This item has no description.

Source: source/component/PasDoc_OptionParser.pas (line 236).

Protected function GetOptionsCount: Integer;

This item has no description.

Source: source/component/PasDoc_OptionParser.pas (line 237).

Protected function GetOptionByLongName(const AName: string): TOption;

This item has no description.

Source: source/component/PasDoc_OptionParser.pas (line 238).

Protected function GetOptionByShortname(const AName: char): TOption;

This item has no description.

Source: source/component/PasDoc_OptionParser.pas (line 239).

Public constructor Create; virtual;

Create without any options — this will parse the current command line

Source: source/component/PasDoc_OptionParser.pas (line 242).

Public constructor CreateParams(const AParams: TStrings); virtual;

Create with parameters to be used instead of command line

Source: source/component/PasDoc_OptionParser.pas (line 244).

Public destructor Destroy; override;

destroy the option parser object and all associated TOption objects

Source: source/component/PasDoc_OptionParser.pas (line 246).

Public function AddOption(const AOption: TOption): TOption;

Add a TOption descendant to be included in parsing the command line

Source: source/component/PasDoc_OptionParser.pas (line 248).

Public procedure ParseOptions;

Parse the specified command line, see also Create

Source: source/component/PasDoc_OptionParser.pas (line 250).

Public procedure WriteExplanations;

output explanations for all options to stdout, will nicely format the output and wrap explanations

Source: source/component/PasDoc_OptionParser.pas (line 253).

Properties

Public 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

Source: source/component/PasDoc_OptionParser.pas (line 257).

Public property OptionsCount: Integer read GetOptionsCount;

The number of option objects that were added to this parser

Source: source/component/PasDoc_OptionParser.pas (line 259).

Public property Options[const AIndex: Integer]: TOption read GetOption;

retrieve an option by index — you can use this and OptionsCount to iterate through the options that this parser owns

Source: source/component/PasDoc_OptionParser.pas (line 262).

Public property ByName[const AName: string]: TOption read GetOptionByLongName;

retrieve an option by its long form. Case sensitivity of the options is taken into account!

Source: source/component/PasDoc_OptionParser.pas (line 265).

Public property ByShortName[const AName: char]: TOption read GetOptionByShortname;

retrieve an option by its short form. Case sensitivity of the options is taken into account!

Source: source/component/PasDoc_OptionParser.pas (line 268).

Public property ShortOptionStart: Char read FShortOptionChar write FShortOptionChar default DefShortOptionChar;

introductory character to be used for short options

Source: source/component/PasDoc_OptionParser.pas (line 270).

Public property LongOptionStart: String read FLongOptionString write FLongOptionString;

introductory string to be used for long options

Source: source/component/PasDoc_OptionParser.pas (line 272).

Public property IncludeFileOptionName: string read FIncludeFileOptionName write FIncludeFileOptionName;

name of an option to include config file

Source: source/component/PasDoc_OptionParser.pas (line 274).

Public property IncludeFileOptionExpl: string read FIncludeFileOptionExpl write FIncludeFileOptionExpl;

explanation of an option to include config file

Source: source/component/PasDoc_OptionParser.pas (line 276).


Generated by PasDoc 0.17.0.snapshot.