summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/opimaccesstemplate.h
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/core/opimaccesstemplate.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h53
1 files changed, 42 insertions, 11 deletions
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h
index 2deb92a..073d5f9 100644
--- a/libopie2/opiepim/core/opimaccesstemplate.h
+++ b/libopie2/opiepim/core/opimaccesstemplate.h
@@ -69,88 +69,124 @@ public:
typedef OPimCache<T> Cache;
//@{
OPimAccessTemplate( BackEnd* end);
virtual ~OPimAccessTemplate();
//@}
//@{
bool load();
virtual bool reload();
bool save();
void clear() ;
//@}
bool wasChangedExternally()const;
//@{
virtual List allRecords()const;
virtual List matchRegexp( const QRegExp &r ) const;
virtual List queryByExample( const T& t, int querySettings, const QDateTime& d = QDateTime() );
virtual T find( UID uid )const;
virtual T find( UID uid, const QArray<int>&,
uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const;
- virtual List sorted( const List&, bool ascending, int sortOrder,
+ //@}
+
+ /**
+ * Get sorted lists..
+ * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params:
+ * @param list of UID's received by allRecords() or others...
+ * @param sortOrder Setting the sort order defined by enum SortOrder
+ * @param ascending Sort in ascending order if true, otherwise descending
+ * @param sortFilter Setting the sort filter defined by enum SortFilter
+ * @param cat number of category.
+ */
+ virtual List sorted( const List& list, bool ascending, int sortOrder,
int sortFilter, int cat )const;
- virtual List sorted( const List&, bool ascending, int sortOrder,
+
+ /**
+ * Get sorted lists..
+ * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params:
+ * @param list of UID's received by allRecords() or others...
+ * @param sortOrder Setting the sort order defined by enum SortOrder
+ * @param ascending Sort in ascending order if true, otherwise descending
+ * @param sortFilter Setting the sort filter defined by enum SortFilter
+ * @param cats List of categories.
+ */
+ virtual List sorted( const List& list, bool ascending, int sortOrder,
int sortFilter, const QArray<UID>& cats )const;
+
+ /**
+ * Get sorted lists..
+ * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params:
+ * @param ascending Sort in ascending order if true, otherwise descending
+ * @param sortOrder Setting the sort order defined by enum SortOrder
+ * @param sortFilter Setting the sort filter defined by enum SortFilter
+ * @param cat number of category.
+ */
virtual List sorted( bool ascending, int sortOrder, int sortFilter, int cat )const;
- virtual List sorted( bool ascending, int sortOrder, int sortOrder,
- const QArray<UID>& cats )const;
- //@}
+ /**
+ * Get sorted lists..
+ * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params:
+ * @param ascending Sort in ascending order if true, otherwise descending
+ * @param sortOrder Setting the sort order defined by enum SortOrder
+ * @param sortFilter Setting the sort filter defined by enum SortFilter
+ * @param cats List of categories.
+ */
+ virtual List sorted( bool ascending, int sortOrder, int sortFilter,
+ const QArray<UID>& cats )const;
/**
* (Re)Implementation
*/
//@{
UIDArray matchRegexpSimple( const QRegExp& r )const;
UIDArray queryByExampleSimple( const OPimRecord*, int, const QDateTime& )const;
UIDArray sortedSimple( const UIDArray&, bool asc, int sortOrder,
int sortFilter, int cat )const;
UIDArray sortedSimple( const UIDArray&, bool asc, int sortOrder,
int sortFilter, const QArray<int>& )const;
UIDArray sortedSimple( bool ascending, int sortOrder, int sortFilter,
int cat )const;
UIDArray sortedSimple( bool ascending, int sortOrder, int sortFilter,
const QArray<int>& )const;
OPimOccurrence::List occurrences( const QDate& start, const QDate& end )const;
OPimOccurrence::List occurrences( const QDateTime& dt )const;
//@}
//@{
virtual bool add( const T& t ) ;
bool add( const OPimRecord& );
bool add( const OPimRecord* );
virtual bool remove( const T& t );
bool remove( UID uid );
bool remove( const OPimRecord& );
virtual bool replace( const T& t) ;
//@}
void setReadAhead( uint count );
- virtual T cacheFind( int uid )const;
void cache( const T& )const;
void setSaneCacheSize( int );
QArray<UID> records()const;
protected:
/**
* invalidate the cache
*/
void invalidateCache();
void setBackEnd( BackEnd* end );
/**
* returns the backend
*/
BackEnd* backEnd();
BackEnd* m_backEnd;
Cache m_cache;
private:
OPimAccessTemplatePrivate *d;
};
@@ -237,53 +273,48 @@ QArray<int> OPimAccessTemplate<T>::records()const {
* queryByExample.
* @see otodoaccess, ocontactaccess
*/
template <class T>
typename OPimAccessTemplate<T>::List
OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) {
QArray<int> ints = m_backEnd->queryByExample( t, settings, d );
List lis(ints, this );
return lis;
}
template <class T>
T OPimAccessTemplate<T>::find( UID uid ) const{
// First search in cache..
if ( m_cache.contains( uid ) )
return m_cache.find( uid );
T t = m_backEnd->find( uid );
cache( t );
return t;
}
-template <class T>
-T OPimAccessTemplate<T>::cacheFind( int uid ) const
-{
- return m_cache.find( uid );
-}
/**
* read ahead cache find method ;)
*/
template <class T>
T OPimAccessTemplate<T>::find( UID uid, const QArray<int>& ar,
uint current, typename OTemplateBase<T>::CacheDirection dir )const {
/*
* better do T.isEmpty()
* after a find this way we would
* avoid two finds in QCache...
*/
if (m_cache.contains( uid ) )
return m_cache.find( uid );
T t = m_backEnd->find( uid, ar, current, dir );
cache( t );
return t;
}
/**
* clears the backend and invalidates the backend
*/