From 589eabd8e60636b7b250b75a5a2966034e8ba911 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 7 Feb 2009 17:45:48 -0400 Subject: Threw away the "multiple parser" infrastructure. --- src/iterators.cc | 43 ++++++++----------------------------------- 1 file changed, 8 insertions(+), 35 deletions(-) (limited to 'src/iterators.cc') diff --git a/src/iterators.cc b/src/iterators.cc index 3e1375f6..2d924956 100644 --- a/src/iterators.cc +++ b/src/iterators.cc @@ -37,37 +37,23 @@ namespace ledger { void entries_iterator::reset(session_t& session) { - journals_i = session.journals.begin(); - journals_end = session.journals.end(); - - journals_uninitialized = false; - - if (journals_i != journals_end) { - entries_i = (*journals_i).entries.begin(); - entries_end = (*journals_i).entries.end(); - - entries_uninitialized = false; - } else { - entries_uninitialized = true; - } + entries_i = session.journal->entries.begin(); + entries_end = session.journal->entries.end(); + entries_uninitialized = false; } entry_t * entries_iterator::operator()() { - if (entries_i == entries_end) { - journals_i++; - if (journals_i == journals_end) - return NULL; - - entries_i = (*journals_i).entries.begin(); - entries_end = (*journals_i).entries.end(); - } - return *entries_i++; + if (entries_i != entries_end) + return *entries_i++; + else + return NULL; } void session_xacts_iterator::reset(session_t& session) { entries.reset(session); + entry_t * entry = entries(); if (entry != NULL) xacts.reset(*entry); @@ -139,19 +125,6 @@ account_t * sorted_accounts_iterator::operator()() return account; } -void journals_iterator::reset(session_t& session) -{ - journals_i = session.journals.begin(); - journals_end = session.journals.end(); -} - -journal_t * journals_iterator::operator()() -{ - if (journals_i == journals_end) - return NULL; - return &(*journals_i++); -} - #if 0 // jww (2008-08-03): This needs to be changed into a commodities->xacts // iterator. -- cgit v1.2.3