本文整理汇总了C++中wxArrayInt::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ wxArrayInt::IsEmpty方法的具体用法?C++ wxArrayInt::IsEmpty怎么用?C++ wxArrayInt::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxArrayInt
的用法示例。
在下文中一共展示了wxArrayInt::IsEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoGetWordStarts
bool SpellCheckerPlugin::DoGetWordStarts(const wxString& word, wxArrayInt& wordStarts, int numWords)
{
if (numWords <= 0) // finish split
{
wordStarts.Add(0); // first word
wxString currWord;
for (int i = wordStarts.GetCount() - 1; i > 0; --i) // reverse iteration (so numbers are checked lowest to highest)
{
currWord = word(wordStarts[i], wordStarts[i - 1] - wordStarts[i]);
if (currWord.Length() > 3) // capitalize medium/long words so proper nouns work
currWord = currWord(0, 1).Upper() + currWord.Mid(1);
if (!m_pSpellChecker->IsWordInDictionary(currWord))
{
wordStarts.RemoveAt(wordStarts.GetCount() - 1);
return false; // no, fall back a level
}
}
currWord = word.Mid(wordStarts[0]);
if (currWord.Length() > 3) // capitalize
currWord = currWord(0, 1).Upper() + currWord.Mid(1);
if (!m_pSpellChecker->IsWordInDictionary(currWord)) // last word (wordStarts[] is reverse sorted)
{
wordStarts.RemoveAt(wordStarts.GetCount() - 1);
return false; // no, fall back a level
}
return true; // all parts are correctly spelled
}
// iterate through possibilities of the current word start
for (int i = (wordStarts.IsEmpty() ? word.Length() : wordStarts[wordStarts.GetCount() - 1]) - 2;
i >= numWords * 2; --i)
{
wordStarts.Add(i);
if (DoGetWordStarts(word, wordStarts, numWords - 1))
{
return true; // yes, fall through and return
}
wordStarts.RemoveAt(wordStarts.GetCount() - 1);
}
return false; // no, fall back an iteration
}