Re: [boost] Re: Formal review of "Output Formatters" library beginstoday

John Torjo wrote:
2. The first part of documentation should be what is purpose of the library.
I guess in this case it is debugging and testing support, 100% cases.
Introduction: "The Standard Template Library (STL) provides a mechanism for storing collections of objects, but does not provide I/O support via streams. [...] The outfmt library is an attempt to solve the problems outlined above, providing an extensible framework [...]"
So, what I gather is that it provides customizable I/O for containers/ranges.
Yes.
That said, I donot think its purpose is debugging/testing support 100% cases. It does definitely support that, but you can do more - like, do some pretty printing to file(s), std::cout, etc.
Yes.
5. To support debugging I would like to see many more features:
- ability to wrap long lines in pretty way
I guess this could be solved by IO streams lib ;)
:) The problem with doing this during the output phase with my library is that you don't know in advance if outputting the next element will wrap around to the next line (and thus will need a new line inserting). Jonathan's library does indeed provide a solution for this. The example he gives does not support smart word-wrap facilities, but this can be done by writing to an internal buffer and outputting that up to the last space in the buffer, retaining the rest of the buffer until it wraps.
- ability to generate HTML as output (+ ability to fold/unfold big data structures using Javascript).
I assume this could be added in time... Reece?
You can generate this now if what you are generating is regular, for example: <ol><li>a</li><li>b</li><li>c</li></ol> if you want an id or special position-based output, you can create a state object and use statefmt() like is done in libs/example/john-torjo.cpp to output: [0] John, [1] Jane, [2] Claire, [3] Mark for example: <ol><li id = "elem1">a</li><li id = "elem2">b</li><li id = "elem3">c</li></ol> Alternatively, you can output the data as XML and use XSL:T to generate the javascript/dynamic content. For example: std::list< std::pair< int, std::vector< char > > > data; std::cout << xml_signature << '\n' << xsl_stylesheet_signature << '\n' << '\n' << io::formatob( data, io::containerfmt ( io::pairfmt ( io::wrappedfmt().format( "<e>", "</e>" ) io::containerfmt().format( "<seq><e>", "</e></seq>", "</e><e>" ) ).format( "<pair>", "</pair>" ) ).format( "<seq>", "</seq>" ) ); output: <seq><pair><e>5</e><seq><e>a</e><e>b</e><e>c</e></seq></pair><pair><e>102</e><seq><e>x</e><e>y</e><e>z</e></seq></pair></seq> If you want it to be pretty, e.g.: <seq> <pair><e>5</e> <seq><e>a</e><e>b</e><e>c</e></seq> </pair> <pair><e>102</e> <seq><e>x</e><e>y</e><e>z</e></seq> </pair> </seq> You can specify this as: io::formatob( data, io::containerfmt ( io::pairfmt ( io::wrappedfmt().format( "<e>", "</e>" ) io::containerfmt().format( "\n <seq><e>", "</e></seq>", "</e><e>" ) ).format( "\n <pair>", "\n </pair>" ) ).format( "<seq>", "</seq>" ) ); Regards, Reece _________________________________________________________________ Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo
participants (1)
-
Reece Dunn