diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-04 02:23:04 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-04 02:23:04 -0400 |
commit | 946534b102da5bd9bc1e26e1c0f3869dc81457d7 (patch) | |
tree | 8792bf4c369e0e050ae7f80ba23c32bf9b14050a | |
parent | 45451125e329f47314e24b34425f6da3aab920cd (diff) | |
download | fork-ledger-946534b102da5bd9bc1e26e1c0f3869dc81457d7.tar.gz fork-ledger-946534b102da5bd9bc1e26e1c0f3869dc81457d7.tar.bz2 fork-ledger-946534b102da5bd9bc1e26e1c0f3869dc81457d7.zip |
A little bit of code cleanup
-rw-r--r-- | src/amount.h | 3 | ||||
-rw-r--r-- | src/commodity.h | 1 | ||||
-rw-r--r-- | src/report.cc | 30 | ||||
-rw-r--r-- | src/session.h | 1 | ||||
-rw-r--r-- | test/regress/25A099C9.test | 14 |
5 files changed, 29 insertions, 20 deletions
diff --git a/src/amount.h b/src/amount.h index 1ac4b37e..49f33417 100644 --- a/src/amount.h +++ b/src/amount.h @@ -62,7 +62,6 @@ namespace ledger { class commodity_t; class annotation_t; class keep_details_t; -class commodity_pool_t; DECLARE_EXCEPTION(amount_error, std::runtime_error); @@ -514,7 +513,7 @@ public: amount's commodity: commodity() returns an amount's commodity. If the amount has no - commodity, the value returned is `current_pool->null_commodity'. + commodity, the value returned is the `null_commodity'. has_commodity() returns true if the amount has a commodity. diff --git a/src/commodity.h b/src/commodity.h index 53e3033f..05dc3395 100644 --- a/src/commodity.h +++ b/src/commodity.h @@ -50,6 +50,7 @@ namespace ledger { class keep_details_t; +class commodity_pool_t; DECLARE_EXCEPTION(commodity_error, std::runtime_error); diff --git a/src/report.cc b/src/report.cc index cc652f8d..81234b0f 100644 --- a/src/report.cc +++ b/src/report.cc @@ -1318,9 +1318,10 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind, case symbol_t::COMMAND: switch (*p) { case 'a': - if (is_eq(p, "accounts")) + if (is_eq(p, "accounts")) { return WRAP_FUNCTOR(reporter<>(new report_accounts(*this), *this, "#accounts")); + } break; case 'b': @@ -1381,48 +1382,57 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind, HANDLER(print_virtual).on_only(string("#equity")); return WRAP_FUNCTOR(reporter<>(new print_xacts(*this), *this, "#equity")); } - else if (is_eq(p, "entry")) + else if (is_eq(p, "entry")) { return WRAP_FUNCTOR(xact_command); - else if (is_eq(p, "emacs")) + } + else if (is_eq(p, "emacs")) { return WRAP_FUNCTOR (reporter<>(new format_emacs_posts(output_stream), *this, "#emacs")); - else if (is_eq(p, "echo")) + } + else if (is_eq(p, "echo")) { return MAKE_FUNCTOR(report_t::echo_command); + } break; case 'p': - if (*(p + 1) == '\0' || is_eq(p, "print")) + if (*(p + 1) == '\0' || is_eq(p, "print")) { return WRAP_FUNCTOR (reporter<>(new print_xacts(*this, HANDLED(raw)), *this, "#print")); - else if (is_eq(p, "prices")) + } + else if (is_eq(p, "prices")) { return expr_t::op_t::wrap_functor (reporter<post_t, post_handler_ptr, &report_t::commodities_report> (new format_posts(*this, report_format(HANDLER(prices_format_)), maybe_format(HANDLER(prepend_format_)), HANDLER(prepend_width_).value.to_long()), *this, "#prices")); - else if (is_eq(p, "pricedb")) + } + else if (is_eq(p, "pricedb")) { return expr_t::op_t::wrap_functor (reporter<post_t, post_handler_ptr, &report_t::commodities_report> (new format_posts(*this, report_format(HANDLER(pricedb_format_)), maybe_format(HANDLER(prepend_format_)), HANDLER(prepend_width_).value.to_long()), *this, "#pricedb")); - else if (is_eq(p, "payees")) + } + else if (is_eq(p, "payees")) { return WRAP_FUNCTOR(reporter<>(new report_payees(*this), *this, "#payees")); + } break; case 'r': - if (*(p + 1) == '\0' || is_eq(p, "reg") || is_eq(p, "register")) + if (*(p + 1) == '\0' || is_eq(p, "reg") || is_eq(p, "register")) { return WRAP_FUNCTOR (reporter<> (new format_posts(*this, report_format(HANDLER(register_format_)), maybe_format(HANDLER(prepend_format_)), HANDLER(prepend_width_).value.to_long()), *this, "#register")); - else if (is_eq(p, "reload")) + } + else if (is_eq(p, "reload")) { return MAKE_FUNCTOR(report_t::reload_command); + } break; case 's': diff --git a/src/session.h b/src/session.h index 10f636bb..3916b964 100644 --- a/src/session.h +++ b/src/session.h @@ -50,7 +50,6 @@ namespace ledger { -class commodity_pool_t; class xact_t; class session_t : public symbol_scope_t diff --git a/test/regress/25A099C9.test b/test/regress/25A099C9.test index 604939d8..251b0f24 100644 --- a/test/regress/25A099C9.test +++ b/test/regress/25A099C9.test @@ -2,18 +2,18 @@ <<< >>>1 >>>2 -While parsing file "$sourcepath/src/amount.h", line 67: +While parsing file "$sourcepath/src/amount.h", line 66: Error: No quantity specified for amount -While parsing file "$sourcepath/src/amount.h", line 721: +While parsing file "$sourcepath/src/amount.h", line 720: Error: Invalid date/time: line amount_t amoun -While parsing file "$sourcepath/src/amount.h", line 727: +While parsing file "$sourcepath/src/amount.h", line 726: Error: Invalid date/time: line string amount_ -While parsing file "$sourcepath/src/amount.h", line 733: +While parsing file "$sourcepath/src/amount.h", line 732: Error: Invalid date/time: line string amount_ -While parsing file "$sourcepath/src/amount.h", line 739: +While parsing file "$sourcepath/src/amount.h", line 738: Error: Invalid date/time: line string amount_ -While parsing file "$sourcepath/src/amount.h", line 745: +While parsing file "$sourcepath/src/amount.h", line 744: Error: Invalid date/time: line std::ostream& -While parsing file "$sourcepath/src/amount.h", line 752: +While parsing file "$sourcepath/src/amount.h", line 751: Error: Invalid date/time: line std::istream& === 7 |