Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2017-03

Run Time Type Info - are the type names of all classes defined in a unit stored in the RTTI?

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dennis

Programmatically, I want to make a list of all Classes defined in the unit. Is this info stored in the RTTI or anywhere else?

Thanks in advance.

Dennis

Sven Barth
to Dennis
"Dennis" wrote
Programmatically, I want to make a list of all Classes defined in the

unit.

Is this info stored in the RTTI or anywhere else?

This info is not yet available, but will be in the future.

Regards,
Sven

Dennis Poon
to Sven Barth
Sven Barth wrote 10 lines
Am 01.03.2017 11:53 schrieb "Dennis" < >: > > Programmatically, I want to make a list of all Classes defined in the unit. > Is this info stored in the RTTI or anywhere else? This info is not yet available, but will be in the future.

Thanks.

Ideally, with this feature, in the initialization section of the unit, I can 'register' all the classes defined in the unit into a dictionary<String, TClass>.
That way, when loading objects from file, I can use the dictionary to lookup the actual TClass with the stored Classname, to recreate the object stored.

Dennis

Sven Barth
to Dennis Poon
"Dennis Poon" wrote 10 lines
Sven Barth wrote: > > Am 01.03.2017 11:53 schrieb "Dennis" < <mailto: >: > > > > Programmatically, I want to make a list of all Classes defined in the

unit.

Show quoted text 8 lines
> > Is this info stored in the RTTI or anywhere else? > > This info is not yet available, but will be in the future. > Thanks. Ideally, with this feature, in the initialization section of the unit, I

can 'register' all the classes defined in the unit into a dictionary<String, TClass>.

That way, when loading objects from file, I can use the dictionary to

lookup the actual TClass with the stored Classname, to recreate the object stored.

For now you'll simply have to do it manually for each class...

Regards,
Sven