2002-08-04 23:11:50 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file SpellBase.h
|
2003-08-23 00:17:00 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-08-04 23:11:50 +00:00
|
|
|
*
|
|
|
|
* \author unknown
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-08-04 23:11:50 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SPELL_BASE_H
|
|
|
|
#define SPELL_BASE_H
|
|
|
|
|
2006-09-11 08:54:10 +00:00
|
|
|
#include "support/docstring.h"
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
#include <string>
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
class BufferParams;
|
2002-08-13 14:40:38 +00:00
|
|
|
class WordLangTuple;
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
/**
|
2005-09-08 09:20:16 +00:00
|
|
|
* Base class of all spellchecker implementations.
|
2005-05-02 13:35:30 +00:00
|
|
|
* The class can be instantiated but will have no functionality.
|
2002-08-04 23:11:50 +00:00
|
|
|
*/
|
|
|
|
class SpellBase {
|
|
|
|
public:
|
|
|
|
|
|
|
|
/// the result from checking a single word
|
|
|
|
enum Result {
|
2005-01-20 16:17:37 +00:00
|
|
|
/// word is correct
|
|
|
|
OK = 1,
|
|
|
|
/// root of given word was found
|
|
|
|
ROOT,
|
|
|
|
/// word found through compound formation
|
|
|
|
COMPOUND_WORD,
|
|
|
|
/// word not found
|
|
|
|
UNKNOWN_WORD,
|
|
|
|
/// not found, with suggestions
|
|
|
|
SUGGESTED_WORDS,
|
|
|
|
/// number of other ignored "word"
|
|
|
|
IGNORED_WORD
|
2002-08-04 23:11:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
virtual ~SpellBase() {}
|
|
|
|
|
|
|
|
/// return true if the spellchecker instance still exists
|
2005-05-02 13:35:30 +00:00
|
|
|
virtual bool alive();
|
2002-08-04 23:11:50 +00:00
|
|
|
|
2002-08-06 22:38:44 +00:00
|
|
|
/// check the given word of the given lang code and return the result
|
2005-05-02 13:35:30 +00:00
|
|
|
virtual enum Result check(WordLangTuple const &);
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
/// insert the given word into the personal dictionary
|
2005-05-02 13:35:30 +00:00
|
|
|
virtual void insert(WordLangTuple const &);
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
/// accept the given word temporarily
|
2005-05-02 13:35:30 +00:00
|
|
|
virtual void accept(WordLangTuple const &);
|
2002-08-04 23:11:50 +00:00
|
|
|
|
2005-01-20 16:17:37 +00:00
|
|
|
/// return the next near miss after a SUGGESTED_WORDS result
|
2005-05-02 13:35:30 +00:00
|
|
|
virtual std::string const nextMiss();
|
2002-12-01 22:59:25 +00:00
|
|
|
|
|
|
|
/// give an error message on messy exit
|
2006-09-11 08:54:10 +00:00
|
|
|
virtual lyx::docstring const error();
|
2002-08-04 23:11:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SPELL_BASE_H
|