value_t::print uses an output buffer now

This is so that  it plays nicely with straccstream.
This commit is contained in:
John Wiegley 2011-07-17 16:23:07 -05:00
parent 8da603cb81
commit 65b3a778e2

View file

@ -1721,11 +1721,13 @@ string value_t::label(optional<type_t> the_type) const
return _("<invalid>"); return _("<invalid>");
} }
void value_t::print(std::ostream& out, void value_t::print(std::ostream& _out,
const int first_width, const int first_width,
const int latter_width, const int latter_width,
const uint_least8_t flags) const const uint_least8_t flags) const
{ {
std::ostringstream out;
if (first_width > 0 && if (first_width > 0 &&
(! is_amount() || as_amount().is_zero()) && (! is_amount() || as_amount().is_zero()) &&
! is_balance() && ! is_string()) { ! is_balance() && ! is_string()) {
@ -1821,6 +1823,8 @@ void value_t::print(std::ostream& out,
add_error_context(_("While printing %1:") << *this); add_error_context(_("While printing %1:") << *this);
throw_(value_error, _("Cannot print %1") << label()); throw_(value_error, _("Cannot print %1") << label());
} }
_out << out.str();
} }
void value_t::dump(std::ostream& out, const bool relaxed) const void value_t::dump(std::ostream& out, const bool relaxed) const