Home > Back-end >  Delphi XE5 how to parse the unknown type array, the array data
Delphi XE5 how to parse the unknown type array, the array data

Time:09-22

Delphi XE5 how to parse the unknown type array, take out an array of data

ArrayOflong=array of Int64;
ArrayOfstring=array of string;

//get RTTI attribute of the object as a function of incident
The function GetPropertyAndEventList (obj: TObject;
PList, eList: TStringList) : Boolean;
Var
ClassTypeInfo: PTypeInfo; {class information structure pointer}
ClassDataInfo: PTypeData; {a pointer to a data structure class}
PropertyList: PPropList; {TPropInfo is attribute data structure;
PPropList is its pointer;
The list of TPropList is attribute structure pointer array;
PPropList is a pointer to the array}

Num: Integer; {the total number of records attribute}
Size: Integer; {records attribute structure size}
I: Integer;
The begin
ClassTypeInfo:=obj. ClassInfo; Of information structure pointer} {access: first class
ClassDataInfo:=GetTypeData (ClassTypeInfo); {access: a pointer to a data structure class}
Num:=ClassDataInfo. PropCount; {property total}
Size:=SizeOf (TPropInfo); {} attribute structure size

Num GetMem (propertyList, size *); {assign attributes array memory}

GetPropInfos (ClassTypeInfo propertyList); Gets an attribute list {}

For I:=0 to num 1 do
The begin
If propertyList [I]. PropType ^. Kind=tkDynArray then
how can you remove the data
The else
PList. Add (propertyList [I] Name);
end;

FreeMem (propertyList); {release the memory attribute array}

Result:=True;
end;



CodePudding user response:

Red font part is to take out the unknown set of values
  • Related