-rw-r--r-- | libopie/pim/otemplatebase.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libopie/pim/otemplatebase.h b/libopie/pim/otemplatebase.h index 29fb6ec..cadac74 100644 --- a/libopie/pim/otemplatebase.h +++ b/libopie/pim/otemplatebase.h | |||
@@ -5,71 +5,78 @@ | |||
5 | 5 | ||
6 | #include <opie/opimrecord.h> | 6 | #include <opie/opimrecord.h> |
7 | 7 | ||
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Templates do not have a base class, This is why | 10 | * Templates do not have a base class, This is why |
11 | * we've this class | 11 | * we've this class |
12 | * this is here to give us the possibility | 12 | * this is here to give us the possibility |
13 | * to have a common base class | 13 | * to have a common base class |
14 | * You may not want to use that interface internaly | 14 | * You may not want to use that interface internaly |
15 | * POOR mans interface | 15 | * POOR mans interface |
16 | */ | 16 | */ |
17 | class OPimBasePrivate; | ||
17 | struct OPimBase { | 18 | struct OPimBase { |
18 | /** | 19 | /** |
19 | * return the rtti | 20 | * return the rtti |
20 | */ | 21 | */ |
21 | virtual int rtti()= 0; | 22 | virtual int rtti()= 0; |
22 | virtual OPimRecord* record()const = 0; | 23 | virtual OPimRecord* record()const = 0; |
23 | virtual OPimRecord* record(int uid)const = 0; | 24 | virtual OPimRecord* record(int uid)const = 0; |
24 | virtual bool add( const OPimRecord& ) = 0; | 25 | virtual bool add( const OPimRecord& ) = 0; |
25 | virtual bool remove( int uid ) = 0; | 26 | virtual bool remove( int uid ) = 0; |
26 | virtual bool remove( const OPimRecord& ) = 0; | 27 | virtual bool remove( const OPimRecord& ) = 0; |
27 | virtual void clear() = 0; | 28 | virtual void clear() = 0; |
28 | virtual bool load() = 0; | 29 | virtual bool load() = 0; |
29 | virtual bool save() = 0; | 30 | virtual bool save() = 0; |
30 | virtual QArray<int> records()const = 0; | 31 | virtual QArray<int> records()const = 0; |
31 | /* | 32 | /* |
32 | * ADD editing here? | 33 | * ADD editing here? |
33 | * -zecke | 34 | * -zecke |
34 | */ | 35 | */ |
36 | private: | ||
37 | OPimBasePrivate* d; | ||
35 | 38 | ||
36 | }; | 39 | }; |
37 | /** | 40 | /** |
38 | * internal template base | 41 | * internal template base |
39 | * T needs to implement the copy c'tor!!! | 42 | * T needs to implement the copy c'tor!!! |
40 | */ | 43 | */ |
44 | class OTemplateBasePrivate; | ||
41 | template <class T = OPimRecord> | 45 | template <class T = OPimRecord> |
42 | class OTemplateBase : public OPimBase { | 46 | class OTemplateBase : public OPimBase { |
43 | public: | 47 | public: |
44 | enum CacheDirection { Forward=0, Reverse }; | 48 | enum CacheDirection { Forward=0, Reverse }; |
45 | OTemplateBase() { | 49 | OTemplateBase() { |
46 | }; | 50 | }; |
47 | virtual ~OTemplateBase() { | 51 | virtual ~OTemplateBase() { |
48 | } | 52 | } |
49 | virtual T find( int uid )const = 0; | 53 | virtual T find( int uid )const = 0; |
50 | 54 | ||
51 | /** | 55 | /** |
52 | * read ahead find | 56 | * read ahead find |
53 | */ | 57 | */ |
54 | virtual T find( int uid, const QArray<int>& items, | 58 | virtual T find( int uid, const QArray<int>& items, |
55 | uint current, CacheDirection dir = Forward )const = 0; | 59 | uint current, CacheDirection dir = Forward )const = 0; |
56 | virtual void cache( const T& )const = 0; | 60 | virtual void cache( const T& )const = 0; |
57 | virtual void setSaneCacheSize( int ) = 0; | 61 | virtual void setSaneCacheSize( int ) = 0; |
58 | 62 | ||
59 | /* reimplement of OPimBase */ | 63 | /* reimplement of OPimBase */ |
60 | int rtti(); | 64 | int rtti(); |
61 | OPimRecord* record()const; | 65 | OPimRecord* record()const; |
62 | OPimRecord* record(int uid )const; | 66 | OPimRecord* record(int uid )const; |
63 | static T* rec(); | 67 | static T* rec(); |
68 | |||
69 | private: | ||
70 | OTemplateBasePrivate *d; | ||
64 | }; | 71 | }; |
65 | 72 | ||
66 | /* | 73 | /* |
67 | * implementation | 74 | * implementation |
68 | */ | 75 | */ |
69 | template <class T> | 76 | template <class T> |
70 | int | 77 | int |
71 | OTemplateBase<T>::rtti() { | 78 | OTemplateBase<T>::rtti() { |
72 | return T::rtti(); | 79 | return T::rtti(); |
73 | } | 80 | } |
74 | template <class T> | 81 | template <class T> |
75 | OPimRecord* OTemplateBase<T>::record()const { | 82 | OPimRecord* OTemplateBase<T>::record()const { |