Runtime Type Information (RTTI)/fr

From Free Pascal wiki
Revision as of 20:14, 20 July 2014 by E-ric (talk | contribs)
Jump to navigationJump to search

English (en) français (fr) русский (ru)


RTTI peut être employée pour obtenir un nombre de méta informations dans une application Pascal.

Conversion d'un type énuméré en une chaîne

On peut utiliser la RTTI pour obtenir une chaîne d'un type énuméré.

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

uses TypInfo;

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

See Also