@@ -23,15 +23,17 @@ namespace Poco {
2323namespace Data {
2424
2525
26- SimpleRowFormatter::SimpleRowFormatter (std::streamsize columnWidth):
27- _colWidth (columnWidth), _rowCount(0 )
26+ SimpleRowFormatter::SimpleRowFormatter (std::streamsize columnWidth, std::streamsize spacing ):
27+ _colWidth (columnWidth), _spacing(spacing), _rowCount(0 )
2828{
2929}
3030
3131
3232SimpleRowFormatter::SimpleRowFormatter (const SimpleRowFormatter& other):
3333 RowFormatter (other.prefix(), other.postfix()),
34- _colWidth (other._colWidth)
34+ _colWidth (other._colWidth),
35+ _spacing (other._spacing),
36+ _rowCount (0 )
3537{
3638}
3739
@@ -56,6 +58,7 @@ void SimpleRowFormatter::swap(SimpleRowFormatter& other)
5658 setPrefix (other.prefix ());
5759 setPostfix (other.postfix ());
5860 swap (_colWidth, other._colWidth );
61+ swap (_spacing, other._spacing );
5962}
6063
6164
@@ -64,12 +67,13 @@ std::string& SimpleRowFormatter::formatNames(const NameVecPtr pNames, std::strin
6467 _rowCount = 0 ;
6568
6669 std::ostringstream str;
67- std::string line (std::string::size_type (pNames->size () * _colWidth), ' -' );
68-
70+ std::string line (std::string::size_type (pNames->size ()* _colWidth + (pNames-> size () - 1 )*_spacing ), ' -' );
71+ std::string space (_spacing, ' ' );
6972 NameVec::const_iterator it = pNames->begin ();
7073 NameVec::const_iterator end = pNames->end ();
7174 for (; it != end; ++it)
7275 {
76+ if (it != pNames->begin ()) str << space;
7377 str << std::left << std::setw (_colWidth) << *it;
7478 }
7579 str << std::endl << line << std::endl;
@@ -81,11 +85,12 @@ std::string& SimpleRowFormatter::formatNames(const NameVecPtr pNames, std::strin
8185std::string& SimpleRowFormatter::formatValues (const ValueVec& vals, std::string& formattedValues)
8286{
8387 std::ostringstream str;
84-
88+ std::string space (_spacing, ' ' );
8589 ValueVec::const_iterator it = vals.begin ();
8690 ValueVec::const_iterator end = vals.end ();
8791 for (; it != end; ++it)
8892 {
93+ if (it != vals.begin ()) str << space;
8994 if (it->isNumeric ())
9095 {
9196 str << std::right
0 commit comments