For HTML generation, I started to use basic C++ iostreams, but this quickly becomes unmaintainable, and you will run into debug problems. If your markup is wrong, it’s very complicated to see in the C++ code where the error source is. A much nicer solution is Google ctemplate, a C++ HTML template engine in the spirit of Smarty. Basically, you can author the template using any HTML editor, add some markup for repeating sections, then you fill out some values on the C++ side, and your done. For debugging, you simply strip the template tags, and validate the code with any HTML validator. Two things are especially nice about ctemplate. First of all, repeating sections is trivial. If you add a dictionary for a section twice, it will be repeated twice in the output, no need to set up loop constructs on your own. Seconds, it’s fast – generating a 50 MiB HTML file takes ~ 2 seconds with it. For viewing such large files, I can recommend to use a WebKit based browsers, as at least Firefox 3.0 has some problems when closing such a file.
$("#yourId").toggle(). If you have tabular data, JQuery has a real killer plugin: TableSorter. This allows you to sort tables interactively, without any additional setup code. All you have to do is to use proper headers for your table, and you’re ready to sort.
I have to admit that I still use plain-text only reporting quite a bit, but it’s usually much faster for analysis to have a nice report with some comfort (hyperlinks to additional data, embedded images). With the ctemplate stuff, the cost of adding HTML output over plain-text is rather minimal, so the next time you run into a situation where you’ll need some output, you should really consider to give HTML a try.