home *** CD-ROM | disk | FTP | other *** search
- #include <windows.h>
- #include <wininet.h>
- #include <commctrl.h>
- #include "comctlhd.h"
- #include "clist.h"
- #include "resource.h"
-
-
- //**********************************************************************
- // Clist::Clist
- //
- // Purpose: Constructor for Clist class
- // Parameters: None
- //
- //********************************************************************
-
- Clist::Clist()
- {
- head = new node;
- z = new node;
- head->next = z;
- z->next = z;
-
- }
-
- //**********************************************************************
- // Clist::Clist
- //
- // Purpose: Destructor for Clist class
- // Parameters: None
- //
- //********************************************************************
- Clist::~Clist()
- {
- return;
-
- }
-
- //**********************************************************************
- // Clist::remove
- //
- // Purpose: remove all the nodes associated with the class instance
- // Parameters: None
- // Return Value: None
- //
- //********************************************************************
- void Clist::remove(void)
- {
- struct node *t = head;
- while ( t!=z)
- {
- head = t;
- t = t->next;
- delete head;
- }
-
- }
-
- //**********************************************************************
- // Clist::remove
- //
- // Purpose: remove a node based on key value
- // Parameters:
- // Lint ikey - key value
- // Return Value: None
- //
- //********************************************************************
-
- void Clist::remove(int ikey)
- {
- struct node *tmp, *t = head;
- while ( t->next !=z)
- {
- if (t->next->data.key == ikey)
- {
- tmp = t->next;
- t->next = tmp->next;
- delete tmp;
- break;
- }
- t = t->next;
- }
-
- }
-
-
- //**********************************************************************
- // Clist::insertatend
- //
- // Purpose: Insert a new node into the linked list
- // Parameters:
- // LPTVNODEINFO pelem - initialization values for node data member
- // Return Value:
- // pointer to node elements data member
- //
- //********************************************************************
-
- LPTVNODEINFO Clist::insertatend(LPTVNODEINFO pelem)
- {
- struct node *t = head->next;
- struct node *n = new node;
- struct node *last = head;
- n->data.dwAttributes = pelem->dwAttributes;
- n->data.enumflag = pelem->enumflag;
- n->data.hConnect = pelem->hConnect;
- lstrcpy(n->data.pszSite, pelem->pszSite);
- lstrcpy(n->data.pszDir, pelem->pszDir);
- n->data.requestType = pelem->requestType;
- n->data.prequestResult = pelem->prequestResult;
- n->data.index = pelem->index;
-
- srand( (unsigned)GetTickCount( ) );
- n->data.key = rand();
-
- n->next = z;
- while (t!=z)
- {
- last = t;
- t = t->next;
- }
- last->next = n;
- return &(n->data);
-
- }
-
-
-
-
-