Jelajahi Sumber

+ add utility properties to TPropInfo to easily access the next TPropInfo in a list of prop infos (TPropInfo.Next) or the direct, unpadded end of the known information (TPropInfo.Tail)

git-svn-id: trunk@35337 -
svenbarth 8 tahun lalu
induk
melakukan
bf2891938f
1 mengubah file dengan 14 tambahan dan 0 penghapusan
  1. 14 0
      rtl/objpas/typinfo.pp

+ 14 - 0
rtl/objpas/typinfo.pp

@@ -461,6 +461,8 @@ unit typinfo;
       TPropInfo = packed record
       private
         function GetPropType: PTypeInfo; inline;
+        function GetTail: Pointer; inline;
+        function GetNext: PPropInfo; inline;
       public
         PropTypeRef : TypeInfoPtr;
         GetProc : CodePointer;
@@ -479,6 +481,8 @@ unit typinfo;
 
         Name : ShortString;
         property PropType: PTypeInfo read GetPropType;
+        property Tail: Pointer read GetTail;
+        property Next: PPropInfo read GetNext;
       end;
 
       TProcInfoProc = Procedure(PropInfo : PPropInfo) of object;
@@ -2529,4 +2533,14 @@ begin
   Result := DerefTypeInfoPtr(PropTypeRef);
 end;
 
+function TPropInfo.GetTail: Pointer;
+begin
+  Result := PByte(@Name[0]) + SizeOf(Name[0]) + Length(Name);
+end;
+
+function TPropInfo.GetNext: PPropInfo;
+begin
+  Result := PPropInfo(aligntoptr(Tail));
+end;
+
 end.