
On 02/29/08 09:32, Roland Schwarz wrote:
Surprisingly I was not able to find on the net code that would give me a smart way to indent a stream. So I wrote a little filter based on the boost iostreams library.
A long time ago, I had one and was intending *eventually* to add it to iostreams, but never got around to it. It's in: http://svn.boost.org/trac/boost/browser/sandbox-branches/cppljevans/boost/io... It was used, with g++'s demangler and boost's spirit, to produce more readable demangled names as demonstrated by: http://sourceforge.net/mailarchive/message.php?msg_id=fmqia0%24kak%241%40ger... OOPS. It doesn't appear the way it should there, but it did appear properly indented in my mail reader. In short, the stream has an operator++ and operator-- as well as operator+= and operator-= which increment the indentation and decrement the indentation. I've attached the spirit code which, given the demangled name from g++'s demangler, produces the indented output. The indentable stream is the str_tree_type_name_parser_print::my_out member variable.