Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.5 KiB

  1. //
  2. // CWBOBLIST.HPP
  3. // User Class
  4. //
  5. // Copyright Microsoft 1998-
  6. //
  7. #ifndef __CWBOBLIST_HPP_
  8. #define __CWBOBLIST_HPP_
  9. // class COBNODED;
  10. #define WBPOSITION COBNODED*
  11. struct COBNODED
  12. {
  13. WBPOSITION pNext;
  14. WBPOSITION pPrev;
  15. void* pItem;
  16. };
  17. class CWBOBLIST
  18. {
  19. protected:
  20. WBPOSITION m_pHead;
  21. WBPOSITION m_pTail;
  22. virtual BOOL Compare(void* pItemToCompare, void* pComparator)
  23. {return(pItemToCompare == pComparator);};
  24. public:
  25. CWBOBLIST() : m_pHead(NULL), m_pTail(NULL) { };
  26. WBPOSITION GetHeadPosition() { return(m_pHead); };
  27. WBPOSITION GetTailPosition() { return(m_pTail); };
  28. virtual void * RemoveAt(WBPOSITION rPos);
  29. WBPOSITION AddAt(VOID* pItem, WBPOSITION Pos);
  30. virtual void * ReplaceAt(WBPOSITION rPos, void* pNewItem)
  31. {
  32. void *pvoid = rPos->pItem;
  33. rPos->pItem = pNewItem;
  34. return(pvoid);
  35. }
  36. WBPOSITION AddHead(void* pItem);
  37. WBPOSITION AddTail(void* pItem);
  38. BOOL IsEmpty() { return(!m_pHead); };
  39. void * GetHead(){return GetFromPosition(GetHeadPosition());};
  40. void * GetTail();
  41. void * GetNext(WBPOSITION& rPos);
  42. void* GetPrevious(WBPOSITION& rPos);
  43. WBPOSITION GetPosition(void* pItem);
  44. WBPOSITION Lookup(void* pComparator);
  45. void EmptyList();
  46. virtual ~CWBOBLIST();
  47. void * RemoveHead() { return RemoveAt(m_pHead); };
  48. void * RemoveTail() { return RemoveAt(m_pTail); };
  49. void * GetFromPosition(WBPOSITION rPos){return (rPos == NULL ? NULL : rPos->pItem);};
  50. };
  51. #endif __CWBOBLIST_HPP_