From cf35984971341b8a8688eb02a22bcbc1772991d1 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 19 Jul 2011 23:29:41 -0500 Subject: Use Boost iterator_facade to create new iterators --- src/generate.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/generate.cc') diff --git a/src/generate.cc b/src/generate.cc index 05f754e6..60c6955e 100644 --- a/src/generate.cc +++ b/src/generate.cc @@ -350,9 +350,10 @@ void generate_posts_iterator::generate_xact(std::ostream& out) out << '\n'; } -post_t * generate_posts_iterator::operator()() +void generate_posts_iterator::increment() { - post_t * post = posts(); + post_t * post = *posts++; + if (post == NULL && quantity > 0) { std::ostringstream buf; generate_xact(buf); @@ -364,7 +365,7 @@ post_t * generate_posts_iterator::operator()() if (session.journal->parse(in, session) != 0) { VERIFY(session.journal->xacts.back()->valid()); posts.reset(*session.journal->xacts.back()); - post = posts(); + post = *posts++; } } catch (std::exception&) { @@ -382,7 +383,8 @@ post_t * generate_posts_iterator::operator()() quantity--; } - return post; + + m_node = post; } } // namespace ledger -- cgit v1.2.3