File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 7
7
Author : Kike Pérez
8
8
Version : 1.0
9
9
Created : 06/05/2019
10
- Modified : 09/04 /2020
10
+ Modified : 26/06 /2020
11
11
12
12
This file is part of QuickLib: https://github.com/exilon/QuickLib
13
13
@@ -69,6 +69,7 @@ TRTTIFlexValue = record helper for TFlexValue
69
69
function AsType <T : class > : T;
70
70
function AsRecord <T : record > : T;
71
71
function AsArray <T> : TArray<T>;
72
+ function AsInterfaceEx <T : IInterface> : T; overload;
72
73
end ;
73
74
74
75
implementation
@@ -81,6 +82,11 @@ function TRTTIFlexValue.AsArray<T>: TArray<T>;
81
82
Result := (Self.Data as IValueTValue).Value .AsType<TArray<T>>;
82
83
end ;
83
84
85
+ function TRTTIFlexValue.AsInterfaceEx <T>: T;
86
+ begin
87
+ Result := T(Self.Data);
88
+ end ;
89
+
84
90
function TRTTIFlexValue.AsRecord <T>: T;
85
91
begin
86
92
if DataType <> dtRecord then raise Exception.Create(' DataType not supported' );
Original file line number Diff line number Diff line change @@ -618,6 +618,7 @@ function TFlexValue.CastToInterface: IInterface;
618
618
dtNull : Result := nil ;
619
619
dtInterface : Result := fDataIntf;
620
620
dtPointer : Result := IInterface(fDataIntf);
621
+ dtVariant : Result := IInterface(fDataIntf);
621
622
else raise Exception.Create(' DataType not supported' );
622
623
end ;
623
624
except
You can’t perform that action at this time.
0 commit comments