Sign in Join
FPDoc Onlineexperiment

GetPropInfos procedure

In unit TypInfo

Return a list of published properties.

Declaration

pascal
procedure GetPropInfos(TypeInfo: PTypeInfo; PropList: PPropList)

Description

GetPropInfos stores pointers to the property information of all published properties of a class with class info TypeInfo in the list pointed to by Proplist. The PropList pointer must point to a memory location that contains enough space to hold all properties of the class and its parent classes.

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: ex12

pascal
Program example12;

{ This program demonstrates the GetPropInfos 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('Property Count : ',PT^.PropCount);
  GetMem (PP,PT^.PropCount*SizeOf(Pointer));
  GetPropInfos(PI,PP);
  For I:=0 to PT^.PropCount-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.