Consider the case where there is not any layout name.
[lyx.git] / src / ispell.h
blobe33d848cb7ee915587db37705882c6fc294d5228
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.
7 * \author unknown
8 * \author John Levon
10 * Full author contact details are available in file CREDITS.
13 #ifndef SP_ISPELL_H
14 #define SP_ISPELL_H
16 #include "SpellBase.h"
18 #include <boost/scoped_ptr.hpp>
20 #include <cstdio>
22 class BufferParams;
23 namespace lyx {
24 namespace support {
25 class ForkedProcess;
29 /// i/a spell process-based spellchecker
30 class ISpell : public SpellBase {
31 public:
32 ISpell(BufferParams const & params, std::string const & lang);
34 ~ISpell();
36 /// return true if the spellchecker instance still exists
37 virtual bool alive();
39 /// check the given word and return the result
40 virtual enum Result check(WordLangTuple const & word);
42 /// insert the given word into the personal dictionary
43 virtual void insert(WordLangTuple const & word);
45 /// accept the given word temporarily
46 virtual void accept(WordLangTuple const & word);
48 /// return the next near miss after a SUGGESTED_WORDS result
49 virtual std::string const nextMiss();
51 /// give an error message on messy exit
52 virtual std::string const error();
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);
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;
66 /// pipe fds
67 int pipein[2];
68 int pipeout[2];
69 int pipeerr[2];
71 /// buffer for reading
72 char buf[BUFSIZ];
74 /// spell error
75 std::string error_;
77 boost::scoped_ptr<lyx::support::ForkedProcess> child_;
79 // vileness below ... please FIXME
80 /// str ???
81 char * str;
82 /// e ???
83 char * e;
87 #endif // ISPELL_H