5
votes
Vote UpVote

Fun with Delphi Rtti – Dump a TRttiType Definition

The Road to Delphi – Here ‘s a sample code of how you can dump the declaration of a TRttiType using the rtti. Supports classes, records and interfaces. uses Rtti, TypInfo, Classes, Generics.Collections, SysUtils; function DumpTypeDefinition(ATypeInfo: Pointer;OnlyDeclarated:Boolean=False) :string; //add and format a field procedure AddField(List:TStrings;lField : TRttiField); begin if Assigned(lField.FieldType) then List.Add((Format(' %-20s:%s;',[lField.Name,lField.FieldType.Name]))) else List.Add((Format(' %-20s:%s;',[lField.Name,'Unknow']))); end; //add ...
Favorite? Off-Topic? Rodrigo @ 2010-10-10 08:09

Statistics

Visits: 656
Votes: 5
Favorites: 2
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Charles Ardour
JC Chu
Mohammed Nasman
Radek
Tier777
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)