Sign in Join

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

Mailing lists / fpc-pascal / 2014-06

Printing object

6 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Krzysztof

Hi,

I need to analyze a lot of big objects (a lot of properties, global vars etc). Looking for easy way to print object info in format:

TObject
Property/VarName = value
end;

It should also step into subobjects. Looking at typeinfo but can't find method for this.

Regards

Reply by email

Michael Van Canneyt
to Krzysztof
Krzysztof wrote 10 lines
Hi, I need to analyze a lot of big objects (a lot of properties, global vars etc). Looking for easy way to print object info in format: TObject   Property/VarName = value end; It should also step into subobjects. Looking at typeinfo but can't find method for this.

This is done in classes unit. It requires a tcomponent, though. the jsonrtti and rttiutils also can do this.

Michael.

Reply by email

Howard Page-Clark
to Michael Van Canneyt
Michael Van Canneyt wrote 19 lines
On Sat, 7 Jun 2014, Krzysztof wrote: > Hi, > > I need to analyze a lot of big objects (a lot of properties, global > vars etc). Looking for easy way to print object info in > format: > > TObject > Property/VarName = value > end; > > It should also step into subobjects. Looking at typeinfo but can't > find method for this. This is done in classes unit. It requires a tcomponent, though. the jsonrtti and rttiutils also can do this.

As the unit names indicate these utilities cover published properties. I think to get equivalent information for public and protected properties you have to roll your own routines (if that's what Krzysztof needs).

Howard

Reply by email

Michael Van Canneyt
to Howard Page-Clark
Howard Page-Clark wrote 24 lines
On 07/06/2014 15:49, Michael Van Canneyt wrote: > > > On Sat, 7 Jun 2014, Krzysztof wrote: > >> Hi, >> >> I need to analyze a lot of big objects (a lot of properties, global >> vars etc). Looking for easy way to print object info in >> format: >> >> TObject >> Property/VarName = value >> end; >> >> It should also step into subobjects. Looking at typeinfo but can't >> find method for this. > > This is done in classes unit. It requires a tcomponent, though. > the jsonrtti and rttiutils also can do this. As the unit names indicate these utilities cover published properties. I think to get equivalent information for public and protected properties you have to roll your own routines (if that's what Krzysztof needs).

That info isn't published in RTTI.

Michael.

Reply by email

Krzysztof
to Michael Van Canneyt: This is done in classes unit. It requires a tcomponent, though. the jsonrtti and…

2014-06-07 16:49 GMT+02:00 Michael Van Canneyt :

Show quoted text 20 lines
On Sat, 7 Jun 2014, Krzysztof wrote: Hi, > > I need to analyze a lot of big objects (a lot of properties, global vars > etc). Looking for easy way to print object info in > format: > > TObject > Property/VarName = value > end; > > It should also step into subobjects. Looking at typeinfo but can't find > method for this. > This is done in classes unit. It requires a tcomponent, though. the jsonrtti and rttiutils also can do this.

Thank you Michael. fpjsonrtti seems to be exactly what I need, but too bad that it handle only published properties, not public :/ . Maybe I say for what I need it. There is probably a bug in TIpHTMLPanel component. I have big HTML with <TABLE> . I'm adding new TR row on runtime by TIpHtmlNodeTR.Create(FTable). But after this HTML is not rendered correctly (more specifically, all TR rows are "losing" align and valign properties in final render, but they are not modified). Seems like adding new row is modyfing other TIpHtmlNode objects. I can't find this by debugging. If you se at source, TIpHtmlNodeTR is descendant of many other nodes, a bunch of properties and subobjects. So what I want to do is enumerate all HTML nodes and create "dump" of properties before and after adding new node and compare result in kdiff for example.

Reply by email

Michael Van Canneyt
to Krzysztof
Krzysztof wrote 25 lines
2014-06-07 16:49 GMT+02:00 Michael Van Canneyt : On Sat, 7 Jun 2014, Krzysztof wrote: Hi, I need to analyze a lot of big objects (a lot of properties, global vars etc). Looking for easy way to print object info in format: TObject   Property/VarName = value end; It should also step into subobjects. Looking at typeinfo but can't find method for this. This is done in classes unit. It requires a tcomponent, though. the jsonrtti and rttiutils also can do this. Thank you Michael.  fpjsonrtti seems to be exactly what I need, but too bad that it handle only published properties, not public :/

That information is simply not available.

Show quoted text 6 lines
. Maybe I say for what I need it. There is probably a bug in TIpHTMLPanel component. I have big HTML with <TABLE> . I'm adding new TR row on runtime by TIpHtmlNodeTR.Create(FTable). But after this HTML is not rendered correctly (more specifically, all TR rows are "losing" align and valign properties in final render, but they are not modified). Seems like adding new row is modyfing other TIpHtmlNode objects. I can't find this by debugging. If you se at source, TIpHtmlNodeTR is descendant of many other nodes, a bunch of properties and subobjects. So what I want to do is enumerate all HTML nodes and create "dump" of properties before and after adding new node and compare result in kdiff for example.

Sorry, I've never used this component, so I'm afraid I'm not of help here :(

Michael.

Reply by email