diff options
-rw-r--r-- | src/chain.cc | 26 | ||||
-rw-r--r-- | src/entry.cc | 7 | ||||
-rw-r--r-- | src/filters.cc | 2 | ||||
-rw-r--r-- | src/global.cc | 4 | ||||
-rw-r--r-- | src/output.cc | 34 | ||||
-rw-r--r-- | src/output.h | 5 | ||||
-rw-r--r-- | src/unistring.h | 4 | ||||
-rw-r--r-- | src/value.cc | 2 | ||||
-rw-r--r-- | src/xact.cc | 15 | ||||
-rw-r--r-- | src/xact.h | 2 |
10 files changed, 19 insertions, 82 deletions
diff --git a/src/chain.cc b/src/chain.cc index cf8c965d..68577dcb 100644 --- a/src/chain.cc +++ b/src/chain.cc @@ -145,7 +145,6 @@ xact_handler_ptr chain_xact_handlers(report_t& report, report.what_to_keep()))); } -#if 0 // budget_xacts takes a set of xacts from a data file and uses them to // generate "budget xacts" which balance against the reported xacts. // @@ -153,30 +152,35 @@ xact_handler_ptr chain_xact_handlers(report_t& report, // only for the future, and does not balance them against anything but the // future balance. - if (report.budget_flags) { + if (report.budget_flags != BUDGET_NO_BUDGET) { budget_xacts * budget_handler = new budget_xacts(handler, report.budget_flags); - budget_handler->add_period_entries(journal->period_entries); + budget_handler->add_period_entries(report.session.journal->period_entries); handler.reset(budget_handler); // Apply this before the budget handler, so that only matching xacts are // calculated toward the budget. The use of filter_xacts above will // further clean the results so that no automated xacts that don't match // the filter get reported. - if (! report.predicate.empty()) - handler.reset(new filter_xacts(handler, report.predicate)); + if (report.HANDLED(limit_)) + handler.reset(new filter_xacts + (handler, item_predicate<xact_t> + (report.HANDLER(limit_).str(), report.what_to_keep()))); } - else if (! report.forecast_limit.empty()) { + else if (report.HANDLED(forecast_)) { forecast_xacts * forecast_handler - = new forecast_xacts(handler, report.forecast_limit); - forecast_handler->add_period_entries(journal->period_entries); + = new forecast_xacts(handler, + item_predicate<xact_t> + (report.HANDLER(forecast_).str(), report.what_to_keep())); + forecast_handler->add_period_entries(report.session.journal->period_entries); handler.reset(forecast_handler); // See above, under budget_xacts. - if (! report.predicate.empty()) - handler.reset(new filter_xacts(handler, report.predicate)); + if (report.HANDLED(limit_)) + handler.reset(new filter_xacts + (handler, item_predicate<xact_t> + (report.HANDLER(limit_).str(), report.what_to_keep()))); } -#endif if (report.HANDLED(comm_as_payee)) handler.reset(new set_comm_as_payee(handler)); diff --git a/src/entry.cc b/src/entry.cc index 530d12fb..438cc5b0 100644 --- a/src/entry.cc +++ b/src/entry.cc @@ -40,9 +40,6 @@ entry_base_t::entry_base_t(const entry_base_t& e) : item_t(), journal(NULL) { TRACE_CTOR(entry_base_t, "copy"); -#if 0 - xacts.insert(xacts.end(), e.xacts.begin(), e.xacts.end()); -#endif } entry_base_t::~entry_base_t() @@ -255,10 +252,6 @@ entry_t::entry_t(const entry_t& e) : entry_base_t(e), code(e.code), payee(e.payee) { TRACE_CTOR(entry_t, "copy"); -#if 0 - foreach (xact_t * xact, xacts) - xact->entry = this; -#endif } void entry_t::add_xact(xact_t * xact) diff --git a/src/filters.cc b/src/filters.cc index 16fa8dad..bc365fac 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -267,7 +267,7 @@ namespace { break; default: - assert(false); // jww (2008-04-24): What to do here? + assert(false); break; } diff --git a/src/global.cc b/src/global.cc index f84eef65..c012b17d 100644 --- a/src/global.cc +++ b/src/global.cc @@ -196,9 +196,6 @@ void global_scope_t::execute_command(strings_list args, bool at_repl) if (! is_precommand) { if (! at_repl) read_journal_files(); - - // jww (2009-02-02): This is a complete hack, and a leftover from long, - // long ago. The question is, how best to remove its necessity... normalize_report_options(verb); } @@ -387,7 +384,6 @@ void global_scope_t::normalize_report_options(const string& verb) // jww (2008-08-14): This code really needs to be rationalized away // for 3.0. - if (verb == "print" || verb == "entry" || verb == "dump") { rep.HANDLER(related).on(); rep.HANDLER(related_all).on(); diff --git a/src/output.cc b/src/output.cc index 752d6dd2..f7090e4e 100644 --- a/src/output.cc +++ b/src/output.cc @@ -146,40 +146,6 @@ void format_entries::operator()(xact_t& xact) last_entry = xact.entry; } -void print_entry(std::ostream& out, const entry_base_t& entry_base, - const string& prefix) -{ - string print_format; - - if (dynamic_cast<const entry_t *>(&entry_base)) { - print_format = (prefix + "%D %X%C%P\n" + - prefix + " %-34A %12o\n%/" + - prefix + " %-34A %12o\n"); - } - else if (const auto_entry_t * entry = - dynamic_cast<const auto_entry_t *>(&entry_base)) { - out << "= " << entry->predicate.predicate.text() << '\n'; - print_format = prefix + " %-34A %12o\n"; - } - else if (const period_entry_t * entry = - dynamic_cast<const period_entry_t *>(&entry_base)) { - out << "~ " << entry->period_string << '\n'; - print_format = prefix + " %-34A %12o\n"; - } - else { - assert(false); - } - -#if 0 - format_entries formatter(out, print_format); - walk_xacts(const_cast<xacts_list&>(entry_base.xacts), formatter); - formatter.flush(); - - clear_xact_xdata cleaner; - walk_xacts(const_cast<xacts_list&>(entry_base.xacts), cleaner); -#endif -} - void format_accounts::flush() { std::ostream& out(report.output_stream); diff --git a/src/output.h b/src/output.h index ada7b21c..f78d2df1 100644 --- a/src/output.h +++ b/src/output.h @@ -139,11 +139,6 @@ class format_entries : public format_xacts format_xacts::flush(); } virtual void operator()(xact_t& xact); - -private: - void print_entry(std::ostream& out, - const entry_base_t& entry, - const string& prefix = ""); }; /** diff --git a/src/unistring.h b/src/unistring.h index b23be7c2..97156fde 100644 --- a/src/unistring.h +++ b/src/unistring.h @@ -68,9 +68,7 @@ public: const char * p = input.c_str(); std::size_t len = input.length(); -#if 0 - assert(utf8::is_valid(p, p + len)); -#endif + //assert(utf8::is_valid(p, p + len)); utf8::utf8to32(p, p + len, std::back_inserter(utf32chars)); } ~unistring() { diff --git a/src/value.cc b/src/value.cc index bcd00e0b..550ce8c7 100644 --- a/src/value.cc +++ b/src/value.cc @@ -243,7 +243,7 @@ void value_t::in_place_simplify() DEBUG("ledger.value.reduce", "as an amount it looks like: " << *this); } -#if 0 +#ifdef REDUCE_TO_INTEGER // this is off by default if (is_amount() && ! as_amount().has_commodity() && as_amount().fits_in_long()) { DEBUG_("Reducing amount to integer"); diff --git a/src/xact.cc b/src/xact.cc index 4e5004a2..3106f1a3 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -112,17 +112,6 @@ namespace { } } -#if 0 - value_t get_price(xact_t& xact) { - if (xact.has_xdata() && - xact.xdata().has_flags(XACT_EXT_COMPOUND)) { - return xact.xdata().value; - } else { - return xact.amount; - } - } -#endif - value_t get_total(xact_t& xact) { if (xact.xdata_) return xact.xdata_->total; @@ -196,10 +185,6 @@ expr_t::ptr_op_t xact_t::lookup(const string& name) case 'p': if (name == "payee") return WRAP_FUNCTOR(get_wrapper<&get_payee>); -#if 0 - else if (name == "price") - return WRAP_FUNCTOR(get_wrapper<&get_price>); -#endif break; case 't': @@ -99,7 +99,7 @@ public: amount(xact.amount), cost(xact.cost), assigned_amount(xact.assigned_amount), - xdata_(xact.xdata_) // jww (2008-07-19): What are the copy semantics? + xdata_(xact.xdata_) { TRACE_CTOR(xact_t, "copy"); } |