mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 20:20:26 +02:00
parent
4e96fe8fac
commit
49796e5151
@ -752,6 +752,43 @@
|
||||
NewInstance:=inherited NewInstance;
|
||||
TInterfacedObject(NewInstance).frefcount:=1;
|
||||
end;
|
||||
|
||||
{****************************************************************************
|
||||
TAGGREGATEDOBJECT
|
||||
****************************************************************************}
|
||||
|
||||
constructor TAggregatedObject.Create(const aController: IUnknown);
|
||||
|
||||
begin
|
||||
inherited Create;
|
||||
{ do not keep a counted reference to the controller! }
|
||||
fcontroller := Pointer(aController);
|
||||
end;
|
||||
|
||||
function TAggregatedObject.QueryInterface(
|
||||
const iid : tguid;out obj) : longint;stdcall;
|
||||
|
||||
begin
|
||||
Result := IUnknown(fcontroller).QueryInterface(iid, obj);
|
||||
end;
|
||||
|
||||
function TAggregatedObject._AddRef : longint;stdcall;
|
||||
|
||||
begin
|
||||
Result := IUnknown(fcontroller)._AddRef;
|
||||
end;
|
||||
|
||||
function TAggregatedObject._Release : longint;stdcall;
|
||||
|
||||
begin
|
||||
Result := IUnknown(fcontroller)._Release;
|
||||
end;
|
||||
|
||||
function TAggregatedObject.GetController : IUnknown;
|
||||
|
||||
begin
|
||||
Result := IUnknown(fcontroller);
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
|
@ -226,6 +226,20 @@
|
||||
property RefCount : longint read frefcount;
|
||||
end;
|
||||
TInterfacedClass = class of TInterfacedObject;
|
||||
|
||||
TAggregatedObject = class(TObject)
|
||||
private
|
||||
fcontroller: Pointer;
|
||||
function GetController: IUnknown;
|
||||
protected
|
||||
{ implement methods of IUnknown }
|
||||
function QueryInterface(const iid : tguid;out obj) : longint;stdcall;
|
||||
function _AddRef : longint;stdcall;
|
||||
function _Release : longint;stdcall;
|
||||
public
|
||||
constructor Create(const aController: IUnknown);
|
||||
property Controller : IUnknown read GetController;
|
||||
end;
|
||||
|
||||
{ some pointer definitions }
|
||||
PUnknown = ^IUnknown;
|
||||
|
Loading…
Reference in New Issue
Block a user