Index

Package: Applications

Description

package Applications is
Copyright (c) 2012 Kevin Wellwood All rights reserved. This source code is distributed under the Modified BSD License. For terms and conditions, see license.txt.

Classes

Application (abstract)

type Application is abstract new Limited_Object with private;

Ancestors:

Immediate Children:

Primitive operations:

Construct
Delete (overriding Objects.Delete)
Finalize
Initialize
Objects.Construct (Inherited)
Objects.To_String (Inherited)
Run
Show_Error
An Application is a global singleton object that implements an application's initialization, runtime, and shutdown behavior and provides some meta information about it.

Types

A_Application

type A_Application is access all Application'Class;

Constants & Global variables

NO_ERROR

NO_ERROR                   : constant := 0;
Predefined values returned by Run

ERROR_UNEXPECTED_EXCEPTION

ERROR_UNEXPECTED_EXCEPTION : constant := 1;

INIT_EXCEPTION

INIT_EXCEPTION : exception;
This can be raised by initialization code in other packages to indicate that application initialization has failed. This exception is not raised by the Application class.

USE_ERROR

USE_ERROR : exception;
This can be raised by the Application class to indicate that it is being misused. For example, calling Create_Application without registering an Application object allocator will raise USE_ERROR.

Subprograms & Entries

Get_Company

function Get_Company
( this: not null access Application'Class ) return String;
Returns the name of the company or individual that produced this application.

Get_Name

function Get_Name
( this: not null access Application'Class ) return String;
Returns the short name of the application. This can be used to determine the names of application-specific files, etc. Special characters should be avoided.

Get_User_Directory

function Get_User_Directory
( this: not null access Application'Class ) return String;
Returns the path to the directory where the user's configuration and user-created data can safely be written. If it's not an absolute path, it is relative to the current working directory.

Create_Application

procedure Create_Application;
Forces creation of the global application without returning a reference. If the application already exists, nothing will happen.

Run_Application

procedure Run_Application
( returnCode: out Integer );
Runs the global application from start to finish, initializing it, running the main body, and finalizing it. The application's return status will be returned in 'returnCode'.

Get_Application

function Get_Application return A_Application;
Returns a reference to the global application or null if it has not been created.

Delete_Application

procedure Delete_Application;
Deletes the global application if it exists.