本文整理汇总了C++中WordLangTuple::lang方法的典型用法代码示例。如果您正苦于以下问题:C++ WordLangTuple::lang方法的具体用法?C++ WordLangTuple::lang怎么用?C++ WordLangTuple::lang使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WordLangTuple
的用法示例。
在下文中一共展示了WordLangTuple::lang方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void AspellChecker::Private::insert(WordLangTuple const & word)
{
Spellers::iterator it = spellers_.find(word.lang()->lang());
if (it != spellers_.end()) {
addToSession(it->second.e_speller, word.word());
PersonalWordList * pd = personal_[word.lang()->lang()];
if (!pd)
return;
pd->insert(word.word());
}
}
示例2: check
SpellChecker::Result AppleSpellChecker::check(WordLangTuple const & word)
{
if (!hasDictionary(word.lang()))
return WORD_OK;
string const word_str = to_utf8(word.word());
string const lang = d->languageMap[word.lang()->lang()];
SpellCheckResult result =
AppleSpeller_check(d->speller,
word_str.c_str(), lang.c_str());
LYXERR(Debug::GUI, "spellCheck: \"" <<
word.word() << "\" = " << d->toString(result) <<
", lang = " << lang) ;
return d->toResult(result);
}
示例3: suggest
void AspellChecker::suggest(WordLangTuple const & wl,
docstring_list & suggestions)
{
suggestions.clear();
AspellSpeller * m = d->speller(wl.lang());
if (!m)
return;
string const word = d->toAspellWord(wl.word());
AspellWordList const * sugs =
aspell_speller_suggest(m, word.c_str(), -1);
LASSERT(sugs != 0, return);
AspellStringEnumeration * els = aspell_word_list_elements(sugs);
if (!els || aspell_word_list_empty(sugs))
return;
for (;;) {
char const * str = aspell_string_enumeration_next(els);
if (!str)
break;
suggestions.push_back(from_utf8(str));
}
delete_aspell_string_enumeration(els);
}
示例4: accept
void EnchantChecker::accept(WordLangTuple const & word)
{
enchant::Dict * m = d->speller(word.lang()->code());
if (m) {
m->add_to_session(to_utf8(word.word()));
advanceChangeNumber();
}
}
示例5: remove
void EnchantChecker::remove(WordLangTuple const & word)
{
enchant::Dict * m = d->speller(word.lang()->code());
if (m) {
m->remove(to_utf8(word.word()));
advanceChangeNumber();
}
}
示例6: accept
void AspellChecker::accept(WordLangTuple const & word)
{
Spellers::iterator it = d->spellers_.find(word.lang()->lang());
if (it != d->spellers_.end()) {
d->addToSession(it->second.e_speller, word.word());
d->accept(it->second, word);
advanceChangeNumber();
}
}
示例7: suggest
void AppleSpellChecker::suggest(WordLangTuple const & wl,
docstring_list & suggestions)
{
suggestions.clear();
string const word_str = to_utf8(wl.word());
size_t num = AppleSpeller_makeSuggestion(d->speller,
word_str.c_str(), wl.lang()->code().c_str());
for (size_t i = 0; i < num; i++) {
char const * next = AppleSpeller_getSuggestion(d->speller, i);
if (!next) break;
suggestions.push_back(from_utf8(next));
}
}
示例8: check
SpellChecker::Result AspellChecker::check(WordLangTuple const & word)
{
AspellSpeller * m = d->speller(word.lang());
if (!m)
return NO_DICTIONARY;
if (word.word().empty())
// MSVC compiled Aspell doesn't like it.
return WORD_OK;
SpellChecker::Result rc = d->check(m, word);
return (rc == WORD_OK && d->learned(word)) ? LEARNED_WORD : rc;
}
示例9: suggest
void EnchantChecker::suggest(WordLangTuple const & wl,
docstring_list & suggestions)
{
suggestions.clear();
enchant::Dict * m = d->speller(wl.lang()->code());
if (!m)
return;
string utf8word = to_utf8(wl.word());
vector<string> suggs = m->suggest(utf8word);
vector<string>::const_iterator it = suggs.begin();
for (; it != suggs.end(); ++it)
suggestions.push_back(from_utf8(*it));
}
示例10: check
SpellChecker::Result EnchantChecker::check(WordLangTuple const & word)
{
enchant::Dict * m = d->speller(word.lang()->code());
if (!m)
return NO_DICTIONARY;
if (word.word().empty())
return WORD_OK;
string utf8word = to_utf8(word.word());
if (m->check(utf8word))
return WORD_OK;
return UNKNOWN_WORD;
}