Difference between revisions of "Runtime Type Information (RTTI)"

From Lazarus wiki
Jump to navigationJump to search
m (Text replace - "delphi>" to "syntaxhighlight>")
Line 1: Line 1:
 +
{{Editing Runtime Type Information (RTTI)}}
 
RTTI can be utilized to obtain a number of meta information in a Pascal application.
 
RTTI can be utilized to obtain a number of meta information in a Pascal application.
 
__TOC__
 
__TOC__

Revision as of 10:41, 31 January 2014

English (en) français (fr) русский (ru)
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.

type
  TProgrammerType = (tpDelphi, tpVisualC, tpVB, tpJava) ;

uses TypInfo;

var 
  s: string;
begin
  s := GetEnumName(TypeInfo(TProgrammerType), integer(tpDelphi));
  // Here s = 'tpDelphi'

See Also