summaryrefslogtreecommitdiff
path: root/src/value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2011-07-17 16:23:07 -0500
committerJohn Wiegley <johnw@newartisans.com>2011-07-17 16:23:07 -0500
commit65b3a778e2abb24e40945c1e3b4a9081c6a55ecd (patch)
treefe8883da9f7202755e3fb72fca88d4a1fa09df8a /src/value.cc
parent8da603cb813022bdf37ad0951ee6935a91557a04 (diff)
downloadfork-ledger-65b3a778e2abb24e40945c1e3b4a9081c6a55ecd.tar.gz
fork-ledger-65b3a778e2abb24e40945c1e3b4a9081c6a55ecd.tar.bz2
fork-ledger-65b3a778e2abb24e40945c1e3b4a9081c6a55ecd.zip
value_t::print uses an output buffer now
This is so that it plays nicely with straccstream.
Diffstat (limited to 'src/value.cc')
-rw-r--r--src/value.cc6
1 files changed, 5 insertions, 1 deletions
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<type_t> the_type) const
return _("<invalid>");
}
-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