diff options
Diffstat (limited to 'src/account.cc')
-rw-r--r-- | src/account.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/account.cc b/src/account.cc index 711e815e..c2628134 100644 --- a/src/account.cc +++ b/src/account.cc @@ -140,7 +140,7 @@ string account_t::partial_name(bool flat) const if (! flat) { std::size_t count = acct->children_with_flags(ACCOUNT_EXT_TO_DISPLAY); assert(count > 0); - if (count > 1) + if (count > 1 || acct->has_flags(ACCOUNT_EXT_TO_DISPLAY)) break; } pname = acct->name + ":" + pname; @@ -194,6 +194,10 @@ namespace { return false; } + value_t get_true(account_t&) { + return true; + } + value_t get_depth_spacer(account_t& account) { std::size_t depth = 0; @@ -202,7 +206,7 @@ namespace { acct = acct->parent) { std::size_t count = acct->children_with_flags(ACCOUNT_EXT_TO_DISPLAY); assert(count > 0); - if (count > 1) + if (count > 1 || acct->has_flags(ACCOUNT_EXT_TO_DISPLAY)) depth++; } @@ -217,6 +221,10 @@ namespace { value_t get_wrapper(call_scope_t& scope) { return (*Func)(find_scope<account_t>(scope)); } + + value_t get_parent(account_t& account) { + return value_t(static_cast<scope_t *>(account.parent)); + } } expr_t::ptr_op_t account_t::lookup(const string& name) @@ -243,9 +251,16 @@ expr_t::ptr_op_t account_t::lookup(const string& name) return WRAP_FUNCTOR(get_wrapper<&get_depth_spacer>); break; + case 'i': + if (name == "is_account") + return WRAP_FUNCTOR(get_wrapper<&get_true>); + break; + case 'p': if (name == "partial_account") return WRAP_FUNCTOR(get_partial_name); + else if (name == "parent") + return WRAP_FUNCTOR(get_wrapper<&get_parent>); break; case 's': |