/* Web Polygraph http://www.web-polygraph.org/ * (C) 2003-2006 The Measurement Factory * Licensed under the Apache License, Version 2.0 */ #include "base/polygraph.h" #include "xstd/h/iostream.h" #include "xml/XmlAttr.h" #include "loganalyzers/Formatter.h" inline const String &attr(const String &value) { return value; } inline const String &text(const String &value) { return value; } WebPageFormatter::WebPageFormatter(ostream *aPage): thePage(aPage) { } void WebPageFormatter::openSection(const String &id, const String &title) { *thePage << "
" << endl; *thePage << "

" << text(title) << "

" << endl; } void WebPageFormatter::closeSection() { *thePage << "
" << endl; } void WebPageFormatter::openTable(const String &id, const String &title) { *thePage << "" << endl; *thePage << "" << endl; } void WebPageFormatter::openTableAnonym() { *thePage << "
" << text(title) << "
" << endl; } void WebPageFormatter::closeTable() { *thePage << "
" << endl; } void WebPageFormatter::openTableHeader(const String &id, const String &title) { *thePage << "" << endl; } void WebPageFormatter::closeTableHeader() { *thePage << "" << endl; } void WebPageFormatter::openTableRecord() { *thePage << "" << endl; } void WebPageFormatter::closeTableRecord() { *thePage << "" << endl; } void WebPageFormatter::openTableCell(const String &classId) { *thePage << " 0) XmlAttr("class", classId).print(*thePage, " "); *thePage << ">"; } void WebPageFormatter::closeTableCell() { *thePage << ""; } void WebPageFormatter::addTableCell(const String &cell) { openTableCell(""); addText(cell); closeTableCell(); } void WebPageFormatter::addLink(const String &addr, const String &text) { *thePage << ""; addText(text); *thePage << ""; } void WebPageFormatter::addText(const String &text) { *thePage << text; } void WebPageFormatter::addInteger(int v, const String &unit, bool addSign) { if (addSign && v >= 0) addText(v > 0 ? "+" : " "); *thePage << v << unit; } void WebPageFormatter::addNothing() { *thePage << " "; } void WebPageFormatter::make() { Assert(thePage); }