#include <list.h>
Inheritance diagram for List:
Public Member Functions | |
List () | |
List class constructor. | |
virtual | ~List () |
List class destructor. NOTE that this does NOT destroy the list items - it simply delinks all items in the list and deletes the list header. | |
virtual ListItem * | RemoveHead () |
RemoveHead does not as its name may suggest delete the ListItem at the head of the list. It instead removes pointers to and from the ListItem at the head of the list, in effect removing it from the list. RemoveHead returns a pointer to the ListItem 'removed'. It is the responsibility of the caller to delete the ListItem from memory. | |
virtual ListItem * | RemoveTail () |
RemoveTail does not as its name may suggest delete the ListItem at the tail of the list. It instead removes pointers to and from the ListItem at the tail of the list, in effect removing it from the list. RemoveTail returns a pointer to the ListItem 'removed'. It is the responsibility of the caller to delete the ListItem from memory. | |
virtual void | DeleteAll () |
Deletes the list, calling the destructors of all ListItems. | |
virtual void | AddHead (ListItem *) |
To insert a ListItem at the head of the list. | |
virtual void | AddTail (ListItem *) |
To insert a ListItem at the tail of the list. | |
ListItem * | GetHead () const |
To allow access to the ListItem at the head of the list. | |
LISTPOS | GetHeadPosition () const |
Gives the user the relative position of the head of the list. | |
ListItem * | GetTail () const |
To allow access to the ListItem at the tail of the list. | |
LISTPOS | GetTailPosition () const |
Gives the user the relative position of the tail of the list. | |
ListItem * | GetNext (const ListItem *) const |
To allow access to the next ListItem in the list after the one that has been passed in as input. | |
ListItem * | GetPrev (const ListItem *) const |
To allow access to the previous ListItem in the list before the one that has been passed in as input. | |
ListItem * | FindItem (LISTPOS) const |
Gives the user the ListItem at list position passed in. | |
LISTPOS | FindPosition (ListItem *) const |
Gives the user the relative position of the ListItem passed in. | |
virtual ListItem * | RemoveItem (ListItem *) |
Removes the ListItem passed in as a parameter. It is the responsibility of the caller to delete the removed ListItem from memory. | |
virtual LISTPOS | InsertBefore (LISTPOS here, ListItem *item) |
Inserts a ListItem in the list position before the one that is passed in. Notes: This function involves scanning the entire list until 'here' is found, so is much slower on average than the other flavour of InsertBefore. | |
virtual ListItem * | InsertBefore (ListItem *here, ListItem *item) |
Inserts the 'newItem' ListItem before 'here' ListItem in the list. | |
virtual LISTPOS | InsertAfter (LISTPOS here, ListItem *item) |
Inserts a ListItem in the list position after the one that is passed in. Notes: To find 'here', the list must be scanned, so this is much slower on average than the other flavour of InsertAfter. | |
virtual ListItem * | InsertAfter (ListItem *here, ListItem *item) |
Inserts the 'newItem' ListItem after 'here' ListItem in the list. | |
UINT32 | GetCount () const |
To give user of list an indication of its size in terms of number of items. | |
BOOL | IsEmpty () const |
Allows user to see if list is empty or not. | |
BOOL | CreateIndex (List *IndexedList) |
Creates a list of in-order pointers into this list. | |
Private Attributes | |
ListItem * | HeadItem |
ListItem * | TailItem |
UINT32 | ItemCount |
Definition at line 159 of file list.h.
|
List class constructor.
Definition at line 148 of file list.cpp. 00149 { 00150 HeadItem = NULL; 00151 TailItem = NULL; 00152 ItemCount = 0; 00153 00154 #ifdef _DEBUG 00155 LastItemRemoved = NULL; 00156 #endif 00157 }
|
|
List class destructor. NOTE that this does NOT destroy the list items - it simply delinks all items in the list and deletes the list header.
Notes: In DEBUG builds, any non-empty lists are reported to the TRACE output, in order to encourage people to discard their used lists thoughtfully. To remove this TRACE, you must either delete (DeleteAll()) or delink (RemoveItem()) the items from the list before calling the destructor. In ALL builds, any items still in the list when it is destructed are delinked (RemoveItem()) from the list, in order to ensure their next/previous pointers remain valid. Definition at line 187 of file list.cpp. 00188 { 00189 #ifdef _DEBUG 00190 if (!IsEmpty()) 00191 { 00192 TRACE( _T("NON EMPTY LIST DELETED! Its items may appear as memory leaks on exit\n") 00193 _T("The %ld items are listed below. I have delinked them from the list\n"), 00194 (INT32) GetCount()); 00195 00196 // Dump the contents of the list 00197 ListItem *Ptr = GetHead(); 00198 while (Ptr != NULL) 00199 { 00200 TRACE( _T(" '%s' at 0x%x\n"), Ptr->GetRuntimeClass()->GetClassName(), Ptr ); 00201 Ptr = GetNext(Ptr); 00202 } 00203 TRACE( _T("\n") ); 00204 } 00205 #endif 00206 00207 // In all builds, if the list was deleted while non-empty, we delink all items from it 00208 // to ensure that their next/previous pointers are all NULL, rather than pointing at 00209 // possibly invalid areas of memory. This will at least mean that the items can be 00210 // safely added to other lists, without causing complete screwups. 00211 // These items will show up as memory leaks if they are not properly deleted by anyone 00212 // so we don't really need to concern ourselves with alerting the programmer too much 00213 // at this point 00214 while (!IsEmpty()) 00215 RemoveHead(); 00216 }
|
|
To insert a ListItem at the head of the list.
Reimplemented in ColourList. Definition at line 369 of file list.cpp. 00370 { 00371 // CC_ASSERT_VALID(this); 00372 00373 if (this->IsEmpty()) // if list is empty 00374 { 00375 newHead->Next = NULL; // init next prev pointers 00376 newHead->Previous = NULL; 00377 HeadItem = newHead; // head & tail point to first item 00378 TailItem = newHead; 00379 } 00380 else 00381 { 00382 #ifdef _DEBUG 00383 if (ListDebugLevel > 0) 00384 { 00385 ENSURE( this->FindPosition(newHead) == NOT_IN_LIST, 00386 "AddHead: New head item is already in the list"); 00387 } 00388 #endif 00389 newHead->Next = HeadItem; // new head pointed to old head 00390 newHead->Previous = NULL; // new head previous pointer nullified 00391 HeadItem->Previous = newHead; // old head pointed back to new head 00392 HeadItem = newHead; // head pointer pointed to new head 00393 } 00394 00395 ItemCount += 1; // increment item counter 00396 00397 #ifdef _DEBUG 00398 if (newHead == LastItemRemoved) 00399 LastItemRemoved = NULL; 00400 #endif 00401 }
|
|
To insert a ListItem at the tail of the list.
Reimplemented in ColourList. Definition at line 429 of file list.cpp. 00430 { 00431 // CC_ASSERT_VALID(this); 00432 00433 if (this->IsEmpty()) // if list is empty 00434 { 00435 newTail->Next = NULL; // init next prev pointers 00436 newTail->Previous = NULL; 00437 HeadItem = newTail; // head & tail point to first item 00438 TailItem = newTail; 00439 } 00440 else 00441 { 00442 #ifdef _DEBUG 00443 if (ListDebugLevel > 0) 00444 { 00445 ENSURE(this->FindPosition(newTail) == NOT_IN_LIST, 00446 "AddTail: New tail item is already in the list"); 00447 } 00448 #endif 00449 00450 newTail->Previous = TailItem; // previous points old tail 00451 newTail->Next = NULL; // next is nullified 00452 TailItem->Next = newTail; // old tail next points to new tail 00453 TailItem = newTail; // update tail pointer 00454 } 00455 00456 ItemCount += 1; // increment item counter 00457 00458 #ifdef _DEBUG 00459 if (newTail == LastItemRemoved) 00460 LastItemRemoved = NULL; 00461 #endif 00462 }
|
|
Creates a list of in-order pointers into this list.
You wish to scan a list repeatedly, not wasting time considering items you are not interested in. This method avoids changing the order of the items within the list. Could be used for list sorting etc.
Definition at line 1175 of file list.cpp. 01176 { 01177 01178 ListItem* pi = GetHead(); // pointer to this lists item 01179 ListItemIdx* ppi; // pointer to pi 01180 while (pi) 01181 { 01182 ppi = new ListItemIdx(); 01183 if (!ppi) 01184 { 01185 ListIndex->DeleteAll(); // Tidyup 01186 return FALSE; 01187 } 01188 ppi->pItem = pi; 01189 ListIndex->AddTail(ppi); 01190 pi = GetNext(pi); 01191 } 01192 return TRUE; 01193 }
|
|
Deletes the list, calling the destructors of all ListItems.
Reimplemented in ColourList, ColourRamp, TransparencyRamp, PageRectList, and MarkedStack. Definition at line 335 of file list.cpp. 00336 { 00337 while (!IsEmpty()) 00338 { 00339 delete (RemoveTail()); 00340 } 00341 }
|
|
Gives the user the ListItem at list position passed in.
Definition at line 652 of file list.cpp. 00653 { 00654 // CC_ASSERT_VALID(this); 00655 00656 00657 if ((this->IsEmpty()) || (here < 0)) // if list is empty return a null pointer 00658 return NULL; 00659 00660 ListItem *listIter; // list iterator 00661 LISTPOS listCount = 0; // list iterator count 00662 00663 listIter = HeadItem; 00664 00665 while (listCount != here && listIter != NULL) // iterate until input List position found 00666 { 00667 listIter = listIter->Next; 00668 listCount += 1; 00669 } 00670 00671 return listIter; 00672 }
|
|
Gives the user the relative position of the ListItem passed in.
Definition at line 606 of file list.cpp. 00607 { 00608 // CC_ASSERT_VALID(this); 00609 00610 00611 if (this->IsEmpty()) // if list is empty return a null pointer 00612 return EMPTY_LIST; 00613 00614 if (here == NULL) // if input list item is NULL 00615 return NOT_IN_LIST; 00616 00617 ListItem *listIter; // list iterator 00618 LISTPOS listCount = 0; // list iterator count 00619 00620 listIter = HeadItem; 00621 00622 while (listIter != here && listIter != NULL) // iterate until input ListItem found 00623 { 00624 listIter = listIter->Next; 00625 listCount += 1; 00626 } 00627 00628 if (listIter == NULL) 00629 return NOT_IN_LIST; 00630 else 00631 return listCount; 00632 }
|
|
To give user of list an indication of its size in terms of number of items.
Reimplemented in NewColourList. Definition at line 1117 of file list.cpp. 01118 { 01119 // CC_ASSERT_VALID(this); 01120 01121 return ItemCount; 01122 }
|
|
To allow access to the ListItem at the head of the list.
Definition at line 481 of file list.cpp. 00482 { 00483 // CC_ASSERT_VALID(this); 00484 00485 if (this->IsEmpty()) 00486 return NULL; 00487 else 00488 return HeadItem; 00489 }
|
|
Gives the user the relative position of the head of the list.
Definition at line 541 of file list.cpp. 00542 { 00543 // CC_ASSERT_VALID(this); 00544 00545 if (this->IsEmpty()) 00546 return EMPTY_LIST; 00547 else 00548 return 0; 00549 }
|
|
To allow access to the next ListItem in the list after the one that has been passed in as input.
Definition at line 290 of file list.h. 00291 { 00292 #ifdef _DEBUG 00293 CC_ASSERT_VALID(this); 00294 00295 ENSURE(!this->IsEmpty() && here != NULL, 00296 "List::GetNext(here) - The list is empty, or 'here' is NULL"); 00297 00298 ENSURE(here != LastItemRemoved, 00299 "List::GetNext - Serious mistake! The item has just been removed from the list!!"); 00300 00301 if (ListDebugLevel > 1) 00302 { 00303 ListItem *listIter; // list iterator 00304 00305 listIter = HeadItem; 00306 00307 while (listIter != here && listIter != NULL) // iterate until input ListItem found 00308 listIter = listIter->Next; 00309 00310 ENSURE(listIter != NULL, "List:GetNext(here) - 'here' isn't in the list!"); 00311 } 00312 #endif 00313 00314 return here->Next; 00315 }
|
|
To allow access to the previous ListItem in the list before the one that has been passed in as input.
Definition at line 345 of file list.h. 00346 { 00347 #ifdef _DEBUG 00348 CC_ASSERT_VALID(this); 00349 00350 ENSURE(!this->IsEmpty() && here != NULL, 00351 "List::GetNext(here) - The list is empty, or 'here' is NULL"); 00352 00353 ENSURE(here != LastItemRemoved, 00354 "List::GetPrev - Serious mistake! The item has just been removed from the list!!"); 00355 00356 if (ListDebugLevel > 1) 00357 { 00358 ListItem *listIter; // list iterator 00359 00360 listIter = HeadItem; 00361 00362 while (listIter != here && listIter != NULL) // iterate until input ListItem found 00363 listIter = listIter->Next; 00364 00365 ENSURE(listIter != NULL, "List:GetPrev(here) - 'here' isn't in the list!"); 00366 } 00367 00368 #endif 00369 00370 return(here->Previous); 00371 }
|
|
To allow access to the ListItem at the tail of the list.
Definition at line 508 of file list.cpp. 00509 { 00510 // CC_ASSERT_VALID(this); 00511 00512 if (this->IsEmpty()) 00513 return NULL; 00514 else 00515 return TailItem; 00516 }
|
|
Gives the user the relative position of the tail of the list.
Definition at line 577 of file list.cpp. 00578 { 00579 // CC_ASSERT_VALID(this); 00580 00581 if (this->IsEmpty()) 00582 return EMPTY_LIST; 00583 else 00584 return (ItemCount - 1); 00585 }
|
|
Inserts the 'newItem' ListItem after 'here' ListItem in the list.
Reimplemented in ColourList. Definition at line 1049 of file list.cpp. 01050 { 01051 // CC_ASSERT_VALID(this); 01052 01053 #ifdef _DEBUG 01054 if (ListDebugLevel > 0) 01055 { 01056 if (!this->IsEmpty()) 01057 ENSURE( this->FindPosition(newItem) == NOT_IN_LIST, 01058 "InsertAfter: Item to be inserted is already in the list"); 01059 } 01060 #endif 01061 01062 if ((this->IsEmpty()) || (here == NULL) || (newItem == NULL)) 01063 return NULL; 01064 01065 01066 if (here == TailItem) // if tail of list 01067 { 01068 this->AddTail(newItem); // insert after tail 01069 return newItem; 01070 } 01071 01072 #ifdef _DEBUG 01073 if (ListDebugLevel > 0) 01074 { 01075 ListItem *listIter = HeadItem; 01076 01077 while (listIter != here && listIter != NULL) // iterate until list position found 01078 listIter = listIter->Next; 01079 01080 if (listIter == NULL) // list position does not exist in list 01081 { 01082 return NULL; 01083 } 01084 } 01085 #endif 01086 01087 newItem->Previous = here; // point new item to previous one in list 01088 newItem->Next = here->Next; // point new item to next one 01089 here->Next = newItem; // point after item to new one 01090 newItem->Next->Previous = newItem; // point next item back to new one 01091 01092 #ifdef _DEBUG 01093 if (newItem == LastItemRemoved) 01094 LastItemRemoved = NULL; 01095 #endif 01096 01097 ItemCount += 1; // increment item counter 01098 return newItem; 01099 }
|
|
Inserts a ListItem in the list position after the one that is passed in. Notes: To find 'here', the list must be scanned, so this is much slower on average than the other flavour of InsertAfter.
Reimplemented in ColourList. Definition at line 965 of file list.cpp. 00966 { 00967 // CC_ASSERT_VALID(this); 00968 00969 #ifdef _DEBUG 00970 if (ListDebugLevel > 0) 00971 { 00972 if (!this->IsEmpty()) 00973 ENSURE( this->FindPosition(newItem) == NOT_IN_LIST, 00974 "InsertAfter: Item to be inserted is already in the list"); 00975 } 00976 #endif 00977 00978 if ((this->IsEmpty()) && (here > 0)) 00979 return INVALID_LISTPOS; 00980 00981 if (newItem == NULL) 00982 return INVALID_NEWITEM; 00983 00984 if (here == this->GetTailPosition()) // if tail of list 00985 { 00986 this->AddTail(newItem); // insert after tail 00987 return this->GetTailPosition(); 00988 } 00989 00990 ListItem *listIter; // list iterator 00991 LISTPOS listCount = GetHeadPosition(); // list iterator count 00992 00993 listIter = HeadItem; 00994 00995 while (listCount != here && listIter != NULL) // iterate until list position found 00996 { 00997 listIter = listIter->Next; 00998 listCount += 1; 00999 } 01000 01001 if (listIter == NULL) // list position does not exist in list 01002 return INVALID_LISTPOS; 01003 01004 01005 newItem->Previous = listIter; // point new item to previous one in list 01006 newItem->Next = listIter->Next; // point new item to next one 01007 listIter->Next = newItem; // point after item to new one 01008 newItem->Next->Previous = newItem; // point next item back to new one 01009 ItemCount += 1; // increment item counter 01010 01011 #ifdef _DEBUG 01012 if (newItem == LastItemRemoved) 01013 LastItemRemoved = NULL; 01014 #endif 01015 01016 return (listCount + 1); 01017 }
|
|
Inserts the 'newItem' ListItem before 'here' ListItem in the list.
Reimplemented in ColourList. Definition at line 882 of file list.cpp. 00883 { 00884 // CC_ASSERT_VALID(this); 00885 00886 #ifdef _DEBUG 00887 if (ListDebugLevel > 0) 00888 { 00889 if (!this->IsEmpty()) 00890 ENSURE( this->FindPosition(newItem) == NOT_IN_LIST, 00891 "InsertBefore: Item to be inserted is already in the list"); 00892 } 00893 #endif 00894 00895 if (this->IsEmpty() || (here == NULL) || (newItem == NULL)) 00896 return NULL; 00897 00898 if (here == HeadItem) // if head of list 00899 { 00900 this->AddHead(newItem); // insert before head 00901 return newItem; 00902 } 00903 00904 #ifdef _DEBUG 00905 if (ListDebugLevel > 0) 00906 { 00907 ListItem *listIter; // list iterator 00908 00909 listIter = HeadItem; 00910 00911 while (listIter != here && listIter != NULL) // iterate until list position found 00912 listIter = listIter->Next; 00913 00914 ENSURE (listIter != NULL, "List::InsertBefore(Here) - 'Here' does not exist!"); 00915 } 00916 #endif 00917 00918 newItem->Next = here; // point new item to before one 00919 newItem->Previous = here->Previous; // point new item to previous one 00920 here->Previous = newItem; // point before item to new one 00921 newItem->Previous->Next = newItem; // point previous item back new one 00922 00923 #ifdef _DEBUG 00924 if (newItem == LastItemRemoved) 00925 LastItemRemoved = NULL; 00926 #endif 00927 00928 ItemCount += 1; // increment item counter 00929 return newItem; 00930 }
|
|
Inserts a ListItem in the list position before the one that is passed in. Notes: This function involves scanning the entire list until 'here' is found, so is much slower on average than the other flavour of InsertBefore.
Reimplemented in ColourList. Definition at line 798 of file list.cpp. 00799 { 00800 // CC_ASSERT_VALID(this); 00801 00802 #ifdef _DEBUG 00803 if (ListDebugLevel > 0) 00804 { 00805 if (!this->IsEmpty()) 00806 ENSURE( this->FindPosition(newItem) == NOT_IN_LIST, 00807 "InsertBefore: Item to be inserted is already in the list"); 00808 } 00809 #endif 00810 00811 if ((this->IsEmpty()) && (here > 0)) 00812 return INVALID_LISTPOS; 00813 00814 if (newItem == NULL) // if input parameter is NULL 00815 return INVALID_NEWITEM; 00816 00817 if (here == this->GetHeadPosition()) // if head of list 00818 { 00819 this->AddHead(newItem); // insert before head 00820 return this->GetHeadPosition(); 00821 } 00822 00823 ListItem *listIter; // list iterator 00824 LISTPOS listCount = this->GetHeadPosition(); // list iterator count 00825 00826 listIter = HeadItem; 00827 00828 while (listCount != here && listIter != NULL) // iterate until list position found 00829 { 00830 listIter = listIter->Next; 00831 listCount += 1; 00832 } 00833 00834 if (listIter == NULL) // list position does not exist in list 00835 return INVALID_LISTPOS; 00836 00837 newItem->Next = listIter; // point new item to before one 00838 newItem->Previous = listIter->Previous; // point new item to previous one 00839 listIter->Previous = newItem; // point before item to new one 00840 newItem->Previous->Next = newItem; // point previous item back new one 00841 ItemCount += 1; // increment item counter 00842 00843 #ifdef _DEBUG 00844 if (newItem == LastItemRemoved) 00845 LastItemRemoved = NULL; 00846 #endif 00847 00848 return listCount; 00849 }
|
|
Allows user to see if list is empty or not.
Definition at line 1141 of file list.cpp. 01142 { 01143 // CC_ASSERT_VALID(this); 01144 01145 if (ItemCount == 0) 01146 return TRUE; 01147 else 01148 return FALSE; 01149 }
|
|
RemoveHead does not as its name may suggest delete the ListItem at the head of the list. It instead removes pointers to and from the ListItem at the head of the list, in effect removing it from the list. RemoveHead returns a pointer to the ListItem 'removed'. It is the responsibility of the caller to delete the ListItem from memory.
Definition at line 242 of file list.cpp. 00243 { 00244 // CC_ASSERT_VALID(this); 00245 00246 if (this->IsEmpty()) // if list is empty return a null pointer 00247 return NULL; 00248 00249 ListItem *oldHead; 00250 00251 oldHead = HeadItem; 00252 HeadItem = HeadItem->Next; // list head pointed to next item in list 00253 00254 if (HeadItem != NULL) // if list is not empty 00255 HeadItem->Previous = NULL; // pointer to old list head must be nullified 00256 else 00257 TailItem = NULL; // tail item must be nullified 00258 00259 ItemCount -= 1; // decrement item counter 00260 00261 #ifdef _DEBUG 00262 LastItemRemoved = oldHead; 00263 #endif 00264 00265 return oldHead; 00266 }
|
|
Removes the ListItem passed in as a parameter. It is the responsibility of the caller to delete the removed ListItem from memory.
Definition at line 706 of file list.cpp. 00707 { 00708 // CC_ASSERT_VALID(this); 00709 00710 #ifdef _DEBUG 00711 if (ListDebugLevel > 0) 00712 { 00713 ENSURE( this->FindPosition(oldItem) != NOT_IN_LIST, 00714 "RemoveItem: List item to be removed is not in the list"); 00715 } 00716 #endif 00717 00718 if ((this->IsEmpty()) || // if list is empty or 00719 (oldItem == NULL)) // NULL input or 00720 return NULL; 00721 00722 ListItem *adjacentItem; 00723 00724 if ((oldItem->Previous) != NULL) 00725 { 00726 adjacentItem = oldItem->Previous; // point to previous item in list 00727 adjacentItem->Next = oldItem->Next; // by pass old item forwards 00728 if ((oldItem->Next) != NULL) // Remove from middle of ist 00729 { // there are items both sides 00730 adjacentItem = oldItem->Next; // point to next item in list 00731 adjacentItem->Previous = oldItem->Previous; // by pass old item backwards 00732 } 00733 else 00734 { // Removal of tail of list 00735 TailItem = adjacentItem; // new tail item 00736 } 00737 } 00738 else 00739 { // Removal of head of list 00740 if ((oldItem->Next) != NULL) 00741 { 00742 adjacentItem = oldItem->Next; // next item in list 00743 adjacentItem->Previous = NULL; // nullify prev pointer to old item 00744 HeadItem = adjacentItem; // new head item 00745 } 00746 else 00747 { 00748 HeadItem = NULL; // nullify head and tail pointers 00749 TailItem = NULL; 00750 } 00751 } 00752 00753 ItemCount -= 1; // decrement item counter 00754 00755 #ifdef _DEBUG 00756 LastItemRemoved = oldItem; // Check for stupidity - see GetNext/Prev 00757 #endif 00758 00759 oldItem->Previous = NULL; // Er, we should vape the disused links 00760 oldItem->Next = NULL; // shouldn't we? 00761 00762 return oldItem; 00763 }
|
|
RemoveTail does not as its name may suggest delete the ListItem at the tail of the list. It instead removes pointers to and from the ListItem at the tail of the list, in effect removing it from the list. RemoveTail returns a pointer to the ListItem 'removed'. It is the responsibility of the caller to delete the ListItem from memory.
Definition at line 292 of file list.cpp. 00293 { 00294 // CC_ASSERT_VALID(this); 00295 00296 if (this->IsEmpty()) // if list is empty return a null pointer 00297 return NULL; 00298 00299 ListItem *oldTail; 00300 00301 oldTail = TailItem; 00302 TailItem = TailItem->Previous; // list tail pointed to previous item in list 00303 00304 if (TailItem != NULL) // if list is not empty 00305 TailItem->Next = NULL; // pointer to old list tail must be nullified 00306 else 00307 HeadItem = NULL; // head item must be nullified 00308 00309 ItemCount -= 1; // decrement item counter 00310 00311 #ifdef _DEBUG 00312 LastItemRemoved = oldTail; 00313 #endif 00314 00315 return oldTail; 00316 }
|
|
|
|
|
|
|