#ifndef DLLIST_H #define DLLIST_H #include "dlnode.h" //DLlist(DoubleLink list) is the class which provides the 'interface' for //the use of DLnodes - for example it handles all the memory allocation & deleting, //so the user of the class don't have to think about those. //---------- class DLlist //---------- { private: DLnode* first; DLnode* last; DLnode* curr; unsigned int size; public: // class constructor DLlist() : first(0), last(0), curr(0), size(0) {} // class destructor, clears the list. ~DLlist(); // Add node after curr void Append(const int); // Add node before curr void Prepend(const int); // Deletes the node to which curr points to, and returns the number of elements remaining in the list. unsigned int Remove(); // Moves curr to next if next exists. Return value is used for loop control: // true indicates curr->next existed // false indicates that curr is the last one. bool MoveNext(); // Moves curr to first void MoveFirst(); // Put value to curr, returns true if list is empty. bool Put(const int); // Returns value from curr int Get(); // Prints list void Print(); }; #endif // DLLIST_H