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