summaryrefslogtreecommitdiff
path: root/walk.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-02-27 23:52:31 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:27 -0400
commit7901598f1d1e419e19c860e81749805371298030 (patch)
treef3b4b42ad4217cd5a59eafb8cb8ffacea83b60ca /walk.h
parent4507573d4fbc4ece6a4bb832b2e1fffae0885db8 (diff)
downloadfork-ledger-7901598f1d1e419e19c860e81749805371298030.tar.gz
fork-ledger-7901598f1d1e419e19c860e81749805371298030.tar.bz2
fork-ledger-7901598f1d1e419e19c860e81749805371298030.zip
Checked in all major updates.
Diffstat (limited to 'walk.h')
-rw-r--r--walk.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/walk.h b/walk.h
index 887963bf..0f8c6956 100644
--- a/walk.h
+++ b/walk.h
@@ -120,6 +120,11 @@ inline const account_t * xact_account(const transaction_t& xact) {
return xact_account(const_cast<transaction_t&>(xact));
}
+extern bool show_lots;
+
+#define translate_amount(amt) \
+ ((! show_lots && amt.commodity().price) ? amt.base_amount() : amt)
+
//////////////////////////////////////////////////////////////////////
inline void walk_transactions(transactions_list::iterator begin,
@@ -212,20 +217,19 @@ class sort_transactions : public item_handler<transaction_t>
transactions_deque transactions;
const value_expr_t * sort_order;
- bool allocated;
public:
sort_transactions(item_handler<transaction_t> * handler,
const value_expr_t * _sort_order)
: item_handler<transaction_t>(handler),
- sort_order(_sort_order), allocated(false) {}
+ sort_order(_sort_order) {}
sort_transactions(item_handler<transaction_t> * handler,
const std::string& _sort_order)
- : item_handler<transaction_t>(handler), allocated(false) {
+ : item_handler<transaction_t>(handler) {
try {
sort_order = parse_value_expr(_sort_order);
- allocated = true;
+ sort_order->acquire();
}
catch (value_expr_error& err) {
throw value_expr_error(std::string("In sort string '") + _sort_order +
@@ -235,8 +239,7 @@ class sort_transactions : public item_handler<transaction_t>
virtual ~sort_transactions() {
assert(sort_order);
- if (allocated)
- delete sort_order;
+ sort_order->release();
}
virtual void post_accumulated_xacts();