From 4ecbf7407c19b59fc136c334f9386c53db453930 Mon Sep 17 00:00:00 2001 From: zecke Date: Tue, 10 Dec 2002 17:01:18 +0000 Subject: 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 :) --- (limited to 'libopie2/opiepim/core/opimaccesstemplate.h') diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h index 8cf81c8..259e2c1 100644 --- a/libopie2/opiepim/core/opimaccesstemplate.h +++ b/libopie2/opiepim/core/opimaccesstemplate.h @@ -22,20 +22,26 @@ template class OPimAccessTemplate : public OTemplateBase { public: + enum Access { + Random = 0, + SortedAccess + }; typedef ORecordList List; typedef OPimAccessBackend BackEnd; typedef OPimCache Cache; /** * c'tor BackEnd + * enum Access a small hint on how to handle the backend */ OPimAccessTemplate( BackEnd* end); + virtual ~OPimAccessTemplate(); /** * load from the backend */ - virtual bool load(); + bool load(); /** Reload database. * You should execute this function if the external database @@ -49,7 +55,7 @@ public: * Save is more a "commit". After calling this function, all changes are public available. * @return true if successful */ - virtual bool save(); + bool save(); /** * if the resource was changed externally @@ -85,7 +91,7 @@ public: /** * clears the backend and invalidates the backend */ - virtual void clear() ; + void clear() ; /** * add T to the backend @@ -108,7 +114,8 @@ public: * @param uid The ID of the item to remove * @return true if successful. */ - virtual bool remove( int uid ); + bool remove( int uid ); + bool remove( const OPimRecord& ); /** * replace T from backend @@ -123,6 +130,8 @@ public: */ void cache( const T& )const; void setSaneCacheSize( int ); + + QArray records()const; protected: /** * invalidate the cache @@ -172,6 +181,10 @@ typename OPimAccessTemplate::List OPimAccessTemplate::allRecords()const { return lis; } template +QArray OPimAccessTemplate::records()const { + return m_backEnd->allRecords(); +} +template typename OPimAccessTemplate::List OPimAccessTemplate::queryByExample( const T& t, int sortOrder ) { QArray ints = m_backEnd->queryByExample( t, sortOrder ); @@ -231,6 +244,10 @@ bool OPimAccessTemplate::remove( int uid ) { return m_backEnd->remove( uid ); } template +bool OPimAccessTemplate::remove( const OPimRecord& rec) { + return remove( rec.uid() ); +} +template bool OPimAccessTemplate::replace( const T& t ) { m_cache.replace( t ); return m_backEnd->replace( t ); -- cgit v0.9.0.2