From 396491c568651bc50b7d65459f4e2d54161abb1a Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 15 Feb 2005 03:32:32 +0000 Subject: (truncate_entries::flush): Fix so that --head and --tail can be used at the same time. (export_walk): Added TruncateEntries for Python. --- walk.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/walk.cc b/walk.cc index 9381daa6..ddfbcfb9 100644 --- a/walk.cc +++ b/walk.cc @@ -86,22 +86,24 @@ void truncate_entries::flush() bool print = false; if (head_count) { - if (count > 0 && i < count) + if (head_count > 0 && i < head_count) print = true; - else if (count < 0 && i >= - count) + else if (head_count < 0 && i >= - head_count) print = true; } if (! print && tail_count) { - if (count > 0 && l - i <= count) + if (tail_count > 0 && l - i <= tail_count) print = true; - else if (count < 0 && l - i > - count) + else if (tail_count < 0 && l - i > - tail_count) print = true; } if (print) item_handler::operator()(**x); } + xacts.clear(); + item_handler::flush(); } @@ -991,6 +993,13 @@ void export_walk() .def("__call__", &ignore_transactions::operator()); ; + class_< truncate_entries, bases > + ("TruncateEntries", init() + [with_custodian_and_ward<1, 2>()]) + .def("flush", &truncate_entries::flush) + .def("__call__", &truncate_entries::operator()); + ; + class_< set_account_value, bases > ("SetAccountValue") .def(init()[with_custodian_and_ward<1, 2>()]) .def("flush", &xact_handler_t::flush) -- cgit v1.2.3