Can I get a PTypeInfo from a string?
- by Mason Wheeler
This is probably going to be a "no", but is there any way I can use Delphi's RTTI, either old-school or the 2010 extended RTTI, to pass in a string containing the name of a type, specifically the name of an enumerated type, and have it give me the PTypeInfo for that type? I've looked through RTTI.pas and TypInfo.pas and I don't see any function that would do that, but I might have missed something.
What I'm looking for:
var
info: PTypeInfo;
begin
info := GetTypeInfoFromName('TComponentStyle');
end;
Or something like that. Thing is, the name of the enumerated type would be passed in; it wouldn't be known at compile time.