2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 // $XConsortium: CC_Dlist.cc /main/5 1996/08/06 09:27:22 rcs $
27 #include "Exceptions.hh"
28 #include "cc_exceptions.h"
32 //---------------------------------------------------------------------
34 CC_Boolean CC_TPtrDlistIterator<T>::operator+=(size_t n)
36 for ( size_t i = 0; i < n ; i++ ) {
45 //---------------------------------------------------------------------
47 CC_TPtrDlist<T>::CC_TPtrDlist(const CC_TPtrDlist<T>&adlist)
49 CC_TPtrDlistIterator<T> dlist_iter( *(CC_TPtrDlist<T> *)&adlist );
50 while ( dlist_iter() ) {
51 insert ( dlist_iter.key() );
55 //---------------------------------------------------------------------
57 void CC_TPtrDlist<T>::clear()
59 if ( !this->get_destructed() ) {
60 CC_TPtrSlistIterator<T> iter(*this);
63 CC_Link<T> *elem = (CC_Link<T> *)CC_Listbase::remove( (CC_List_Iterator_base &)iter );
73 //---------------------------------------------------------------------
75 CC_TPtrDlist<T>::~CC_TPtrDlist()
80 //---------------------------------------------------------------------
82 void CC_TPtrDlist<T>::clearAndDestroy()
85 this->set_destructed(TRUE);
86 CC_TPtrDlistIterator<T> iter(*this);
89 CC_Link<T> *elem = (CC_Link<T> *)CC_Listbase::remove( (CC_List_Iterator_base &)iter );
91 T *temp_elem = elem->f_element;
93 elem->f_element = NULL; // prevent further destruction on this pointer