summaryrefslogtreecommitdiff
path: root/libopie/pim/opimaccesstemplate.h
authorzecke <zecke>2002-12-10 17:01:18 (UTC)
committer zecke <zecke>2002-12-10 17:01:18 (UTC)
commit4ecbf7407c19b59fc136c334f9386c53db453930 (patch) (unidiff)
tree1cba438e2533f7109af169b0b77988cec6664192 /libopie/pim/opimaccesstemplate.h
parent36375df6ff103e52455823f7afd64c4f4ae7fcb8 (diff)
downloadopie-4ecbf7407c19b59fc136c334f9386c53db453930.zip
opie-4ecbf7407c19b59fc136c334f9386c53db453930.tar.gz
opie-4ecbf7407c19b59fc136c334f9386c53db453930.tar.bz2
get in sync with HEAD again
-OPimBase was added to be used as a default struct inside OPimResolver and to work with DSOs -TodoListXML backend now uses mmap and madvise to load data -OContact added/changed rtti -OTodo added changed rtti OPimAccess* added stuff necessary for the Resolver and a 'state'/'hint' on how to load data OPimResolver which resolves uid + services to Records, rtti to QCOPChannels loads arbitary Service backends ( will work with DSOs soon ) -OPimMainWindow added some setDocument scripting possibility and internal marshalling and demarshalling of Records -OPimRecord added loadDataFromm and saveDataTo for marshalling purposes much more :)
Diffstat (limited to 'libopie/pim/opimaccesstemplate.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/opimaccesstemplate.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/libopie/pim/opimaccesstemplate.h b/libopie/pim/opimaccesstemplate.h
index 8cf81c8..259e2c1 100644
--- a/libopie/pim/opimaccesstemplate.h
+++ b/libopie/pim/opimaccesstemplate.h
@@ -23,4 +23,8 @@ template <class T = OPimRecord >
23class OPimAccessTemplate : public OTemplateBase<T> { 23class OPimAccessTemplate : public OTemplateBase<T> {
24public: 24public:
25 enum Access {
26 Random = 0,
27 SortedAccess
28 };
25 typedef ORecordList<T> List; 29 typedef ORecordList<T> List;
26 typedef OPimAccessBackend<T> BackEnd; 30 typedef OPimAccessBackend<T> BackEnd;
@@ -29,6 +33,8 @@ public:
29 /** 33 /**
30 * c'tor BackEnd 34 * c'tor BackEnd
35 * enum Access a small hint on how to handle the backend
31 */ 36 */
32 OPimAccessTemplate( BackEnd* end); 37 OPimAccessTemplate( BackEnd* end);
38
33 virtual ~OPimAccessTemplate(); 39 virtual ~OPimAccessTemplate();
34 40
@@ -36,5 +42,5 @@ public:
36 * load from the backend 42 * load from the backend
37 */ 43 */
38 virtual bool load(); 44 bool load();
39 45
40 /** Reload database. 46 /** Reload database.
@@ -50,5 +56,5 @@ public:
50 * @return true if successful 56 * @return true if successful
51 */ 57 */
52 virtual bool save(); 58 bool save();
53 59
54 /** 60 /**
@@ -86,5 +92,5 @@ public:
86 * clears the backend and invalidates the backend 92 * clears the backend and invalidates the backend
87 */ 93 */
88 virtual void clear() ; 94 void clear() ;
89 95
90 /** 96 /**
@@ -109,5 +115,6 @@ public:
109 * @return <i>true</i> if successful. 115 * @return <i>true</i> if successful.
110 */ 116 */
111 virtual bool remove( int uid ); 117 bool remove( int uid );
118 bool remove( const OPimRecord& );
112 119
113 /** 120 /**
@@ -124,4 +131,6 @@ public:
124 void cache( const T& )const; 131 void cache( const T& )const;
125 void setSaneCacheSize( int ); 132 void setSaneCacheSize( int );
133
134 QArray<int> records()const;
126protected: 135protected:
127 /** 136 /**
@@ -173,4 +182,8 @@ typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const {
173} 182}
174template <class T> 183template <class T>
184QArray<int> OPimAccessTemplate<T>::records()const {
185 return m_backEnd->allRecords();
186}
187template <class T>
175typename OPimAccessTemplate<T>::List 188typename OPimAccessTemplate<T>::List
176OPimAccessTemplate<T>::queryByExample( const T& t, int sortOrder ) { 189OPimAccessTemplate<T>::queryByExample( const T& t, int sortOrder ) {
@@ -232,4 +245,8 @@ bool OPimAccessTemplate<T>::remove( int uid ) {
232} 245}
233template <class T> 246template <class T>
247bool OPimAccessTemplate<T>::remove( const OPimRecord& rec) {
248 return remove( rec.uid() );
249}
250template <class T>
234bool OPimAccessTemplate<T>::replace( const T& t ) { 251bool OPimAccessTemplate<T>::replace( const T& t ) {
235 m_cache.replace( t ); 252 m_cache.replace( t );