summaryrefslogtreecommitdiff
path: root/src/xact.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-15 15:41:24 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-15 15:41:24 -0400
commit03219d910f527b6a4c5f563aab6152145a51e0fa (patch)
tree8ed61d455944fce36caa566de5a9492d749cade0 /src/xact.cc
parent36b96c47ac79fd124d1ba4f53b4721179782985f (diff)
downloadfork-ledger-03219d910f527b6a4c5f563aab6152145a51e0fa.tar.gz
fork-ledger-03219d910f527b6a4c5f563aab6152145a51e0fa.tar.bz2
fork-ledger-03219d910f527b6a4c5f563aab6152145a51e0fa.zip
Added xact_t::count member
This allows reports to access the "whicheth" index of the reported transaction. It's used mainly by the --average report, which divides the running total by this count to get the arithmetic mean.
Diffstat (limited to 'src/xact.cc')
-rw-r--r--src/xact.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/xact.cc b/src/xact.cc
index 0e287962..b2337329 100644
--- a/src/xact.cc
+++ b/src/xact.cc
@@ -182,6 +182,11 @@ namespace {
return xact.amount;
}
+ value_t get_count(xact_t& xact) {
+ assert(xact.xdata_);
+ return xact.xdata_->count;
+ }
+
value_t get_account(call_scope_t& scope)
{
xact_t& xact(find_scope<xact_t>(scope));
@@ -231,6 +236,8 @@ expr_t::ptr_op_t xact_t::lookup(const string& name)
return WRAP_FUNCTOR(get_wrapper<&get_code>);
else if (name == "cost")
return WRAP_FUNCTOR(get_wrapper<&get_cost>);
+ else if (name == "count")
+ return WRAP_FUNCTOR(get_wrapper<&get_count>);
else if (name == "calculated")
return WRAP_FUNCTOR(get_wrapper<&get_is_calculated>);
break;