Sign in Join
FPDoc Onlineexperiment

GetPropList function

In unit TypInfo

Return a list of a certain type of published properties.

Declaration

pascal
function GetPropList(TypeInfo: PTypeInfo; TypeKinds: TTypeKinds; 
 PropList: PPropList; Sorted: Boolean=True): LongInt

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

Example: ex13

pascal
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.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.