本文整理汇总了C++中StringT::EndReading方法的典型用法代码示例。如果您正苦于以下问题:C++ StringT::EndReading方法的具体用法?C++ StringT::EndReading怎么用?C++ StringT::EndReading使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringT
的用法示例。
在下文中一共展示了StringT::EndReading方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testPattern
bool
RFindInReadable_Impl( const StringT& aPattern, IteratorT& aSearchStart, IteratorT& aSearchEnd, const Comparator& compare )
{
IteratorT patternStart, patternEnd, searchEnd = aSearchEnd;
aPattern.BeginReading(patternStart);
aPattern.EndReading(patternEnd);
// Point to the last character in the pattern
--patternEnd;
// outer loop keeps searching till we run out of string to search
while ( aSearchStart != searchEnd )
{
// Point to the end position of the next possible match
--searchEnd;
// Check last character, if a match, explore further from here
if ( compare(patternEnd.get(), searchEnd.get(), 1, 1) == 0 )
{
// We're at a potential match, let's see if we really hit one
IteratorT testPattern(patternEnd);
IteratorT testSearch(searchEnd);
// inner loop verifies the potential match at the current position
do
{
// if we verified all the way to the end of the pattern, then we found it!
if ( testPattern == patternStart )
{
aSearchStart = testSearch; // point to start of match
aSearchEnd = ++searchEnd; // point to end of match
return true;
}
// if we got to end of the string we're searching before we hit the end of the
// pattern, we'll never find what we're looking for
if ( testSearch == aSearchStart )
{
aSearchStart = aSearchEnd;
return false;
}
// test previous character for a match
--testPattern;
--testSearch;
}
while ( compare(testPattern.get(), testSearch.get(), 1, 1) == 0 );
}
}
aSearchStart = aSearchEnd;
return false;
}