]> git.lyx.org Git - lyx.git/blob - src/ispell.h
Add GTK bibitem dialog
[lyx.git] / src / ispell.h
1 // -*- C++ -*-
2 /**
3  * \file ispell.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 SP_ISPELL_H
14 #define SP_ISPELL_H
15
16 #include "SpellBase.h"
17
18 #include <boost/scoped_ptr.hpp>
19
20 #include <cstdio>
21
22 class BufferParams;
23 namespace lyx {
24 namespace support {
25 class ForkedProcess;
26 }
27 }
28
29 /// i/a spell process-based spellchecker
30 class ISpell : public SpellBase {
31 public:
32         ISpell(BufferParams const & params, std::string const & lang);
33
34         ~ISpell();
35
36         /// return true if the spellchecker instance still exists
37         virtual bool alive();
38
39         /// check the given word and return the result
40         virtual enum Result check(WordLangTuple const & word);
41
42         /// insert the given word into the personal dictionary
43         virtual void insert(WordLangTuple const & word);
44
45         /// accept the given word temporarily
46         virtual void accept(WordLangTuple const & word);
47
48         /// return the next near miss after a SUGGESTED_WORDS result
49         virtual std::string const nextMiss();
50
51         /// give an error message on messy exit
52         virtual std::string const error();
53
54 private:
55         /// read some data. Returns true on an error. Sets err_read
56         /// to true if the data was from stderr.
57         bool select(bool & err_read);
58
59         /// instream to communicate with ispell
60         FILE * in;
61         /// outstream to communicate with ispell
62         FILE * out;
63         /// errstream for ispell
64         FILE * inerr;
65
66         /// pipe fds
67         int pipein[2];
68         int pipeout[2];
69         int pipeerr[2];
70
71         /// buffer for reading
72         char buf[BUFSIZ];
73
74         /// spell error
75         std::string error_;
76
77         boost::scoped_ptr<lyx::support::ForkedProcess> child_;
78
79         // vileness below ... please FIXME
80         /// str ???
81         char * str;
82         /// e ???
83         char * e;
84
85 };
86
87 #endif // ISPELL_H