author | zecke <zecke> | 2002-09-22 19:25:33 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-22 19:25:33 (UTC) |
commit | 3f194c85b5b9243ff30f1067361ef9fa5bb85a1e (patch) (side-by-side diff) | |
tree | 909eae5d629918d579424a8ca644d6795b43faaf /libopie2 | |
parent | 4904161b6b043e1397db4affd7930fd999ff742e (diff) | |
download | opie-3f194c85b5b9243ff30f1067361ef9fa5bb85a1e.zip opie-3f194c85b5b9243ff30f1067361ef9fa5bb85a1e.tar.gz opie-3f194c85b5b9243ff30f1067361ef9fa5bb85a1e.tar.bz2 |
Some documentation
and addition to OTodoAccess
overDue and effectiveTodos
-rw-r--r-- | libopie2/opiepim/backend/opimaccessbackend.h | 53 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimaccesstemplate.h | 81 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimrecord.h | 19 | ||||
-rw-r--r-- | libopie2/opiepim/core/otemplatebase.h | 3 | ||||
-rw-r--r-- | libopie2/opiepim/orecordlist.h | 40 |
5 files changed, 187 insertions, 9 deletions
diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h index 8e744e7..5707b58 100644 --- a/libopie2/opiepim/backend/opimaccessbackend.h +++ b/libopie2/opiepim/backend/opimaccessbackend.h @@ -7,2 +7,11 @@ + +/** + * OPimAccessBackend is the base class + * for all private backends + * it operates on OPimRecord as the base class + * and it's responsible for fast manipulating + * the resource the implementation takes care + * of + */ template <class T = OPimRecord> @@ -12,11 +21,55 @@ public: virtual ~OPimAccessBackend(); + + /** + * load the resource + */ virtual void load() = 0; + + /** + * reload the resource + */ virtual void reload() = 0; + + /** + * save the resource and + * all it's changes + */ virtual void save() = 0; + + /** + * return an array of + * all available uids + */ virtual QArray<int> allRecords()const = 0; + + /** + * queryByExample for T with the SortOrder + * sort + */ virtual QArray<int> queryByExample( const T& t, int sort ) = 0; + + /** + * find the OPimRecord with uid @param uid + * returns T and T.isEmpty() if nothing was found + */ virtual T find(int uid ) = 0; + + /** + * clear the back end + */ virtual void clear() = 0; + + /** + * add T + */ virtual bool add( const T& t ) = 0; + + /** + * remove + */ virtual bool remove( int uid ) = 0; + + /** + * replace a record with T.uid() + */ virtual bool replace( const T& t ) = 0; diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h index e0708e1..36f5a99 100644 --- a/libopie2/opiepim/core/opimaccesstemplate.h +++ b/libopie2/opiepim/core/opimaccesstemplate.h @@ -11,2 +11,11 @@ +/** + * Thats the frontend to our OPIE PIM + * Library. Either you want to use it's + * interface or you want to implement + * your own Access lib + * Just create a OPimRecord and inherit from + * the plugins + */ + template <class T = OPimRecord > @@ -16,14 +25,50 @@ public: 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(); + + /** + * reload from the backend + */ virtual void reload(); + + /** + * save to the backend + */ virtual void save(); - /* - *do array to Records conversion - * QArray<int> ids + /** + * 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 ); @@ -31,3 +76,10 @@ public: /* invalidate cache here */ + /** + * clears the backend and invalidates the backend + */ virtual void clear() ; + + /** + * add T to the backend + */ virtual bool add( const T& t ) ; @@ -35,7 +87,25 @@ public: /* 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(); + + /** + * returns the backend + */ BackEnd* backEnd(); @@ -116,3 +186,6 @@ OPimAccessTemplate<T>::BackEnd* OPimAccessTemplate<T>::backEnd() { } - +template <class T> +bool OPimAccessTemplate<T>::wasChangedExternally()const { + return false; +} #endif diff --git a/libopie2/opiepim/core/opimrecord.h b/libopie2/opiepim/core/opimrecord.h index e4d33d6..dbb94ed 100644 --- a/libopie2/opiepim/core/opimrecord.h +++ b/libopie2/opiepim/core/opimrecord.h @@ -9,2 +9,8 @@ + +/** + * This is the base class for + * all PIM Records + * + */ class OPimRecord : public Qtopia::Record { @@ -12,2 +18,3 @@ public: /** + * c'tor * uid of 0 isEmpty @@ -46,2 +53,3 @@ public: * if a Record isEmpty + * it's empty if it's 0 */ @@ -90,3 +98,4 @@ public: /** - * + * clear the relations for all relations + * with app */ @@ -95,3 +104,3 @@ public: /** - * + * add a relation */ @@ -100,5 +109,9 @@ public: /** - * + * set the relations for an app */ void setRelations( const QString&, QArray<int> ids ); + + /** + * set the uid + */ virtual void setUid( int uid ); diff --git a/libopie2/opiepim/core/otemplatebase.h b/libopie2/opiepim/core/otemplatebase.h index 41cc934..add1de4 100644 --- a/libopie2/opiepim/core/otemplatebase.h +++ b/libopie2/opiepim/core/otemplatebase.h @@ -5,2 +5,5 @@ +/** + * internal template base + */ template <class T = OPimRecord> diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h index a3955b0..3b30a73 100644 --- a/libopie2/opiepim/orecordlist.h +++ b/libopie2/opiepim/orecordlist.h @@ -9,3 +9,9 @@ - +/** + * Our List Iterator + * it behaves like STL or Qt + * + * for(it = list.begin(); it != list.end(); ++it ) + * doSomeCoolStuff( (*it) ); + */ template <class T = OPimRecord> @@ -14,7 +20,22 @@ public: typedef OTemplateBase<T> Base; + + /** + * The c'tor used internally from + * ORecordList + */ ORecordListIterator( const QArray<int>, const Base* ); + + /** + * The standard c'tor + */ ORecordListIterator(); ~ORecordListIterator(); + ORecordListIterator( const ORecordListIterator& ); ORecordListIterator &operator=(const ORecordListIterator& ); + + /** + * a * operator ;) + * use it like this T = (*it); + */ T &operator*(); @@ -37,3 +58,6 @@ private: }; - +/** + * The recordlist used as a return type + * from OPimAccessTemplate + */ template <class T = OPimRecord > @@ -43,2 +67,6 @@ public: typedef ORecordListIterator<T> Iterator; + + /** + * c'tor + */ ORecordList( const QArray<int>& ids, @@ -46,3 +74,11 @@ public: ~ORecordList(); + + /** + * the first iterator + */ Iterator begin(); + + /** + * the end + */ Iterator end(); |