Class AConsoleApplication
Unit
classwork
Declaration
type AConsoleApplication = class(AnApplication)
Description
This class represents a single process running as a console application: a program that uses a terminal or console for standard input and output. The class automatically creates three instances of AStream: one each to represent stdin , stdout , and stderr .
You will likely not create an instance of AConsoleApplication directly, since it does not do much on its own; however, its methods are designed to easily add support for console I/O to a class which is derived from it.
Hierarchy
Overview
Fields
Methods
Description
Fields
Methods
|
function init: boolean; override; |
Initializer
|
|
function run: integer; override; |
Execute the application.
This method overrides the behavior inherited from AnApplication.run. It constructs AConsoleApplication.ConsoleOut and AConsoleApplication.ErrorOut if they have not already been created. This behavior allows descendant classes to construct their own stream to handle console output, input, and diagnostic output if desired.
Note that AConsoleApplication.ConsoleIn is not automatically constructed in the base implementation of this method because not every application will need it. Descendant classes may override this behavior.
Returns
Zero (0) if all three streams are valid (not Nil ), either because a descendant class created them prior to the method being called, or because the method successfully created them itself. If one or more of the streams are invalid (Nil ), then this method will return a non-zero value. |
|
function print(const items: array of const): TStreamIOSize; virtual; |
Print the selected items to the console.
This method is provided for convenience; it merely calls ConsoleOut.printEach.
|
|
function printError(const items: array of const): TStreamIOSize; virtual; |
Print the selected items to the diagnostic/error output.
This method is provided for convenience; it merely calls ErrorOut.printEach.
|
|
function ConsoleOut: ATextOutputStream; virtual; |
Retrieve a reference to the stream used for console output. The caller should NOT free this reference; that will be done when the application instance is freed.
|
|
function ConsoleIn: ATextInputStream; virtual; |
Retrieve a reference to the stream used for console input. The caller should NOT free this reference; that will be done with the application instance is freed.
|
|
function ErrorOut: ATextOutputStream; virtual; |
Retrieve a reference to the stream used for diagnostic and error output. The caller should NOT free this reference; that will be done when the application instance is freed.
|
Generated by PasDoc 0.13.0 on 2015-01-10 17:13:18
|