diff options
author | John Wiegley <johnw@newartisans.com> | 2012-03-09 03:51:53 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-03-09 03:51:53 -0600 |
commit | 59f5ebe2dfe7cc93e36377f0251691e4de7b83b4 (patch) | |
tree | 479d00fc71f4c7c12cc6f37c01ab579e2119effb /src/print.cc | |
parent | ef478079e7836a9817992a8f8982b40ce97eef55 (diff) | |
download | fork-ledger-59f5ebe2dfe7cc93e36377f0251691e4de7b83b4.tar.gz fork-ledger-59f5ebe2dfe7cc93e36377f0251691e4de7b83b4.tar.bz2 fork-ledger-59f5ebe2dfe7cc93e36377f0251691e4de7b83b4.zip |
Reworked the way that options are handled
Diffstat (limited to 'src/print.cc')
-rw-r--r-- | src/print.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/print.cc b/src/print.cc index c544c4e0..9e52ce95 100644 --- a/src/print.cc +++ b/src/print.cc @@ -133,7 +133,7 @@ namespace { std::size_t columns = (report.HANDLED(columns_) ? - static_cast<std::size_t>(report.HANDLER(columns_).value.to_long()) : 80); + lexical_cast<std::size_t>(report.HANDLER(columns_).str()) : 80); if (xact.note) print_note(out, *xact.note, xact.has_flags(ITEM_NOTE_ON_NEXT_LINE), @@ -191,8 +191,8 @@ namespace { unistring name(pbuf.str()); std::size_t account_width = - (report.HANDLER(account_width_).specified ? - static_cast<std::size_t>(report.HANDLER(account_width_).value.to_long()) : 36); + (report.HANDLED(account_width_) ? + lexical_cast<std::size_t>(report.HANDLER(account_width_).str()) : 36); if (account_width < name.length()) account_width = name.length(); @@ -218,13 +218,14 @@ namespace { // first. } else { - int amount_width = - (report.HANDLER(amount_width_).specified ? - report.HANDLER(amount_width_).value.to_int() : 12); + std::size_t amount_width = + (report.HANDLED(amount_width_) ? + lexical_cast<std::size_t>(report.HANDLER(amount_width_).str()) : + 12); std::ostringstream amt_str; - value_t(post->amount).print(amt_str, amount_width, -1, - AMOUNT_PRINT_RIGHT_JUSTIFY | + value_t(post->amount).print(amt_str, static_cast<int>(amount_width), + -1, AMOUNT_PRINT_RIGHT_JUSTIFY | AMOUNT_PRINT_NO_COMPUTED_ANNOTATIONS); amt = amt_str.str(); } |