-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dictionary.h
executable file
·40 lines (30 loc) · 952 Bytes
/
Dictionary.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* Dictionary.h
*
* Created on: Sep 18, 2016
* Author: kempe
*/
/* The class Dictionary encodes the list of all legal words. */
#ifndef DICTIONARY_H_
#define DICTIONARY_H_
#include <set>
#include <string>
class Dictionary {
public:
Dictionary (std::string dictionary_file_name);
/* The constructor gets passed the name of the file from which
to read the word list.
If the file cannot be opened, it will throw a FileException
with message "DICTIONARY". */
~Dictionary ();
bool isLegalWord (std::string word) const;
/* Checks whether the given word is in the dictionary, and returns true if so.
Case does not matter. */
std::set<std::string> allWords () const;
/* Returns the set of all words in the dictionary.
Mostly meant for a computer player that wants to use this set to
construct useful search-curtailing maps. */
private:
std::set<std::string> _wordset;
};
#endif /* DICTIONARY_H_ */