X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fispell.h;h=3aed4d5f41ef7270e29dc2879d2355d53bd8eac5;hb=ba62665f966508db5a4de6864f4aa7374c5a5356;hp=2e89f00fbb91aa72d67994bb18ee520b3b0796bb;hpb=02e94723740cea9a28f90f406c4cab55d7f6b5b9;p=lyx.git diff --git a/src/ispell.h b/src/ispell.h index 2e89f00fbb..3aed4d5f41 100644 --- a/src/ispell.h +++ b/src/ispell.h @@ -1,61 +1,84 @@ // -*- C++ -*- /** * \file ispell.h - * Copyright 2002 the LyX Team - * Read the file COPYING + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * * \author unknown + * \author John Levon + * + * Full author contact details are available in file CREDITS. */ #ifndef SP_ISPELL_H #define SP_ISPELL_H +#include "SpellBase.h" + +#include "support/docstring.h" + +#include + #include -#include "SpellBase.h" +namespace lyx { class BufferParams; +namespace support { class ForkedProcess; } + /// i/a spell process-based spellchecker class ISpell : public SpellBase { public: - ISpell(BufferParams const & params, string const & lang); + ISpell(BufferParams const & params, std::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 virtual enum Result check(WordLangTuple const & word); - /// finish this spellchecker instance - virtual void close(); - /// insert the given word into the personal dictionary virtual void insert(WordLangTuple const & word); /// accept the given word temporarily virtual void accept(WordLangTuple const & word); - /// return the next near miss after a MISSED result - virtual string const nextMiss(); + /// return the next near miss after a SUGGESTED_WORDS result + virtual docstring const nextMiss(); - /// give an error message on messy exit - virtual string const error(); + /// give an error message on messy exit + virtual docstring const error(); private: + /// read some data. Returns true on an error. Sets err_read + /// to true if the data was from stderr. + bool select(bool & err_read); + /// instream to communicate with ispell FILE * in; /// outstream to communicate with ispell FILE * out; + /// errstream for ispell + FILE * inerr; + + /// pipe fds + int pipein[2]; + int pipeout[2]; + int pipeerr[2]; + + /// buffer for reading + char buf[BUFSIZ]; + /// spell error - char const * error_; - /// the fd of the outgoing pipe - int isp_fd; + docstring error_; + + boost::scoped_ptr child_; + + /// iconv name of the encoding that is used to communicate with ispell + std::string encoding; // vileness below ... please FIXME /// str ??? @@ -65,4 +88,6 @@ private: }; +} // namespace lyx + #endif // ISPELL_H