Rename some of the elements of the SpellBase::Result enum.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9513 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2005-01-20 16:17:37 +00:00
parent f3024416ad
commit 1b264d6f7d
11 changed files with 51 additions and 27 deletions

View File

@ -1,5 +1,18 @@
2005-01-20 Angus Leeming <leeming@lyx.org>
* SpellBase.h: rename some of the elements of the Result enum.
* aspell_local.h:
* ispell.h:
* pspell.h:
* aspell.C (check):
* ispell.C (check):
* pspell.C (check): ditto
2005-01-20 Asger Ottar Alstrup <aalstrup@laerdal.dk>
* buffer.C: add #include <fstream>.
* lyx_main.C (init): Compile fix.
* lyxserver.[Ch] (inPipeName, outPipeName): move out of line.

View File

@ -26,12 +26,18 @@ public:
/// the result from checking a single word
enum Result {
OK = 1, //< word is correct
ROOT, //< root of given word was found
COMPOUNDWORD, //< word found through compound formation
UNKNOWN, //< word not found
MISSED, //< not found, with suggestions
IGNORE //< number of other ignored "word"
/// 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
};
virtual ~SpellBase() {}
@ -48,7 +54,7 @@ public:
/// accept the given word temporarily
virtual void accept(WordLangTuple const &) = 0;
/// return the next near miss after a MISSED result
/// return the next near miss after a SUGGESTED_WORDS result
virtual std::string const nextMiss() = 0;
/// give an error message on messy exit

View File

@ -75,7 +75,7 @@ void ASpell::addSpeller(string const & lang)
ASpell::Result ASpell::check(WordLangTuple const & word)
{
Result res = UNKNOWN;
Result res = UNKNOWN_WORD;
Spellers::iterator it = spellers_.find(word.lang_code());
if (it == spellers_.end()) {
@ -99,9 +99,9 @@ ASpell::Result ASpell::check(WordLangTuple const & word)
BOOST_ASSERT(sugs != 0);
els = aspell_word_list_elements(sugs);
if (aspell_word_list_empty(sugs))
res = UNKNOWN;
res = UNKNOWN_WORD;
else
res = MISSED;
res = SUGGESTED_WORDS;
}
return res;
}

View File

@ -49,7 +49,7 @@ public:
/// accept the given word temporarily
virtual void accept(WordLangTuple const &);
/// return the next near miss after a MISSED result
/// return the next near miss after a SUGGESTED_WORDS result
virtual std::string const nextMiss();
/// give an error message on messy exit

View File

@ -79,6 +79,7 @@
#include <iomanip>
#include <stack>
#include <sstream>
#include <fstream>
using lyx::pos_type;

View File

@ -1,3 +1,7 @@
2005-01-20 Angus Leeming <leeming@lyx.org>
* ControlSpellchecker.C (check): s/IGNORE/IGNORED_WORD/.
2005-01-17 Angus Leeming <leeming@lyx.org>
* tex_helpers.C (rescanTexStyles): prepend the name of the

View File

@ -195,7 +195,7 @@ void ControlSpellchecker::check()
BufferParams & bufferparams = kernel().buffer().params();
while (res == SpellBase::OK || res == SpellBase::IGNORE) {
while (res == SpellBase::OK || res == SpellBase::IGNORED_WORD) {
word_ = nextWord(cur, start, bufferparams);
// end of document
@ -237,7 +237,7 @@ void ControlSpellchecker::check()
kernel().bufferview()->update();
// set suggestions
if (res != SpellBase::OK && res != SpellBase::IGNORE) {
if (res != SpellBase::OK && res != SpellBase::IGNORED_WORD) {
lyxerr[Debug::GUI] << "Found a word needing checking." << endl;
dialog().view().partialUpdate(SPELL_FOUND_WORD);
}

View File

@ -373,18 +373,18 @@ enum ISpell::Result ISpell::check(WordLangTuple const & word)
if (error) {
error_ = _("Could not communicate with the spell-checker program.");
return UNKNOWN;
return UNKNOWN_WORD;
}
if (err_read) {
error_ = buf;
return UNKNOWN;
return UNKNOWN_WORD;
}
// I think we have to check if ispell is still alive here because
// the signal-handler could have disabled blocking on the fd
if (!alive())
return UNKNOWN;
return UNKNOWN_WORD;
switch (*buf) {
case '*':
@ -394,18 +394,18 @@ enum ISpell::Result ISpell::check(WordLangTuple const & word)
res = ROOT;
break;
case '-':
res = COMPOUNDWORD;
res = COMPOUND_WORD;
break;
case '\n':
res = IGNORE;
res = IGNORED_WORD;
break;
case '#': // Not found, no near misses and guesses
res = UNKNOWN;
res = UNKNOWN_WORD;
break;
case '?': // Not found, and no near misses, but guesses (guesses are ignored)
case '&': // Not found, but we have near misses
{
res = MISSED;
res = SUGGESTED_WORDS;
char * p = strpbrk(buf, ":");
str = new char[strlen(p) + 1];
e = str;
@ -413,11 +413,11 @@ enum ISpell::Result ISpell::check(WordLangTuple const & word)
break;
}
default: // This shouldn't happen, but you know Murphy
res = UNKNOWN;
res = UNKNOWN_WORD;
}
*buf = 0;
if (res != IGNORE) {
if (res != IGNORED_WORD) {
/* wait for ispell to finish */
while (*buf!= '\n')
fgets(buf, 255, in);

View File

@ -45,7 +45,7 @@ public:
/// accept the given word temporarily
virtual void accept(WordLangTuple const & word);
/// return the next near miss after a MISSED result
/// return the next near miss after a SUGGESTED_WORDS result
virtual std::string const nextMiss();
/// give an error message on messy exit

View File

@ -83,7 +83,7 @@ void PSpell::addManager(string const & lang)
enum PSpell::Result PSpell::check(WordLangTuple const & word)
{
Result res = UNKNOWN;
Result res = UNKNOWN_WORD;
Managers::iterator it = managers_.find(word.lang_code());
if (it == managers_.end()) {
@ -107,9 +107,9 @@ enum PSpell::Result PSpell::check(WordLangTuple const & word)
BOOST_ASSERT(sugs != 0);
els = pspell_word_list_elements(sugs);
if (pspell_word_list_empty(sugs))
res = UNKNOWN;
res = UNKNOWN_WORD;
else
res = MISSED;
res = SUGGESTED_WORDS;
}
return res;
}

View File

@ -49,7 +49,7 @@ public:
/// accept the given word temporarily
virtual void accept(WordLangTuple const &);
/// return the next near miss after a MISSED result
/// return the next near miss after a SUGGESTED_WORDS result
virtual std::string const nextMiss();
/// give an error message on messy exit