git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@751 0c75b7a4-871f-7646-8a2f-f78d34cc349f
56 lines
1.1 KiB
ObjectPascal
56 lines
1.1 KiB
ObjectPascal
unit uDataModuleBase;
|
|
|
|
interface
|
|
|
|
uses
|
|
Classes;
|
|
|
|
type
|
|
IDataModuleBase = interface
|
|
['{0377C83C-5C68-47CD-97A6-A764746CD2B1}']
|
|
end;
|
|
|
|
TDataModuleBase = class(TDataModule, IDataModuleBase)
|
|
private
|
|
FRefCount: Integer;
|
|
protected
|
|
function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall;
|
|
function _AddRef: Integer; stdcall;
|
|
function _Release: Integer; stdcall;
|
|
|
|
public
|
|
property RefCount: integer read fRefCount write fRefCount;
|
|
|
|
end;
|
|
|
|
implementation
|
|
|
|
|
|
{$R *.DFM}
|
|
|
|
// Set an implicit refcount so that refcounting
|
|
// during construction won't destroy the object.
|
|
|
|
function TDataModuleBase.QueryInterface( const IID: TGUID; out Obj): HResult;
|
|
begin
|
|
if GetInterface(IID, Obj)
|
|
then Result := 0
|
|
else Result := E_NOINTERFACE;
|
|
end;
|
|
|
|
function TDataModuleBase._AddRef: Integer;
|
|
begin
|
|
Inc(fRefCount);
|
|
Result := fRefCount;
|
|
end;
|
|
|
|
function TDataModuleBase._Release: Integer;
|
|
begin
|
|
Dec(fRefCount);
|
|
Result := fRefCount;
|
|
if fRefCount = 0 then Destroy;
|
|
end;
|
|
|
|
|
|
end.
|