mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-12 10:09:36 +02:00
19 lines
424 B
ObjectPascal
19 lines
424 B
ObjectPascal
program example9;
|
|
|
|
{ This program demonstrates the GetEnumName, GetEnumValue functions }
|
|
|
|
{$mode objfpc}
|
|
|
|
uses rttiobj,typinfo;
|
|
|
|
Var
|
|
O : TMyTestObject;
|
|
TI : PTypeInfo;
|
|
|
|
begin
|
|
O:=TMyTestObject.Create;
|
|
TI:=GetPropInfo(O,'MyEnumField')^.PropType;
|
|
Writeln('GetEnumName : ',GetEnumName(TI,Ord(O.MyEnumField)));
|
|
Writeln('GetEnumValue(mefirst) : ',GetEnumName(TI,GetEnumValue(TI,'mefirst')));
|
|
O.Free;
|
|
end. |