diff options
author | John Wiegley <johnw@newartisans.com> | 2004-08-15 17:08:56 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-08-15 17:08:56 -0400 |
commit | 7189b181ef3e0da74d992da87771fa26399391bc (patch) | |
tree | 3c6b677a54161fb63cb169c93d9eade0b316b4da /walk.h | |
parent | 78c44b5e795a98baacfbc56943b784370956cbca (diff) | |
download | fork-ledger-7189b181ef3e0da74d992da87771fa26399391bc.tar.gz fork-ledger-7189b181ef3e0da74d992da87771fa26399391bc.tar.bz2 fork-ledger-7189b181ef3e0da74d992da87771fa26399391bc.zip |
further restructuring
Diffstat (limited to 'walk.h')
-rw-r--r-- | walk.h | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -22,12 +22,14 @@ struct item_handler { virtual void close() { flush(); if (handler) { - handler->flush(); delete handler; handler = NULL; } } - virtual void flush() {} + virtual void flush() { + if (handler) + handler->flush(); + } virtual void operator()(T * item) = 0; }; @@ -188,9 +190,7 @@ class collapse_transactions : public item_handler<transaction_t> virtual ~collapse_transactions() { close(); - delete totals_account; - for (transactions_deque::iterator i = xact_temps.begin(); i != xact_temps.end(); i++) @@ -200,6 +200,7 @@ class collapse_transactions : public item_handler<transaction_t> virtual void flush() { if (subtotal) report_cumulative_subtotal(); + item_handler<transaction_t>::flush(); } void report_cumulative_subtotal(); @@ -251,6 +252,7 @@ class changed_value_transactions : public item_handler<transaction_t> virtual void flush() { (*this)(NULL); + item_handler<transaction_t>::flush(); } virtual void operator()(transaction_t * xact); @@ -286,7 +288,11 @@ class subtotal_transactions : public item_handler<transaction_t> delete *i; } - virtual void flush(const char * spec_fmt = NULL); + void flush(const char * spec_fmt); + + virtual void flush() { + flush(NULL); + } virtual void operator()(transaction_t * xact); }; @@ -320,7 +326,6 @@ class dow_transactions : public subtotal_transactions : subtotal_transactions(handler) {} virtual void flush(); - virtual void operator()(transaction_t * xact) { struct std::tm * desc = std::gmtime(&xact->entry->date); days_of_the_week[desc->tm_wday].push_back(xact); |