Class ALinearCConsoleApplication
Unit
linearc
Declaration
type ALinearCConsoleApplication = class(AConsoleApplication)
Description
This class represents a single process running as a console application, which expects to receive arguments on its command line and which can parse those arguments with an instance of ALinearCParser.
This class modifies the behavior of AConsoleApplication somewhat: the run method is overridden to call the ALinearCConsoleApplication.defineOptions before calling ALinearCConsoleApplication.parseCommandLine.
Hierarchy
- ALinearCConsoleApplication
Overview
Fields
Methods
Description
Fields
|
MyLog: ALog; |
Refers to the log used for error and diagnostic output by the program
|
Methods
|
procedure defineOptions; virtual; |
Define the command line options accepted by the program.
This method may be overridden by descendant classes. In the base implementation of ALinearCConsoleApplication, it defines two flag options: one for "help" and one for "version".
|
|
function printHelp(const ThisOption: ACommandLineOption): boolean; virtual; |
Print usage information for the program.
This method is called automatically by ACommandLineOptionDictionary.handleDirtiedOptions after all command line options have been parsed, if the –help option was specified by the user. The routine simply calls Self.printHelpTo.
Returns
This method always returns False to indicate that the processing of additional options should halt. |
|
function printVersion(const ThisOption: ACommandLineOption): boolean; virtual; |
Print version information for the program.
This method is called automatically by ACommandLineOptionDictionary.handleDirtiedOptions after all command line options have been parsed, if the –version option was specified by the user. The routine simply calls Self.printVersionTo.
Returns
This method always returns False to indicate that the processing of additional options should halt. |
|
function init: boolean; override; |
Initializer
|
|
function parseCommandLine: int64; virtual; |
Parse the command line.
This method constructs an instance of AStringStream to represent the command line arguments passed to the program; it then passes that stream to an instance of ALinearCParser, along with the items in ALinearCConsoleApplication.Options, so that the command line can be parsed.
Returns
The value returned by ALinearCParser.parse, which should indicate the number of errors that occurred while parsing. |
|
procedure printVersionTo(const ThisStream: ATextOutputStream; const additionalItems: array of string); virtual; |
Print version information for the program to the specified stream.
This method is called automatically by ALinearCConsoleApplication.run, after the command line options have been parsed, if the –version option was specified by the user.
The method uses the key/value pairs specified in Self.VersionInfo to print the name of the program and its version. The format of this output is controlled by lcappVersionStringFormat.
Additional items can be specified in the additionalItems array.
|
|
function usageString: string; virtual; |
Construct a usage string for the application.
The usage string is printed whenever the user enters an option in error, and is also printed when the user requests help from the command-line.
The usage string includes the executable name and the name of all rest arguments accepted by the application. The format of the string is controlled by lcappUsageStringFormat.
|
|
function Options: ACommandLineOptionDictionary; virtual; |
Retrieve a reference to the dictionary of command-line options accepted by the program.
The caller should NOT attempt to free the reference returned by this method; that will be done with the application instance is freed.
|
|
function Log: ALog; virtual; |
Retrieve a reference to the log used for error and diagnostic output by the program.
The caller should NOT attempt to free the reference returned by this method; that will be done when the application instance is freed.
|
Generated by PasDoc 0.13.0 on 2015-06-25 11:07:51
|