This repository has been archived on 2024-11-29. You can view files and clone it, but cannot push or open issues or pull requests.
Tecsitel_FactuGES/Libreria/Framework.pas

149 lines
3.5 KiB
ObjectPascal
Raw Normal View History

{
===============================================================================
Copyright (<EFBFBD>) 2003. Rodax Software.
===============================================================================
Los contenidos de este fichero son propiedad de Rodax Software titular del
copyright. Este fichero s<EFBFBD>lo podr<EFBFBD> ser copiado, distribuido y utilizado,
en su totalidad o en parte, con el permiso escrito de Rodax Software, o de
acuerdo con los t<EFBFBD>rminos y condiciones establecidas en el acuerdo/contrato
bajo el que se suministra.
-----------------------------------------------------------------------------
Web: www.rodax-software.com
===============================================================================
Fecha primera versi<EFBFBD>n: 25-05-2003
Versi<EFBFBD>n actual: 1.0.0
Fecha versi<EFBFBD>n actual: 25-05-2003
===============================================================================
Modificaciones:
Fecha Comentarios
---------------------------------------------------------------------------
===============================================================================
}
unit Framework;
{$I COMPILE.INC}
interface
uses
Classes, Contnrs;
type
TObjeto = class(TPersistent)
protected
procedure SalvarDatos; virtual;
procedure ObtenerDatos; virtual; abstract;
procedure AssignError(Source: TPersistent);
procedure AssignTo(Dest: TPersistent); override;
public
constructor Create; virtual;
destructor Destroy; override;
end;
TListaObjetos = class(TPersistent)
protected
FLista : TObjectList;
function GetCount : Integer;
procedure ObtenerLista; virtual; abstract;
procedure AssignError(Source: TPersistent);
procedure AssignTo(Dest: TPersistent); override;
public
function Add(AObjecto: TObjeto): Integer;
procedure Clear;
procedure Delete(Index: Integer);
property Count : Integer read GetCount;
constructor Create; virtual;
destructor Destroy; override;
end;
implementation
uses
SysUtils
{$IFDEF RDX_D5}, Consts{$ENDIF}
{$IFDEF RDX_D7}, RTLConsts{$ENDIF};
{ TObjeto }
procedure TObjeto.AssignError(Source: TPersistent);
var
SourceName: string;
begin
if Source <> nil then
SourceName := Source.ClassName else
SourceName := 'nil';
raise EConvertError.CreateResFmt(@SAssignError, [SourceName, ClassName]);
end;
procedure TObjeto.AssignTo(Dest: TPersistent);
begin
inherited;
end;
constructor TObjeto.Create;
begin
//
end;
destructor TObjeto.Destroy;
begin
inherited;
end;
procedure TObjeto.SalvarDatos;
begin
//
end;
{ TListaObjetos }
function TListaObjetos.Add(AObjecto: TObjeto): Integer;
begin
Result := FLista.Add(AObjecto);
end;
procedure TListaObjetos.AssignError(Source: TPersistent);
var
SourceName: string;
begin
if Source <> nil then
SourceName := Source.ClassName else
SourceName := 'nil';
raise EConvertError.CreateResFmt(@SAssignError, [SourceName, ClassName]);
end;
procedure TListaObjetos.AssignTo(Dest: TPersistent);
begin
inherited;
end;
procedure TListaObjetos.Clear;
begin
FLista.Clear;
end;
constructor TListaObjetos.Create;
begin
FLista := TObjectList.Create;
end;
procedure TListaObjetos.Delete(Index: Integer);
begin
FLista.Delete(Index);
end;
destructor TListaObjetos.Destroy;
begin
FLista.Free;
FLista := NIL;
inherited;
end;
function TListaObjetos.GetCount: Integer;
begin
Result := FLista.Count;
end;
end.