summaryrefslogtreecommitdiff
path: root/src/item.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-08 19:53:39 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-08 19:53:39 -0400
commitb89d8a1fa53f95128cb82769e4dca37beaebee1a (patch)
tree2475e46923acd7674e9ecfd00cabc8a8f203551d /src/item.cc
parentf9f4bf468bd548d7e5c5d7cbd9386040df53ce4e (diff)
downloadfork-ledger-b89d8a1fa53f95128cb82769e4dca37beaebee1a.tar.gz
fork-ledger-b89d8a1fa53f95128cb82769e4dca37beaebee1a.tar.bz2
fork-ledger-b89d8a1fa53f95128cb82769e4dca37beaebee1a.zip
Have all items respond to the "depth" property, defaulting to 0.
Diffstat (limited to 'src/item.cc')
-rw-r--r--src/item.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/item.cc b/src/item.cc
index 9f0329c3..8bd2471b 100644
--- a/src/item.cc
+++ b/src/item.cc
@@ -217,6 +217,10 @@ namespace {
return long(item.end_line);
}
+ value_t get_depth(item_t& item) {
+ return 0L;
+ }
+
template <value_t (*Func)(item_t&)>
value_t get_wrapper(call_scope_t& scope) {
return (*Func)(find_scope<item_t>(scope));
@@ -259,6 +263,8 @@ expr_t::ptr_op_t item_t::lookup(const string& name)
case 'd':
if (name[1] == '\0' || name == "date")
return WRAP_FUNCTOR(get_wrapper<&get_date>);
+ else if (name == "depth")
+ return WRAP_FUNCTOR(get_wrapper<&get_depth>);
break;
case 'h':