From ce8442a30dc3bb2fb52ec250028b46354d17cbca Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 17 Feb 2009 04:49:10 -0400 Subject: Rewrote how the balance command displays accounts The previous method bent over backwards to try and avoid multiple passes through the account tree, but the result was a horribly complicated mess that never ceased to dredge up obscure bugs. The new scheme is a very, very simple two-pass algorithm, with multiple subpasses during the second pass for refining the output based on the report options. --- src/output.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/output.h') diff --git a/src/output.h b/src/output.h index d62a77b1..6952a4a5 100644 --- a/src/output.h +++ b/src/output.h @@ -165,9 +165,6 @@ protected: item_predicate disp_pred; bool print_final_total; - bool disp_subaccounts_p(account_t& account, account_t *& to_show); - bool display_account(account_t& account); - public: format_accounts(report_t& _report, const string& _format = "", @@ -176,14 +173,20 @@ public: print_final_total(_print_final_total) { TRACE_CTOR(format_accounts, "report&, const string&, const bool"); + + if (report.HANDLED(display_)) { + DEBUG("account.display", + "Account display predicate: " << report.HANDLER(display_).str()); + disp_pred.predicate.parse(report.HANDLER(display_).str()); + } } virtual ~format_accounts() { TRACE_DTOR(format_accounts); } - bool should_display(account_t& account); - + virtual void post_accounts(account_t& account); virtual void flush(); + virtual void operator()(account_t& account); }; @@ -207,7 +210,7 @@ class format_equity : public format_accounts } virtual void flush(); - virtual void operator()(account_t& account); + virtual void post_accounts(account_t& account); }; } // namespace ledger -- cgit v1.2.3