2002-08-04 23:11:50 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2002-09-26 08:57:43 +00:00
|
|
|
* \file ispell.h
|
2002-08-04 23:11:50 +00:00
|
|
|
* Copyright 2002 the LyX Team
|
|
|
|
* Read the file COPYING
|
|
|
|
*
|
|
|
|
* \author unknown
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SP_ISPELL_H
|
|
|
|
#define SP_ISPELL_H
|
|
|
|
|
|
|
|
#include "SpellBase.h"
|
|
|
|
|
2003-02-17 18:40:04 +00:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
|
2002-08-04 23:11:50 +00:00
|
|
|
class BufferParams;
|
2003-02-17 18:40:04 +00:00
|
|
|
class ForkedProcess;
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
/// i/a spell process-based spellchecker
|
|
|
|
class ISpell : public SpellBase {
|
|
|
|
public:
|
|
|
|
ISpell(BufferParams const & params, string const & lang);
|
|
|
|
|
|
|
|
~ISpell();
|
|
|
|
|
|
|
|
/// return true if the spellchecker instance still exists
|
|
|
|
virtual bool alive();
|
|
|
|
|
|
|
|
/// check the given word and return the result
|
2002-08-06 22:38:44 +00:00
|
|
|
virtual enum Result check(WordLangTuple const & word);
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
/// insert the given word into the personal dictionary
|
2002-08-06 22:38:44 +00:00
|
|
|
virtual void insert(WordLangTuple const & word);
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
/// accept the given word temporarily
|
2002-08-06 22:38:44 +00:00
|
|
|
virtual void accept(WordLangTuple const & word);
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
/// return the next near miss after a MISSED result
|
|
|
|
virtual string const nextMiss();
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
/// give an error message on messy exit
|
2002-08-04 23:11:50 +00:00
|
|
|
virtual string const error();
|
|
|
|
|
|
|
|
private:
|
2003-02-17 18:40:04 +00:00
|
|
|
/// read some data. Returns true on an error. Sets err_read
|
|
|
|
/// to true if the data was from stderr.
|
|
|
|
bool select(bool & err_read);
|
2002-10-31 12:42:26 +00:00
|
|
|
|
2002-08-04 23:11:50 +00:00
|
|
|
/// instream to communicate with ispell
|
|
|
|
FILE * in;
|
|
|
|
/// outstream to communicate with ispell
|
|
|
|
FILE * out;
|
2003-02-17 18:40:04 +00:00
|
|
|
/// errstream for ispell
|
|
|
|
FILE * inerr;
|
|
|
|
|
|
|
|
/// pipe fds
|
|
|
|
int pipein[2];
|
|
|
|
int pipeout[2];
|
|
|
|
int pipeerr[2];
|
|
|
|
|
|
|
|
/// buffer for reading
|
|
|
|
char buf[BUFSIZ];
|
|
|
|
|
2002-08-04 23:11:50 +00:00
|
|
|
/// spell error
|
2003-02-17 18:40:04 +00:00
|
|
|
string error_;
|
|
|
|
|
|
|
|
boost::scoped_ptr<ForkedProcess> child_;
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
// vileness below ... please FIXME
|
|
|
|
/// str ???
|
|
|
|
char * str;
|
|
|
|
/// e ???
|
|
|
|
char * e;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ISPELL_H
|