summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-14 04:46:53 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-14 04:46:53 -0400
commit1933bb2eadf5ee14d526b79fe5492e7ae0b09f19 (patch)
tree8d4401f4279563450ed5ede6e5650804cc7bd73a
parent5290b6e8aa2c81011a32d1cea807c93c30147a50 (diff)
downloadfork-ledger-1933bb2eadf5ee14d526b79fe5492e7ae0b09f19.tar.gz
fork-ledger-1933bb2eadf5ee14d526b79fe5492e7ae0b09f19.tar.bz2
fork-ledger-1933bb2eadf5ee14d526b79fe5492e7ae0b09f19.zip
Restored the --actual and --real options
-rw-r--r--src/report.h11
-rw-r--r--src/xact.cc24
2 files changed, 33 insertions, 2 deletions
diff --git a/src/report.h b/src/report.h
index c94cbb91..d4e592b8 100644
--- a/src/report.h
+++ b/src/report.h
@@ -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);
diff --git a/src/xact.cc b/src/xact.cc
index 1942e175..24846cf2 100644
--- a/src/xact.cc
+++ b/src/xact.cc
@@ -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>);