Hi , I try to find out the indextype of an indexed parameter with RTTI.
Hi , I try to find out the indextype of an indexed parameter with RTTI.
For property xx[a:String]: .... I would like to find out "String".
Any hint?
Bernd
For property xx[a:String]: .... I would like to find out "String".
Any hint?
Bernd
You could use:
ReplyDeleteTRttiContext.Create.GetType(D.ClassType).GetIndexedProperty('Data').ToString
Which results in something like:
'property Data[AIndex: string]: Integer'
To dig deeper, you could also use ReadMethod.GetParameters[0].ParamType
You have to use the parameters of the TRttiIndexedProperty.ReadMethod and/or TRttiIndexedProperty.WriteMethod.
ReplyDeleteThis is also what TRttiIndexedProperty.ToString does.
We have developed an easier and more powerful RTTI library for Delphi. It makes checking this type of stuff really piece of cake.
ReplyDeleteWe plan to release it as free library in about a month or so as part of our free Mitov Runtime library.
If you are interested, please contact me on Skype - bmitov or over e-mail mitov@mitov.com and I will send you install.
Boian Mitov Unless you build your own compiler to generate RTTI there is not much more than enhance the API of the enhanded RTTI (the things from System.Rtti.pas) because some things are just not there.
ReplyDeleteLike the types of the indixes of an indexed property can only taken from the getter/setter (that is why their RTTI gets included no matter what visibility you have set for methods).
Anyway I would be interested to see what you did about the RTTI.
Stefan Glienke
ReplyDeleteYou would be surprised ;-)