From 65b3a778e2abb24e40945c1e3b4a9081c6a55ecd Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 17 Jul 2011 16:23:07 -0500 Subject: value_t::print uses an output buffer now This is so that it plays nicely with straccstream. --- src/value.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/value.cc') diff --git a/src/value.cc b/src/value.cc index f6ce54e7..6de40d5b 100644 --- a/src/value.cc +++ b/src/value.cc @@ -1721,11 +1721,13 @@ string value_t::label(optional the_type) const return _(""); } -void value_t::print(std::ostream& out, +void value_t::print(std::ostream& _out, const int first_width, const int latter_width, const uint_least8_t flags) const { + std::ostringstream out; + if (first_width > 0 && (! is_amount() || as_amount().is_zero()) && ! is_balance() && ! is_string()) { @@ -1821,6 +1823,8 @@ void value_t::print(std::ostream& out, add_error_context(_("While printing %1:") << *this); throw_(value_error, _("Cannot print %1") << label()); } + + _out << out.str(); } void value_t::dump(std::ostream& out, const bool relaxed) const -- cgit v1.2.3