Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-09-13 06:19:08

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.
>"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


>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.


>>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


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

   [0] John, [1] Jane, [2] Claire, [3] Mark

for example:

   <ol><li id = "elem1">a</li><li id = "elem2">b</li><li id =

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::wrappedfmt().format( "<e>", "</e>" )
               io::containerfmt().format( "<seq><e>", "</e></seq>",
"</e><e>" )
            ).format( "<pair>", "</pair>" )
         ).format( "<seq>", "</seq>" )


If you want it to be pretty, e.g.:


You can specify this as:

io::formatob( data,
         io::wrappedfmt().format( "<e>", "</e>" )
         io::containerfmt().format( "\n <seq><e>", "</e></seq>",
"</e><e>" )
      ).format( "\n <pair>", "\n </pair>" )
   ).format( "<seq>", "</seq>" )


Express yourself with cool new emoticons

Boost list run by bdawes at, gregod at, cpdaniel at, john at