#ifndef __LIST_H__ #define __LIST_H__ const int MAX_LIST_LENGTH = 100; class IntList { public: IntList(); // Construct an empty list // Operations having to do with the number of elements in the list bool isEmpty(); // Is the list empty? bool isFull(); // Is the list full? int getSize(); // How much in list right now? // List navigation void start(); // Set cursor to start of list void advance(); // Move from current position to next element bool atEnd(); // Is there anything left to look at? int getData(); // Get what's at the current cursor position // List manipulation void insertBefore( int item ); // Insert item before the cursor position. // The cursor ends up positioned over // the new item. void insertAfter( int item ); // Insert item after the cursor position. // The cursor ends up positioned over // the new item. void deleteItem(); // Delete item at cursor position. The // cursor ends up positioned over the // item that used to be to its right // (if the item was rightmost in the list, // the cursor will be atEnd()). private: void makeRoom( int position ); void placeAtStart( int item ); int items[ MAX_LIST_LENGTH ]; // The array of item data int size; // The number of items actually in there int cursor; // The current index of the cursor }; #endif // __LIST_H__