[Scummvm-cvs-logs] SF.net SVN: scummvm: [28321] scummvm/trunk/common/list.h

sev at users.sourceforge.net sev at users.sourceforge.net
Mon Jul 30 12:18:25 CEST 2007


Revision: 28321
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28321&view=rev
Author:   sev
Date:     2007-07-30 03:18:25 -0700 (Mon, 30 Jul 2007)

Log Message:
-----------
Renamed some typedefs to avoid clashes with sky engine

Modified Paths:
--------------
    scummvm/trunk/common/list.h

Modified: scummvm/trunk/common/list.h
===================================================================
--- scummvm/trunk/common/list.h	2007-07-30 09:14:15 UTC (rev 28320)
+++ scummvm/trunk/common/list.h	2007-07-30 10:18:25 UTC (rev 28321)
@@ -33,7 +33,7 @@
  * Simple double linked list, modeled after the list template of the standard
  * C++ library. 
  */
-template <class T>
+template <class t_T>
 class List {
 protected:
 #if defined (_WIN32_WCE) || defined (_MSC_VER)
@@ -45,16 +45,16 @@
 		NodeBase *_next;
 	};
 	
-	template <class T2>
+	template <class t_T2>
 	struct Node : public NodeBase {
-		T2 _data;
+		t_T2 _data;
 		
-		Node(const T2 &x) : _data(x) {}
+		Node(const t_T2 &x) : _data(x) {}
 	};
 
-	template <class T2>
+	template <class t_T2>
 	class Iterator {
-		friend class List<T>;
+		friend class List<t_T>;
 		NodeBase *_node;
 
 #if !defined (__WINSCW__)
@@ -67,46 +67,46 @@
 		Iterator() : _node(0) {}
 
 		// Prefix inc
-		Iterator<T2> &operator++() {
+		Iterator<t_T2> &operator++() {
 			if (_node)
 				_node = _node->_next;
 			return *this;
 		}
 		// Postfix inc
-		Iterator<T2> operator++(int) {
+		Iterator<t_T2> operator++(int) {
 			Iterator tmp(_node);
 			++(*this);
 			return tmp;
 		}
 		// Prefix dec
-		Iterator<T2> &operator--() {
+		Iterator<t_T2> &operator--() {
 			if (_node)
 				_node = _node->_prev;
 			return *this;
 		}
 		// Postfix dec
-		Iterator<T2> operator--(int) {
+		Iterator<t_T2> operator--(int) {
 			Iterator tmp(_node);
 			--(*this);
 			return tmp;
 		}
-		T2& operator*() const {
+		t_T2& operator*() const {
 			assert(_node);
 #if (__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)
-			return static_cast<List<T>::Node<T2> *>(_node)->_data;
+			return static_cast<List<t_T>::Node<t_T2> *>(_node)->_data;
 #else
-			return static_cast<Node<T2>*>(_node)->_data;
+			return static_cast<Node<t_T2>*>(_node)->_data;
 #endif
 		}
-		T2* operator->() const {
+		t_T2* operator->() const {
 			return &(operator*());
 		}
 		
-		bool operator==(const Iterator<T2>& x) const {
+		bool operator==(const Iterator<t_T2>& x) const {
 			return _node == x._node;
 		}
 		
-		bool operator!=(const Iterator<T2>& x) const {
+		bool operator!=(const Iterator<t_T2>& x) const {
 			return _node != x._node;
 		}
 	};
@@ -114,10 +114,10 @@
 	NodeBase *_anchor;
 
 public:
-	typedef Iterator<T>			iterator;
-	typedef Iterator<const T>	const_iterator;
+	typedef Iterator<t_T>			iterator;
+	typedef Iterator<const t_T>	const_iterator;
 
-	typedef T value_type;
+	typedef t_T value_type;
 
 public:
 	List() {
@@ -125,7 +125,7 @@
 		_anchor->_prev = _anchor;
 		_anchor->_next = _anchor;
 	}
-	List(const List<T>& list) {
+	List(const List<t_T>& list) {
 		_anchor = new NodeBase;
 		_anchor->_prev = _anchor;
 		_anchor->_next = _anchor;
@@ -138,16 +138,16 @@
 		delete _anchor;
 	}
 
-	void push_front(const T& element) {
+	void push_front(const t_T& element) {
 		insert(begin(), element);
 	}
 
-	void push_back(const T& element) {
+	void push_back(const t_T& element) {
 		insert(end(), element);
 	}
 
-	void insert(iterator pos, const T& element) {
-		NodeBase *newNode = new Node<T>(element);
+	void insert(iterator pos, const t_T& element) {
+		NodeBase *newNode = new Node<t_T>(element);
 		
 		newNode->_next = pos._node;
 		newNode->_prev = pos._node->_prev;
@@ -166,7 +166,7 @@
 
 		NodeBase *next = pos._node->_next;
 		NodeBase *prev = pos._node->_prev;
-		Node<T> *node = static_cast<Node<T> *>(pos._node);
+		Node<t_T> *node = static_cast<Node<t_T> *>(pos._node);
 		prev->_next = next;
 		next->_prev = prev;
 		delete node;
@@ -178,7 +178,7 @@
 
 		NodeBase *next = pos._node->_next;
 		NodeBase *prev = pos._node->_prev;
-		Node<T> *node = static_cast<Node<T> *>(pos._node);
+		Node<t_T> *node = static_cast<Node<t_T> *>(pos._node);
 		prev->_next = next;
 		next->_prev = prev;
 		delete node;
@@ -192,7 +192,7 @@
 		return last;
 	}
 
-	void remove(const T &val) {
+	void remove(const t_T &val) {
 		iterator i = begin();
 		while (i != end())
 			if (val == i.operator*())
@@ -202,13 +202,13 @@
 	}
 
 
-	List<T>& operator  =(const List<T>& list) {
+	List<t_T>& operator  =(const List<t_T>& list) {
 		if (this != &list) {
 			iterator i;
 			const_iterator j;
 
 			for (i = begin(), j = list.begin();  (i != end()) && (j != list.end()) ; ++i, ++j) {
-				static_cast<Node<T> *>(i._node)->_data = static_cast<Node<T> *>(j._node)->_data;
+				static_cast<Node<t_T> *>(i._node)->_data = static_cast<Node<t_T> *>(j._node)->_data;
 			}
 
 			if (i == end())


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list