summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/my_list.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/my_list.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/my_list.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/my_list.h b/noncore/apps/opie-reader/my_list.h
index b3f0cc0..f180d3d 100644
--- a/noncore/apps/opie-reader/my_list.h
+++ b/noncore/apps/opie-reader/my_list.h
@@ -27,8 +27,10 @@ class CList
27 delete p; 27 delete p;
28 } 28 }
29 } 29 }
30 } 30 }
31 T& first() { return front->data; }
32 T& last() { return back->data; }
31 T* operator[](int n) 33 T* operator[](int n)
32 { 34 {
33 node* current = front; 35 node* current = front;
34 while (n-- > 0) 36 while (n-- > 0)
@@ -60,8 +62,9 @@ class CList
60 back->next = n; 62 back->next = n;
61 back = n; 63 back = n;
62 } 64 }
63 } 65 }
66 bool isEmpty() { return (front == NULL); }
64 void erase(unsigned int n) 67 void erase(unsigned int n)
65 { 68 {
66 node* p = front; 69 node* p = front;
67 node* last = front; 70 node* last = front;
@@ -154,12 +157,20 @@ class CList
154 T* operator->() 157 T* operator->()
155 { 158 {
156 return &(current->data); 159 return &(current->data);
157 } 160 }
161 T* pContent()
162 {
163 return &(current->data);
164 }
158 bool operator!=(iterator t) 165 bool operator!=(iterator t)
159 { 166 {
160 return (current != t.current); 167 return (current != t.current);
161 } 168 }
169 bool operator==(iterator t)
170 {
171 return (current == t.current);
172 }
162 }; 173 };
163 iterator begin() 174 iterator begin()
164 { 175 {
165 return iterator(front); 176 return iterator(front);