diff options
Diffstat (limited to 'src/filters.h')
-rw-r--r-- | src/filters.h | 510 |
1 files changed, 255 insertions, 255 deletions
diff --git a/src/filters.h b/src/filters.h index 3a8a5ab5..a2ab5aec 100644 --- a/src/filters.h +++ b/src/filters.h @@ -48,15 +48,15 @@ #include "chain.h" #include "predicate.h" -#include "entry.h" #include "xact.h" +#include "post.h" #include "account.h" namespace ledger { ////////////////////////////////////////////////////////////////////// // -// Transaction filters +// Posting filters // /** @@ -64,10 +64,10 @@ namespace ledger { * * Long. */ -class ignore_xacts : public item_handler<xact_t> +class ignore_posts : public item_handler<post_t> { public: - virtual void operator()(xact_t&) {} + virtual void operator()(post_t&) {} }; /** @@ -75,30 +75,30 @@ public: * * Long. */ -class clear_xact_xdata : public item_handler<xact_t> +class clear_post_xdata : public item_handler<post_t> { public: - virtual void operator()(xact_t& xact) { - xact.clear_xdata(); + virtual void operator()(post_t& post) { + post.clear_xdata(); } }; -class xacts_iterator; +class posts_iterator; /** * @brief Brief * * Long. */ -class pass_down_xacts : public item_handler<xact_t> +class pass_down_posts : public item_handler<post_t> { - pass_down_xacts(); + pass_down_posts(); public: - pass_down_xacts(xact_handler_ptr handler, xacts_iterator& iter); + pass_down_posts(post_handler_ptr handler, posts_iterator& iter); - virtual ~pass_down_xacts() { - TRACE_DTOR(pass_down_xacts); + virtual ~pass_down_posts() { + TRACE_DTOR(pass_down_posts); } }; @@ -107,22 +107,22 @@ public: * * Long. */ -class push_to_xacts_list : public item_handler<xact_t> +class push_to_posts_list : public item_handler<post_t> { - push_to_xacts_list(); + push_to_posts_list(); public: - xacts_list& xacts; + posts_list& posts; - push_to_xacts_list(xacts_list& _xacts) : xacts(_xacts) { - TRACE_CTOR(push_to_xacts_list, "xacts_list&"); + push_to_posts_list(posts_list& _posts) : posts(_posts) { + TRACE_CTOR(push_to_posts_list, "posts_list&"); } - virtual ~push_to_xacts_list() { - TRACE_DTOR(push_to_xacts_list); + virtual ~push_to_posts_list() { + TRACE_DTOR(push_to_posts_list); } - virtual void operator()(xact_t& xact) { - xacts.push_back(&xact); + virtual void operator()(post_t& post) { + posts.push_back(&post); } }; @@ -131,32 +131,32 @@ public: * * Long. */ -class truncate_entries : public item_handler<xact_t> +class truncate_xacts : public item_handler<post_t> { int head_count; int tail_count; - xacts_list xacts; + posts_list posts; - truncate_entries(); + truncate_xacts(); public: - truncate_entries(xact_handler_ptr handler, + truncate_xacts(post_handler_ptr handler, int _head_count, int _tail_count) - : item_handler<xact_t>(handler), + : item_handler<post_t>(handler), head_count(_head_count), tail_count(_tail_count) { - TRACE_CTOR(truncate_entries, "xact_handler_ptr, int, int"); + TRACE_CTOR(truncate_xacts, "post_handler_ptr, int, int"); } - virtual ~truncate_entries() { - TRACE_DTOR(truncate_entries); + virtual ~truncate_xacts() { + TRACE_DTOR(truncate_xacts); } virtual void flush(); - virtual void operator()(xact_t& xact) { + virtual void operator()(post_t& post) { if (! (tail_count == 0 && head_count > 0 && - static_cast<int>(xacts.size()) >= head_count)) - xacts.push_back(&xact); + static_cast<int>(posts.size()) >= head_count)) + posts.push_back(&post); } }; @@ -165,15 +165,15 @@ public: * * Long. */ -class set_account_value : public item_handler<xact_t> +class set_account_value : public item_handler<post_t> { expr_t& amount_expr; public: set_account_value(expr_t& _amount_expr) - : item_handler<xact_t>(), amount_expr(_amount_expr) {} + : item_handler<post_t>(), amount_expr(_amount_expr) {} - virtual void operator()(xact_t& xact); + virtual void operator()(post_t& post); }; /** @@ -181,43 +181,43 @@ public: * * Long. */ -class sort_xacts : public item_handler<xact_t> +class sort_posts : public item_handler<post_t> { - typedef std::deque<xact_t *> xacts_deque; + typedef std::deque<post_t *> posts_deque; - xacts_deque xacts; + posts_deque posts; const expr_t sort_order; - sort_xacts(); + sort_posts(); public: - sort_xacts(xact_handler_ptr handler, + sort_posts(post_handler_ptr handler, const expr_t& _sort_order) - : item_handler<xact_t>(handler), + : item_handler<post_t>(handler), sort_order(_sort_order) { - TRACE_CTOR(sort_xacts, - "xact_handler_ptr, const value_expr&"); + TRACE_CTOR(sort_posts, + "post_handler_ptr, const value_expr&"); } - sort_xacts(xact_handler_ptr handler, + sort_posts(post_handler_ptr handler, const string& _sort_order) - : item_handler<xact_t>(handler), + : item_handler<post_t>(handler), sort_order(_sort_order) { - TRACE_CTOR(sort_xacts, - "xact_handler_ptr, const string&"); + TRACE_CTOR(sort_posts, + "post_handler_ptr, const string&"); } - virtual ~sort_xacts() { - TRACE_DTOR(sort_xacts); + virtual ~sort_posts() { + TRACE_DTOR(sort_posts); } - virtual void post_accumulated_xacts(); + virtual void post_accumulated_posts(); virtual void flush() { - post_accumulated_xacts(); - item_handler<xact_t>::flush(); + post_accumulated_posts(); + item_handler<post_t>::flush(); } - virtual void operator()(xact_t& xact) { - xacts.push_back(&xact); + virtual void operator()(post_t& post) { + posts.push_back(&post); } }; @@ -226,42 +226,42 @@ public: * * Long. */ -class sort_entries : public item_handler<xact_t> +class sort_xacts : public item_handler<post_t> { - sort_xacts sorter; - entry_t * last_entry; + sort_posts sorter; + xact_t * last_xact; - sort_entries(); + sort_xacts(); public: - sort_entries(xact_handler_ptr handler, + sort_xacts(post_handler_ptr handler, const expr_t& _sort_order) : sorter(handler, _sort_order) { - TRACE_CTOR(sort_entries, - "xact_handler_ptr, const value_expr&"); + TRACE_CTOR(sort_xacts, + "post_handler_ptr, const value_expr&"); } - sort_entries(xact_handler_ptr handler, + sort_xacts(post_handler_ptr handler, const string& _sort_order) : sorter(handler, _sort_order) { - TRACE_CTOR(sort_entries, - "xact_handler_ptr, const string&"); + TRACE_CTOR(sort_xacts, + "post_handler_ptr, const string&"); } - virtual ~sort_entries() { - TRACE_DTOR(sort_entries); + virtual ~sort_xacts() { + TRACE_DTOR(sort_xacts); } virtual void flush() { sorter.flush(); - item_handler<xact_t>::flush(); + item_handler<post_t>::flush(); } - virtual void operator()(xact_t& xact) { - if (last_entry && xact.entry != last_entry) - sorter.post_accumulated_xacts(); + virtual void operator()(post_t& post) { + if (last_xact && post.xact != last_xact) + sorter.post_accumulated_posts(); - sorter(xact); + sorter(post); - last_entry = xact.entry; + last_xact = post.xact; } }; @@ -270,37 +270,37 @@ public: * * Long. */ -class filter_xacts : public item_handler<xact_t> +class filter_posts : public item_handler<post_t> { item_predicate pred; scope_t& context; - filter_xacts(); + filter_posts(); public: - filter_xacts(xact_handler_ptr handler, + filter_posts(post_handler_ptr handler, const item_predicate& predicate, scope_t& _context) - : item_handler<xact_t>(handler), pred(predicate), context(_context) { - TRACE_CTOR(filter_xacts, - "xact_handler_ptr, const item_predicate&, scope_t&"); + : item_handler<post_t>(handler), pred(predicate), context(_context) { + TRACE_CTOR(filter_posts, + "post_handler_ptr, const item_predicate&, scope_t&"); } - virtual ~filter_xacts() { - TRACE_DTOR(filter_xacts); + virtual ~filter_posts() { + TRACE_DTOR(filter_posts); } - virtual void operator()(xact_t& xact) { - bind_scope_t bound_scope(context, xact); + virtual void operator()(post_t& post) { + bind_scope_t bound_scope(context, post); if (pred(bound_scope)) { - xact.xdata().add_flags(XACT_EXT_MATCHES); - (*handler)(xact); + post.xdata().add_flags(POST_EXT_MATCHES); + (*handler)(post); } } }; -inline void clear_entries_xacts(std::list<entry_t>& entries_list) { - foreach (entry_t& entry, entries_list) - entry.xacts.clear(); +inline void clear_xacts_posts(std::list<xact_t>& xacts_list) { + foreach (xact_t& xact, xacts_list) + xact.posts.clear(); } /** @@ -308,26 +308,26 @@ inline void clear_entries_xacts(std::list<entry_t>& entries_list) { * * Long. */ -class anonymize_xacts : public item_handler<xact_t> +class anonymize_posts : public item_handler<post_t> { - std::list<entry_t> entry_temps; - std::list<xact_t> xact_temps; + std::list<xact_t> xact_temps; + std::list<post_t> post_temps; - entry_t * last_entry; + xact_t * last_xact; - anonymize_xacts(); + anonymize_posts(); public: - anonymize_xacts(xact_handler_ptr handler) - : item_handler<xact_t>(handler), last_entry(NULL) { - TRACE_CTOR(anonymize_xacts, "xact_handler_ptr"); + anonymize_posts(post_handler_ptr handler) + : item_handler<post_t>(handler), last_xact(NULL) { + TRACE_CTOR(anonymize_posts, "post_handler_ptr"); } - virtual ~anonymize_xacts() { - TRACE_DTOR(anonymize_xacts); - clear_entries_xacts(entry_temps); + virtual ~anonymize_posts() { + TRACE_DTOR(anonymize_posts); + clear_xacts_posts(xact_temps); } - virtual void operator()(xact_t& xact); + virtual void operator()(post_t& post); }; /** @@ -335,25 +335,25 @@ public: * * Long. */ -class calc_xacts : public item_handler<xact_t> +class calc_posts : public item_handler<post_t> { - xact_t * last_xact; + post_t * last_post; expr_t& amount_expr; - calc_xacts(); + calc_posts(); public: - calc_xacts(xact_handler_ptr handler, + calc_posts(post_handler_ptr handler, expr_t& _amount_expr) - : item_handler<xact_t>(handler), - last_xact(NULL), amount_expr(_amount_expr) { - TRACE_CTOR(calc_xacts, "xact_handler_ptr, expr_t&"); + : item_handler<post_t>(handler), + last_post(NULL), amount_expr(_amount_expr) { + TRACE_CTOR(calc_posts, "post_handler_ptr, expr_t&"); } - virtual ~calc_xacts() { - TRACE_DTOR(calc_xacts); + virtual ~calc_posts() { + TRACE_DTOR(calc_posts); } - virtual void operator()(xact_t& xact); + virtual void operator()(post_t& post); }; /** @@ -361,51 +361,51 @@ public: * * Long. */ -class collapse_xacts : public item_handler<xact_t> +class collapse_posts : public item_handler<post_t> { expr_t& amount_expr; item_predicate display_predicate; item_predicate only_predicate; value_t subtotal; std::size_t count; - entry_t * last_entry; xact_t * last_xact; + post_t * last_post; account_t totals_account; bool only_collapse_if_zero; - std::list<entry_t> entry_temps; - std::list<xact_t> xact_temps; - std::list<xact_t *> component_xacts; + std::list<xact_t> xact_temps; + std::list<post_t> post_temps; + std::list<post_t *> component_posts; - collapse_xacts(); + collapse_posts(); public: - collapse_xacts(xact_handler_ptr handler, + collapse_posts(post_handler_ptr handler, expr_t& _amount_expr, item_predicate _display_predicate, item_predicate _only_predicate, bool _only_collapse_if_zero = false) - : item_handler<xact_t>(handler), amount_expr(_amount_expr), + : item_handler<post_t>(handler), amount_expr(_amount_expr), display_predicate(_display_predicate), only_predicate(_only_predicate), count(0), - last_entry(NULL), last_xact(NULL), + last_xact(NULL), last_post(NULL), totals_account(NULL, "<Total>"), only_collapse_if_zero(_only_collapse_if_zero) { - TRACE_CTOR(collapse_xacts, "xact_handler_ptr"); + TRACE_CTOR(collapse_posts, "post_handler_ptr"); } - virtual ~collapse_xacts() { - TRACE_DTOR(collapse_xacts); - clear_entries_xacts(entry_temps); + virtual ~collapse_posts() { + TRACE_DTOR(collapse_posts); + clear_xacts_posts(xact_temps); } virtual void flush() { report_subtotal(); - item_handler<xact_t>::flush(); + item_handler<post_t>::flush(); } void report_subtotal(); - virtual void operator()(xact_t& xact); + virtual void operator()(post_t& post); }; /** @@ -413,29 +413,29 @@ public: * * Long. */ -class related_xacts : public item_handler<xact_t> +class related_posts : public item_handler<post_t> { - xacts_list xacts; + posts_list posts; bool also_matching; - related_xacts(); + related_posts(); public: - related_xacts(xact_handler_ptr handler, + related_posts(post_handler_ptr handler, const bool _also_matching = false) - : item_handler<xact_t>(handler), + : item_handler<post_t>(handler), also_matching(_also_matching) { - TRACE_CTOR(related_xacts, - "xact_handler_ptr, const bool"); + TRACE_CTOR(related_posts, + "post_handler_ptr, const bool"); } - virtual ~related_xacts() throw() { - TRACE_DTOR(related_xacts); + virtual ~related_posts() throw() { + TRACE_DTOR(related_posts); } virtual void flush(); - virtual void operator()(xact_t& xact) { - xact.xdata().add_flags(XACT_EXT_RECEIVED); - xacts.push_back(&xact); + virtual void operator()(post_t& post) { + post.xdata().add_flags(POST_EXT_RECEIVED); + posts.push_back(&post); } }; @@ -444,50 +444,50 @@ public: * * Long. */ -class changed_value_xacts : public item_handler<xact_t> +class changed_value_posts : public item_handler<post_t> { - // This filter requires that calc_xacts be used at some point + // This filter requires that calc_posts be used at some point // later in the chain. expr_t total_expr; report_t& report; bool changed_values_only; - xact_t * last_xact; + post_t * last_post; value_t last_balance; account_t revalued_account; - std::list<entry_t> entry_temps; - std::list<xact_t> xact_temps; + std::list<xact_t> xact_temps; + std::list<post_t> post_temps; - changed_value_xacts(); + changed_value_posts(); public: - changed_value_xacts(xact_handler_ptr handler, + changed_value_posts(post_handler_ptr handler, const expr_t& _total_expr, report_t& _report, bool _changed_values_only) - : item_handler<xact_t>(handler), total_expr(_total_expr), + : item_handler<post_t>(handler), total_expr(_total_expr), report(_report), changed_values_only(_changed_values_only), - last_xact(NULL), revalued_account(NULL, "<Revalued>") { - TRACE_CTOR(changed_value_xacts, - "xact_handler_ptr, const expr_t&, report_t&, bool"); + last_post(NULL), revalued_account(NULL, "<Revalued>") { + TRACE_CTOR(changed_value_posts, + "post_handler_ptr, const expr_t&, report_t&, bool"); } - virtual ~changed_value_xacts() { - TRACE_DTOR(changed_value_xacts); - clear_entries_xacts(entry_temps); + virtual ~changed_value_posts() { + TRACE_DTOR(changed_value_posts); + clear_xacts_posts(xact_temps); } virtual void flush() { - if (last_xact && last_xact->date() <= CURRENT_DATE()) { - output_diff(last_xact, CURRENT_DATE()); - last_xact = NULL; + if (last_post && last_post->date() <= CURRENT_DATE()) { + output_diff(last_post, CURRENT_DATE()); + last_post = NULL; } - item_handler<xact_t>::flush(); + item_handler<post_t>::flush(); } - void output_diff(xact_t * xact, const date_t& current); + void output_diff(post_t * post, const date_t& current); - virtual void operator()(xact_t& xact); + virtual void operator()(post_t& post); }; /** @@ -495,9 +495,9 @@ public: * * Long. */ -class subtotal_xacts : public item_handler<xact_t> +class subtotal_posts : public item_handler<post_t> { - subtotal_xacts(); + subtotal_posts(); protected: class acct_value_t @@ -530,21 +530,21 @@ protected: expr_t& amount_expr; values_map values; optional<string> date_format; - std::list<entry_t> entry_temps; - std::list<xact_t> xact_temps; - std::list<xact_t *> component_xacts; + std::list<xact_t> xact_temps; + std::list<post_t> post_temps; + std::list<post_t *> component_posts; public: - subtotal_xacts(xact_handler_ptr handler, expr_t& _amount_expr, + subtotal_posts(post_handler_ptr handler, expr_t& _amount_expr, const optional<string>& _date_format = none) - : item_handler<xact_t>(handler), amount_expr(_amount_expr), + : item_handler<post_t>(handler), amount_expr(_amount_expr), date_format(_date_format) { - TRACE_CTOR(subtotal_xacts, - "xact_handler_ptr, expr_t&, const optional<string>&"); + TRACE_CTOR(subtotal_posts, + "post_handler_ptr, expr_t&, const optional<string>&"); } - virtual ~subtotal_xacts() { - TRACE_DTOR(subtotal_xacts); - clear_entries_xacts(entry_temps); + virtual ~subtotal_posts() { + TRACE_DTOR(subtotal_posts); + clear_xacts_posts(xact_temps); } void report_subtotal(const char * spec_fmt = NULL, @@ -554,9 +554,9 @@ public: virtual void flush() { if (values.size() > 0) report_subtotal(); - item_handler<xact_t>::flush(); + item_handler<post_t>::flush(); } - virtual void operator()(xact_t& xact); + virtual void operator()(post_t& post); }; /** @@ -564,70 +564,70 @@ public: * * Long. */ -class interval_xacts : public subtotal_xacts +class interval_posts : public subtotal_posts { interval_t interval; - xact_t * last_xact; + post_t * last_post; account_t empty_account; bool exact_periods; - bool generate_empty_xacts; + bool generate_empty_posts; date_t start; - interval_xacts(); + interval_posts(); public: - interval_xacts(xact_handler_ptr _handler, + interval_posts(post_handler_ptr _handler, expr_t& amount_expr, const interval_t& _interval, bool _exact_periods = false, - bool _generate_empty_xacts = false) - : subtotal_xacts(_handler, amount_expr), interval(_interval), - last_xact(NULL), empty_account(NULL, "<None>"), + bool _generate_empty_posts = false) + : subtotal_posts(_handler, amount_expr), interval(_interval), + last_post(NULL), empty_account(NULL, "<None>"), exact_periods(_exact_periods), - generate_empty_xacts(_generate_empty_xacts) { - TRACE_CTOR(interval_xacts, - "xact_handler_ptr, expr_t&, interval_t, account_t *, bool, bool"); + generate_empty_posts(_generate_empty_posts) { + TRACE_CTOR(interval_posts, + "post_handler_ptr, expr_t&, interval_t, account_t *, bool, bool"); } - virtual ~interval_xacts() throw() { - TRACE_DTOR(interval_xacts); + virtual ~interval_posts() throw() { + TRACE_DTOR(interval_posts); } void report_subtotal(const date_t& finish); virtual void flush() { - if (last_xact && interval) + if (last_post && interval) report_subtotal(interval.increment(interval.begin) - gregorian::days(1)); - subtotal_xacts::flush(); + subtotal_posts::flush(); } - virtual void operator()(xact_t& xact); + virtual void operator()(post_t& post); }; -class xacts_as_equity : public subtotal_xacts +class posts_as_equity : public subtotal_posts { interval_t interval; - xact_t * last_xact; + post_t * last_post; account_t equity_account; account_t * balance_account; - xacts_as_equity(); + posts_as_equity(); public: - xacts_as_equity(xact_handler_ptr _handler, expr_t& amount_expr) - : subtotal_xacts(_handler, amount_expr), + posts_as_equity(post_handler_ptr _handler, expr_t& amount_expr) + : subtotal_posts(_handler, amount_expr), equity_account(NULL, "Equity") { - TRACE_CTOR(xacts_as_equity, "xact_handler_ptr, expr_t&"); + TRACE_CTOR(posts_as_equity, "post_handler_ptr, expr_t&"); balance_account = equity_account.find_account("Opening Balances"); } - virtual ~xacts_as_equity() throw() { - TRACE_DTOR(xacts_as_equity); + virtual ~posts_as_equity() throw() { + TRACE_DTOR(posts_as_equity); } void report_subtotal(); virtual void flush() { report_subtotal(); - subtotal_xacts::flush(); + subtotal_posts::flush(); } }; @@ -636,27 +636,27 @@ public: * * Long. */ -class by_payee_xacts : public item_handler<xact_t> +class by_payee_posts : public item_handler<post_t> { - typedef std::map<string, shared_ptr<subtotal_xacts> > payee_subtotals_map; - typedef std::pair<string, shared_ptr<subtotal_xacts> > payee_subtotals_pair; + typedef std::map<string, shared_ptr<subtotal_posts> > payee_subtotals_map; + typedef std::pair<string, shared_ptr<subtotal_posts> > payee_subtotals_pair; expr_t& amount_expr; payee_subtotals_map payee_subtotals; - by_payee_xacts(); + by_payee_posts(); public: - by_payee_xacts(xact_handler_ptr handler, expr_t& _amount_expr) - : item_handler<xact_t>(handler), amount_expr(_amount_expr) { - TRACE_CTOR(by_payee_xacts, "xact_handler_ptr, expr_t&"); + by_payee_posts(post_handler_ptr handler, expr_t& _amount_expr) + : item_handler<post_t>(handler), amount_expr(_amount_expr) { + TRACE_CTOR(by_payee_posts, "post_handler_ptr, expr_t&"); } - virtual ~by_payee_xacts() { - TRACE_DTOR(by_payee_xacts); + virtual ~by_payee_posts() { + TRACE_DTOR(by_payee_posts); } virtual void flush(); - virtual void operator()(xact_t& xact); + virtual void operator()(post_t& post); }; /** @@ -664,10 +664,10 @@ class by_payee_xacts : public item_handler<xact_t> * * Long. */ -class transfer_details : public item_handler<xact_t> +class transfer_details : public item_handler<post_t> { - std::list<entry_t> entry_temps; - std::list<xact_t> xact_temps; + std::list<xact_t> xact_temps; + std::list<post_t> post_temps; account_t * master; expr_t expr; scope_t& scope; @@ -680,22 +680,22 @@ public: SET_ACCOUNT } which_element; - transfer_details(xact_handler_ptr handler, + transfer_details(post_handler_ptr handler, element_t _which_element, account_t * _master, const expr_t& _expr, scope_t& _scope) - : item_handler<xact_t>(handler), master(_master), + : item_handler<post_t>(handler), master(_master), expr(_expr), scope(_scope), which_element(_which_element) { TRACE_CTOR(transfer_details, - "xact_handler_ptr, element_t, account_t *, expr_t, scope_t&"); + "post_handler_ptr, element_t, account_t *, expr_t, scope_t&"); } virtual ~transfer_details() { TRACE_DTOR(transfer_details); - clear_entries_xacts(entry_temps); + clear_xacts_posts(xact_temps); } - virtual void operator()(xact_t& xact); + virtual void operator()(post_t& post); }; /** @@ -703,24 +703,24 @@ public: * * Long. */ -class dow_xacts : public subtotal_xacts +class dow_posts : public subtotal_posts { - xacts_list days_of_the_week[7]; + posts_list days_of_the_week[7]; - dow_xacts(); + dow_posts(); public: - dow_xacts(xact_handler_ptr handler, expr_t& amount_expr) - : subtotal_xacts(handler, amount_expr) { - TRACE_CTOR(dow_xacts, "xact_handler_ptr, bool"); + dow_posts(post_handler_ptr handler, expr_t& amount_expr) + : subtotal_posts(handler, amount_expr) { + TRACE_CTOR(dow_posts, "post_handler_ptr, bool"); } - virtual ~dow_xacts() throw() { - TRACE_DTOR(dow_xacts); + virtual ~dow_posts() throw() { + TRACE_DTOR(dow_posts); } virtual void flush(); - virtual void operator()(xact_t& xact) { - days_of_the_week[xact.date().day_of_week()].push_back(&xact); + virtual void operator()(post_t& post) { + days_of_the_week[post.date().day_of_week()].push_back(&post); } }; @@ -729,32 +729,32 @@ public: * * Long. */ -class generate_xacts : public item_handler<xact_t> +class generate_posts : public item_handler<post_t> { - generate_xacts(); + generate_posts(); protected: - typedef std::pair<interval_t, xact_t *> pending_xacts_pair; - typedef std::list<pending_xacts_pair> pending_xacts_list; + typedef std::pair<interval_t, post_t *> pending_posts_pair; + typedef std::list<pending_posts_pair> pending_posts_list; - pending_xacts_list pending_xacts; - std::list<entry_t> entry_temps; - std::list<xact_t> xact_temps; + pending_posts_list pending_posts; + std::list<xact_t> xact_temps; + std::list<post_t> post_temps; public: - generate_xacts(xact_handler_ptr handler) - : item_handler<xact_t>(handler) { - TRACE_CTOR(generate_xacts, "xact_handler_ptr"); + generate_posts(post_handler_ptr handler) + : item_handler<post_t>(handler) { + TRACE_CTOR(generate_posts, "post_handler_ptr"); } - virtual ~generate_xacts() { - TRACE_DTOR(generate_xacts); - clear_entries_xacts(entry_temps); + virtual ~generate_posts() { + TRACE_DTOR(generate_posts); + clear_xacts_posts(xact_temps); } - void add_period_entries(period_entries_list& period_entries); + void add_period_xacts(period_xacts_list& period_xacts); - virtual void add_xact(const interval_t& period, xact_t& xact); + virtual void add_post(const interval_t& period, post_t& post); }; /** @@ -762,7 +762,7 @@ public: * * Long. */ -class budget_xacts : public generate_xacts +class budget_posts : public generate_posts { #define BUDGET_NO_BUDGET 0x00 #define BUDGET_BUDGETED 0x01 @@ -770,21 +770,21 @@ class budget_xacts : public generate_xacts uint_least8_t flags; - budget_xacts(); + budget_posts(); public: - budget_xacts(xact_handler_ptr handler, + budget_posts(post_handler_ptr handler, uint_least8_t _flags = BUDGET_BUDGETED) - : generate_xacts(handler), flags(_flags) { - TRACE_CTOR(budget_xacts, "xact_handler_ptr, uint_least8_t"); + : generate_posts(handler), flags(_flags) { + TRACE_CTOR(budget_posts, "post_handler_ptr, uint_least8_t"); } - virtual ~budget_xacts() throw() { - TRACE_DTOR(budget_xacts); + virtual ~budget_posts() throw() { + TRACE_DTOR(budget_posts); } void report_budget_items(const date_t& date); - virtual void operator()(xact_t& xact); + virtual void operator()(post_t& post); }; /** @@ -792,24 +792,24 @@ public: * * Long. */ -class forecast_xacts : public generate_xacts +class forecast_posts : public generate_posts { item_predicate pred; scope_t& context; public: - forecast_xacts(xact_handler_ptr handler, + forecast_posts(post_handler_ptr handler, const item_predicate& predicate, scope_t& _context) - : generate_xacts(handler), pred(predicate), context(_context) { - TRACE_CTOR(forecast_xacts, - "xact_handler_ptr, const item_predicate&, scope_t&"); + : generate_posts(handler), pred(predicate), context(_context) { + TRACE_CTOR(forecast_posts, + "post_handler_ptr, const item_predicate&, scope_t&"); } - virtual ~forecast_xacts() throw() { - TRACE_DTOR(forecast_xacts); + virtual ~forecast_posts() throw() { + TRACE_DTOR(forecast_posts); } - virtual void add_xact(const interval_t& period, xact_t& xact); + virtual void add_post(const interval_t& period, post_t& post); virtual void flush(); }; |