author | zecke <zecke> | 2002-09-22 23:32:49 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-22 23:32:49 (UTC) |
commit | d7098ef25f7f4ebe5678061aa3a3c0bd1f077f7f (patch) (unidiff) | |
tree | 5ff52b48fd514c6f24da6d3204bc98b66c48a652 /libopie2/opiepim/orecordlist.h | |
parent | 4f142e98ee63e88fa0df61161b93228ee719d551 (diff) | |
download | opie-d7098ef25f7f4ebe5678061aa3a3c0bd1f077f7f.zip opie-d7098ef25f7f4ebe5678061aa3a3c0bd1f077f7f.tar.gz opie-d7098ef25f7f4ebe5678061aa3a3c0bd1f077f7f.tar.bz2 |
Two brown paper bags later OTodo is ok again... pointers can be so fscking awesome
I had problems with QShared because I forgot to copy it in &operator=
And the other one was d = 0
Diffstat (limited to 'libopie2/opiepim/orecordlist.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/orecordlist.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h index 75bb33c..36728b8 100644 --- a/libopie2/opiepim/orecordlist.h +++ b/libopie2/opiepim/orecordlist.h | |||
@@ -31,25 +31,25 @@ public: | |||
31 | * The standard c'tor | 31 | * The standard c'tor |
32 | */ | 32 | */ |
33 | ORecordListIterator(); | 33 | ORecordListIterator(); |
34 | ~ORecordListIterator(); | 34 | ~ORecordListIterator(); |
35 | 35 | ||
36 | ORecordListIterator( const ORecordListIterator& ); | 36 | ORecordListIterator( const ORecordListIterator& ); |
37 | ORecordListIterator &operator=(const ORecordListIterator& ); | 37 | ORecordListIterator &operator=(const ORecordListIterator& ); |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * a * operator ;) | 40 | * a * operator ;) |
41 | * use it like this T = (*it); | 41 | * use it like this T = (*it); |
42 | */ | 42 | */ |
43 | T &operator*(); | 43 | T operator*(); |
44 | ORecordListIterator &operator++(); | 44 | ORecordListIterator &operator++(); |
45 | ORecordListIterator &operator--(); | 45 | ORecordListIterator &operator--(); |
46 | 46 | ||
47 | bool operator==( const ORecordListIterator& it ); | 47 | bool operator==( const ORecordListIterator& it ); |
48 | bool operator!=( const ORecordListIterator& it ); | 48 | bool operator!=( const ORecordListIterator& it ); |
49 | 49 | ||
50 | private: | 50 | private: |
51 | QArray<int> m_uids; | 51 | QArray<int> m_uids; |
52 | int m_current; | 52 | int m_current; |
53 | const Base* m_temp; | 53 | const Base* m_temp; |
54 | bool m_end : 1; | 54 | bool m_end : 1; |
55 | T m_record; | 55 | T m_record; |
@@ -90,54 +90,55 @@ public: | |||
90 | */ | 90 | */ |
91 | private: | 91 | private: |
92 | QArray<int> m_ids; | 92 | QArray<int> m_ids; |
93 | const Base* m_acc; | 93 | const Base* m_acc; |
94 | }; | 94 | }; |
95 | 95 | ||
96 | /* ok now implement it */ | 96 | /* ok now implement it */ |
97 | template <class T> | 97 | template <class T> |
98 | ORecordListIterator<T>::ORecordListIterator() { | 98 | ORecordListIterator<T>::ORecordListIterator() { |
99 | m_current = 0; | 99 | m_current = 0; |
100 | m_temp = 0l; | 100 | m_temp = 0l; |
101 | m_end = true; | 101 | m_end = true; |
102 | m_record = T(); | ||
102 | } | 103 | } |
103 | template <class T> | 104 | template <class T> |
104 | ORecordListIterator<T>::~ORecordListIterator() { | 105 | ORecordListIterator<T>::~ORecordListIterator() { |
105 | /* nothing to delete */ | 106 | /* nothing to delete */ |
106 | } | 107 | } |
107 | 108 | ||
108 | template <class T> | 109 | template <class T> |
109 | ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) { | 110 | ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) { |
110 | qWarning("ORecordListIterator"); | 111 | // qWarning("ORecordListIterator copy c'tor"); |
111 | m_uids = it.m_uids; | 112 | m_uids = it.m_uids; |
112 | m_current = it.m_current; | 113 | m_current = it.m_current; |
113 | m_temp = it.m_temp; | 114 | m_temp = it.m_temp; |
114 | m_end = it.m_end; | 115 | m_end = it.m_end; |
115 | m_record = it.m_record; | 116 | m_record = it.m_record; |
116 | } | 117 | } |
117 | 118 | ||
118 | template <class T> | 119 | template <class T> |
119 | ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) { | 120 | ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) { |
120 | m_uids = it.m_uids; | 121 | m_uids = it.m_uids; |
121 | m_current = it.m_current; | 122 | m_current = it.m_current; |
122 | m_temp = it.m_temp; | 123 | m_temp = it.m_temp; |
123 | m_end = it.m_end; | 124 | m_end = it.m_end; |
124 | m_record = it.m_record; | 125 | // m_record = it.m_record; |
125 | 126 | ||
126 | return *this; | 127 | return *this; |
127 | } | 128 | } |
128 | 129 | ||
129 | template <class T> | 130 | template <class T> |
130 | T &ORecordListIterator<T>::operator*() { | 131 | T ORecordListIterator<T>::operator*() { |
131 | qWarning("operator* %d %d", m_current, m_uids[m_current] ); | 132 | // qWarning("operator* %d %d", m_current, m_uids[m_current] ); |
132 | if (!m_end ) | 133 | if (!m_end ) |
133 | m_record = m_temp->find( m_uids[m_current] ); | 134 | m_record = m_temp->find( m_uids[m_current] ); |
134 | else | 135 | else |
135 | m_record = T(); | 136 | m_record = T(); |
136 | 137 | ||
137 | return m_record; | 138 | return m_record; |
138 | } | 139 | } |
139 | 140 | ||
140 | template <class T> | 141 | template <class T> |
141 | ORecordListIterator<T> &ORecordListIterator<T>::operator++() { | 142 | ORecordListIterator<T> &ORecordListIterator<T>::operator++() { |
142 | if (m_current < (int)m_uids.count() ) { | 143 | if (m_current < (int)m_uids.count() ) { |
143 | m_end = false; | 144 | m_end = false; |
@@ -184,25 +185,24 @@ ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, | |||
184 | template <class T> | 185 | template <class T> |
185 | ORecordList<T>::ORecordList( const QArray<int>& ids, | 186 | ORecordList<T>::ORecordList( const QArray<int>& ids, |
186 | const Base* acc ) | 187 | const Base* acc ) |
187 | : m_ids( ids ), m_acc( acc ) | 188 | : m_ids( ids ), m_acc( acc ) |
188 | { | 189 | { |
189 | } | 190 | } |
190 | template <class T> | 191 | template <class T> |
191 | ORecordList<T>::~ORecordList() { | 192 | ORecordList<T>::~ORecordList() { |
192 | /* nothing to do here */ | 193 | /* nothing to do here */ |
193 | } | 194 | } |
194 | template <class T> | 195 | template <class T> |
195 | ORecordList<T>::Iterator ORecordList<T>::begin() { | 196 | ORecordList<T>::Iterator ORecordList<T>::begin() { |
196 | qWarning("ORecordList::begin"); | ||
197 | Iterator it( m_ids, m_acc ); | 197 | Iterator it( m_ids, m_acc ); |
198 | return it; | 198 | return it; |
199 | } | 199 | } |
200 | template <class T> | 200 | template <class T> |
201 | ORecordList<T>::Iterator ORecordList<T>::end() { | 201 | ORecordList<T>::Iterator ORecordList<T>::end() { |
202 | Iterator it( m_ids, m_acc ); | 202 | Iterator it( m_ids, m_acc ); |
203 | it.m_end = true; | 203 | it.m_end = true; |
204 | it.m_current = m_ids.count(); | 204 | it.m_current = m_ids.count(); |
205 | 205 | ||
206 | return it; | 206 | return it; |
207 | } | 207 | } |
208 | #endif | 208 | #endif |