瀏覽代碼

added AsType to TFlexValue helper

Unknown 6 年之前
父節點
當前提交
4c3e390286
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      Quick.Value.RTTI.pas

+ 8 - 2
Quick.Value.RTTI.pas

@@ -7,7 +7,7 @@
   Author      : Kike Pérez
   Author      : Kike Pérez
   Version     : 1.0
   Version     : 1.0
   Created     : 06/05/2019
   Created     : 06/05/2019
-  Modified    : 06/05/2019
+  Modified    : 22/08/2019
 
 
   This file is part of QuickLib: https://github.com/exilon/QuickLib
   This file is part of QuickLib: https://github.com/exilon/QuickLib
 
 
@@ -43,13 +43,19 @@ type
     function CastToTValue: TValue;
     function CastToTValue: TValue;
     procedure SetAsTValue(const Value: TValue);
     procedure SetAsTValue(const Value: TValue);
   public
   public
-    property AsTValue : TValue  read CastToTValue write SetAsTValue;
+    property AsTValue : TValue read CastToTValue write SetAsTValue;
+    function AsType<T> : T;
   end;
   end;
 
 
 implementation
 implementation
 
 
 { TRTTIFlexValue }
 { TRTTIFlexValue }
 
 
+function TRTTIFlexValue.AsType<T>: T;
+begin
+  Result := AsObject;
+end;
+
 function TRTTIFlexValue.CastToTValue: TValue;
 function TRTTIFlexValue.CastToTValue: TValue;
 begin
 begin
   try
   try