std::string& formatValues(const ValueVec& vals, std::string& formattedValues) { std::ostringstream str; str << "\t<TR>" << std::endl; ValueVec::const_iterator it = vals.begin(); ValueVec::const_iterator end = vals.end(); for (; it != end; ++it) { if (it->isNumeric()) str << "\t\t<TD align=\"right\">"; else str << "\t\t<TD align=\"left\">"; str << it->convert<std::string>() << "</TD>" << std::endl; } str << "\t</TR>" << std::endl; return formattedValues = str.str(); }
std::string& SimpleRowFormatter::formatValues(const ValueVec& vals, std::string& formattedValues) const { std::ostringstream str; ValueVec::const_iterator it = vals.begin(); ValueVec::const_iterator end = vals.end(); for (; it != end; ++it) { if (it->isNumeric()) { str << std::right << std::fixed << std::setprecision(2); } else str << std::left; str << std::setw(_colWidth) << it->convert<std::string>(); } str << std::endl; return formattedValues = str.str(); }