本文整理汇总了C++中nsDependentCSubstring::EndReading方法的典型用法代码示例。如果您正苦于以下问题:C++ nsDependentCSubstring::EndReading方法的具体用法?C++ nsDependentCSubstring::EndReading怎么用?C++ nsDependentCSubstring::EndReading使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsDependentCSubstring
的用法示例。
在下文中一共展示了nsDependentCSubstring::EndReading方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tokenStart
/* static */
bool
MatchAutoCompleteFunction::findBeginning(const nsDependentCSubstring &aToken,
const nsACString &aSourceString)
{
NS_PRECONDITION(!aToken.IsEmpty(), "Don't search for an empty token!");
// We can't use StringBeginsWith here, unfortunately. Although it will
// happily take a case-insensitive UTF8 comparator, it eventually calls
// nsACString::Equals, which checks that the two strings contain the same
// number of bytes before calling the comparator. This is clearly not what
// we want.
const_char_iterator tokenStart(aToken.BeginReading()),
tokenEnd(aToken.EndReading()),
sourceStart(aSourceString.BeginReading()),
sourceEnd(aSourceString.EndReading());
PRBool dummy;
while (sourceStart < sourceEnd &&
CaseInsensitiveUTF8CharsEqual(sourceStart, tokenStart,
sourceEnd, tokenEnd,
&sourceStart, &tokenStart, &dummy)) {
// We found the token!
if (tokenStart >= tokenEnd) {
return true;
}
}
// We don't need to check CaseInsensitiveUTF8CharsEqual's error condition
// (stored in |dummy|), since the function will return false if it
// encounters an error.
return false;
}