diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-06 23:36:32 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-06 23:36:32 -0400 |
commit | cdcd52dbafc747b01a626cfd306209187a35b5fb (patch) | |
tree | eaaa7ec47764cb96a90e9ea8368326ba04790890 /src | |
parent | 909f7b1aa343c84eccc4ca89c19f632486cf3f43 (diff) | |
download | fork-ledger-cdcd52dbafc747b01a626cfd306209187a35b5fb.tar.gz fork-ledger-cdcd52dbafc747b01a626cfd306209187a35b5fb.tar.bz2 fork-ledger-cdcd52dbafc747b01a626cfd306209187a35b5fb.zip |
Removed the nearly unknown --descend and --descend-if options.
Diffstat (limited to 'src')
-rw-r--r-- | src/chain.cc | 36 | ||||
-rw-r--r-- | src/filters.cc | 35 | ||||
-rw-r--r-- | src/filters.h | 66 | ||||
-rw-r--r-- | src/report.h | 2 | ||||
-rw-r--r-- | src/xact.h | 24 |
5 files changed, 21 insertions, 142 deletions
diff --git a/src/chain.cc b/src/chain.cc index b83c6c8c..1e919c5d 100644 --- a/src/chain.cc +++ b/src/chain.cc @@ -40,8 +40,6 @@ xact_handler_ptr chain_xact_handlers(report_t& report, xact_handler_ptr base_handler, const bool handle_individual_xacts) { - bool remember_components = false; - xact_handler_ptr handler(base_handler); // format_xacts write each xact received to the output stream. @@ -66,31 +64,6 @@ xact_handler_ptr chain_xact_handlers(report_t& report, handler.reset(new calc_xacts(handler)); #if 0 - // component_xacts looks for reported xact that match the given - // `descend_expr', and then reports the xacts which made up the total for - // that reported xact. - if (! report.descend_expr.empty()) { - std::list<std::string> descend_exprs; - - std::string::size_type beg = 0; - for (std::string::size_type pos = report.descend_expr.find(';'); - pos != std::string::npos; - beg = pos + 1, pos = report.descend_expr.find(';', beg)) - descend_exprs.push_back(std::string(report.descend_expr, - beg, pos - beg)); - descend_exprs.push_back(std::string(report.descend_expr, beg)); - - for (std::list<std::string>::reverse_iterator i = - descend_exprs.rbegin(); - i != descend_exprs.rend(); - i++) - handler.reset(new component_xacts - (handler, - item_predicate<xact_t>(*i, report.what_to_keep()))); - - remember_components = true; - } - // reconcile_xacts will pass through only those xacts which can be // reconciled to a given balance (calculated against the xacts which it // receives). @@ -141,18 +114,17 @@ xact_handler_ptr chain_xact_handlers(report_t& report, // dow_xacts is like period_xacts, except that it reports all the xacts // that fall on each subsequent day of the week. if (report.HANDLED(subtotal)) - handler.reset(new subtotal_xacts(handler, remember_components)); + handler.reset(new subtotal_xacts(handler)); if (report.HANDLED(dow)) - handler.reset(new dow_xacts(handler, remember_components)); + handler.reset(new dow_xacts(handler)); else if (report.HANDLED(by_payee)) - handler.reset(new by_payee_xacts(handler, remember_components)); + handler.reset(new by_payee_xacts(handler)); // interval_xacts groups xacts together based on a time period, such as // weekly or monthly. if (report.HANDLED(period_)) { - handler.reset(new interval_xacts(handler, report.HANDLER(period_).str(), - remember_components)); + handler.reset(new interval_xacts(handler, report.HANDLER(period_).str())); handler.reset(new sort_xacts(handler, "d")); } } diff --git a/src/filters.cc b/src/filters.cc index d2a47467..623a5dee 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -227,8 +227,7 @@ namespace { unsigned int flags, std::list<xact_t>& temps, item_handler<xact_t>& handler, - const date_t& date = date_t(), - xacts_list * component_xacts = NULL) + const date_t& date = date_t()) { temps.push_back(xact_t(account)); xact_t& xact(temps.back()); @@ -236,12 +235,6 @@ namespace { xact.add_flags(ITEM_TEMP); entry->add_xact(&xact); - // If there are component xacts to associate with this temporary, do so - // now. - - if (component_xacts) - xact.xdata().copy_component_xacts(*component_xacts); - // If the account for this xact is all virtual, then report the xact as // such. This allows subtotal reports to show "(Account)" for accounts // that contain only virtual xacts. @@ -391,20 +384,6 @@ void changed_value_xacts::operator()(xact_t& xact) last_xact = &xact; } -void component_xacts::operator()(xact_t& xact) -{ - if (handler && pred(xact)) { - if (xact.has_xdata() && - xact.xdata().has_component_xacts()) -#if 0 - xact.xdata().walk_component_xacts(*handler) -#endif - ; - else - (*handler)(xact); - } -} - void subtotal_xacts::report_subtotal(const char * spec_fmt) { std::ostringstream out_date; @@ -427,7 +406,7 @@ void subtotal_xacts::report_subtotal(const char * spec_fmt) foreach (values_map::value_type& pair, values) handle_value(pair.second.value, pair.second.account, &entry, 0, - xact_temps, *handler, finish, &pair.second.components); + xact_temps, *handler, finish); values.clear(); } @@ -449,14 +428,8 @@ void subtotal_xacts::operator()(xact_t& xact) std::pair<values_map::iterator, bool> result = values.insert(values_pair(acct->fullname(), acct_value_t(acct, temp))); assert(result.second); - - if (remember_components) - (*result.first).second.components.push_back(&xact); } else { xact.add_to_value((*i).second.value); - - if (remember_components) - (*i).second.components.push_back(&xact); } // If the account for this xact is all virtual, mark it as @@ -544,9 +517,7 @@ void by_payee_xacts::operator()(xact_t& xact) { payee_subtotals_map::iterator i = payee_subtotals.find(xact.entry->payee); if (i == payee_subtotals.end()) { - payee_subtotals_pair - temp(xact.entry->payee, - new subtotal_xacts(handler, remember_components)); + payee_subtotals_pair temp(xact.entry->payee, new subtotal_xacts(handler)); std::pair<payee_subtotals_map::iterator, bool> result = payee_subtotals.insert(temp); diff --git a/src/filters.h b/src/filters.h index 67b650dc..748622ac 100644 --- a/src/filters.h +++ b/src/filters.h @@ -409,31 +409,6 @@ public: * * Long. */ -class component_xacts : public item_handler<xact_t> -{ - item_predicate<xact_t> pred; - - component_xacts(); - -public: - component_xacts(xact_handler_ptr handler, - const item_predicate<xact_t>& predicate) - : item_handler<xact_t>(handler), pred(predicate) { - TRACE_CTOR(component_xacts, - "xact_handler_ptr, const item_predicate<xact_t>&"); - } - virtual ~component_xacts() throw() { - TRACE_DTOR(component_xacts); - } - - virtual void operator()(xact_t& xact); -}; - -/** - * @brief Brief - * - * Long. - */ class related_xacts : public item_handler<xact_t> { xacts_list xacts; @@ -522,8 +497,6 @@ class subtotal_xacts : public item_handler<xact_t> account_t * account; value_t value; - xacts_list components; - acct_value_t(account_t * a) : account(a) { TRACE_CTOR(acct_value_t, "acount_t *"); } @@ -531,8 +504,7 @@ class subtotal_xacts : public item_handler<xact_t> TRACE_CTOR(acct_value_t, "acount_t *, value_t&"); } acct_value_t(const acct_value_t& av) - : account(av.account), value(av.value), - components(av.components) { + : account(av.account), value(av.value) { TRACE_CTOR(acct_value_t, "copy"); } ~acct_value_t() throw() { @@ -547,7 +519,6 @@ class subtotal_xacts : public item_handler<xact_t> protected: values_map values; - bool remember_components; optional<string> date_format; std::list<entry_t> entry_temps; std::list<xact_t> xact_temps; @@ -557,11 +528,8 @@ public: date_t finish; subtotal_xacts(xact_handler_ptr handler, - bool _remember_components = false, - optional<string> _date_format = none) - : item_handler<xact_t>(handler), - remember_components(_remember_components), - date_format(_date_format) { + optional<string> _date_format = none) + : item_handler<xact_t>(handler), date_format(_date_format) { TRACE_CTOR(subtotal_xacts, "xact_handler_ptr, bool"); } @@ -594,19 +562,17 @@ class interval_xacts : public subtotal_xacts interval_xacts(); public: - interval_xacts(xact_handler_ptr _handler, - const interval_t& _interval, - bool remember_components = false) - : subtotal_xacts(_handler, remember_components), - interval(_interval), last_xact(NULL), started(false) { + interval_xacts(xact_handler_ptr _handler, + const interval_t& _interval) + : subtotal_xacts(_handler), interval(_interval), + last_xact(NULL), started(false) { TRACE_CTOR(interval_xacts, "xact_handler_ptr, const interval_t&, bool"); } interval_xacts(xact_handler_ptr _handler, - const string& _interval, - bool remember_components = false) - : subtotal_xacts(_handler, remember_components), - interval(_interval), last_xact(NULL), started(false) { + const string& _interval) + : subtotal_xacts(_handler), interval(_interval), + last_xact(NULL), started(false) { TRACE_CTOR(interval_xacts, "xact_handler_ptr, const string&, bool"); } @@ -635,15 +601,12 @@ class by_payee_xacts : public item_handler<xact_t> typedef std::pair<string, subtotal_xacts *> payee_subtotals_pair; payee_subtotals_map payee_subtotals; - bool remember_components; by_payee_xacts(); public: - by_payee_xacts(xact_handler_ptr handler, - bool _remember_components = false) - : item_handler<xact_t>(handler), - remember_components(_remember_components) { + by_payee_xacts(xact_handler_ptr handler) + : item_handler<xact_t>(handler) { TRACE_CTOR(by_payee_xacts, "xact_handler_ptr, bool"); } @@ -715,9 +678,8 @@ class dow_xacts : public subtotal_xacts dow_xacts(); public: - dow_xacts(xact_handler_ptr handler, - bool remember_components = false) - : subtotal_xacts(handler, remember_components) { + dow_xacts(xact_handler_ptr handler) + : subtotal_xacts(handler) { TRACE_CTOR(dow_xacts, "xact_handler_ptr, bool"); } virtual ~dow_xacts() throw() { diff --git a/src/report.h b/src/report.h index bc42f86c..edc3a838 100644 --- a/src/report.h +++ b/src/report.h @@ -195,8 +195,6 @@ public: OPTION(report_t, current); // -c OPTION(report_t, daily); OPTION(report_t, date_format_); // -y - OPTION(report_t, descend_); - OPTION(report_t, descend_if_); OPTION(report_t, deviation); // -D OPTION(report_t, display_); // -d @@ -137,8 +137,6 @@ public: account_t * account; void * ptr; - optional<xacts_list> component_xacts; - xdata_t() : supports_flags<>(), account(NULL), ptr(NULL) { TRACE_CTOR(xact_t::xdata_t, ""); } @@ -156,28 +154,6 @@ public: ~xdata_t() throw() { TRACE_DTOR(xact_t::xdata_t); } - - void remember_xact(xact_t& xact) { - if (! component_xacts) - component_xacts = xacts_list(); - component_xacts->push_back(&xact); - } - - bool has_component_xacts() const { - return component_xacts && ! component_xacts->empty(); - } - - void copy_component_xacts(xacts_list& xacts) { - foreach (xact_t * xact, xacts) - remember_xact(*xact); - } - -#if 0 - void walk_component_xacts(item_handler<xact_t>& handler) const { - foreach (xact_t * xact, *component_xacts) - handler(*xact); - } -#endif }; // This variable holds optional "extended data" which is usually produced |