Reputation: 84550
If I have an object that implements an interface, it's not too difficult to use RTTI to look up the interface and obtain its GUID. But if I want its name, is there any way to get that? It's simple enough to get a class's name, but for interfaces it seems a bit trickier...
Upvotes: 4
Views: 1780
Reputation: 163277
The tricky part is getting RTTI from an interface. If you've managed to do that, then you should already have the name there in the PTypeInfo
record pointer.
In one of my programs, I wrote a special registration system that mapped GUIDs to strings so that I could report failed calls to QueryInterface
and failed "as
" casts. That was in delphi 2005. My understanding is that in later Delphi versions RTTI for interfaces has progressed such that I might not need that system anymore.
Upvotes: 1