2002-08-04 23:11:50 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file sp_ispell.h
|
|
|
|
* Copyright 2002 the LyX Team
|
|
|
|
* Read the file COPYING
|
|
|
|
*
|
|
|
|
* \author unknown
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SP_ISPELL_H
|
|
|
|
#define SP_ISPELL_H
|
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
|
|
|
|
#include "SpellBase.h"
|
|
|
|
|
|
|
|
class BufferParams;
|
|
|
|
|
|
|
|
/// 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();
|
|
|
|
|
|
|
|
/// clean up on messy exit
|
|
|
|
virtual void cleanUp();
|
|
|
|
|
|
|
|
/// 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
|
|
|
|
|
|
|
/// finish this spellchecker instance
|
|
|
|
virtual void close();
|
|
|
|
|
|
|
|
/// 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();
|
|
|
|
|
|
|
|
/// give an error message on messy exit
|
|
|
|
virtual string const error();
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// instream to communicate with ispell
|
|
|
|
FILE * in;
|
|
|
|
/// outstream to communicate with ispell
|
|
|
|
FILE * out;
|
|
|
|
/// spell error
|
|
|
|
char const * error_;
|
|
|
|
/// the fd of the outgoing pipe
|
|
|
|
int isp_fd;
|
|
|
|
|
|
|
|
// vileness below ... please FIXME
|
|
|
|
/// str ???
|
|
|
|
char * str;
|
|
|
|
/// e ???
|
|
|
|
char * e;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ISPELL_H
|