diff options
author | John Wiegley <johnw@newartisans.com> | 2011-07-19 23:29:41 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2011-07-19 23:29:41 -0500 |
commit | cf35984971341b8a8688eb02a22bcbc1772991d1 (patch) | |
tree | 8defec43b26a6cf9a216dac8b41d79504c32ad93 /src/generate.cc | |
parent | 966b6fc359bacad6b22e79fd5afbec0ea80e8d6a (diff) | |
download | fork-ledger-cf35984971341b8a8688eb02a22bcbc1772991d1.tar.gz fork-ledger-cf35984971341b8a8688eb02a22bcbc1772991d1.tar.bz2 fork-ledger-cf35984971341b8a8688eb02a22bcbc1772991d1.zip |
Use Boost iterator_facade to create new iterators
Diffstat (limited to 'src/generate.cc')
-rw-r--r-- | src/generate.cc | 10 |
1 files changed, 6 insertions, 4 deletions
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 |