Restored the --actual and --real options

This commit is contained in:
John Wiegley 2009-02-14 04:46:53 -04:00
parent 5290b6e8aa
commit 1933bb2ead
2 changed files with 33 additions and 2 deletions

View file

@ -197,7 +197,11 @@ public:
OPTION(report_t, abbrev_len_);
OPTION(report_t, account_);
OPTION(report_t, actual); // -L
OPTION_(report_t, actual, DO() { // -L
parent->append_predicate("actual");
});
OPTION_(report_t, add_budget, DO() {
parent->budget_flags = BUDGET_BUDGETED | BUDGET_UNBUDGETED;
});
@ -386,7 +390,10 @@ public:
parent->prefix_to_period("quarterly");
});
OPTION(report_t, real); // -R
OPTION_(report_t, real, DO() { // -R
parent->append_predicate("real");
});
OPTION(report_t, register_format_);
OPTION(report_t, related); // -r
OPTION(report_t, related_all);

View file

@ -80,6 +80,18 @@ namespace {
return xact.has_flags(XACT_CALCULATED);
}
value_t get_virtual(xact_t& xact) {
return xact.has_flags(XACT_VIRTUAL);
}
value_t get_real(xact_t& xact) {
return ! xact.has_flags(XACT_VIRTUAL);
}
value_t get_actual(xact_t& xact) {
return ! xact.has_flags(XACT_AUTO);
}
value_t get_entry(xact_t& xact) {
return value_t(static_cast<scope_t *>(xact.entry));
}
@ -172,6 +184,8 @@ expr_t::ptr_op_t xact_t::lookup(const string& name)
return WRAP_FUNCTOR(get_account);
else if (name == "account_base")
return WRAP_FUNCTOR(get_wrapper<&get_account_base>);
else if (name == "actual")
return WRAP_FUNCTOR(get_wrapper<&get_actual>);
break;
case 'c':
@ -188,6 +202,11 @@ expr_t::ptr_op_t xact_t::lookup(const string& name)
return WRAP_FUNCTOR(get_wrapper<&get_entry>);
break;
case 'r':
if (name == "real")
return WRAP_FUNCTOR(get_wrapper<&get_real>);
break;
case 'p':
if (name == "payee")
return WRAP_FUNCTOR(get_wrapper<&get_payee>);
@ -200,6 +219,11 @@ expr_t::ptr_op_t xact_t::lookup(const string& name)
return WRAP_FUNCTOR(get_wrapper<&get_total_cost>);
break;
case 'v':
if (name == "virtual")
return WRAP_FUNCTOR(get_wrapper<&get_virtual>);
break;
case 'x':
if (name == "xact")
return WRAP_FUNCTOR(get_wrapper<&get_this>);