Difference between revisions of "Runtime Type Information (RTTI)"
From Lazarus wiki
Jump to navigationJump to searchSekelsenmat (talk | contribs) |
Sekelsenmat (talk | contribs) |
||
Line 21: | Line 21: | ||
*[[RTTI controls]] | *[[RTTI controls]] | ||
+ | * http://www.blong.com/Conferences/BorConUK98/DelphiRTTI/CB140.htm |
Revision as of 09:57, 19 July 2011
RTTI can be utilized to obtain a number of meta information in a Pascal application.
Converting a enumerated type to a string
One can use RTTI to obtain a string from a enumerated type.
<delphi> type
TProgrammerType = (tpDelphi, tpVisualC, tpVB, tpJava) ;
uses TypInfo;
var
s: string;
begin
s := GetEnumName(TypeInfo(TProgrammerType), integer(tpDelphi)); // Here s = 'tpDelphi'
</delphi>