Browse Source

* Introduce AsOrdinal. Patch by Lipinast Lekrisov

Michaël Van Canneyt 8 months ago
parent
commit
6c1c3e35ee
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

@@ -71,6 +71,7 @@ type
   TRttiIndexedProperty = class;
   TRttiIndexedProperty = class;
   TRttiField = Class;
   TRttiField = Class;
   TRttiProperty = class;
   TRttiProperty = class;
+  TRttiOrdinalType = class;
   TRttiInstanceType = class;
   TRttiInstanceType = class;
   TRttiRecordType = class;
   TRttiRecordType = class;
 
 
@@ -361,6 +362,7 @@ type
     FProperties : TRttiPropertyArray;
     FProperties : TRttiPropertyArray;
     FIndexedProperties : TRttiIndexedPropertyArray;
     FIndexedProperties : TRttiIndexedPropertyArray;
     function GetAsInstance: TRttiInstanceType;
     function GetAsInstance: TRttiInstanceType;
+    function GetAsOrdinal: TRttiOrdinalType;
     function GetAsRecord: TRttiRecordType;
     function GetAsRecord: TRttiRecordType;
   protected
   protected
     FTypeData: PTypeData;
     FTypeData: PTypeData;
@@ -401,6 +403,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 AsOrdinal: TRttiOrdinalType read GetAsOrdinal;
     property AsRecord: TRttiRecordType read GetAsRecord;
     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;
@@ -7183,6 +7186,11 @@ begin
   result := TRttiInstanceType(self);
   result := TRttiInstanceType(self);
 end;
 end;
 
 
+function TRttiType.GetAsOrdinal: TRttiOrdinalType;
+begin
+  Result := TRttiOrdinalType(Self);
+end;
+
 function TRttiType.GetAsRecord: TRttiRecordType;
 function TRttiType.GetAsRecord: TRttiRecordType;
 begin
 begin
   result := TRttiRecordType(self);
   result := TRttiRecordType(self);