home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-09-24 | 1.5 KB | 45 lines | [TEXT/CWIE] |
- // Start of Bit added by Ken
-
- #include "oofbool.hpp"
-
- class OOF_ListElement {
- public:
- OOF_ListElement(unsigned long theItem); // initialize a list element
-
- OOF_ListElement *mNext; // next element on list,
- // NULL if this is the last
- unsigned long mItem; // item on the list
- };
-
- // The following class defines a "list" -- a singly linked list of
- // list elements, each of which points to a single item on the list.
- //
- // By using the "Sorted" functions, the list can be kept in sorted
- // in increasing order by "key" in ListElement.
-
- class OOF_List {
- public:
- OOF_List(); // initialize the list
- ~OOF_List(); // de-allocate the list
-
- void prepend(unsigned long theItem); // Put item at the beginning of the list
- void append(unsigned long theItem); // Put item at the end of the list
- unsigned long remove(); // Take item off the front of the list
-
- bool isEmpty() const; // is the list empty?
-
- bool member(unsigned long theItem) const; // Is theItem in the list
-
- void sortedInsert(unsigned long theItem); // Put item into list sorted
- void sortedInsertNoDups(unsigned long theItem); // Put item into list sorted
-
- unsigned long count() const; // Return the number of items
-
- private:
- OOF_ListElement *mFirst; // Head of the list, NULL if list is empty // owned - special case as linked list of owned items
- OOF_ListElement *mLast; // Last element of list
- unsigned long mCount; // number of items
- };
-
- // End of Bit added by Ken
-