Browse Source

* Introduce IsClassProperty, Index and Default in TRttiProperty. Patch from Lipinast Lekrisov

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

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

@@ -556,6 +556,9 @@ type
     function GetIsWritable: boolean; override;
     function GetIsWritable: boolean; override;
     function GetIsReadable: boolean; override;
     function GetIsReadable: boolean; override;
     function GetDataType: TRttiType; override;
     function GetDataType: TRttiType; override;
+    function GetDefault: Integer; virtual;
+    function GetIndex: Integer; virtual;
+    function GetIsClassProperty: boolean; virtual;
   protected
   protected
     function GetName: string; override;
     function GetName: string; override;
     function GetHandle: Pointer; override;
     function GetHandle: Pointer; override;
@@ -567,6 +570,9 @@ type
     procedure SetValue(Instance: pointer; const AValue: TValue); override; 
     procedure SetValue(Instance: pointer; const AValue: TValue); override; 
     function ToString: String; override;
     function ToString: String; override;
     property PropertyType: TRttiType read GetPropertyType;
     property PropertyType: TRttiType read GetPropertyType;
+    property Default: Integer read GetDefault;
+    property Index: Integer read GetIndex;
+    property IsClassProperty: boolean read GetIsClassProperty;
     property IsReadable: boolean read GetIsReadable;
     property IsReadable: boolean read GetIsReadable;
     property IsWritable: boolean read GetIsWritable;
     property IsWritable: boolean read GetIsWritable;
   end;
   end;
@@ -6751,6 +6757,21 @@ begin
   Result:=GetPropertyType
   Result:=GetPropertyType
 end;
 end;
 
 
+function TRttiProperty.GetDefault: Integer;
+begin
+  Result := FPropInfo^.Default;
+end;
+
+function TRttiProperty.GetIndex: Integer;
+begin
+  Result := FPropInfo^.Index;
+end;
+
+function TRttiProperty.GetIsClassProperty: boolean;
+begin
+  result := FPropInfo^.IsStatic;
+end;
+
 function TRttiProperty.GetPropertyType: TRttiType;
 function TRttiProperty.GetPropertyType: TRttiType;
 var
 var
   context: TRttiContext;
   context: TRttiContext;