[Scummvm-cvs-logs] CVS: scummvm/common list.h,1.28,1.29
Chris Apers
chrilith at users.sourceforge.net
Sat Sep 3 09:11:07 CEST 2005
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27315
Modified Files:
list.h
Log Message:
Fixed compilation
Index: list.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/list.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- list.h 30 Jul 2005 21:10:57 -0000 1.28
+++ list.h 3 Sep 2005 16:10:08 -0000 1.29
@@ -28,7 +28,7 @@
/**
* Simple double linked list, modelled after the list template of the standard
- * C++ library.
+ * C++ library.
*/
template <class T>
class List {
@@ -41,11 +41,11 @@
NodeBase *_prev;
NodeBase *_next;
};
-
+
template <class T2>
struct Node : public NodeBase {
T2 _data;
-
+
Node<T2>(const T2 &x) : _data(x) {}
};
@@ -54,7 +54,12 @@
friend class List<T>;
NodeBase *_node;
+#ifndef PALMOS_MODE
explicit Iterator<T2>(NodeBase *node) : _node(node) {}
+#else
+ Iterator<T2>(NodeBase *node) : _node(node) {}
+#endif
+
public:
Iterator<T2>() : _node(0) {}
@@ -91,11 +96,11 @@
T2* operator->() const {
return &(operator*());
}
-
+
bool operator==(const Iterator<T2>& x) const {
return _node == x._node;
}
-
+
bool operator!=(const Iterator<T2>& x) const {
return _node != x._node;
}
@@ -141,7 +146,7 @@
void insert(iterator pos, const T& element) {
NodeBase *newNode = new Node<T>(element);
-
+
newNode->_next = pos._node;
newNode->_prev = pos._node->_prev;
newNode->_prev->_next = newNode;
@@ -167,8 +172,15 @@
}
iterator erase(iterator first, iterator last) {
- while (first != last)
+ while (first != last) {
+#ifndef PALMOS_MODE
erase(first++);
+#else
+ iterator tmp = first._node->_next;
+ erase(first);
+ first = tmp;
+#endif
+ }
return last;
}
@@ -196,7 +208,7 @@
else
erase(i, end());
}
-
+
return *this;
}
@@ -210,8 +222,8 @@
void clear() {
erase(begin(), end());
}
-
- bool isEmpty() const {
+
+ bool isEmpty() const {
return (_anchor == _anchor->_next);
}
More information about the Scummvm-git-logs
mailing list