- Spellers::iterator it = spellers_.find(lang);
- if (it != spellers_.end())
- return it->second;
-
- return addSpeller(lang);
+ int result = 0;
+ Spellers::const_iterator it = spellers_.begin();
+ Spellers::const_iterator et = spellers_.end();
+
+ for (; it != et; ++it)
+ result += it->second != nullptr;
+ return result;
+}
+
+
+bool HunspellChecker::Private::isIgnored(WordLangTuple const & wl) const
+{
+ WordLangTable::const_iterator it = ignored_.begin();
+ for (; it != ignored_.end(); ++it) {
+ if (it->lang()->code() != wl.lang()->code())
+ continue;
+ if (it->word() == wl.word())
+ return true;
+ }
+ return false;
+}
+
+/// personal word list interface
+void HunspellChecker::Private::remove(WordLangTuple const & wl)
+{
+ Hunspell * h = speller(wl.lang());
+ if (!h)
+ return;
+ string const encoding = h->get_dic_encoding();
+ string const word_to_check = to_iconv_encoding(wl.word(), encoding);
+ h->remove(word_to_check.c_str());
+ PersonalWordList * pd = personal_[wl.lang()->lang()];
+ if (!pd)
+ return;
+ pd->remove(wl.word());
+}
+
+
+void HunspellChecker::Private::insert(WordLangTuple const & wl)
+{
+ Hunspell * h = speller(wl.lang());
+ if (!h)
+ return;
+ string const encoding = h->get_dic_encoding();
+ string const word_to_check = to_iconv_encoding(wl.word(), encoding);
+ h->add(word_to_check.c_str());
+ PersonalWordList * pd = personal_[wl.lang()->lang()];
+ if (!pd)
+ return;
+ pd->insert(wl.word());