mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 11:06:19 +02:00
parent
4e96fe8fac
commit
49796e5151
@ -753,6 +753,43 @@
|
|||||||
TInterfacedObject(NewInstance).frefcount:=1;
|
TInterfacedObject(NewInstance).frefcount:=1;
|
||||||
end;
|
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;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Exception Support
|
Exception Support
|
||||||
|
@ -227,6 +227,20 @@
|
|||||||
end;
|
end;
|
||||||
TInterfacedClass = class of TInterfacedObject;
|
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 }
|
{ some pointer definitions }
|
||||||
PUnknown = ^IUnknown;
|
PUnknown = ^IUnknown;
|
||||||
PPUnknown = ^PUnknown;
|
PPUnknown = ^PUnknown;
|
||||||
|
Loading…
Reference in New Issue
Block a user