diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-21 15:19:42 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-21 15:19:42 -0500 |
commit | f01fa1a5131c287a4efe2708ffe3c9bc57b79468 (patch) | |
tree | 2a2f732edd59c4f42c1eb3e9a9e95ff135091bab /src/value.cc | |
parent | 117dddabd4f883de4f464821f9567d889a6fa449 (diff) | |
parent | acb24d6d22e19d4f6b3883c029dd9fef5c1c9529 (diff) | |
download | fork-ledger-f01fa1a5131c287a4efe2708ffe3c9bc57b79468.tar.gz fork-ledger-f01fa1a5131c287a4efe2708ffe3c9bc57b79468.tar.bz2 fork-ledger-f01fa1a5131c287a4efe2708ffe3c9bc57b79468.zip |
Merge branch 'next'
Diffstat (limited to 'src/value.cc')
-rw-r--r-- | src/value.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/value.cc b/src/value.cc index e2e748f4..cce4c4e8 100644 --- a/src/value.cc +++ b/src/value.cc @@ -1114,18 +1114,18 @@ void value_t::in_place_cast(type_t cast_type) break; } - case BALANCE: + case BALANCE: { + const balance_t& bal(as_balance()); switch (cast_type) { case AMOUNT: { - const balance_t& temp(as_balance()); - if (temp.amounts.size() == 1) { + if (bal.amounts.size() == 1) { // Because we are changing the current balance value to an amount // value, and because set_amount takes a reference (and that memory is // about to be repurposed), we must pass in a copy. - set_amount(amount_t((*temp.amounts.begin()).second)); + set_amount(amount_t((*bal.amounts.begin()).second)); return; } - else if (temp.amounts.size() == 0) { + else if (bal.amounts.size() == 0) { set_amount(0L); return; } @@ -1135,10 +1135,17 @@ void value_t::in_place_cast(type_t cast_type) } break; } + case STRING: + if (bal.is_empty()) + set_string(""); + else + set_string(as_balance().to_string()); + return; default: break; } break; + } case STRING: switch (cast_type) { |