Tuğrul HELVACI
Tuğrul HELVACI

Reputation: 43

I have some troubles about Delphi-RTTI (Abstract class, Sealed class etc)

I am trying to develop simple toolsapi plugin for class browsing. I can find all vcl objects and i can show its implementatiton(code definition) inside memo using RTTI.

But, i have some troubles;

- How can i determine if class is abstract or not.
- How can i determine if class is sealed or not.
- How can i find nested classes inside a one class with its visibility.

I am using Delphi XE5 with RTTI (TRttiContext).

I am using foolowing defines inside my projects source.

{$STRONGLINKTYPES ON}
{$RTTI EXPLICIT METHODS([vcPrivate, vcProtected, vcPublic, vcPublished]) PROPERTIES([vcPrivate, vcProtected, vcPublic, vcPublished]) FIELDS([vcPrivate, vcProtected, vcPublic, vcPublished])}

Thanks

Upvotes: 4

Views: 402

Answers (1)

Stefan Glienke
Stefan Glienke

Reputation: 21748

The first two things cannot be retrieved using RTTI (just as you cannot retrieve if a method is overload or override).

To retrieve if a type is nested you can parse its name because a nested type always includes the name of the outer type. But you again have no information about the visibility of the nested type because the RTTI does not know about the nesting.

Upvotes: 4

Related Questions