[fpc-pascal] Enum RTTI

Wimpie Nortje wimpienortje at gmail.com
Thu Nov 5 11:16:59 CET 2009


Thanks, I will try this

Wolfram Kläger wrote:
> Wimpie,
>
> maybe you want to try:
>
> uses
>   typinfo;
>
> // implementation
>
> function Str(const AEnum : TEnum) : String; overload;
> begin
>   Result := GetEnumName(TypeInfo(TEnum), ord(AEnum));
> end;
>
> I usually declare one such overload per enum type. If you are using sysutils.Str, you have to avoid conflicts by chosing a different function name, e.g. EnumStr.
>
>
>   



More information about the fpc-pascal mailing list