Class ACommandLineChoice
Unit
linearc
Declaration
type ACommandLineChoice = class(ACommandLineOption)
Description
This class represents a command-line option that expects a value to be chosen from a list of pre-defined values.
If the user supplies a value which is not in ACommandLineChoice.AcceptedValues, then an error is returned to them.
Hierarchy
Overview
Fields
Methods
|
constructor named(const thisName: string; const isRequired: boolean; const isRest: boolean; const thisDefaultValue: Variant; const theseValuesAccepted: array of const; const thisDescription: string; const thisValueDescription: string = ''); reintroduce; virtual; |
|
function init: boolean; override; |
|
destructor destroy; override; |
|
function usageString: AnsiString; override; |
|
function AcceptedValues: AVariantList; virtual; |
|
function setValue(const newValue: Variant; const makeDirty: boolean = true): Variant; override; |
Description
Fields
|
MyAcceptedValues: AVariantList; |
Refers to the list of allowed values
|
Methods
|
constructor named(const thisName: string; const isRequired: boolean; const isRest: boolean; const thisDefaultValue: Variant; const theseValuesAccepted: array of const; const thisDescription: string; const thisValueDescription: string = ''); reintroduce; virtual; |
Construct a new command-line option with the specified name.
This method constructs a new instance of ACommandLineOption with the specified defaultValue and theseValuesAccepted . The caller can also set whether the option is required, and can provide a description of the option which will be used when the user requests help.
|
|
function init: boolean; override; |
Initializer
|
|
function usageString: AnsiString; override; |
Construct and return a string representation of the option, suitable for output to a text-based device, such as a console.
This method builds upon the behavior inherited from ACommandLineOption.usageString: it calls that routine first, then appends a string that indicates the acceptable values for the option. The format of the appended string is controlled by clchAcceptedValuesDescription.
|
|
function AcceptedValues: AVariantList; virtual; |
Retrieve a reference to the list of values allowed for the option. The caller should NOT attempt to free this reference; that will be done when the option itself is freed.
|
|
function setValue(const newValue: Variant; const makeDirty: boolean = true): Variant; override; |
Set the value of the option.
This method overrides the behavior inherited from ACommandLineOption.setValue. It checks to ensure that newValue is in the list of values specified by Self.AcceptedValues. If not, the value is not set and an exception is raised.
Returns
The previous value of ACommandLineChoice.value. Exceptions raised
- AnOptionValueError
- if
newValue specifies a value that is not in the list of accepted values.
|
Generated by PasDoc 0.13.0 on 2015-01-10 17:13:18
|