X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Faspell.C;h=f9caa75233a690270ba6c0259b50f89d9f8a69e1;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=b0470339b747e2b303639f0ce69c6efc01c64f8b;hpb=35c0c230d7661da940992d741a544c69b61f827d;p=lyx.git diff --git a/src/aspell.C b/src/aspell.C index b0470339b7..f9caa75233 100644 --- a/src/aspell.C +++ b/src/aspell.C @@ -1,5 +1,5 @@ /** - * \file aspell_local.C + * \file aspell.C * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * @@ -11,8 +11,6 @@ #include -#ifdef USE_ASPELL - #include "debug.h" #include @@ -24,6 +22,7 @@ using std::string; +namespace lyx { ASpell::ASpell(BufferParams const &, string const & lang) : els(0), spell_error_object(0) @@ -73,9 +72,9 @@ void ASpell::addSpeller(string const & lang) } -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()) { @@ -88,7 +87,7 @@ enum ASpell::Result ASpell::check(WordLangTuple const & word) AspellSpeller * m = it->second.speller; - int word_ok = aspell_speller_check(m, word.word().c_str(), -1); + int const word_ok = aspell_speller_check(m, word.word().c_str(), -1); BOOST_ASSERT(word_ok != -1); if (word_ok) { @@ -99,9 +98,9 @@ enum 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; } @@ -129,23 +128,21 @@ string const ASpell::nextMiss() if (els) str = aspell_string_enumeration_next(els); - if (str) - return str; - return ""; + + return (str ? str : ""); } -string const ASpell::error() +docstring const ASpell::error() { char const * err = 0; - + if (spell_error_object && aspell_error_number(spell_error_object) != 0) { err = aspell_error_message(spell_error_object); } - if (err) - return err; - return ""; + return (err ? from_utf8(err) : docstring()); } -#endif // USE_ASPELL + +} // namespace lyx