7 #include <lib/base/smartptr.h>
10 class ePtrList : public std::list<T*>
13 typedef typename std::list<T*, std::allocator<T*> >::iterator std_list_T_iterator; // to remove compiler warnings
14 typedef typename std::list<T*, std::allocator<T*> >::const_iterator std_list_T_const_iterator;
15 typedef typename std::list<T*, std::allocator<T*> >::reverse_iterator std_list_T_reverse_iterator;
16 typedef typename std::list<T*, std::allocator<T*> >::const_reverse_iterator std_list_T_const_reverse_iterator;
17 typedef typename ePtrList<T>::iterator T_iterator;
18 typedef typename ePtrList<T>::const_iterator T_const_iterator;
19 typedef typename ePtrList<T>::reverse_iterator T_reverse_iterator;
20 typedef typename ePtrList<T>::const_reverse_iterator T_const_reverse_iterator;
25 class reverse_iterator;
26 class const_reverse_iterator;
30 inline ePtrList(const ePtrList&);
33 // overwritted sort method
36 // changed methods for autodelete and current implementation
37 inline void remove(T* t);
39 inline void pop_back();
40 inline void pop_front();
41 inline void push_back(T*);
42 inline void push_front(T*);
44 // added methods for current implementation
46 inline void take(T* t);
52 inline T* setCurrent(const T*);
53 inline const T* current() const;
54 inline const T* next() const;
55 inline const T* prev() const;
56 inline const T* first() const;
57 inline const T* last() const;
59 // added operator methods
60 inline operator bool();
61 inline bool operator!();
63 // added compare struct ... to sort
70 // makes implicit type conversion form std::list::iterator to ePtrList::iterator
71 return std::list<T*>::begin();
76 // makes implicit type conversion form std::list::iterator to ePtrList::iterator
77 return std::list<T*>::end();
80 const_iterator begin() const
82 // makes implicit type conversion form std::list::const_iterator to ePtrList::const_iterator
83 return std::list<T*>::begin();
86 const_iterator end() const
88 // makes implicit type conversion form std::list::const_iterator to ePtrList::const_iterator
89 return std::list<T*>::end();
92 reverse_iterator rbegin()
94 // makes implicit type conversion form std::list::reverse:_iterator to ePtrList::reverse_iterator
95 return std::list<T*>::rbegin();
98 reverse_iterator rend()
100 // makes implicit type conversion form std::list::reverse_iterator to ePtrList::reverse_iterator
101 return std::list<T*>::rend();
104 const_reverse_iterator rbegin() const
106 // makes implicit type conversion form std::list::const_reverse_iterator to ePtrList::const_reverse_iterator
107 return std::list<T*>::rbegin();
110 const_reverse_iterator rend() const
112 // makes implicit type conversion form std::list::const_reverse_iterator to ePtrList::const_reverse_iterator
113 return std::list<T*>::rend();
116 iterator erase(iterator it)
118 // Remove the item it, if auto-deletion is enabled, than the list call delete for this item
119 // If current is equal to the item that was removed, current is set to the next item in the list
121 return cur = std::list<T*>::erase(it);
123 return std::list<T*>::erase(it);
126 iterator erase(iterator from, iterator to)
128 // Remove all items between the to iterators from and to
129 // If auto-deletion is enabled, than the list call delete for all removed items
138 // Returns a iterator that equal to begin() of the list
142 operator const_iterator() const
144 // Returns a const_iterator that equal to begin() of the list
148 operator reverse_iterator()
150 // Returns a reverse_iterator that equal to rbegin() of the list
154 operator const_reverse_iterator() const
156 // Returns a const_reverse_iterator that equal to rbegin() of the list
160 std::vector<T>* getVector()
162 // Creates an vector and copys all elements to this vector
163 // returns a pointer to this new vector ( the reserved memory must deletet from the receiver !! )
164 std::vector<T>* v=new std::vector<T>();
165 v->reserve( std::list<T>::size() );
166 for ( std_list_T_iterator it( std::list<T*>::begin() ); it != std::list<T*>::end(); it++)
167 v->push_back( **it );
172 inline iterator insert_in_order( T* e )
174 // added a new item to the list... in order
175 // returns a iterator to the new item
176 return insert( std::lower_bound( std::list<T*>::begin(), std::list<T*>::end(), e, less()), e );
181 /////////////////// iterator class /////////////////////////////
183 class ePtrList<T>::iterator : public std::list<T*>::iterator
187 iterator(const std_list_T_iterator& Q) : std_list_T_iterator(Q) { }
189 // changed operator for pointer
190 T* operator->() const
192 return *std::list<T*>::iterator::operator->();
197 return *operator->();
205 iterator& operator++()
207 std::list<T*>::iterator::operator++();
211 iterator operator++(int)
213 return std::list<T*>::iterator::operator++(0);
216 iterator& operator--()
218 std::list<T*>::iterator::operator--();
222 iterator operator--(int)
224 return std::list<T*>::iterator::operator--(0);
228 /////////////////// const_iterator class /////////////////////////////
230 class ePtrList<T>::const_iterator : public std::list<T*>::const_iterator
234 const_iterator(const std_list_T_const_iterator& Q) :std_list_T_const_iterator(Q) { }
236 // changed operator for pointer
237 T* operator->() const
239 return *std::list<T*>::const_iterator::operator->();
244 return *operator->();
252 const_iterator& operator++()
254 std::list<T*>::const_iterator::operator++();
258 const_iterator operator++(int)
260 return std::list<T*>::const_iterator::operator++(0);
263 const_iterator& operator--()
265 std::list<T*>::const_iterator::operator--();
269 const_iterator operator--(int)
271 return std::list<T*>::const_iterator::operator--(0);
275 /////////////////// reverse_iterator class /////////////////////////////
277 class ePtrList<T>::reverse_iterator : public std::list<T*>::reverse_iterator
281 reverse_iterator(const std_list_T_reverse_iterator& Q) :std_list_T_reverse_iterator(Q) { }
283 // changed operators for pointer
284 T* operator->() const
286 return *std::list<T*>::reverse_iterator::operator->();
291 return *operator->();
299 reverse_iterator& operator++()
301 std::list<T*>::reverse_iterator::operator++();
305 reverse_iterator operator++(int)
307 return std::list<T*>::reverse_iterator::operator++(0);
310 reverse_iterator& operator--()
312 std::list<T*>::reverse_iterator::operator--();
316 reverse_iterator operator--(int)
318 return std::list<T*>::reverse_iterator::operator--(0);
322 /////////////////// const_reverse_iterator class /////////////////////////////
324 class ePtrList<T>::const_reverse_iterator : public std::list<T*>::const_reverse_iterator
328 const_reverse_iterator(const std_list_T_const_reverse_iterator& Q) :std_list_T_const_reverse_iterator(Q) { }
330 // changed operators for pointer
331 T* operator->() const
333 return *std::list<T*>::const_reverse_iterator::operator->();
338 return *operator->();
346 const_reverse_iterator& operator++()
348 std::list<T*>::const_reverse_iterator::operator++();
352 const_reverse_iterator operator++(int)
354 return std::list<T*>::const_reverse_iterator::operator++(0);
357 const_reverse_iterator& operator--()
359 std::list<T*>::const_reverse_iterator::operator--();
363 const_reverse_iterator operator--(int)
365 return std::list<T*>::const_reverse_iterator::operator--(0);
369 /////////////////// Default Constructor /////////////////////////////
371 ePtrList<T>::ePtrList()
372 :cur(std::list<T*>::begin())
377 /////////////////// Copy Constructor /////////////////////////////
379 ePtrList<T>::ePtrList(const ePtrList& e)
380 :std::list<T*>(e), cur(e.cur)
384 /////////////////// ePtrList Destructor /////////////////////////////
386 inline ePtrList<T>::~ePtrList()
390 /////////////////// ePtrList sort() /////////////////////////
392 inline void ePtrList<T>::sort()
394 // Sorts all items in the list.
395 // The type T must have a operator <.
396 std::list<T*>::sort(typename ePtrList<T>::less());
399 /////////////////// ePtrList remove(T*) /////////////////////////
401 inline void ePtrList<T>::remove(T* t)
403 // Remove all items that, equals to t, if auto-deletion is enabled, than the list call delete for the removed items
404 // If current is equal to one of the removed items, current is set to the next valid item
405 T_iterator it(std::list<T*>::begin());
407 while (it != std::list<T*>::end())
411 break; // one item is complete removed an deleted
416 while (it != std::list<T*>::end())
418 it = std::list<T*>::erase(it); // remove all other items that equals to t (no delete is called..)
424 /////////////////// ePtrList clear() //////////////////
426 inline void ePtrList<T>::clear()
428 // Remove all items from the list
429 // If auto-deletion is enabled, than the list call delete for all items in the list
430 erase(std::list<T*>::begin(), std::list<T*>::end());
433 /////////////////// ePtrList pop_back() ////////////////////
435 inline void ePtrList<T>::pop_back()
437 // Removes the last item from the list. If the current item ist the last, than the current is set to the new
438 // last item in the list;
439 // The removed item is deleted if auto-deletion is enabled.
443 /////////////////// ePtrList pop_front() ////////////////////
445 inline void ePtrList<T>::pop_front()
447 // Removes the first item from the list. If the current item ist the first, than the current is set to the new
448 // first item in the list;
449 // The removed item is deleted if auto-deletion is enabled.
453 /////////////////// ePtrList push_back(T*) ////////////////////
455 inline void ePtrList<T>::push_back(T* x)
457 // Add a new item at the end of the list.
458 // The current item is set to the last item;
459 std::list<T*>::push_back(x);
463 /////////////////// ePtrList push_front(T*) ////////////////////
465 inline void ePtrList<T>::push_front(T* x)
467 // Add a new item at the begin of the list.
468 // The current item is set to the first item;
469 std::list<T*>::push_front(x);
473 /////////////////// ePtrList take() ////////////////////
475 inline T* ePtrList<T>::take()
477 // Takes the current item out of the list without deleting it (even if auto-deletion is enabled).
478 // Returns a pointer to the item taken out of the list, or null if the index is out of range.
479 // The item after the taken item becomes the new current list item if the taken item is not the last item in the list. If the last item is taken, the new last item becomes the current item.
480 // The current item is set to null if the list becomes empty.
482 cur = std::list<T*>::erase(cur);
486 /////////////////// ePtrList take(T*) ////////////////////
488 inline void ePtrList<T>::take(T* t)
490 // Takes all item with T* out of the list without deleting it (even if auto-deletion is enabled).
491 std::list<T*>::remove(t);
494 /////////////////// ePtrList setCurrent(T*) ////////////////////
496 inline T* ePtrList<T>::setCurrent(const T* t)
498 // Sets the internal current iterator to the first element that equals to t, and returns t when a item is found,
499 // otherwise it returns 0 !
500 for (T_iterator it(std::list<T*>::begin()); it != std::list<T*>::end(); ++it)
510 /////////////////// ePtrList current() ////////////////////
512 inline T* ePtrList<T>::current()
514 // Returns a pointer to the current list item. The current item may be null (implies that the current index is -1).
515 return cur==end() ? 0 : *cur;
518 /////////////////// ePtrList next() ////////////////////
520 inline T* ePtrList<T>::next()
522 // Returns a pointer to the item succeeding the current item. Returns null if the current items is null or equal to the last item.
523 // Makes the succeeding item current. If the current item before this function call was the last item, the current item will be set to null. If the current item was null, this function does nothing.
533 /////////////////// ePtrList prev() ////////////////////
535 inline T* ePtrList<T>::prev()
537 // Returns a pointer to the item preceding the current item. Returns null if the current items is null or equal to the first item.
538 // Makes the preceding item current. If the current item before this function call was the first item, the current item will be set to null. If the current item was null, this function does nothing.
545 /////////////////// ePtrList first() ////////////////////
547 inline T* ePtrList<T>::first()
549 // Returns a pointer to the first item in the list and makes this the current list item, or null if the list is empty.
550 return *(cur = begin());
553 /////////////////// ePtrList last() ////////////////////
555 inline T* ePtrList<T>::last()
557 // Returns a pointer to the last item in the list and makes this the current list item, or null if the list is empty.
558 return *(cur = --end());
561 /////////////////// const ePtrList current() ////////////////////
563 inline const T* ePtrList<T>::current() const
565 // Returns a pointer to the current list item. The current item may be null (implies that the current index is not valid)
566 return cur==end() ? 0 : *cur;
569 /////////////////// const ePtrList next() ////////////////////
571 inline const T* ePtrList<T>::next() const
573 // Returns a pointer to the item succeeding the current item. Returns null if the current items is null or equal to the last item.
574 // Makes the succeeding item current. If the current item before this function call was the last item, the current item will be set to null. If the current item was null, this function does nothing.
584 /////////////////// const ePtrList prev() ////////////////////
586 inline const T* ePtrList<T>::prev() const
588 // Returns a pointer to the item preceding the current item. Returns null if the current items is null or equal to the first item.
589 // Makes the preceding item current. If the current item before this function call was the first item, the current item will be set to null. If the current item was null, this function does nothing.
596 /////////////////// const ePtrList first() ////////////////////
598 inline const T* ePtrList<T>::first() const
600 // Returns a pointer to the first item in the list and makes this the current list item, or null if the list is empty.
601 return *(cur = begin());
604 /////////////////// const ePtrList last() ////////////////////
606 inline const T* ePtrList<T>::last() const
608 // Returns a pointer to the last item in the list and makes this the current list item, or null if the list is empty.
609 return *(cur = --end());
612 ////////////////// struct less //////////////////////////////
614 struct ePtrList<T>::less
616 // operator() is used internal from the list to sort them
617 bool operator() (const T* t1, const T* t2)
623 /////////////////// ePtrList operator bool ////////////////////
625 ePtrList<T>::operator bool()
627 // Returns a bool that contains true, when the list is NOT empty otherwise false
628 return !std::list<T*>::empty();
632 bool ePtrList<T>::operator!()
634 // Returns a bool that contains true, when the list is empty otherwise false
635 return std::list<T*>::empty();
639 class eSmartPtrList : public std::list<ePtr<T> >
642 typedef typename std::list<ePtr<T>, std::allocator<ePtr<T> > >::iterator std_list_T_iterator; // to remove compiler warnings
643 typedef typename std::list<ePtr<T>, std::allocator<ePtr<T> > >::const_iterator std_list_T_const_iterator;
644 typedef typename std::list<ePtr<T>, std::allocator<ePtr<T> > >::reverse_iterator std_list_T_reverse_iterator;
645 typedef typename std::list<ePtr<T>, std::allocator<ePtr<T> > >::const_reverse_iterator std_list_T_const_reverse_iterator;
646 typedef typename eSmartPtrList<T>::iterator T_iterator;
647 typedef typename eSmartPtrList<T>::const_iterator T_const_iterator;
648 typedef typename eSmartPtrList<T>::reverse_iterator T_reverse_iterator;
649 typedef typename eSmartPtrList<T>::const_reverse_iterator T_const_reverse_iterator;
653 class const_iterator;
654 class reverse_iterator;
655 class const_reverse_iterator;
658 inline eSmartPtrList();
659 inline eSmartPtrList(const eSmartPtrList&);
660 inline ~eSmartPtrList();
662 // overwritted sort method
665 // changed methods for autodelete and current implementation
666 inline void remove(T* t);
668 inline void pop_back();
669 inline void pop_front();
670 inline void push_back(T*);
671 inline void push_front(T*);
673 // added methods for current implementation
675 // inline void take(T* t);
681 inline T* setCurrent(const T*);
682 inline const T* current() const;
683 inline const T* next() const;
684 inline const T* prev() const;
685 inline const T* first() const;
686 inline const T* last() const;
688 // added operator methods
689 inline operator bool();
690 inline bool operator!();
692 // added compare struct ... to sort
699 // makes implicit type conversion form std::list::iterator to eSmartPtrList::iterator
700 return std::list<ePtr<T> >::begin();
705 // makes implicit type conversion form std::list::iterator to eSmartPtrList::iterator
706 return std::list<ePtr<T> >::end();
709 const_iterator begin() const
711 // makes implicit type conversion form std::list::const_iterator to eSmartPtrList::const_iterator
712 return std::list<ePtr<T> >::begin();
715 const_iterator end() const
717 // makes implicit type conversion form std::list::const_iterator to eSmartPtrList::const_iterator
718 return std::list<ePtr<T> >::end();
721 reverse_iterator rbegin()
723 // makes implicit type conversion form std::list::reverse:_iterator to eSmartPtrList::reverse_iterator
724 return std::list<ePtr<T> >::rbegin();
727 reverse_iterator rend()
729 // makes implicit type conversion form std::list::reverse_iterator to eSmartPtrList::reverse_iterator
730 return std::list<ePtr<T> >::rend();
733 const_reverse_iterator rbegin() const
735 // makes implicit type conversion form std::list::const_reverse_iterator to eSmartPtrList::const_reverse_iterator
736 return std::list<ePtr<T> >::rbegin();
739 const_reverse_iterator rend() const
741 // makes implicit type conversion form std::list::const_reverse_iterator to eSmartPtrList::const_reverse_iterator
742 return std::list<ePtr<T> >::rend();
745 iterator erase(iterator it)
747 // Remove the item it, if auto-deletion is enabled, than the list call delete for this item
748 // If current is equal to the item that was removed, current is set to the next item in the list
751 return cur = std::list<ePtr<T> >::erase(it);
753 return std::list<ePtr<T> >::erase(it);
756 iterator erase(iterator from, iterator to)
758 // Remove all items between the to iterators from and to
759 // If auto-deletion is enabled, than the list call delete for all removed items
768 // Returns a iterator that equal to begin() of the list
772 operator const_iterator() const
774 // Returns a const_iterator that equal to begin() of the list
778 operator reverse_iterator()
780 // Returns a reverse_iterator that equal to rbegin() of the list
784 operator const_reverse_iterator() const
786 // Returns a const_reverse_iterator that equal to rbegin() of the list
790 std::vector<T>* getVector()
792 // Creates an vector and copys all elements to this vector
793 // returns a pointer to this new vector ( the reserved memory must deletet from the receiver !! )
794 std::vector<T>* v=new std::vector<T>();
795 v->reserve( std::list<T>::size() );
796 for ( std_list_T_iterator it( std::list<ePtr<T> >::begin() ); it != std::list<ePtr<T> >::end(); it++)
797 v->push_back( **it );
802 inline iterator insert_in_order( T* e )
804 // added a new item to the list... in order
805 // returns a iterator to the new item
806 return insert( std::lower_bound( std::list<ePtr<T> >::begin(), e, std::list<ePtr<T> >::end()), e );
811 /////////////////// iterator class /////////////////////////////
813 class eSmartPtrList<T>::iterator : public std::list<ePtr<T> >::iterator
817 iterator(const std_list_T_iterator& Q) : std_list_T_iterator(Q) { }
819 // changed operator for pointer
820 T* operator->() const
822 return *std::list<ePtr<T> >::iterator::operator->();
827 return *operator->();
835 iterator& operator++()
837 std::list<ePtr<T> >::iterator::operator++();
841 iterator operator++(int)
843 return std::list<ePtr<T> >::iterator::operator++(0);
846 iterator& operator--()
848 std::list<ePtr<T> >::iterator::operator--();
852 iterator operator--(int)
854 return std::list<ePtr<T> >::iterator::operator--(0);
858 /////////////////// const_iterator class /////////////////////////////
860 class eSmartPtrList<T>::const_iterator : public std::list<ePtr<T> >::const_iterator
864 const_iterator(const std_list_T_const_iterator& Q) :std_list_T_const_iterator(Q) { }
866 // changed operator for pointer
867 T* operator->() const
869 return *std::list<ePtr<T> >::const_iterator::operator->();
874 return *operator->();
882 const_iterator& operator++()
884 std::list<ePtr<T> >::const_iterator::operator++();
888 const_iterator operator++(int)
890 return std::list<ePtr<T> >::const_iterator::operator++(0);
893 const_iterator& operator--()
895 std::list<ePtr<T> >::const_iterator::operator--();
899 const_iterator operator--(int)
901 return std::list<ePtr<T> >::const_iterator::operator--(0);
905 /////////////////// reverse_iterator class /////////////////////////////
907 class eSmartPtrList<T>::reverse_iterator : public std::list<ePtr<T> >::reverse_iterator
911 reverse_iterator(const std_list_T_reverse_iterator& Q) :std_list_T_reverse_iterator(Q) { }
913 // changed operators for pointer
914 T* operator->() const
916 return *std::list<ePtr<T> >::reverse_iterator::operator->();
921 return *operator->();
929 reverse_iterator& operator++()
931 std::list<ePtr<T> >::reverse_iterator::operator++();
935 reverse_iterator operator++(int)
937 return std::list<ePtr<T> >::reverse_iterator::operator++(0);
940 reverse_iterator& operator--()
942 std::list<ePtr<T> >::reverse_iterator::operator--();
946 reverse_iterator operator--(int)
948 return std::list<ePtr<T> >::reverse_iterator::operator--(0);
952 /////////////////// const_reverse_iterator class /////////////////////////////
954 class eSmartPtrList<T>::const_reverse_iterator : public std::list<ePtr<T> >::const_reverse_iterator
958 const_reverse_iterator(const std_list_T_const_reverse_iterator& Q) :std_list_T_const_reverse_iterator(Q) { }
960 // changed operators for pointer
961 T* operator->() const
963 return *std::list<ePtr<T> >::const_reverse_iterator::operator->();
968 return *operator->();
976 const_reverse_iterator& operator++()
978 std::list<ePtr<T> >::const_reverse_iterator::operator++();
982 const_reverse_iterator operator++(int)
984 return std::list<ePtr<T> >::const_reverse_iterator::operator++(0);
987 const_reverse_iterator& operator--()
989 std::list<ePtr<T> >::const_reverse_iterator::operator--();
993 const_reverse_iterator operator--(int)
995 return std::list<ePtr<T> >::const_reverse_iterator::operator--(0);
999 /////////////////// Default Constructor /////////////////////////////
1001 eSmartPtrList<T>::eSmartPtrList()
1002 :cur(std::list<ePtr<T> >::begin())
1007 /////////////////// Copy Constructor /////////////////////////////
1009 eSmartPtrList<T>::eSmartPtrList(const eSmartPtrList& e)
1010 :std::list<ePtr<T> >(e), cur(e.cur)
1014 /////////////////// eSmartPtrList Destructor /////////////////////////////
1016 inline eSmartPtrList<T>::~eSmartPtrList()
1021 /////////////////// eSmartPtrList sort() /////////////////////////
1023 inline void eSmartPtrList<T>::sort()
1025 // Sorts all items in the list.
1026 // The type T must have a operator <.
1027 std::list<ePtr<T> >::sort(eSmartPtrList<T>::less());
1030 /////////////////// eSmartPtrList remove(T*) /////////////////////////
1032 inline void eSmartPtrList<T>::remove(T* t)
1034 // Remove all items that, equals to t, if auto-deletion is enabled, than the list call delete for the removed items
1035 // If current is equal to one of the removed items, current is set to the next valid item
1036 T_iterator it(std::list<ePtr<T> >::begin());
1038 while (it != std::list<ePtr<T> >::end())
1042 break; // one item is complete removed an deleted
1047 while (it != std::list<ePtr<T> >::end())
1049 it = std::list<ePtr<T> >::erase(it); // remove all other items that equals to t (no delete is called..)
1055 /////////////////// eSmartPtrList clear() //////////////////
1057 inline void eSmartPtrList<T>::clear()
1059 // Remove all items from the list
1060 // If auto-deletion is enabled, than the list call delete for all items in the list
1061 erase(std::list<ePtr<T> >::begin(), std::list<ePtr<T> >::end());
1064 /////////////////// eSmartPtrList pop_back() ////////////////////
1066 inline void eSmartPtrList<T>::pop_back()
1068 // Removes the last item from the list. If the current item ist the last, than the current is set to the new
1069 // last item in the list;
1070 // The removed item is deleted if auto-deletion is enabled.
1074 /////////////////// eSmartPtrList pop_front() ////////////////////
1076 inline void eSmartPtrList<T>::pop_front()
1078 // Removes the first item from the list. If the current item ist the first, than the current is set to the new
1079 // first item in the list;
1080 // The removed item is deleted if auto-deletion is enabled.
1084 /////////////////// eSmartPtrList push_back(T*) ////////////////////
1086 inline void eSmartPtrList<T>::push_back(T* x)
1088 // Add a new item at the end of the list.
1089 // The current item is set to the last item;
1090 std::list<ePtr<T> >::push_back(x);
1094 /////////////////// eSmartPtrList push_front(T*) ////////////////////
1096 inline void eSmartPtrList<T>::push_front(T* x)
1098 // Add a new item at the begin of the list.
1099 // The current item is set to the first item;
1100 std::list<ePtr<T> >::push_front(x);
1104 /////////////////// eSmartPtrList setCurrent(T*) ////////////////////
1106 inline T* eSmartPtrList<T>::setCurrent(const T* t)
1108 // Sets the internal current iterator to the first element that equals to t, and returns t when a item is found,
1109 // otherwise it returns 0 !
1110 for (T_iterator it(std::list<ePtr<T> >::begin()); it != std::list<ePtr<T> >::end(); ++it)
1120 /////////////////// eSmartPtrList current() ////////////////////
1122 inline T* eSmartPtrList<T>::current()
1124 // Returns a pointer to the current list item. The current item may be null (implies that the current index is -1).
1125 return cur==end() ? 0 : *cur;
1128 /////////////////// eSmartPtrList next() ////////////////////
1130 inline T* eSmartPtrList<T>::next()
1132 // Returns a pointer to the item succeeding the current item. Returns null if the current items is null or equal to the last item.
1133 // Makes the succeeding item current. If the current item before this function call was the last item, the current item will be set to null. If the current item was null, this function does nothing.
1143 /////////////////// eSmartPtrList prev() ////////////////////
1145 inline T* eSmartPtrList<T>::prev()
1147 // Returns a pointer to the item preceding the current item. Returns null if the current items is null or equal to the first item.
1148 // Makes the preceding item current. If the current item before this function call was the first item, the current item will be set to null. If the current item was null, this function does nothing.
1155 /////////////////// eSmartPtrList first() ////////////////////
1157 inline T* eSmartPtrList<T>::first()
1159 // Returns a pointer to the first item in the list and makes this the current list item, or null if the list is empty.
1160 return *(cur = begin());
1163 /////////////////// eSmartPtrList last() ////////////////////
1165 inline T* eSmartPtrList<T>::last()
1167 // Returns a pointer to the last item in the list and makes this the current list item, or null if the list is empty.
1168 return *(cur = --end());
1171 /////////////////// const eSmartPtrList current() ////////////////////
1173 inline const T* eSmartPtrList<T>::current() const
1175 // Returns a pointer to the current list item. The current item may be null (implies that the current index is not valid)
1176 return cur==end() ? 0 : *cur;
1179 /////////////////// const eSmartPtrList next() ////////////////////
1181 inline const T* eSmartPtrList<T>::next() const
1183 // Returns a pointer to the item succeeding the current item. Returns null if the current items is null or equal to the last item.
1184 // Makes the succeeding item current. If the current item before this function call was the last item, the current item will be set to null. If the current item was null, this function does nothing.
1194 /////////////////// const eSmartPtrList prev() ////////////////////
1196 inline const T* eSmartPtrList<T>::prev() const
1198 // Returns a pointer to the item preceding the current item. Returns null if the current items is null or equal to the first item.
1199 // Makes the preceding item current. If the current item before this function call was the first item, the current item will be set to null. If the current item was null, this function does nothing.
1206 /////////////////// const eSmartPtrList first() ////////////////////
1208 inline const T* eSmartPtrList<T>::first() const
1210 // Returns a pointer to the first item in the list and makes this the current list item, or null if the list is empty.
1211 return *(cur = begin());
1214 /////////////////// const eSmartPtrList last() ////////////////////
1216 inline const T* eSmartPtrList<T>::last() const
1218 // Returns a pointer to the last item in the list and makes this the current list item, or null if the list is empty.
1219 return *(cur = --end());
1222 ////////////////// struct less //////////////////////////////
1224 struct eSmartPtrList<T>::less
1226 // operator() is used internal from the list to sort them
1227 bool operator() (const T* t1, const T* t2)
1233 /////////////////// eSmartPtrList operator bool ////////////////////
1235 eSmartPtrList<T>::operator bool()
1237 // Returns a bool that contains true, when the list is NOT empty otherwise false
1238 return !std::list<T>::empty();
1242 bool eSmartPtrList<T>::operator!()
1244 // Returns a bool that contains true, when the list is empty otherwise false
1245 return std::list<T>::empty();
1248 #endif // _E_PTRLIST