Browse Source

* Introduce AsRecord. Patch by Lipinast Lekrisov

Michaël Van Canneyt 8 months ago
parent
commit
5945722811
1 changed files with 8 additions and 0 deletions
  1. 8 0
      packages/rtl-objpas/src/inc/rtti.pp

+ 8 - 0
packages/rtl-objpas/src/inc/rtti.pp

@@ -359,6 +359,7 @@ type
     FProperties : TRttiPropertyArray;
     FProperties : TRttiPropertyArray;
     FIndexedProperties : TRttiIndexedPropertyArray;
     FIndexedProperties : TRttiIndexedPropertyArray;
     function GetAsInstance: TRttiInstanceType;
     function GetAsInstance: TRttiInstanceType;
+    function GetAsRecord: TRttiRecordType;
   protected
   protected
     FTypeData: PTypeData;
     FTypeData: PTypeData;
     function GetName: string; override;
     function GetName: string; override;
@@ -397,6 +398,7 @@ type
     property BaseType: TRttiType read GetBaseType;
     property BaseType: TRttiType read GetBaseType;
     property Handle: PTypeInfo read FTypeInfo;
     property Handle: PTypeInfo read FTypeInfo;
     property AsInstance: TRttiInstanceType read GetAsInstance;
     property AsInstance: TRttiInstanceType read GetAsInstance;
+    property AsRecord: TRttiRecordType read GetAsRecord;
     property TypeKind: TTypeKind read GetTypeKind;
     property TypeKind: TTypeKind read GetTypeKind;
     property TypeSize: integer read GetTypeSize;
     property TypeSize: integer read GetTypeSize;
   end;
   end;
@@ -7160,6 +7162,12 @@ begin
   result := TRttiInstanceType(self);
   result := TRttiInstanceType(self);
 end;
 end;
 
 
+function TRttiType.GetAsRecord: TRttiRecordType;
+begin
+  result := TRttiRecordType(self);
+end;
+
+
 function TRttiType.GetBaseType: TRttiType;
 function TRttiType.GetBaseType: TRttiType;
 begin
 begin
   result := nil;
   result := nil;