mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 03:19:27 +02:00
+ add TValue.AsInterface to retrieve a COM style interface again
git-svn-id: trunk@36969 -
This commit is contained in:
parent
e2458c9803
commit
9c0423b3a4
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user