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