Diffstat (limited to 'libopie2/opiepim/core/opimtemplatebase.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimtemplatebase.h | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/libopie2/opiepim/core/opimtemplatebase.h b/libopie2/opiepim/core/opimtemplatebase.h index 58cbfeb..b48dfed 100644 --- a/libopie2/opiepim/core/opimtemplatebase.h +++ b/libopie2/opiepim/core/opimtemplatebase.h | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Main Author <main-author@whereever.org> | 3 | Copyright (C) Holger Freyther <zecke@handhelds.org> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
@@ -46,16 +46,17 @@ namespace Opie { | |||
46 | */ | 46 | */ |
47 | class OPimBasePrivate; | 47 | class OPimBasePrivate; |
48 | struct OPimBase { | 48 | struct OPimBase { |
49 | /** | 49 | /** |
50 | * return the rtti | 50 | * return the rtti |
51 | */ | 51 | */ |
52 | virtual int rtti()= 0; | 52 | virtual int rtti() const = 0; |
53 | virtual OPimRecord* record()const = 0; | 53 | virtual OPimRecord* record()const = 0; |
54 | virtual OPimRecord* record(int uid)const = 0; | 54 | virtual OPimRecord* record(int uid)const = 0; |
55 | virtual bool add( const OPimRecord& ) = 0; | 55 | virtual bool add( const OPimRecord& ) = 0; |
56 | virtual bool add( const OPimRecord* ) = 0; | ||
56 | virtual bool remove( int uid ) = 0; | 57 | virtual bool remove( int uid ) = 0; |
57 | virtual bool remove( const OPimRecord& ) = 0; | 58 | virtual bool remove( const OPimRecord& ) = 0; |
58 | virtual void clear() = 0; | 59 | virtual void clear() = 0; |
59 | virtual bool load() = 0; | 60 | virtual bool load() = 0; |
60 | virtual bool save() = 0; | 61 | virtual bool save() = 0; |
61 | virtual QArray<int> records()const = 0; | 62 | virtual QArray<int> records()const = 0; |
@@ -87,30 +88,21 @@ public: | |||
87 | */ | 88 | */ |
88 | virtual T find( int uid, const QArray<int>& items, | 89 | virtual T find( int uid, const QArray<int>& items, |
89 | uint current, CacheDirection dir = Forward )const = 0; | 90 | uint current, CacheDirection dir = Forward )const = 0; |
90 | virtual void cache( const T& )const = 0; | 91 | virtual void cache( const T& )const = 0; |
91 | virtual void setSaneCacheSize( int ) = 0; | 92 | virtual void setSaneCacheSize( int ) = 0; |
92 | 93 | ||
93 | /* reimplement of OPimBase */ | ||
94 | int rtti(); | ||
95 | OPimRecord* record()const; | 94 | OPimRecord* record()const; |
96 | OPimRecord* record(int uid )const; | 95 | OPimRecord* record(int uid )const; |
97 | static T* rec(); | 96 | static T* rec(); |
98 | 97 | ||
99 | private: | 98 | private: |
100 | OTemplateBasePrivate *d; | 99 | OTemplateBasePrivate *d; |
101 | }; | 100 | }; |
102 | 101 | ||
103 | /* | 102 | |
104 | * implementation | ||
105 | */ | ||
106 | template <class T> | ||
107 | int | ||
108 | OTemplateBase<T>::rtti() { | ||
109 | return T::rtti(); | ||
110 | } | ||
111 | template <class T> | 103 | template <class T> |
112 | OPimRecord* OTemplateBase<T>::record()const { | 104 | OPimRecord* OTemplateBase<T>::record()const { |
113 | T* t = new T; | 105 | T* t = new T; |
114 | return t; | 106 | return t; |
115 | } | 107 | } |
116 | template <class T> | 108 | template <class T> |