]> git.lyx.org Git - lyx.git/blob - src/SpellBase.h
do not define boost::throw_exceptions if we are compiling with exceptions
[lyx.git] / src / SpellBase.h
1 // -*- C++ -*-
2 /**
3  * \file SpellBase.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author unknown
8  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef SPELL_BASE_H
14 #define SPELL_BASE_H
15
16 #include <string>
17
18 class BufferParams;
19 class WordLangTuple;
20
21 /**
22  * Base class of all spellchecker implementations.
23  * The class can be instantiated but will have no functionality.
24  */
25 class SpellBase {
26 public:
27
28         /// the result from checking a single word
29         enum Result  {
30                 /// word is correct
31                 OK = 1,
32                 /// root of given word was found
33                 ROOT,
34                 /// word found through compound formation
35                 COMPOUND_WORD,
36                 /// word not found
37                 UNKNOWN_WORD,
38                 /// not found, with suggestions
39                 SUGGESTED_WORDS,
40                 /// number of other ignored "word"
41                 IGNORED_WORD
42         };
43
44         virtual ~SpellBase() {}
45
46         /// return true if the spellchecker instance still exists
47         virtual bool alive();
48
49         /// check the given word of the given lang code and return the result
50         virtual enum Result check(WordLangTuple const &);
51
52         /// insert the given word into the personal dictionary
53         virtual void insert(WordLangTuple const &);
54
55         /// accept the given word temporarily
56         virtual void accept(WordLangTuple const &);
57
58         /// return the next near miss after a SUGGESTED_WORDS result
59         virtual std::string const nextMiss();
60
61         /// give an error message on messy exit
62         virtual std::string const error();
63 };
64
65 #endif // SPELL_BASE_H