/* This file is part of cardwords
   (c) 1998 1999 2000 Tobias Peters
   see file COPYING for the copyright terms.
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

// cardwords_dictionary.hh

#ifndef CARDWORDS_DICTIONARY_HH
#define CARDWORDS_DICTIONARY_HH

#include "cardwords_hashtable.hh"
#include "cardwords_cardselection.hh"

namespace CardWords {
class DicBot_CardTableRequirements;
class DicBot_BestOrderGenerator;
class DicBot_CardSelectionContents;

class Dictionary {
public:

  bool
  contains_word (const String &) const;

  const String *
  insert_word (const String &);

  void
  erase_word  (const String &);

  // add a dictionary
  void
  insert_file (const string & filename);
  
  // remove words in that file
  void
  remove_file (const string & filename);

  // This function will save the result in a member variable. It will live
  // until the next call to find_possible_words.
  const vector<CardSelection> *
  find_possible_words (size_t min_word_length,
                       size_t max_word_length,
                       DicBot_CardSelectionContents & sc,
                       class DicBot_CardTableRequirements * req,
                       class DicBot_BestOrderGenerator * bog);

  Dictionary (size_t min_word_length,
                        size_t max_word_length,
                        size_t hash_table_size);

  // Returns the number of contained words:
  size_t word_count(void) const;
  
private:
  vector< HashTable< String > > dict;

  vector<CardSelection> founds;

  size_t minWordLength, maxWordLength;
};
}
#endif

