////////////////////////////////////////////////////////////////////// // // dictionary.h // // Jeff Ondich 6/25/96 // Last modified 11/4/99 // // Interface for a simple dictionary class. // ////////////////////////////////////////////////////////////////////// #ifndef DICTIONARY_H #define DICTIONARY_H #include #include class Dictionary { private: // This part is up to you. public: // Constructor. Initialize the data structure from // the specified file. Dictionary( const string& dictionaryFileName ); // Destructor. De-allocate allocated memory, or // do whatever needs doing when a Dictionary dies. ~Dictionary(); // AddWord returns false if the dictionary is full // already or if theWord is already in the // dictionary. Otherwise, AddWord adds the word to // the dictionary and returns true. bool AddWord( const string& theWord ); // IsIn returns true if theWord is in the dictionary // already, and false otherwise. bool IsIn( const string& theWord ) const; // IsFull returns true if the dictionary is full, // false otherwise. Some versions of a dictionary // class will never need IsFull to return true, // but others will. bool IsFull() const; // Print prints the contents of the dictionary // in any form you wish to the stream "out", which // could be an ofstream or cout or any other output // stream. Print is intended for debugging, and // would seldom be used by programs (who wants //to print out a dictionary?). void Print( ostream& out ) const; }; #endif