#ifndef _LISTARRAY_H #define _LISTARRAY_H #include using namespace std; class List { public: typedef int Item; static const int MAX_ITEMS = 10; //-------------------------------------------------------------------------- // Constructor and Destructor Operations // List(); // Create an empty list of capacity MAX_ITEMS List(int max); // Create an empty list of capacity max ~List(); // Destroy list and free resources //-------------------------------------------------------------------------- // Mutator Operations // void insert(const Item & item); // insert item before cursor void remove(); // remove item at current cursor void reset(); // cursor to first position bool advance(); // advance cursor position //-------------------------------------------------------------------------- // Accessor and Predicate Operations // Item getCurrent() const; // return copy of item at cursor bool isEmpty() const; // is the list empty? bool isFull() const; // is the list full (at capacity)? bool atEOL() const; // is the cursor at EOL? //-------------------------------------------------------------------------- // Print and string Operations // void display(ostream & stream) const; // insert entire list into stream private: Item * elements; // pointer to dynamic array of Item elements int capacity; // maximum number of elements int size; // current size (num elements) in list int cursor; // current position }; #endif