+ add TValue.AsInterface to retrieve a COM style interface again

git-svn-id: trunk@36969 -
This commit is contained in:
svenbarth 2017-08-20 18:27:49 +00:00
parent e2458c9803
commit 9c0423b3a4

View File

@ -85,6 +85,7 @@ type
function AsBoolean: boolean;
function AsCurrency: Currency;
function AsInteger: Integer;
function AsInterface: IInterface;
function ToString: String;
function IsType(ATypeInfo: PTypeInfo): boolean; inline;
function TryAsOrdinal(out AResult: int64): boolean;
@ -814,6 +815,13 @@ begin
raise EInvalidCast.Create(SErrInvalidTypecast);
end;
function TValue.AsInterface: IInterface;
begin
if Kind <> tkInterface then
EInvalidCast.Create(SErrInvalidTypecast);
Result := PInterface(FData.FValueData.GetReferenceToRawData)^;
end;
function TValue.ToString: String;
begin
case Kind of