浏览代码

* rename TAttributeData to the more appropriate TAttributeTable

git-svn-id: trunk@42371 -
svenbarth 6 年之前
父节点
当前提交
e060a43d70

+ 9 - 9
packages/rtl-objpas/src/inc/rtti.pp

@@ -3398,12 +3398,12 @@ end;
 function TRttiProperty.GetAttributes: specialize TArray<TCustomAttribute>;
 var
   i: Integer;
-  ad: PAttributeData;
+  at: PAttributeTable;
 begin
   if not FAttributesResolved then
     begin
-      ad := FPropInfo^.AttributeTable;
-      if Assigned(ad) then
+      at := FPropInfo^.AttributeTable;
+      if Assigned(at) then
         begin
           SetLength(FAttributes, FPropInfo^.AttributeTable^.AttributeCount);
           for i := 0 to High(FAttributes) do
@@ -3629,16 +3629,16 @@ end;
 function TRttiType.GetAttributes: specialize TArray<TCustomAttribute>;
 var
   i: Integer;
-  ad: PAttributeData;
+  at: PAttributeTable;
 begin
   if not FAttributesResolved then
     begin
-    ad := GetAttributeData(FTypeInfo);
-    if Assigned(ad) then
+    at := GetAttributeTable(FTypeInfo);
+    if Assigned(at) then
       begin
-      setlength(FAttributes,ad^.AttributeCount);
-      for i := 0 to ad^.AttributeCount-1 do
-        FAttributes[i]:=GetAttribute(ad,i);
+      setlength(FAttributes,at^.AttributeCount);
+      for i := 0 to at^.AttributeCount-1 do
+        FAttributes[i]:=GetAttribute(at,i);
       end;
     FAttributesResolved:=true;
     end;

+ 12 - 12
rtl/objpas/typinfo.pp

@@ -253,7 +253,7 @@ unit TypInfo;
       PAttributeProcList = ^TAttributeProcList;
       TAttributeProcList = array[0..$ffff] of TAttributeProc;
 
-      TAttributeData =
+      TAttributeTable =
       {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
       packed
       {$endif}
@@ -261,7 +261,7 @@ unit TypInfo;
         AttributeCount: word;
         AttributesList: TAttributeProcList;
       end;
-      PAttributeData = ^TAttributeData;
+      PAttributeTable = ^TAttributeTable;
 
       // members of TTypeData
       TArrayTypeData =
@@ -522,7 +522,7 @@ unit TypInfo;
         ClassType : TClass;
         Parent : PPTypeInfo;
         PropCount : SmallInt;
-        AttributeTable : PAttributeData;
+        AttributeTable : PAttributeTable;
         property UnitName: ShortString read GetUnitName;
         property PropertyTable: PPropData read GetPropertyTable;
       private
@@ -625,7 +625,7 @@ unit TypInfo;
               (ClassType : TClass;
                ParentInfoRef : TypeInfoPtr;
                PropCount : SmallInt;
-               AttributeTable : PAttributeData;
+               AttributeTable : PAttributeTable;
                UnitName : ShortString;
                // here the properties follow as array of TPropInfo
               );
@@ -744,7 +744,7 @@ unit TypInfo;
         //     6 : true, constant index property
         PropProcs : Byte;
 
-        AttributeTable : PAttributeData;
+        AttributeTable : PAttributeTable;
         Name : ShortString;
         property PropType: PTypeInfo read GetPropType;
         property Tail: Pointer read GetTail;
@@ -893,11 +893,11 @@ procedure SetDynArrayProp(Instance: TObject; const PropName: string; const Value
 procedure SetDynArrayProp(Instance: TObject; PropInfo: PPropInfo; const Value: Pointer);
 
 // Extended RTTI
-function GetAttributeData(TypeInfo: PTypeInfo): PAttributeData;
+function GetAttributeTable(TypeInfo: PTypeInfo): PAttributeTable;
 
 function GetPropAttribute(PropInfo: PPropInfo; AttributeNr: Word): TCustomAttribute;
 
-function GetAttribute(AttributeData: PAttributeData; AttributeNr: Word): TCustomAttribute;
+function GetAttribute(AttributeTable: PAttributeTable; AttributeNr: Word): TCustomAttribute;
 
 // Auxiliary routines, which may be useful
 Function GetEnumName(TypeInfo : PTypeInfo;Value : Integer) : string;
@@ -976,7 +976,7 @@ begin
 {$endif}
 end;
 
-function GetAttributeData(TypeInfo: PTypeInfo): PAttributeData;
+function GetAttributeTable(TypeInfo: PTypeInfo): PAttributeTable;
 var
   TD: PTypeData;
 begin
@@ -999,7 +999,7 @@ end;
 
 function GetPropAttribute(PropInfo: PPropInfo; AttributeNr: Word): TCustomAttribute;
 var
-  attrtable: PAttributeData;
+  attrtable: PAttributeTable;
 begin
   attrtable := PropInfo^.AttributeTable;
   if not Assigned(attrtable) or (AttributeNr >= attrtable^.AttributeCount) then
@@ -1010,15 +1010,15 @@ begin
     end;
 end;
 
-function GetAttribute(AttributeData: PAttributeData; AttributeNr: Word): TCustomAttribute;
+function GetAttribute(AttributeTable: PAttributeTable; AttributeNr: Word): TCustomAttribute;
 var
   AttributeProcList: TAttributeProcList;
 begin
-  if (AttributeData=nil) or (AttributeNr>=AttributeData^.AttributeCount) then
+  if (AttributeTable=nil) or (AttributeNr>=AttributeTable^.AttributeCount) then
     result := nil
   else
     begin
-      result := AttributeData^.AttributesList[AttributeNr]();
+      result := AttributeTable^.AttributesList[AttributeNr]();
     end;
 end;
 

+ 5 - 5
tests/test/tcustomattr1.pp

@@ -20,7 +20,7 @@ type
   end;
 
 var
-  ad: PAttributeData;
+  at: PAttributeTable;
   AClassAttribute: TCustomAttribute;
 
 { tmyt }
@@ -31,13 +31,13 @@ begin
 end;
 
 begin
-  ad := GetAttributeData(TMyObject.ClassInfo);
-  if not assigned(ad) then
+  at := GetAttributeTable(TMyObject.ClassInfo);
+  if not assigned(at) then
     halt(1);
-  if ad^.AttributeCount<>1 then
+  if at^.AttributeCount<>1 then
     halt(2);
 
-  AClassAttribute := GetAttribute(ad,0);
+  AClassAttribute := GetAttribute(at,0);
   if AClassAttribute = nil then
     halt(3);
   writeln('ok');

+ 5 - 5
tests/test/tcustomattr10.pp

@@ -18,17 +18,17 @@ type
   end;
 
 var
-  ad: PAttributeData;
+  at: PAttributeTable;
   AClassAttribute: TCustomAttribute;
 
 begin
-  ad := GetAttributeData(TMyObject.ClassInfo);
-  if not Assigned(ad) then
+  at := GetAttributeTable(TMyObject.ClassInfo);
+  if not Assigned(at) then
     Halt(1);
-  if ad^.AttributeCount<>1 then
+  if at^.AttributeCount<>1 then
     halt(2);
 
-  AClassAttribute := GetAttribute(ad,0);
+  AClassAttribute := GetAttribute(at,0);
   if AClassAttribute = nil then
     halt(3);
   writeln('ok');

+ 5 - 5
tests/test/tcustomattr11.pp

@@ -22,16 +22,16 @@ type
   end;
 
 var
-  ad: PAttributeData;
+  at: PAttributeTable;
   attr: TCustomAttribute;
 begin
-  ad := GetAttributeData(TypeInfo(TTestObj));
-  if not Assigned(ad) then
+  at := GetAttributeTable(TypeInfo(TTestObj));
+  if not Assigned(at) then
     Halt(1);
-  if ad^.AttributeCount <> 1 then
+  if at^.AttributeCount <> 1 then
     Halt(2);
 
-  attr := GetAttribute(ad, 0);
+  attr := GetAttribute(at, 0);
   if not Assigned(attr) then
     Halt(3);
   if not (attr is TTestAttribute) then

+ 2 - 2
tests/test/tcustomattr4.pp

@@ -23,7 +23,7 @@ type
   end;
 
 var
-  rtd: PAttributeData;
+  rtd: PAttributeTable;
   AClassAttribute: tmyt;
 
 { tmyt }
@@ -34,7 +34,7 @@ begin
 end;
 
 begin
-  rtd := GetAttributeData(TMyObject.ClassInfo);
+  rtd := GetAttributeTable(TMyObject.ClassInfo);
 
   if not Assigned(rtd) then
     halt(1);

+ 5 - 5
tests/test/tcustomattr9.pp

@@ -17,17 +17,17 @@ type
   end;
 
 var
-  ad: PAttributeData;
+  at: PAttributeTable;
   AClassAttribute: TCustomAttribute;
 
 begin
-  ad := GetAttributeData(TMyObject.ClassInfo);
-  if not Assigned(ad) then
+  at := GetAttributeTable(TMyObject.ClassInfo);
+  if not Assigned(at) then
     halt(1);
-  if ad^.AttributeCount<>1 then
+  if at^.AttributeCount<>1 then
     halt(2);
 
-  AClassAttribute := GetAttribute(ad,0);
+  AClassAttribute := GetAttribute(at,0);
   if AClassAttribute = nil then
     halt(3);
   writeln('ok');