GetPropList

Return a list of a certain type of published properties.

Declaration

Source position: typinfo.pp line 866

  function GetPropList(TypeInfo: PTypeInfo; TypeKinds: TTypeKinds; 
                      PropList: PPropList; Sorted: Boolean) : LongInt;
  function GetPropList(TypeInfo: PTypeInfo; out PropList: PPropList)
                       : SizeInt;
  function GetPropList(AClass: TClass; out PropList: PPropList) : Integer;
  function GetPropList(Instance: TObject; out PropList: PPropList)
                       : Integer;

Description

GetPropList stores pointers to property information of the class with class info TypeInfo for properties of kind TypeKinds in the list pointed to by Proplist. PropList must contain enough space to hold all properties.

The function returns the number of pointers that matched the criteria and were stored in PropList.

Errors

No checks are done to see whether PropList points to a memory area that is big enough to hold all pointers.

See also

Name Description
GetPropInfo Return property type information, by property name.
GetPropInfos Return a list of published properties.

Example

Program example13;
{ This program demonstrates the GetPropList function }
uses
  rttiobj,typinfo;
Var
  O : TMyTestObject;
  PT : PTypeData;
  PI : PTypeInfo;
  I,J : Longint;
  PP : PPropList;
  prI : PPropInfo;
begin
  O:=TMyTestObject.Create;
  PI:=O.ClassInfo;
  PT:=GetTypeData(PI);
  Writeln('Total property Count : ',PT^.PropCount);
  GetMem (PP,PT^.PropCount*SizeOf(Pointer));
  J:=GetPropList(PI,OrdinalTypes,PP);
  Writeln('Ordinal property Count : ',J);
  For I:=0 to J-1 do
    begin
    With PP^[i]^ do
      begin
      Write('Property ',i+1:3,': ',name:30);
      writeln('  Type: ',TypeNames[typinfo.PropType(O,Name)]);
      end;
    end;
  FreeMem(PP);
  O.Free;
end.