General Type Information

From RAD Studio
Jump to: navigation, search

Go Up to Working with RTTI

All RTTI objects are descendants of the TRttiObject class. For RTTI objects describing types, TRttiType is the most important ancestor. These two base classes expose a large number of methods and properties that apply to nearly all types and type members that have RTTI information.

The common information for all RTTI-enabled types and members includes:

  • Handle RttiDataSize, which provides a pointer to the in-memory location where raw RTTI data is stored and also gives the block's size.
  • Parent, which specifies the parent RTTI object. The parent only make sense for RTTI objects that describe structured types made of multiple parts, each having its own RTTI information.
  • Package, which gives information about the parent package where the reflected element is stored.
  • GetAttributes, which grants access to attributes annotated to the reflected type or type member.
  • Name, which provides access to the name of the reflected type or member.

RTTI objects describing types extend the exposed information by including:

  • QualifiedName, used to return the qualified name of the type.
  • TypeKind, used to check the sort of the type.
  • TypeSize, which specifies the size of a variable of this type.
  • BaseType, which makes sense only for types that have ancestry, such as classes and interfaces.
  • A plethora of methods used to query for type members (only available for structured types that allow members.)

The following topics describe the specialized RTTI objects. Each specialized RTTI object adds more properties and methods on top of the inherited ones.

See Also

Code Samples