mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 04:19:38 +02:00
35 lines
596 B
ObjectPascal
35 lines
596 B
ObjectPascal
Program example13;
|
|
|
|
|
|
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.
|
|
|