author | zecke <zecke> | 2002-09-22 22:21:51 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-22 22:21:51 (UTC) |
commit | e49230a12104b718c46a34c81b6c0e608c9d40be (patch) (side-by-side diff) | |
tree | 4ef2e58c366a8cf7c4abe04838e255b38613fbcb /libopie2/opiepim/core/opimaccesstemplate.h | |
parent | 3049d9418b882283814ca71baa98420b2a6745db (diff) | |
download | opie-e49230a12104b718c46a34c81b6c0e608c9d40be.zip opie-e49230a12104b718c46a34c81b6c0e608c9d40be.tar.gz opie-e49230a12104b718c46a34c81b6c0e608c9d40be.tar.bz2 |
Add XML resources for todolist and compile fixes for RecordList
Diffstat (limited to 'libopie2/opiepim/core/opimaccesstemplate.h') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimaccesstemplate.h | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h index 36f5a99..31ab516 100644 --- a/libopie2/opiepim/core/opimaccesstemplate.h +++ b/libopie2/opiepim/core/opimaccesstemplate.h @@ -19,173 +19,178 @@ */ template <class T = OPimRecord > class OPimAccessTemplate : public OTemplateBase<T> { public: typedef ORecordList<T> List; typedef OPimAccessBackend<T> BackEnd; /** * our sort order * should be safe explaining */ enum SortOrder { WildCards = 0, IgnoreCase = 1, RegExp = 2, ExactMatch = 4 }; /** * c'tor BackEnd */ OPimAccessTemplate( BackEnd* end); virtual ~OPimAccessTemplate(); /** * load from the backend */ - virtual void load(); + virtual bool load(); /** * reload from the backend */ - virtual void reload(); + virtual bool reload(); /** * save to the backend */ - virtual void save(); + virtual bool save(); /** * if the resource was changed externally */ bool wasChangedExternally()const; /** * return a List of records * you can iterate over them */ virtual List allRecords()const; /** * queryByExample */ virtual List queryByExample( const T& t, int sortOrder ); /** * find the OPimRecord uid */ - virtual T find( int uid ); + virtual T find( int uid )const; /* invalidate cache here */ /** * clears the backend and invalidates the backend */ virtual void clear() ; /** * add T to the backend */ virtual bool add( const T& t ) ; /* only the uid matters */ /** * remove T from the backend */ virtual bool remove( const T& t ); /** * remove the OPimRecord with uid */ virtual bool remove( int uid ); /** * replace T from backend */ virtual bool replace( const T& t) ; protected: /** * invalidate the cache */ void invalidateCache(); + void setBackEnd( BackEnd* end ); /** * returns the backend */ BackEnd* backEnd(); BackEnd* m_backEnd; }; template <class T> OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end ) : OTemplateBase<T>(), m_backEnd( end ) { } template <class T> OPimAccessTemplate<T>::~OPimAccessTemplate() { qWarning("~OPimAccessTemplate<T>"); delete m_backEnd; } template <class T> -void OPimAccessTemplate<T>::load() { - m_backEnd->load(); +bool OPimAccessTemplate<T>::load() { + return m_backEnd->load(); } template <class T> -void OPimAccessTemplate<T>::reload() { - m_backEnd->reload(); +bool OPimAccessTemplate<T>::reload() { + return m_backEnd->reload(); } template <class T> -void OPimAccessTemplate<T>::save() { - m_backEnd->save(); +bool OPimAccessTemplate<T>::save() { + return m_backEnd->save(); } template <class T> OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { QArray<int> ints = m_backEnd->allRecords(); List lis(ints, this ); return lis; } template <class T> OPimAccessTemplate<T>::List OPimAccessTemplate<T>::queryByExample( const T& t, int sortOrder ) { QArray<int> ints = m_backEnd->queryByExample( t, sortOrder ); List lis(ints, this ); return lis; } template <class T> -T OPimAccessTemplate<T>::find( int uid ) { +T OPimAccessTemplate<T>::find( int uid ) const{ T t = m_backEnd->find( uid ); return t; } template <class T> void OPimAccessTemplate<T>::clear() { invalidateCache(); m_backEnd->clear(); } template <class T> bool OPimAccessTemplate<T>::add( const T& t ) { return m_backEnd->add( t ); } template <class T> bool OPimAccessTemplate<T>::remove( const T& t ) { return m_backEnd->remove( t.uid() ); } template <class T> bool OPimAccessTemplate<T>::remove( int uid ) { return m_backEnd->remove( uid ); } template <class T> bool OPimAccessTemplate<T>::replace( const T& t ) { return m_backEnd->replace( t ); } template <class T> void OPimAccessTemplate<T>::invalidateCache() { } template <class T> OPimAccessTemplate<T>::BackEnd* OPimAccessTemplate<T>::backEnd() { return m_backEnd; } template <class T> bool OPimAccessTemplate<T>::wasChangedExternally()const { return false; } +template <class T> +void OPimAccessTemplate<T>::setBackEnd( BackEnd* end ) { + m_backEnd = end; +} #endif |