mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 16:19:21 +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 AsBoolean: boolean;
|
||||||
function AsCurrency: Currency;
|
function AsCurrency: Currency;
|
||||||
function AsInteger: Integer;
|
function AsInteger: Integer;
|
||||||
|
function AsInterface: IInterface;
|
||||||
function ToString: String;
|
function ToString: String;
|
||||||
function IsType(ATypeInfo: PTypeInfo): boolean; inline;
|
function IsType(ATypeInfo: PTypeInfo): boolean; inline;
|
||||||
function TryAsOrdinal(out AResult: int64): boolean;
|
function TryAsOrdinal(out AResult: int64): boolean;
|
||||||
@ -814,6 +815,13 @@ begin
|
|||||||
raise EInvalidCast.Create(SErrInvalidTypecast);
|
raise EInvalidCast.Create(SErrInvalidTypecast);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TValue.AsInterface: IInterface;
|
||||||
|
begin
|
||||||
|
if Kind <> tkInterface then
|
||||||
|
EInvalidCast.Create(SErrInvalidTypecast);
|
||||||
|
Result := PInterface(FData.FValueData.GetReferenceToRawData)^;
|
||||||
|
end;
|
||||||
|
|
||||||
function TValue.ToString: String;
|
function TValue.ToString: String;
|
||||||
begin
|
begin
|
||||||
case Kind of
|
case Kind of
|
||||||
|
Loading…
Reference in New Issue
Block a user