+
+string const LyXParagraph::StringWithLabels(Buffer const * buffer,
+ LyXParagraph::size_type beg,
+ LyXParagraph::size_type end)
+{
+ std::ostringstream ost;
+
+ if (beg == 0 && !params.labelString().empty())
+ ost << params.labelString() << ' ';
+
+ string str(ost.str().c_str());
+
+ str += String(buffer, beg, end);
+
+ return str;
}
Actually I would prefere to see the addition of a String that takes a
ostream..., alternatively:
string const LyXParagraph::StringWithLabels(Buffer const * buffer,
LyXParagraph::size_type beg,
LyXParagraph::size_type end)
{
std::ostringstream ost;
if (beg == 0 && !params.labelString().empty()) {
ost << params.labelString() << ' ';
}
ost << String(buffer, beg, end);
return ost.str().c_str();
}
and the nice version would have been:
string const LyXParagraph::StringWithLabels(Buffer const * buffer,
LyXParagraph::size_type beg,
LyXParagraph::size_type end)
{
std::ostringstream ost;
StringWithLabels(buffer, ost, beg, end);
return ost.str().c_str();
}
void LyXParagraph::StringWithLabels(Buffer const * buffer,
std::ostream & os,
LyXParagraph::size_type beg,
LyXParagraph::size_type end)
{
if (beg == 0 && !params.labelString().empty()) {
os << params.labelString() << ' ';
}
String(buffer, os, beg, end);
}
and later we could schedule the non ostream version for deletions...
--
Lgb