(sort_transactions::post_accumulated_xacts): Created this function so
that interval_transactions has a way to post sorted xacts without calling flush().
This commit is contained in:
parent
f8b45d534a
commit
c8bbbf3f9c
2 changed files with 10 additions and 6 deletions
6
walk.cc
6
walk.cc
|
|
@ -117,7 +117,7 @@ void set_account_value::operator()(transaction_t& xact)
|
|||
item_handler<transaction_t>::operator()(xact);
|
||||
}
|
||||
|
||||
void sort_transactions::flush()
|
||||
void sort_transactions::post_accumulated_xacts()
|
||||
{
|
||||
std::stable_sort(transactions.begin(), transactions.end(),
|
||||
compare_items<transaction_t>(sort_order));
|
||||
|
|
@ -129,8 +129,6 @@ void sort_transactions::flush()
|
|||
item_handler<transaction_t>::operator()(**i);
|
||||
}
|
||||
|
||||
item_handler<transaction_t>::flush();
|
||||
|
||||
transactions.clear();
|
||||
}
|
||||
|
||||
|
|
@ -402,7 +400,7 @@ void interval_transactions::report_subtotal(const std::time_t moment)
|
|||
subtotal_transactions::report_subtotal();
|
||||
|
||||
if (sorter)
|
||||
subtotal_transactions::flush();
|
||||
sorter->post_accumulated_xacts();
|
||||
|
||||
last_xact = NULL;
|
||||
}
|
||||
|
|
|
|||
10
walk.h
10
walk.h
|
|
@ -220,7 +220,13 @@ class sort_transactions : public item_handler<transaction_t>
|
|||
delete sort_order;
|
||||
}
|
||||
|
||||
virtual void flush();
|
||||
virtual void post_accumulated_xacts();
|
||||
|
||||
virtual void flush() {
|
||||
post_accumulated_xacts();
|
||||
item_handler<transaction_t>::flush();
|
||||
}
|
||||
|
||||
virtual void operator()(transaction_t& xact) {
|
||||
transactions.push_back(&xact);
|
||||
}
|
||||
|
|
@ -402,7 +408,7 @@ class interval_transactions : public subtotal_transactions
|
|||
transaction_t * last_xact;
|
||||
bool started;
|
||||
|
||||
item_handler<transaction_t> * sorter;
|
||||
sort_transactions * sorter;
|
||||
|
||||
public:
|
||||
interval_transactions(item_handler<transaction_t> * _handler,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue