X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/d63d2c3c6cbbd574dda4f8b00ebe6c661735edd5..ba02fb4aced5868d047a5bffbd2ed87583daee4d:/lib/base/eptrlist.h diff --git a/lib/base/eptrlist.h b/lib/base/eptrlist.h index f1421eb2..ae61d78d 100644 --- a/lib/base/eptrlist.h +++ b/lib/base/eptrlist.h @@ -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::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::erase(it); else @@ -377,7 +368,7 @@ public: /////////////////// Default Constructor ///////////////////////////// template ePtrList::ePtrList() - :cur(std::list::begin()), autoDelete(false) + :cur(std::list::begin()) { } @@ -385,27 +376,16 @@ ePtrList::ePtrList() /////////////////// Copy Constructor ///////////////////////////// template ePtrList::ePtrList(const ePtrList& e) - :std::list(e), cur(e.cur), autoDelete( false ) + :std::list(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 inline ePtrList::~ePtrList() { -// if autoDelete is enabled, delete is called for all elements in the list - if (autoDelete) - for (std_list_T_iterator it(std::list::begin()); it != std::list::end(); it++) - delete *it; } - /////////////////// ePtrList sort() ///////////////////////// template inline void ePtrList::sort() @@ -654,22 +634,6 @@ bool ePtrList::operator!() return empty(); } -template -void ePtrList::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 -bool ePtrList::isAutoDelete() -{ -// returns a bool that contains the state of autoDelete - return autoDelete; -} - template class eSmartPtrList : public std::list > { @@ -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::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 >::erase(it); @@ -1042,7 +998,7 @@ public: /////////////////// Default Constructor ///////////////////////////// template eSmartPtrList::eSmartPtrList() - :cur(std::list >::begin()), autoDelete(false) + :cur(std::list >::begin()) { } @@ -1050,24 +1006,14 @@ eSmartPtrList::eSmartPtrList() /////////////////// Copy Constructor ///////////////////////////// template eSmartPtrList::eSmartPtrList(const eSmartPtrList& e) - :std::list >(e), cur(e.cur), autoDelete( false ) + :std::list >(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 inline eSmartPtrList::~eSmartPtrList() { -// if autoDelete is enabled, delete is called for all elements in the list - if (autoDelete) - for (std_list_T_iterator it(std::list >::begin()); it != std::list >::end(); it++) - delete *it; } @@ -1319,20 +1265,4 @@ bool eSmartPtrList::operator!() return empty(); } -template -void eSmartPtrList::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 -bool eSmartPtrList::isAutoDelete() -{ -// returns a bool that contains the state of autoDelete - return autoDelete; -} - #endif // _E_PTRLIST