summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/opimaccesstemplate.h
Unidiff
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
@@ -87,21 +87,58 @@ public:
87 virtual List allRecords()const; 87 virtual List allRecords()const;
88 virtual List matchRegexp( const QRegExp &r ) const; 88 virtual List matchRegexp( const QRegExp &r ) const;
89 virtual List queryByExample( const T& t, int querySettings, const QDateTime& d = QDateTime() ); 89 virtual List queryByExample( const T& t, int querySettings, const QDateTime& d = QDateTime() );
90 virtual T find( UID uid )const; 90 virtual T find( UID uid )const;
91 virtual T find( UID uid, const QArray<int>&, 91 virtual T find( UID uid, const QArray<int>&,
92 uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const; 92 uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const;
93 virtual List sorted( const List&, bool ascending, int sortOrder, 93 //@}
94
95 /**
96 * Get sorted lists..
97 * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params:
98 * @param list of UID's received by allRecords() or others...
99 * @param sortOrder Setting the sort order defined by enum SortOrder
100 * @param ascending Sort in ascending order if true, otherwise descending
101 * @param sortFilter Setting the sort filter defined by enum SortFilter
102 * @param cat number of category.
103 */
104 virtual List sorted( const List& list, bool ascending, int sortOrder,
94 int sortFilter, int cat )const; 105 int sortFilter, int cat )const;
95 virtual List sorted( const List&, bool ascending, int sortOrder, 106
107 /**
108 * Get sorted lists..
109 * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params:
110 * @param list of UID's received by allRecords() or others...
111 * @param sortOrder Setting the sort order defined by enum SortOrder
112 * @param ascending Sort in ascending order if true, otherwise descending
113 * @param sortFilter Setting the sort filter defined by enum SortFilter
114 * @param cats List of categories.
115 */
116 virtual List sorted( const List& list, bool ascending, int sortOrder,
96 int sortFilter, const QArray<UID>& cats )const; 117 int sortFilter, const QArray<UID>& cats )const;
118
119 /**
120 * Get sorted lists..
121 * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params:
122 * @param ascending Sort in ascending order if true, otherwise descending
123 * @param sortOrder Setting the sort order defined by enum SortOrder
124 * @param sortFilter Setting the sort filter defined by enum SortFilter
125 * @param cat number of category.
126 */
97 virtual List sorted( bool ascending, int sortOrder, int sortFilter, int cat )const; 127 virtual List sorted( bool ascending, int sortOrder, int sortFilter, int cat )const;
98 virtual List sorted( bool ascending, int sortOrder, int sortOrder,
99 const QArray<UID>& cats )const;
100 //@}
101 128
129 /**
130 * Get sorted lists..
131 * @see OPimContactAccess, OPimTodoAccess and ODateBookAccess regarding more info for the following params:
132 * @param ascending Sort in ascending order if true, otherwise descending
133 * @param sortOrder Setting the sort order defined by enum SortOrder
134 * @param sortFilter Setting the sort filter defined by enum SortFilter
135 * @param cats List of categories.
136 */
137 virtual List sorted( bool ascending, int sortOrder, int sortFilter,
138 const QArray<UID>& cats )const;
102 /** 139 /**
103 * (Re)Implementation 140 * (Re)Implementation
104 */ 141 */
105 //@{ 142 //@{
106 UIDArray matchRegexpSimple( const QRegExp& r )const; 143 UIDArray matchRegexpSimple( const QRegExp& r )const;
107 UIDArray queryByExampleSimple( const OPimRecord*, int, const QDateTime& )const; 144 UIDArray queryByExampleSimple( const OPimRecord*, int, const QDateTime& )const;
@@ -126,13 +163,12 @@ public:
126 bool remove( const OPimRecord& ); 163 bool remove( const OPimRecord& );
127 virtual bool replace( const T& t) ; 164 virtual bool replace( const T& t) ;
128 165
129 //@} 166 //@}
130 167
131 void setReadAhead( uint count ); 168 void setReadAhead( uint count );
132 virtual T cacheFind( int uid )const;
133 void cache( const T& )const; 169 void cache( const T& )const;
134 void setSaneCacheSize( int ); 170 void setSaneCacheSize( int );
135 171
136 QArray<UID> records()const; 172 QArray<UID> records()const;
137protected: 173protected:
138 /** 174 /**
@@ -255,17 +291,12 @@ T OPimAccessTemplate<T>::find( UID uid ) const{
255 T t = m_backEnd->find( uid ); 291 T t = m_backEnd->find( uid );
256 cache( t ); 292 cache( t );
257 293
258 return t; 294 return t;
259} 295}
260 296
261template <class T>
262T OPimAccessTemplate<T>::cacheFind( int uid ) const
263{
264 return m_cache.find( uid );
265}
266 297
267/** 298/**
268 * read ahead cache find method ;) 299 * read ahead cache find method ;)
269 */ 300 */
270template <class T> 301template <class T>
271T OPimAccessTemplate<T>::find( UID uid, const QArray<int>& ar, 302T OPimAccessTemplate<T>::find( UID uid, const QArray<int>& ar,