diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-17 04:49:10 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-17 04:49:10 -0400 |
commit | ce8442a30dc3bb2fb52ec250028b46354d17cbca (patch) | |
tree | 837acb6d1a229c62b721f31f88d827f709c4a798 /src/account.h | |
parent | 7dc6e6f109ae2f48ad6253888f8065f6a0af1e43 (diff) | |
download | fork-ledger-ce8442a30dc3bb2fb52ec250028b46354d17cbca.tar.gz fork-ledger-ce8442a30dc3bb2fb52ec250028b46354d17cbca.tar.bz2 fork-ledger-ce8442a30dc3bb2fb52ec250028b46354d17cbca.zip |
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.
Diffstat (limited to 'src/account.h')
-rw-r--r-- | src/account.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/account.h b/src/account.h index dfa6eba5..bd0210db 100644 --- a/src/account.h +++ b/src/account.h @@ -122,19 +122,18 @@ class account_t : public scope_t #define ACCOUNT_EXT_SORT_CALC 0x02 #define ACCOUNT_EXT_HAS_NON_VIRTUALS 0x04 #define ACCOUNT_EXT_HAS_UNB_VIRTUALS 0x08 +#define ACCOUNT_EXT_VISITED 0x10 +#define ACCOUNT_EXT_MATCHING 0x20 value_t value; value_t total; std::size_t count; // xacts counted toward amount std::size_t total_count; // xacts counted toward total std::size_t virtuals; - uint_least8_t dflags; std::list<sort_value_t> sort_values; - xdata_t() - : supports_flags<>(), count(0), total_count(0), - virtuals(0), dflags(0) + xdata_t() : supports_flags<>(), count(0), total_count(0), virtuals(0) { TRACE_CTOR(account_t::xdata_t, ""); } @@ -145,7 +144,6 @@ class account_t : public scope_t count(other.count), total_count(other.total_count), virtuals(other.virtuals), - dflags(other.dflags), sort_values(other.sort_values) { TRACE_CTOR(account_t::xdata_t, "copy"); @@ -178,6 +176,11 @@ class account_t : public scope_t return *xdata_; } + bool has_flags(xdata_t::flags_t flags) const { + return xdata_ && xdata_->has_flags(flags); + } + std::size_t children_with_flags(xdata_t::flags_t flags) const; + void calculate_sums(expr_t& amount_expr); }; |