On Wed, 28 Oct 2009, Paul Ishenin wrote:
Michael Van Canneyt wrote:
On the other hand, UnitName may come in handy for the Lazarus IDE.
And this is the most difficult thing amoung other new methods :)
I am trying to get UnitName from the RTTI but have some problems:
1. If I call PTypeInfo(TypeInfo(TObject))^.Kind then I get tkClass and
UnitInfo can be retrieved since tkClass has this member.
2. If I am using PTypeInfo(TypeInfo(Self))^.Kind inside a class method I get
tkUnknown and UnitName is not avaiable ofcource.
3. If I am using ClassInfo iside a class method then it returns nil if the
class has no RTTI.
This last is correct, since the ClassInfo is part of the RTTI ?
Few questions now:
a) Why TypeInfo(TObject) <> TObject.ClassInfo?
b) Why TypeInfo(TPersistent) = TPersistent.ClassInfo?
Because TPersistent is compiled in $M+ ?
c) How to get TypeInfo of the class inside that class class method?
I think that Florian should answer this, but it seems like a bug to me ?
Michael.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel