summaryrefslogtreecommitdiff
path: root/walk.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-08-15 17:08:56 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-08-15 17:08:56 -0400
commit7189b181ef3e0da74d992da87771fa26399391bc (patch)
tree3c6b677a54161fb63cb169c93d9eade0b316b4da /walk.h
parent78c44b5e795a98baacfbc56943b784370956cbca (diff)
downloadfork-ledger-7189b181ef3e0da74d992da87771fa26399391bc.tar.gz
fork-ledger-7189b181ef3e0da74d992da87771fa26399391bc.tar.bz2
fork-ledger-7189b181ef3e0da74d992da87771fa26399391bc.zip
further restructuring
Diffstat (limited to 'walk.h')
-rw-r--r--walk.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/walk.h b/walk.h
index 6289c681..af0661be 100644
--- a/walk.h
+++ b/walk.h
@@ -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);