remove lib/content
[enigma2.git] / lib / base / eptrlist.h
index f1421eb2c75858f6f8f2ce2c874269b55bf920e1..3c21510d2dd31a06df86e0fdf20602b5b4789cb7 100644 (file)
@@ -59,16 +59,10 @@ public:
        inline operator bool();
        inline bool operator!();
 
-// added methods for autodelete implementation
-       inline void setAutoDelete(bool b);
-       inline bool isAutoDelete();
-
 // added compare struct ... to sort
        struct less;
 private:
        iterator cur;
-       bool autoDelete;
-
 public:
        iterator ePtrList<T>::begin()
        {                               
@@ -122,9 +116,6 @@ public:
        {
        //      Remove the item it, if auto-deletion is enabled, than the list call delete for this item
        //  If current is equal to the item that was removed, current is set to the next item in the list
-               if (autoDelete && *it)
-                       delete *it;                                     
-
                if (cur == it)
                        return cur = std::list<T*>::erase(it);
                else
@@ -170,19 +161,19 @@ public:
                // Creates an vector and copys all elements to this vector
                // returns a pointer to this new vector ( the reserved memory must deletet from the receiver !! )
                std::vector<T>* v=new std::vector<T>();
-               v->reserve( size() );
+               v->reserve( std::list<T>::size() );
     for ( std_list_T_iterator it( std::list<T*>::begin() ); it != std::list<T*>::end(); it++)
                        v->push_back( **it );
 
                return v;
        }
 
-       inline iterator insert_in_order( T* e )
-       {
-               // added a new item to the list... in order
-               // returns a iterator to the new item
-               return insert( std::lower_bound( std::list<T*>::begin(), std::list<T*>::end(), e ), e );
-       }
+//     inline iterator insert_in_order( T* e )
+//     {
+//             // added a new item to the list... in order
+//             // returns a iterator to the new item
+//             return insert( std::lower_bound( std::list<T*>::begin(), std::list<T*>::end(), e ), e );
+//     }
 
 };
 
@@ -377,7 +368,7 @@ public:
 /////////////////// Default Constructor /////////////////////////////
 template <class T>
 ePtrList<T>::ePtrList()
-    :cur(std::list<T*>::begin()), autoDelete(false)            
+    :cur(std::list<T*>::begin())
 {              
 
 }
@@ -385,34 +376,23 @@ ePtrList<T>::ePtrList()
 /////////////////// Copy Constructor /////////////////////////////
 template <class T>
 ePtrList<T>::ePtrList(const ePtrList& e)
-       :std::list<T*>(e), cur(e.cur), autoDelete( false )
+       :std::list<T*>(e), cur(e.cur)
 {              
-       if ( e.autoDelete )     
-               if ( e.size() )
-                       eDebug("Warning !! We make a Copy of a non empty ePtrList, with autoDelete enabled"
-                                                "We disable autoDelete in the new ePtrList !!");
-               else
-                       autoDelete=true;
 }
 
 /////////////////// ePtrList Destructor /////////////////////////////
 template <class T>
 inline ePtrList<T>::~ePtrList()
 {
-// if autoDelete is enabled, delete is called for all elements in the list
-       if (autoDelete)
-               for (std_list_T_iterator it(std::list<T*>::begin()); it != std::list<T*>::end(); it++)
-                       delete *it;
 }
 
-
 /////////////////// ePtrList sort() /////////////////////////
 template <class T>
 inline void ePtrList<T>::sort()
 {              
 //     Sorts all items in the list.
 //     The type T must have a operator <.
-       std::list<T*>::sort(ePtrList<T>::less());
+       std::list<T*>::sort(typename ePtrList<T>::less());
 }      
 
 /////////////////// ePtrList remove(T*) /////////////////////////
@@ -644,30 +624,14 @@ template <class T>
 ePtrList<T>::operator bool()   
 {
 //     Returns a bool that contains true, when the list is NOT empty otherwise false
-       return !empty();        
+       return !std::list<T*>::empty(); 
 }
 
 template <class T>
 bool ePtrList<T>::operator!()  
 {
 //     Returns a bool that contains true, when the list is empty otherwise false
-       return empty(); 
-}
-
-template <class T>
-void ePtrList<T>::setAutoDelete(bool b)
-{
-//     switched autoDelete on or off
-//     if autoDelete is true, than the pointer list controls the heap memory behind the pointer itself
-//     the list calls delete for the item before it removed from the list
-       autoDelete=b;   
-}
-
-template <class T>
-bool ePtrList<T>::isAutoDelete()
-{
-// returns a bool that contains the state of autoDelete
-       return autoDelete;
+       return std::list<T*>::empty();  
 }
 
 template <class T>
@@ -724,16 +688,10 @@ public:
        inline operator bool();
        inline bool operator!();
 
-// added methods for autodelete implementation
-       inline void setAutoDelete(bool b);
-       inline bool isAutoDelete();
-
 // added compare struct ... to sort
        struct less;
 private:
        iterator cur;
-       bool autoDelete;
-
 public:
        iterator eSmartPtrList<T>::begin()
        {                               
@@ -787,8 +745,6 @@ public:
        {
        //      Remove the item it, if auto-deletion is enabled, than the list call delete for this item
        //  If current is equal to the item that was removed, current is set to the next item in the list
-               if (autoDelete && *it)
-                       delete *it;                                     
 
                if (cur == it)
                        return cur = std::list<ePtr<T> >::erase(it);
@@ -835,19 +791,19 @@ public:
                // Creates an vector and copys all elements to this vector
                // returns a pointer to this new vector ( the reserved memory must deletet from the receiver !! )
                std::vector<T>* v=new std::vector<T>();
-               v->reserve( size() );
+               v->reserve( std::list<T>::size() );
     for ( std_list_T_iterator it( std::list<ePtr<T> >::begin() ); it != std::list<ePtr<T> >::end(); it++)
                        v->push_back( **it );
 
                return v;
        }
 
-       inline iterator insert_in_order( T* e )
-       {
-               // added a new item to the list... in order
-               // returns a iterator to the new item
-               return insert( std::lower_bound( std::list<ePtr<T> >::begin(), std::list<ePtr<T> >::end(), e ), e );
-       }
+//     inline iterator insert_in_order( T* e )
+//     {
+//             // added a new item to the list... in order
+//             // returns a iterator to the new item
+//             return insert( std::lower_bound( std::list<ePtr<T> >::begin(), std::list<ePtr<T> >::end(), e ), e );
+//     }
 
 };
 
@@ -1042,7 +998,7 @@ public:
 /////////////////// Default Constructor /////////////////////////////
 template <class T>
 eSmartPtrList<T>::eSmartPtrList()
-    :cur(std::list<ePtr<T> >::begin()), autoDelete(false)              
+    :cur(std::list<ePtr<T> >::begin())
 {              
 
 }
@@ -1050,24 +1006,14 @@ eSmartPtrList<T>::eSmartPtrList()
 /////////////////// Copy Constructor /////////////////////////////
 template <class T>
 eSmartPtrList<T>::eSmartPtrList(const eSmartPtrList& e)
-       :std::list<ePtr<T> >(e), cur(e.cur), autoDelete( false )
+       :std::list<ePtr<T> >(e), cur(e.cur)
 {              
-       if ( e.autoDelete )     
-               if ( e.size() )
-                       eDebug("Warning !! We make a Copy of a non empty eSmartPtrList, with autoDelete enabled"
-                                                "We disable autoDelete in the new eSmartPtrList !!");
-               else
-                       autoDelete=true;
 }
 
 /////////////////// eSmartPtrList Destructor /////////////////////////////
 template <class T>
 inline eSmartPtrList<T>::~eSmartPtrList()
 {
-// if autoDelete is enabled, delete is called for all elements in the list
-       if (autoDelete)
-               for (std_list_T_iterator it(std::list<ePtr<T> >::begin()); it != std::list<ePtr<T> >::end(); it++)
-                       delete *it;
 }
 
 
@@ -1309,30 +1255,14 @@ template <class T>
 eSmartPtrList<T>::operator bool()      
 {
 //     Returns a bool that contains true, when the list is NOT empty otherwise false
-       return !empty();        
+       return !std::list<T>::empty();  
 }
 
 template <class T>
 bool eSmartPtrList<T>::operator!()     
 {
 //     Returns a bool that contains true, when the list is empty otherwise false
-       return empty(); 
-}
-
-template <class T>
-void eSmartPtrList<T>::setAutoDelete(bool b)
-{
-//     switched autoDelete on or off
-//     if autoDelete is true, than the pointer list controls the heap memory behind the pointer itself
-//     the list calls delete for the item before it removed from the list
-       autoDelete=b;   
-}
-
-template <class T>
-bool eSmartPtrList<T>::isAutoDelete()
-{
-// returns a bool that contains the state of autoDelete
-       return autoDelete;
+       return std::list<T>::empty();   
 }
 
 #endif // _E_PTRLIST