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