//---------------------------------------------------------------------- // SPECIFICATION FILE (clist.h) // This module exports a class for maintaining lists of // single characters //---------------------------------------------------------------------- #ifndef clist_h #define clist_h 1 #include "bool.h" const int LMAX_LENG = 100; class CharList { // ABSTRACTLY: a ordered sequence of values // and a cursor, which is a position in the list or 1 beyond the tail end // CLASSINV: the sequence is empty --> the cursor is beyond the tail end public: Boolean IsEmpty() const; // POST: FCTVAL == (sequence is empty) Boolean IsFull() const; // POST: FCTVAL == true if no more // items can be stored, false otherwise void Reset(); // PRE: the sequence is not empty // MODIFIES: self // POST: the cursor is at the front Boolean EndOfList() const; // POST: FCTVAL == (list cursor is beyond end of list) void Advance(); // PRE: the cursor is not beyond end // MODIFIES: self // POST: cursor points to next item char CurrentItem() const; // PRE: cursor is not beyond end // POST: FCTVAL == item at cursor void InsertBefore( char someChar ); // PRE: another item can be stored // MODIFIES: self // POST: self has someChar at cursor // && someChar precedes the item at cursor (if it exists) void InsertAfter( char someChar ); // PRE: another item can be stored // MODIFIES: self // POST: self has someChar at cursor // && someChar follows the item at cursor (if it exists) void Delete(); // PRE: cursor is not beyond end // MODIFIES: self // POST: item at cursor is not in the sequence // && cursor at next item (if it exists) CharList(); // MODIFIES: self // POST: sequence of values is empty #include "clist.pri" }; #endif