5 #ifndef __IRR_LIST_H_INCLUDED__ 6 #define __IRR_LIST_H_INCLUDED__ 27 SKListNode(
const T& e) : Next(0), Prev(0), Element(e) {}
52 while (
num-- && this->Current != 0) ++(*this);
56 while(
num++ && this->Current != 0) --(*this);
99 while(
num-- && this->Current != 0) ++(*this);
103 while(
num++ && this->Current != 0) --(*this);
133 : First(0), Last(0), Size(0) {}
160 SKListNode* node = other.First;
187 SKListNode * next = First->Next;
211 SKListNode* node = allocator.
allocate(1);
232 SKListNode* node = allocator.
allocate(1);
255 return Iterator(First);
263 return ConstIterator(First);
279 return ConstIterator(0);
287 return Iterator(Last);
295 return ConstIterator(Last);
306 SKListNode* node = allocator.
allocate(1);
309 node->Next = it.Current->Next;
311 if (it.Current->Next)
312 it.Current->Next->Prev = node;
314 node->Prev = it.Current;
315 it.Current->Next = node;
318 if (it.Current == Last)
330 SKListNode* node = allocator.
allocate(1);
333 node->Prev = it.Current->Prev;
335 if (it.Current->Prev)
336 it.Current->Prev->Next = node;
338 node->Next = it.Current;
339 it.Current->Prev = node;
342 if (it.Current == First)
355 Iterator returnIterator(it);
358 if(it.Current == First)
360 First = it.Current->Next;
364 it.Current->Prev->Next = it.Current->Next;
367 if(it.Current == Last)
369 Last = it.Current->Prev;
373 it.Current->Next->Prev = it.Current->Prev;
381 return returnIterator;
bool operator !=(const Iterator &other) const
ConstIterator operator+(s32 num) const
void insert_after(const Iterator &it, const T &element)
Inserts an element after an element.
u32 size() const
Returns amount of elements in list.
Iterator & operator -=(s32 num)
ConstIterator & operator -=(s32 num)
ConstIterator(const Iterator &iter)
Iterator getLast()
Gets last element.
Iterator & operator+=(s32 num)
ConstIterator & operator --()
bool operator !=(const ConstIterator &other) const
void destruct(T *ptr)
Destruct an element.
Iterator operator+(s32 num) const
Everything in the Irrlicht Engine can be found in this namespace.
Iterator operator --(s32)
ConstIterator end() const
Gets end node.
bool operator !=(const Iterator &other) const
Doubly linked list template.
List iterator for const access.
bool operator==(const Iterator &other) const
list(const list< T > &other)
Copy constructor.
signed int s32
32 bit signed variable.
void push_back(const T &element)
Adds an element at the end of the list.
unsigned int u32
32 bit unsigned variable.
void push_front(const T &element)
Adds an element at the begin of the list.
void operator=(const list< T > &other)
Assignment operator.
bool operator==(const ConstIterator &other) const
T * allocate(size_t cnt)
Allocate memory for an array of objects.
void swap(list< T > &other)
Swap the content of this list container with the content of another list.
Iterator operator -(s32 num) const
void swap(T1 &a, T2 &b)
swaps the content of the passed parameters
ConstIterator begin() const
Gets first node.
void clear()
Clears the list, deletes all elements in the list.
ConstIterator & operator++()
Iterator erase(Iterator &it)
Erases an element.
void construct(T *ptr, const T &e)
Construct an element.
ConstIterator & operator+=(s32 num)
ConstIterator & operator=(const Iterator &iterator)
bool operator !=(const ConstIterator &other) const
Iterator end()
Gets end node.
ConstIterator operator --(s32)
void deallocate(T *ptr)
Deallocate memory for an array of objects.
bool empty() const
Checks for empty list.
Iterator begin()
Gets first node.
void insert_before(const Iterator &it, const T &element)
Inserts an element before an element.
ConstIterator getLast() const
Gets last element.
list()
Default constructor for empty list.
ConstIterator operator -(s32 num) const