本文整理汇总了C++中TextBreakIterator::next方法的典型用法代码示例。如果您正苦于以下问题:C++ TextBreakIterator::next方法的具体用法?C++ TextBreakIterator::next怎么用?C++ TextBreakIterator::next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextBreakIterator
的用法示例。
在下文中一共展示了TextBreakIterator::next方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findMisspellings
static void findMisspellings(TextCheckerClient& client, const UChar* text, int start, int length, Vector<TextCheckingResult>& results)
{
TextBreakIterator* iterator = wordBreakIterator(text + start, length);
if (!iterator)
return;
int wordStart = iterator->current();
while (0 <= wordStart) {
int wordEnd = iterator->next();
if (wordEnd < 0)
break;
int wordLength = wordEnd - wordStart;
int misspellingLocation = -1;
int misspellingLength = 0;
client.checkSpellingOfString(String(text + start + wordStart, wordLength), &misspellingLocation, &misspellingLength);
if (0 < misspellingLength) {
ASSERT(0 <= misspellingLocation && misspellingLocation <= wordLength);
ASSERT(0 < misspellingLength && misspellingLocation + misspellingLength <= wordLength);
TextCheckingResult misspelling;
misspelling.decoration = TextDecorationTypeSpelling;
misspelling.location = start + wordStart + misspellingLocation;
misspelling.length = misspellingLength;
results.append(misspelling);
}
wordStart = wordEnd;
}
}
示例2: max
static inline unsigned countGraphemesInCluster(const UChar* str,
unsigned strLength, uint16_t startIndex, uint16_t endIndex)
{
if (startIndex > endIndex) {
uint16_t tempIndex = startIndex;
startIndex = endIndex;
endIndex = tempIndex;
}
uint16_t length = endIndex - startIndex;
ASSERT(static_cast<unsigned>(startIndex + length) <= strLength);
TextBreakIterator* cursorPosIterator = cursorMovementIterator(&str[startIndex], length);
int cursorPos = cursorPosIterator->current();
int numGraphemes = -1;
while (0 <= cursorPos) {
cursorPos = cursorPosIterator->next();
numGraphemes++;
}
return std::max(0, numGraphemes);
}
示例3: wordBoundaries
void AbstractInlineTextBox::wordBoundaries(Vector<WordBoundaries>& words) const
{
if (!m_inlineTextBox)
return;
String text = this->text();
int len = text.length();
TextBreakIterator* iterator = wordBreakIterator(text, 0, len);
// FIXME: When http://crbug.com/411764 is fixed, replace this with an ASSERT.
if (!iterator)
return;
int pos = iterator->first();
while (pos >= 0 && pos < len) {
int next = iterator->next();
if (isWordTextBreak(iterator))
words.append(WordBoundaries(pos, next));
pos = next;
}
}
示例4: isASingleWord
// Helper function to determine whether text is a single word.
static bool isASingleWord(const String& text)
{
TextBreakIterator* it = wordBreakIterator(text, 0, text.length());
return it && it->next() == static_cast<int>(text.length());
}