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

From Lazarus wiki
Jump to navigationJump to search
m (Fixed syntax highlighting)
 
Line 2: Line 2:
  
 
La RTTI peut être employée pour obtenir un nombre de méta-informations dans une application Pascal.
 
La RTTI peut être employée pour obtenir un nombre de méta-informations dans une application Pascal.
 +
  
 
__TOC__
 
__TOC__
 +
  
 
== Conversion d'un type énuméré en chaîne ==
 
== Conversion d'un type énuméré en chaîne ==
 
On peut utiliser la RTTI pour obtenir la chaîne d'un type énuméré.
 
On peut utiliser la RTTI pour obtenir la chaîne d'un type énuméré.
  
<syntaxhighlight>
+
<syntaxhighlight lang=pascal>
 
type
 
type
 
   TProgrammerType = (tpDelphi, tpVisualC, tpVB, tpJava) ;
 
   TProgrammerType = (tpDelphi, tpVisualC, tpVB, tpJava) ;

Latest revision as of 14:45, 25 February 2020

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


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


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

On peut utiliser la RTTI pour obtenir la 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'

Voir aussi