summaryrefslogtreecommitdiff
path: root/src/value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-19 01:22:22 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-19 01:22:22 -0400
commit1fa3c1956ff087a5621184e18b0d785e6c41646a (patch)
treee886aaca1028e0e2922fc3e5191ceea48013950c /src/value.cc
parentec08dee745ee7c1bda63defa2828ce98e438370b (diff)
downloadfork-ledger-1fa3c1956ff087a5621184e18b0d785e6c41646a.tar.gz
fork-ledger-1fa3c1956ff087a5621184e18b0d785e6c41646a.tar.bz2
fork-ledger-1fa3c1956ff087a5621184e18b0d785e6c41646a.zip
Moved amount_t::right_justify to simply ::justify
Diffstat (limited to 'src/value.cc')
-rw-r--r--src/value.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/value.cc b/src/value.cc
index 3a8d1f14..96fb6647 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -30,6 +30,7 @@
*/
#include "value.h"
+#include "unistring.h"
namespace ledger {
@@ -1253,8 +1254,11 @@ void value_t::print(std::ostream& out,
const int latter_width,
const optional<string>& date_format) const
{
- if (first_width > 0 && ! is_amount() && ! is_balance())
+ if (first_width > 0 &&
+ ! is_amount() && ! is_balance() && ! is_string()) {
out.width(first_width);
+ out << std::left;
+ }
switch (type()) {
case VOID:
@@ -1283,15 +1287,18 @@ void value_t::print(std::ostream& out,
out << as_long();
break;
- case AMOUNT:
+ case AMOUNT: {
+ std::ostringstream buf;
if (as_amount().is_zero())
- out << 0L;
+ buf << 0L;
else
- as_amount().right_justify(out, first_width);
+ buf << as_amount();
+ justify(out, buf.str(), first_width, true);
break;
+ }
case STRING:
- out << as_string();
+ justify(out, as_string(), first_width);
break;
case MASK: