summaryrefslogtreecommitdiff
path: root/src/filters.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-02-28 02:34:37 -0600
committerJohn Wiegley <johnw@newartisans.com>2012-02-28 02:34:37 -0600
commit6adfcc8469e3d526f4bcb0971b49efb490ad6401 (patch)
tree4185b2ebbd668b7ded2808a9cd8a5edccf39d8bc /src/filters.h
parent887f429ae40934c145e03b03cc452e6af4457c0f (diff)
downloadfork-ledger-6adfcc8469e3d526f4bcb0971b49efb490ad6401.tar.gz
fork-ledger-6adfcc8469e3d526f4bcb0971b49efb490ad6401.tar.bz2
fork-ledger-6adfcc8469e3d526f4bcb0971b49efb490ad6401.zip
Rewrite the way interval reports are generated
Diffstat (limited to 'src/filters.h')
-rw-r--r--src/filters.h38
1 files changed, 10 insertions, 28 deletions
diff --git a/src/filters.h b/src/filters.h
index 2e51c91c..c972de82 100644
--- a/src/filters.h
+++ b/src/filters.h
@@ -655,11 +655,11 @@ protected:
typedef std::pair<string, acct_value_t> values_pair;
protected:
- expr_t& amount_expr;
- values_map values;
- optional<string> date_format;
- temporaries_t temps;
- std::list<post_t *> component_posts;
+ expr_t& amount_expr;
+ values_map values;
+ optional<string> date_format;
+ temporaries_t temps;
+ std::deque<post_t *> component_posts;
public:
subtotal_posts(post_handler_ptr handler, expr_t& _amount_expr,
@@ -697,12 +697,12 @@ class interval_posts : public subtotal_posts
{
date_interval_t start_interval;
date_interval_t interval;
- date_interval_t last_interval;
- post_t * last_post;
account_t * empty_account;
bool exact_periods;
bool generate_empty_posts;
+ std::deque<post_t *> all_posts;
+
interval_posts();
public:
@@ -713,8 +713,7 @@ public:
bool _exact_periods = false,
bool _generate_empty_posts = false)
: subtotal_posts(_handler, amount_expr), start_interval(_interval),
- interval(start_interval), last_post(NULL),
- exact_periods(_exact_periods),
+ interval(start_interval), exact_periods(_exact_periods),
generate_empty_posts(_generate_empty_posts) {
TRACE_CTOR(interval_posts,
"post_handler_ptr, expr_t&, date_interval_t, bool, bool");
@@ -744,28 +743,11 @@ public:
}
#endif
- virtual void flush() {
- if (last_post && interval.duration) {
- DEBUG("filters.interval", "There is a last_post and an interval.duration");
- if (interval != last_interval) {
-#if defined(DEBUG_ON)
- DEBUG("filters.interval", "interval != last_interval, so reporting");
- DEBUG("filters.interval", "interval is:");
- debug_interval(interval);
- DEBUG("filters.interval", "last_interval is:");
- debug_interval(last_interval);
-#endif
- report_subtotal(last_interval);
- }
- subtotal_posts::flush();
- }
- }
virtual void operator()(post_t& post);
+ virtual void flush();
virtual void clear() {
- interval = start_interval;
- last_interval = date_interval_t();
- last_post = NULL;
+ interval = start_interval;
subtotal_posts::clear();
create_accounts();