diff options
author | John Wiegley <johnw@newartisans.com> | 2006-02-25 12:02:11 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 02:41:26 -0400 |
commit | 88a895a4944efcae0f7dbc7e7d73bef817cd317e (patch) | |
tree | 1b9ec62b7efe0574f4210c4d1e76e3c133e3499d /valexpr.cc | |
parent | 0dc7584810d4a1c3d619a06f64e2ca55a9375d2c (diff) | |
download | fork-ledger-88a895a4944efcae0f7dbc7e7d73bef817cd317e.tar.gz fork-ledger-88a895a4944efcae0f7dbc7e7d73bef817cd317e.tar.bz2 fork-ledger-88a895a4944efcae0f7dbc7e7d73bef817cd317e.zip |
*** no comment ***
Diffstat (limited to 'valexpr.cc')
-rw-r--r-- | valexpr.cc | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -18,6 +18,28 @@ details_t::details_t(const transaction_t& _xact) DEBUG_PRINT("ledger.memory.ctors", "ctor details_t"); } +bool compute_amount(value_expr_t * expr, amount_t& amt, transaction_t& xact) +{ + value_t result; + expr->compute(result, details_t(xact)); + switch (result.type) { + case value_t::BOOLEAN: + amt = *((bool *) result.data); + break; + case value_t::INTEGER: + amt = *((long *) result.data); + break; + case value_t::AMOUNT: + amt = *((amount_t *) result.data); + break; + + case value_t::BALANCE: + case value_t::BALANCE_PAIR: + return false; + } + return true; +} + void value_expr_t::compute(value_t& result, const details_t& details) const { switch (kind) { |