本文整理汇总了C++中SpellChecker类的典型用法代码示例。如果您正苦于以下问题:C++ SpellChecker类的具体用法?C++ SpellChecker怎么用?C++ SpellChecker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SpellChecker类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: didCancel
void SpellCheckRequest::didCancel()
{
if (!m_checker)
return;
SpellChecker* checker = m_checker;
m_checker = 0;
checker->didCheckCancel(m_requestData.sequence());
}
示例2: didSucceed
void SpellCheckRequest::didSucceed(const Vector<TextCheckingResult>& results)
{
if (!m_checker)
return;
SpellChecker* checker = m_checker;
m_checker = 0;
checker->didCheckSucceed(m_requestData.sequence(), results);
}
示例3: SpellChecker
void SpellChecker::checkDocument(Editor* document)
{
SpellChecker* checker = new SpellChecker(document);
checker->m_start_cursor = document->textCursor();
checker->m_cursor = checker->m_start_cursor;
checker->m_cursor.movePosition(QTextCursor::Start);
checker->show();
checker->check();
}
示例4: SpellChecker
void SpellChecker::checkDocument(QPlainTextEdit* document, Dictionary& dictionary)
{
SpellChecker* checker = new SpellChecker(document, dictionary);
checker->m_start_cursor = document->textCursor();
checker->m_cursor = checker->m_start_cursor;
checker->m_cursor.movePosition(QTextCursor::Start);
checker->show();
checker->check();
}
示例5: check
static VALUE check(VALUE self, VALUE val) {
SpellChecker *obj;
Data_Get_Struct(self, SpellChecker, obj);
char *word = RSTRING_PTR(val);
//cout << obj->exists(word);
if(obj->exists(word))
return Qtrue;
else
return Qfalse;
}
示例6: load
static VALUE load(VALUE self, VALUE val) {
SpellChecker *obj;
Data_Get_Struct(self, SpellChecker, obj);
std::string words_list_file = RSTRING_PTR(val);
//cout << obj->exists(word);
if(obj->load(words_list_file))
return Qtrue;
else
return Qfalse;
}
示例7: SpellChecker
void SpellChecker::checkDocument(QTextEdit* document, DictionaryRef& dictionary)
{
SpellChecker* checker = new SpellChecker(document, dictionary);
checker->m_start_cursor = document->textCursor();
checker->m_cursor = checker->m_start_cursor;
checker->m_cursor.movePosition(QTextCursor::StartOfBlock);
checker->m_loop_available = checker->m_start_cursor.block().previous().isValid();
checker->show();
checker->check();
}
示例8: spellchecker
int Internals::lastSpellCheckProcessedSequence(Document* document, ExceptionCode& ec)
{
SpellChecker* checker = spellchecker(document);
if (!checker) {
ec = INVALID_ACCESS_ERR;
return -1;
}
return checker->lastProcessedSequence();
}
示例9: getAvailableDictionaries
/*
Creates a vector with a list of support languages for spell checking
You must to g_free the allocated memory
*/
UT_Vector* XAP_Dialog_Language::getAvailableDictionaries()
{
#ifdef ENABLE_SPELL
SpellChecker * checker = SpellManager::instance().getInstance();
UT_Vector& vec= checker->getMapping();
DictionaryMapping * mapping;
UT_Vector* vecRslt = new UT_Vector();
const UT_uint32 nItems = vec.getItemCount();
for (UT_uint32 iItem = nItems; iItem; --iItem)
{
mapping = static_cast<DictionaryMapping*>(const_cast<void*>(vec.getNthItem(iItem - 1)));
if (checker->doesDictionaryExist(mapping->lang.c_str()))
vecRslt->addItem( g_strdup(mapping->lang.c_str()));
}
return vecRslt;
#else
return NULL;
#endif
}
示例10: fixPositionsIfBroken
void SpellcheckerWidget::Private::check()
{
BufferView * bv = gv_->documentBufferView();
if (!bv || bv->buffer().text().empty())
return;
fixPositionsIfBroken();
SpellChecker * speller = theSpellChecker();
if (speller && !speller->hasDictionary(bv->buffer().language())) {
int dsize = speller->numDictionaries();
if (0 == dsize) {
hide();
QMessageBox::information(p,
qt_("Spell Checker"),
qt_("Spell checker has no dictionaries."));
return;
}
}
DocIterator from = bv->cursor();
DocIterator to = isCurrentBuffer(from) ? end_ : doc_iterator_end(&bv->buffer());
WordLangTuple word_lang;
docstring_list suggestions;
LYXERR(Debug::GUI, "Spellchecker: start check at " << from);
try {
bv->buffer().spellCheck(from, to, word_lang, suggestions);
} catch (ExceptionMessage const & message) {
if (message.type_ == WarningException) {
Alert::warning(message.title_, message.details_);
return;
}
throw message;
}
// end of document or selection?
if (atLastPos(from)) {
if (isWrapAround()) {
hide();
return;
}
if (continueFromBeginning())
check();
return;
}
if (isWrapAround(from)) {
hide();
return;
}
word_ = word_lang;
// set suggestions
updateSuggestions(suggestions);
// set language
if (!word_lang.lang())
return;
setLanguage(word_lang.lang());
// mark misspelled word
setSelection(from, to);
}