diff options
author | John Wiegley <johnw@newartisans.com> | 2009-01-19 22:31:04 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-01-19 22:31:04 -0400 |
commit | 906d8004aed96e8d1d91f5a1a56920528676e049 (patch) | |
tree | 585c6ad59e9b1a4d66e602e28a7b882daf8cfa98 /src/account.cc | |
parent | c6303ab9efdb414a1809ec3413264037b31f092e (diff) | |
download | fork-ledger-906d8004aed96e8d1d91f5a1a56920528676e049.tar.gz fork-ledger-906d8004aed96e8d1d91f5a1a56920528676e049.tar.bz2 fork-ledger-906d8004aed96e8d1d91f5a1a56920528676e049.zip |
Added a function for account_t to get the account's total cost.
Diffstat (limited to 'src/account.cc')
-rw-r--r-- | src/account.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/account.cc b/src/account.cc index fc80a9d6..9014c015 100644 --- a/src/account.cc +++ b/src/account.cc @@ -138,6 +138,11 @@ namespace { return account.xdata_->total; } + value_t get_total_cost(account_t& account) { + assert(account.xdata_); + return account.xdata_->total.cost(); + } + value_t get_amount(account_t& account) { assert(account.xdata_); return account.xdata_->value; @@ -187,6 +192,8 @@ expr_t::ptr_op_t account_t::lookup(const string& name) case 't': if (name == "total") return WRAP_FUNCTOR(get_wrapper<&get_total>); + else if (name == "total_cost") + return WRAP_FUNCTOR(get_wrapper<&get_total_cost>); break; } |