Initial check in lib
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
unit dpglib.ExceptionSpec;
|
||||
|
||||
interface
|
||||
uses
|
||||
System.Classes,
|
||||
dpgrtl.types,
|
||||
dpglib.Types;
|
||||
|
||||
type
|
||||
// =========================================================================
|
||||
// Class TExceptionSpec declaration
|
||||
// =========================================================================
|
||||
TExceptionSpec = class( TInterfacedObject,
|
||||
IExceptionSpec)
|
||||
// ---------------------------------------------------------------
|
||||
// Members
|
||||
// ---------------------------------------------------------------
|
||||
protected
|
||||
fLabel : IToken;
|
||||
fHandlers : TInterfaceList;
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Constructor/destructor
|
||||
// ---------------------------------------------------------------
|
||||
public
|
||||
constructor Create( pLabel: IToken);
|
||||
destructor Destroy; override;
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// IExceptionSpec methods
|
||||
// ---------------------------------------------------------------
|
||||
protected
|
||||
function GetLabel : IToken;
|
||||
function GetHandlers: TInterfaceList;
|
||||
|
||||
public
|
||||
procedure AddHandler( pHandler: IExceptionHandler);
|
||||
end;
|
||||
|
||||
implementation
|
||||
uses
|
||||
System.SysUtils;
|
||||
|
||||
// ****************************************************************************
|
||||
// Constructor/destructor
|
||||
// ****************************************************************************
|
||||
// ============================================================================
|
||||
// Constructor
|
||||
// ============================================================================
|
||||
constructor TExceptionSpec.Create(pLabel: IToken);
|
||||
begin
|
||||
inherited Create;
|
||||
|
||||
fLabel := pLabel;
|
||||
fHandlers := TInterfaceList.Create;
|
||||
end;
|
||||
|
||||
// ============================================================================
|
||||
// Destructor
|
||||
// ============================================================================
|
||||
destructor TExceptionSpec.Destroy;
|
||||
begin
|
||||
FreeAndNil( fHandlers);
|
||||
fLabel := nil;
|
||||
|
||||
inherited;
|
||||
end;
|
||||
|
||||
// ****************************************************************************
|
||||
// IExceptionSpec implementation
|
||||
// ****************************************************************************
|
||||
// ============================================================================
|
||||
// GetLabel
|
||||
// ============================================================================
|
||||
function TExceptionSpec.GetLabel: IToken;
|
||||
begin
|
||||
result := fLabel;
|
||||
end;
|
||||
|
||||
// ============================================================================
|
||||
// GetHandlers
|
||||
// ============================================================================
|
||||
function TExceptionSpec.GetHandlers: TInterfaceList;
|
||||
begin
|
||||
result := fHandlers;
|
||||
end;
|
||||
|
||||
// ============================================================================
|
||||
// AddHandler
|
||||
// ============================================================================
|
||||
procedure TExceptionSpec.AddHandler(pHandler: IExceptionHandler);
|
||||
begin
|
||||
fHandlers.Add( pHandler);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
Reference in New Issue
Block a user