home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / directx2 / sdk / samples / include / linklist.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-28  |  1.3 KB  |  54 lines

  1. /*===========================================================================*\
  2. |
  3. |  File:        linklist.h
  4. |
  5. |  Description: 
  6. |       link list class include file
  7. |       
  8. |-----------------------------------------------------------------------------
  9. |
  10. |  Copyright (C) 1995-1996 Microsoft Corporation.  All Rights Reserved.
  11. |
  12. |  Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation
  13. |
  14. \*===========================================================================*/
  15.  
  16. #ifndef _LINKLIST_H
  17. #define _LINKLIST_H
  18.  
  19. typedef struct _NODE {
  20.     struct _NODE        *pPrev;
  21.     struct _NODE        *pNext;
  22.     void    *pData;
  23. } NODE,  *LPNODE;
  24.  
  25. class CLinkedList {
  26. private:
  27.    LPNODE   Find(void  *pData);
  28.    LPNODE   pHead;
  29.    LPNODE   pTail;
  30.    LPNODE   pCurPosition;
  31. public:
  32.    CLinkedList();
  33.    ~CLinkedList();
  34.    void *GetFirst();
  35.    void *GetLast();
  36.    void *GetNext();
  37.    void *GetNext(void  *pData);
  38.    void *GetPrev( );
  39.    void *GetPrev(void  *pData);
  40.    void Add(void  *pData);
  41.    void Insert(void  *pData);
  42.    void Insert(void  *pData, void  *pBefore);
  43.    void Append(void  *pData);
  44.    void Remove( );
  45.    void Remove(void  *pData);
  46.    void *RemoveFirst();
  47.    void *RemoveLast();
  48. };
  49.  
  50. #define LinkedList  CLinkedList
  51.  
  52. #endif
  53.  
  54.