From 1dcc1b1fc9fd35d959255452c8b5be1269ca4f44 Mon Sep 17 00:00:00 2001 From: zecke Date: Thu, 10 Oct 2002 17:08:58 +0000 Subject: The Cache is finally in place I tested it with my todolist and it 'works' for 10.000 todos the hits are awesome ;) The read ahead functionality does not make sense for XMLs backends because most of the stuff is already in memory. While using readahead on SQL makes things a lot faster.... I still have to fully implement read ahead This change is bic but sc --- (limited to 'libopie/pim/orecordlist.h') diff --git a/libopie/pim/orecordlist.h b/libopie/pim/orecordlist.h index b6fa7fa..08f5c85 100644 --- a/libopie/pim/orecordlist.h +++ b/libopie/pim/orecordlist.h @@ -68,6 +68,7 @@ private: const Base* m_temp; bool m_end : 1; T m_record; + bool m_direction :1; /* d pointer for future versions */ class IteratorPrivate; @@ -125,6 +126,8 @@ ORecordListIterator::ORecordListIterator() { m_temp = 0l; m_end = true; m_record = T(); + /* forward */ + m_direction = TRUE; } template ORecordListIterator::~ORecordListIterator() { @@ -139,6 +142,7 @@ ORecordListIterator::ORecordListIterator( const ORecordListIterator& it) { m_temp = it.m_temp; m_end = it.m_end; m_record = it.m_record; + m_direction = it.m_direction; } template @@ -156,11 +160,9 @@ template T ORecordListIterator::operator*() { qWarning("operator* %d %d", m_current, m_uids[m_current] ); if (!m_end ) - /* FIXME - * until the cache is in place - * we do the uid match uid check - */ - m_record = m_temp->find( m_uids[m_current] ); + m_record = m_temp->find( m_uids[m_current], m_uids, m_current, + m_direction ? Base::Forward : + Base::Reverse ); else m_record = T(); @@ -169,6 +171,7 @@ T ORecordListIterator::operator*() { template ORecordListIterator &ORecordListIterator::operator++() { + m_direction = true; if (m_current < m_uids.count() ) { m_end = false; ++m_current; @@ -179,6 +182,7 @@ ORecordListIterator &ORecordListIterator::operator++() { } template ORecordListIterator &ORecordListIterator::operator--() { + m_direction = false; if ( m_current > 0 ) { --m_current; m_end = false; @@ -207,7 +211,8 @@ bool ORecordListIterator::operator!=( const ORecordListIterator& it ) { template ORecordListIterator::ORecordListIterator( const QArray uids, const Base* t ) - : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ) + : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ), + m_direction( false ) { } template @@ -254,6 +259,7 @@ return m_ids.count(); } template T ORecordList::operator[]( uint i ) { - return m_acc->find( m_ids[i] ); + /* forward */ + return m_acc->find( m_ids[i], m_ids, i ); } #endif -- cgit v0.9.0.2