ScummVM API documentation
list.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /********************************************
23  DISCLAIMER:
24 
25  This is a wrapper code to mimic the relevant std:: class
26  Please use it ONLY when porting an existing code e.g. from the original sources
27 
28  For all new development please use classes from Common::
29  *********************************************/
30 
31 #ifndef COMMON_STD_LIST_H
32 #define COMMON_STD_LIST_H
33 
34 #include "common/list.h"
35 
36 namespace Std {
37 
38 template<class T>
39 class list : public Common::List<T> {
40 public:
42 private:
43  typename Common::List<T>::iterator _it;
44 public:
45  reverse_iterator(typename Common::List<T>::iterator it) : _it(it) {
46  }
48  }
49 
50  T operator*() const {
51  return *_it;
52  }
53 
54  reverse_iterator &operator++() {
55  --_it;
56  return *this;
57  }
58 
59  bool operator==(const reverse_iterator &rhs) {
60  return _it == rhs._it;
61  }
62  bool operator!=(const reverse_iterator &rhs) {
63  return _it != rhs._it;
64  }
65 };
66 public:
67  reverse_iterator rbegin() {
69  }
70  reverse_iterator rend() {
72  }
73 
74  void splice(typename Common::List<T>::iterator pos, list<T>& /*other*/, typename Common::List<T>::iterator it ) {
75  // We insert it before pos in this list
76  typename Common::List<T>::NodeBase *n = it._node;
77  typename Common::List<T>::NodeBase *nPos = pos._node;
78  if (n == nullptr || nPos == nullptr || n == nPos || n->_next == nPos)
79  return;
80  // Remove from current position
81  n->_prev->_next = n->_next;
82  n->_next->_prev = n->_prev;
83  // Insert in new position
84  n->_next = nPos;
85  n->_prev = nPos->_prev;
86  n->_prev->_next = n;
87  n->_next->_prev = n;
88  }
89 };
90 
91 } // namespace Std
92 
93 #endif
Definition: list_intern.h:33
Definition: list.h:41
Definition: list.h:39
Definition: list.h:44
Definition: list_intern.h:51
Definition: algorithm.h:37