summaryrefslogtreecommitdiff
path: root/src/xact.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-15 22:36:12 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-15 22:36:12 -0400
commite32129b25cbea725208bb4212edb6caf1cf9bbf3 (patch)
tree50fdf0361ce135bf639520126ef9b8b46d6c6feb /src/xact.cc
parente8c90ef96f9d461a3d24d7125cddcd47a545ca75 (diff)
downloadfork-ledger-e32129b25cbea725208bb4212edb6caf1cf9bbf3.tar.gz
fork-ledger-e32129b25cbea725208bb4212edb6caf1cf9bbf3.tar.bz2
fork-ledger-e32129b25cbea725208bb4212edb6caf1cf9bbf3.zip
Provide a "depth" variable for xacts
Diffstat (limited to 'src/xact.cc')
-rw-r--r--src/xact.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/xact.cc b/src/xact.cc
index 83e36078..883c320d 100644
--- a/src/xact.cc
+++ b/src/xact.cc
@@ -204,6 +204,10 @@ namespace {
return string_value(xact.reported_account()->name);
}
+ value_t get_account_depth(xact_t& xact) {
+ return long(xact.reported_account()->depth);
+ }
+
template <value_t (*Func)(xact_t&)>
value_t get_wrapper(call_scope_t& scope) {
return (*Func)(find_scope<xact_t>(scope));
@@ -235,6 +239,11 @@ expr_t::ptr_op_t xact_t::lookup(const string& name)
return WRAP_FUNCTOR(get_wrapper<&get_is_calculated>);
break;
+ case 'd':
+ if (name == "depth")
+ return WRAP_FUNCTOR(get_wrapper<&get_account_depth>);
+ break;
+
case 'e':
if (name == "entry")
return WRAP_FUNCTOR(get_wrapper<&get_entry>);