Keywords as basic scalar type
This commit is contained in:
@@ -18,6 +18,18 @@ type
|
||||
class operator Implicit(const Upvalue: TManaged<T>): T; overload;
|
||||
end;
|
||||
|
||||
TGenericContainedObject<T: TInterfacedObject> = class(TObject, IInterface)
|
||||
private
|
||||
FController: TInterfacedObject;
|
||||
protected
|
||||
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
|
||||
function _AddRef: Integer; stdcall;
|
||||
function _Release: Integer; stdcall;
|
||||
property Controller: TInterfacedObject read FController;
|
||||
public
|
||||
constructor Create(AController: TInterfacedObject);
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
constructor TManaged<T>.TObj.Create(AValue: T);
|
||||
@@ -42,4 +54,30 @@ begin
|
||||
Result := (Upvalue.FIntf as TObj).FValue;
|
||||
end;
|
||||
|
||||
constructor TGenericContainedObject<T>.Create(AController: TInterfacedObject);
|
||||
begin
|
||||
inherited Create;
|
||||
FController := AController;
|
||||
end;
|
||||
|
||||
{ TGenericContainedObject }
|
||||
|
||||
function TGenericContainedObject<T>.QueryInterface(const IID: TGUID; out Obj): HResult;
|
||||
begin
|
||||
if GetInterface(IID, Obj) then
|
||||
Result := S_OK
|
||||
else
|
||||
Result := E_NOINTERFACE;
|
||||
end;
|
||||
|
||||
function TGenericContainedObject<T>._AddRef: Integer;
|
||||
begin
|
||||
Result := IInterface(FController)._AddRef;
|
||||
end;
|
||||
|
||||
function TGenericContainedObject<T>._Release: Integer;
|
||||
begin
|
||||
Result := IInterface(FController)._Release;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user