summaryrefslogtreecommitdiff
path: root/src/iterators.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-07 17:45:48 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-07 17:45:48 -0400
commit589eabd8e60636b7b250b75a5a2966034e8ba911 (patch)
treef9db5c14df14dbc2db3ba0c96dff34c8e670a311 /src/iterators.cc
parent9380d73646bcd79c4f24581b2212f684cea70138 (diff)
downloadfork-ledger-589eabd8e60636b7b250b75a5a2966034e8ba911.tar.gz
fork-ledger-589eabd8e60636b7b250b75a5a2966034e8ba911.tar.bz2
fork-ledger-589eabd8e60636b7b250b75a5a2966034e8ba911.zip
Threw away the "multiple parser" infrastructure.
Diffstat (limited to 'src/iterators.cc')
-rw-r--r--src/iterators.cc43
1 files changed, 8 insertions, 35 deletions
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.