summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2005-02-15 03:32:32 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:01 -0400
commit396491c568651bc50b7d65459f4e2d54161abb1a (patch)
treea5a8fcb79daf50b9780b0e69f939262d8344c96f
parent4faed720b500f95f47d05baf9ba183328baf86fc (diff)
downloadfork-ledger-396491c568651bc50b7d65459f4e2d54161abb1a.tar.gz
fork-ledger-396491c568651bc50b7d65459f4e2d54161abb1a.tar.bz2
fork-ledger-396491c568651bc50b7d65459f4e2d54161abb1a.zip
(truncate_entries::flush): Fix so that --head and --tail can be used
at the same time. (export_walk): Added TruncateEntries for Python.
-rw-r--r--walk.cc17
1 files 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<transaction_t>::operator()(**x);
}
+ xacts.clear();
+
item_handler<transaction_t>::flush();
}
@@ -991,6 +993,13 @@ void export_walk()
.def("__call__", &ignore_transactions::operator());
;
+ class_< truncate_entries, bases<xact_handler_t> >
+ ("TruncateEntries", init<xact_handler_t *, int, int>()
+ [with_custodian_and_ward<1, 2>()])
+ .def("flush", &truncate_entries::flush)
+ .def("__call__", &truncate_entries::operator());
+ ;
+
class_< set_account_value, bases<xact_handler_t> > ("SetAccountValue")
.def(init<xact_handler_t *>()[with_custodian_and_ward<1, 2>()])
.def("flush", &xact_handler_t::flush)