diff options
author | Eugene Sandulenko | 2007-07-30 10:18:25 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2007-07-30 10:18:25 +0000 |
commit | 6505686c5a2ce99033cb577598206d5b6d4abb54 (patch) | |
tree | 3c66aea8deb41fe95be2057aed5a4b43fb022ada /common | |
parent | b888c0858156960943f68adf23d94e669495cbd0 (diff) | |
download | scummvm-rg350-6505686c5a2ce99033cb577598206d5b6d4abb54.tar.gz scummvm-rg350-6505686c5a2ce99033cb577598206d5b6d4abb54.tar.bz2 scummvm-rg350-6505686c5a2ce99033cb577598206d5b6d4abb54.zip |
Renamed some typedefs to avoid clashes with sky engine
svn-id: r28321
Diffstat (limited to 'common')
-rw-r--r-- | common/list.h | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/common/list.h b/common/list.h index 1fda266da9..4ece453711 100644 --- a/common/list.h +++ b/common/list.h @@ -33,7 +33,7 @@ namespace Common { * 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: _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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: } - 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()) |