/**
* \file aspell.C
- * Copyright 2001 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 Kevin Atkinson
- * \author John Levon <levon@movementarian.org>
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS.
*/
#include <config.h>
-#ifdef USE_ASPELL
-
-#include "support/LAssert.h"
#include "debug.h"
#include <aspell.h>
#include "aspell_local.h"
#include "WordLangTuple.h"
-using namespace lyx::support;
+#include <boost/assert.hpp>
+
+using std::string;
-using std::endl;
ASpell::ASpell(BufferParams const &, string const & lang)
: els(0), spell_error_object(0)
}
-enum ASpell::Result ASpell::check(WordLangTuple const & word)
+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()) {
AspellSpeller * m = it->second.speller;
- int word_ok = aspell_speller_check(m, word.word().c_str(), -1);
- Assert(word_ok != -1);
+ int const word_ok = aspell_speller_check(m, word.word().c_str(), -1);
+ BOOST_ASSERT(word_ok != -1);
if (word_ok) {
res = OK;
} else {
AspellWordList const * sugs =
aspell_speller_suggest(m, word.word().c_str(), -1);
- Assert(sugs != 0);
+ 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;
}
if (els)
str = aspell_string_enumeration_next(els);
- if (str)
- return str;
- return "";
+
+ return (str ? str : "");
}
err = aspell_error_message(spell_error_object);
}
- if (err)
- return err;
- return "";
+ return (err ? err : "");
}
-
-#endif // USE_ASPELL