home *** CD-ROM | disk | FTP | other *** search
- #include "linklist.h"
-
- void link_index::operator -- ( int )
- {
- link_node *old_value = data;
- link_node *last = NULL;
-
- old_value = data;
- rewind();
- while (data != old_value) {
- last = data;
- (*this)++;
- }
- data = last;
- }
-
- void link_index::put(containable *arg)
- {
- if (list == NULL) return;
- put(new link_node(arg));
- }
-
- void link_index::destroy()
- {
- link_node *old_node = data;
-
- if (data == NULL) return;
- (*this)--; // back up one.
- if (data == NULL)
- ((linked_list *)list)->head = old_node->next;
- else
- data->next = old_node->next;
- delete old_node;
- ((linked_list *)list)->object_count--;
- }
-
- void linked_list::put(containable *arg)
- {
- link_index i(*this);
-
- i.put(arg);
- }
-
- containable *linked_list::remove(containable *arg)
- {
- link_index i(*this);
-
- if (i.has(arg))
- i.remove();
- return arg;
- }
-
-