mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-16 15:01:15 +02:00
- made prefix() and postfix() virtual
- avoid stream operator calls when copying empty strings
This commit is contained in:
parent
417c2344cb
commit
65ad81c363
@ -616,13 +616,6 @@ inline RecordSet::Iterator RecordSet::end()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline std::ostream& RecordSet::copyNames(std::ostream& os) const
|
|
||||||
{
|
|
||||||
os << (*_pBegin)->namesToString();
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline const RowFilter* RecordSet::getFilter() const
|
inline const RowFilter* RecordSet::getFilter() const
|
||||||
{
|
{
|
||||||
return _pFilter;
|
return _pFilter;
|
||||||
|
@ -103,10 +103,10 @@ public:
|
|||||||
void setTotalRowCount(int count);
|
void setTotalRowCount(int count);
|
||||||
/// Sets total row count.
|
/// Sets total row count.
|
||||||
|
|
||||||
const std::string& prefix() const;
|
virtual const std::string& prefix() const;
|
||||||
/// Returns prefix string;
|
/// Returns prefix string;
|
||||||
|
|
||||||
const std::string& postfix() const;
|
virtual const std::string& postfix() const;
|
||||||
/// Returns postfix string;
|
/// Returns postfix string;
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
@ -116,7 +116,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
void setPrefix(const std::string& prefix) const;
|
void setPrefix(const std::string& prefix) const;
|
||||||
/// Sets the p[refix for the formatter.
|
/// Sets the prefix for the formatter.
|
||||||
|
|
||||||
void setPostfix(const std::string& postfix) const;
|
void setPostfix(const std::string& postfix) const;
|
||||||
/// Sets the postfix for the formatter
|
/// Sets the postfix for the formatter
|
||||||
|
@ -319,11 +319,24 @@ void RecordSet::setRowFormatter(RowFormatter* pRowFormatter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::ostream& RecordSet::copyNames(std::ostream& os) const
|
||||||
|
{
|
||||||
|
std::string names = (*_pBegin)->namesToString();
|
||||||
|
if (!names.empty()) os << names;
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::ostream& RecordSet::copyValues(std::ostream& os, std::size_t offset, std::size_t length) const
|
std::ostream& RecordSet::copyValues(std::ostream& os, std::size_t offset, std::size_t length) const
|
||||||
{
|
{
|
||||||
RowIterator itBegin = *_pBegin + offset;
|
RowIterator itBegin = *_pBegin + offset;
|
||||||
RowIterator itEnd = (RowIterator::POSITION_END != length) ? itBegin + length : *_pEnd;
|
RowIterator itEnd = (RowIterator::POSITION_END != length) ? itBegin + length : *_pEnd;
|
||||||
std::copy(itBegin, itEnd, std::ostream_iterator<Row>(os));
|
std::string val;
|
||||||
|
for (; itBegin != itEnd; ++itBegin)
|
||||||
|
{
|
||||||
|
val = itBegin->valuesToString();
|
||||||
|
if (!val.empty()) os << val;
|
||||||
|
}
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user