• Home
  • Raw
  • Download

Lines Matching refs:strsrch

126 inline int32_t getCE(const UStringSearch *strsrch, uint32_t sourcece)  in getCE()  argument
131 sourcece &= strsrch->ceMask; in getCE()
133 if (strsrch->toShift) { in getCE()
139 if (strsrch->variableTop > sourcece) { in getCE()
140 if (strsrch->strength >= UCOL_QUATERNARY) { in getCE()
147 } else if (strsrch->strength >= UCOL_QUATERNARY && sourcece == UCOL_IGNORABLE) { in getCE()
268 inline void initializePatternCETable(UStringSearch *strsrch, UErrorCode *status) in initializePatternCETable() argument
270 UPattern *pattern = &(strsrch->pattern); in initializePatternCETable()
274 UCollationElements *coleiter = strsrch->utilIter; in initializePatternCETable()
277 coleiter = ucol_openElements(strsrch->collator, pattern->text, in initializePatternCETable()
282 strsrch->utilIter = coleiter; in initializePatternCETable()
300 uint32_t newce = getCE(strsrch, ce); in initializePatternCETable()
334 inline void initializePatternPCETable(UStringSearch *strsrch, in initializePatternPCETable() argument
337 UPattern *pattern = &(strsrch->pattern); in initializePatternPCETable()
341 UCollationElements *coleiter = strsrch->utilIter; in initializePatternPCETable()
344 coleiter = ucol_openElements(strsrch->collator, pattern->text, in initializePatternPCETable()
349 strsrch->utilIter = coleiter; in initializePatternPCETable()
401 inline void initializePattern(UStringSearch *strsrch, UErrorCode *status) in initializePattern() argument
405 UPattern *pattern = &(strsrch->pattern); in initializePattern()
411 if (strsrch->strength == UCOL_PRIMARY) { in initializePattern()
424 if (strsrch->pattern.pces != nullptr) { in initializePattern()
425 if (strsrch->pattern.pces != strsrch->pattern.pcesBuffer) { in initializePattern()
426 uprv_free(strsrch->pattern.pces); in initializePattern()
429 strsrch->pattern.pces = nullptr; in initializePattern()
432 initializePatternCETable(strsrch, status); in initializePattern()
442 inline void initialize(UStringSearch *strsrch, UErrorCode *status) in initialize() argument
444 initializePattern(strsrch, status); in initialize()
450 static UBreakIterator* getBreakIterator(UStringSearch *strsrch, UErrorCode &status) in getBreakIterator() argument
456 if (strsrch->search->breakIter != nullptr) { in getBreakIterator()
457 return strsrch->search->breakIter; in getBreakIterator()
460 if (strsrch->search->internalBreakIter != nullptr) { in getBreakIterator()
461 return strsrch->search->internalBreakIter; in getBreakIterator()
465 strsrch->search->internalBreakIter = ubrk_open(UBRK_CHARACTER, in getBreakIterator()
466 ucol_getLocaleByType(strsrch->collator, ULOC_VALID_LOCALE, &status), in getBreakIterator()
467 strsrch->search->text, strsrch->search->textLength, &status); in getBreakIterator()
469 return strsrch->search->internalBreakIter; in getBreakIterator()
481 inline void setMatchNotFound(UStringSearch *strsrch, UErrorCode &status) in setMatchNotFound() argument
485 strsrch->search->matchedIndex = USEARCH_DONE; in setMatchNotFound()
486 strsrch->search->matchedLength = 0; in setMatchNotFound()
487 if (strsrch->search->isForwardSearching) { in setMatchNotFound()
488 setColEIterOffset(strsrch->textIter, strsrch->search->textLength, localStatus); in setMatchNotFound()
491 setColEIterOffset(strsrch->textIter, 0, localStatus); in setMatchNotFound()
521 inline UBool checkIdentical(const UStringSearch *strsrch, int32_t start, int32_t end) in checkIdentical() argument
523 if (strsrch->strength != UCOL_IDENTICAL) { in checkIdentical()
531 strsrch->nfd->normalize( in checkIdentical()
532 UnicodeString(false, strsrch->search->text + start, end - start), t2, status); in checkIdentical()
533 strsrch->nfd->normalize( in checkIdentical()
534 UnicodeString(false, strsrch->pattern.text, strsrch->pattern.textLength), p2, status); in checkIdentical()
702 U_CAPI void U_EXPORT2 usearch_close(UStringSearch *strsrch) in usearch_close() argument
704 if (strsrch) { in usearch_close()
705 if (strsrch->pattern.ces != strsrch->pattern.cesBuffer && in usearch_close()
706 strsrch->pattern.ces) { in usearch_close()
707 uprv_free(strsrch->pattern.ces); in usearch_close()
710 if (strsrch->pattern.pces != nullptr && in usearch_close()
711 strsrch->pattern.pces != strsrch->pattern.pcesBuffer) { in usearch_close()
712 uprv_free(strsrch->pattern.pces); in usearch_close()
715 delete strsrch->textProcessedIter; in usearch_close()
716 ucol_closeElements(strsrch->textIter); in usearch_close()
717 ucol_closeElements(strsrch->utilIter); in usearch_close()
719 if (strsrch->ownCollator && strsrch->collator) { in usearch_close()
720 ucol_close((UCollator *)strsrch->collator); in usearch_close()
724 if (strsrch->search->internalBreakIter != nullptr) { in usearch_close()
725 ubrk_close(strsrch->search->internalBreakIter); in usearch_close()
729 uprv_free(strsrch->search); in usearch_close()
730 uprv_free(strsrch); in usearch_close()
736 UBool initTextProcessedIter(UStringSearch *strsrch, UErrorCode *status) { in initTextProcessedIter() argument
738 if (strsrch->textProcessedIter == nullptr) { in initTextProcessedIter()
739 strsrch->textProcessedIter = new icu::UCollationPCE(strsrch->textIter); in initTextProcessedIter()
740 if (strsrch->textProcessedIter == nullptr) { in initTextProcessedIter()
745 strsrch->textProcessedIter->init(strsrch->textIter); in initTextProcessedIter()
754 U_CAPI void U_EXPORT2 usearch_setOffset(UStringSearch *strsrch, in usearch_setOffset() argument
758 if (U_SUCCESS(*status) && strsrch) { in usearch_setOffset()
759 if (isOutOfBounds(strsrch->search->textLength, position)) { in usearch_setOffset()
763 setColEIterOffset(strsrch->textIter, position, *status); in usearch_setOffset()
765 strsrch->search->matchedIndex = USEARCH_DONE; in usearch_setOffset()
766 strsrch->search->matchedLength = 0; in usearch_setOffset()
767 strsrch->search->reset = false; in usearch_setOffset()
771 U_CAPI int32_t U_EXPORT2 usearch_getOffset(const UStringSearch *strsrch) in usearch_getOffset() argument
773 if (strsrch) { in usearch_getOffset()
774 int32_t result = ucol_getOffset(strsrch->textIter); in usearch_getOffset()
775 if (isOutOfBounds(strsrch->search->textLength, result)) { in usearch_getOffset()
783 U_CAPI void U_EXPORT2 usearch_setAttribute(UStringSearch *strsrch, in usearch_setAttribute() argument
788 if (U_SUCCESS(*status) && strsrch) { in usearch_setAttribute()
792 strsrch->search->isOverlap = (value == USEARCH_ON ? true : false); in usearch_setAttribute()
795 strsrch->search->isCanonicalMatch = (value == USEARCH_ON ? true : in usearch_setAttribute()
800 strsrch->search->elementComparisonType = (int16_t)value; in usearch_setAttribute()
802 strsrch->search->elementComparisonType = 0; in usearch_setAttribute()
816 const UStringSearch *strsrch, in usearch_getAttribute() argument
819 if (strsrch) { in usearch_getAttribute()
822 return (strsrch->search->isOverlap == true ? USEARCH_ON : in usearch_getAttribute()
825 return (strsrch->search->isCanonicalMatch == true ? USEARCH_ON : in usearch_getAttribute()
829 int16_t value = strsrch->search->elementComparisonType; in usearch_getAttribute()
844 const UStringSearch *strsrch) in usearch_getMatchedStart() argument
846 if (strsrch == nullptr) { in usearch_getMatchedStart()
849 return strsrch->search->matchedIndex; in usearch_getMatchedStart()
853 U_CAPI int32_t U_EXPORT2 usearch_getMatchedText(const UStringSearch *strsrch, in usearch_getMatchedText() argument
861 if (strsrch == nullptr || resultCapacity < 0 || (resultCapacity > 0 && in usearch_getMatchedText()
867 int32_t copylength = strsrch->search->matchedLength; in usearch_getMatchedText()
868 int32_t copyindex = strsrch->search->matchedIndex; in usearch_getMatchedText()
878 uprv_memcpy(result, strsrch->search->text + copyindex, in usearch_getMatchedText()
882 strsrch->search->matchedLength, status); in usearch_getMatchedText()
886 const UStringSearch *strsrch) in usearch_getMatchedLength() argument
888 if (strsrch) { in usearch_getMatchedLength()
889 return strsrch->search->matchedLength; in usearch_getMatchedLength()
896 U_CAPI void U_EXPORT2 usearch_setBreakIterator(UStringSearch *strsrch, in usearch_setBreakIterator() argument
900 if (U_SUCCESS(*status) && strsrch) { in usearch_setBreakIterator()
901 strsrch->search->breakIter = breakiter; in usearch_setBreakIterator()
903 ubrk_setText(breakiter, strsrch->search->text, in usearch_setBreakIterator()
904 strsrch->search->textLength, status); in usearch_setBreakIterator()
910 usearch_getBreakIterator(const UStringSearch *strsrch) in usearch_getBreakIterator() argument
912 if (strsrch) { in usearch_getBreakIterator()
913 return strsrch->search->breakIter; in usearch_getBreakIterator()
920 U_CAPI void U_EXPORT2 usearch_setText( UStringSearch *strsrch, in usearch_setText() argument
926 if (strsrch == nullptr || text == nullptr || textlength < -1 || in usearch_setText()
934 strsrch->search->text = text; in usearch_setText()
935 strsrch->search->textLength = textlength; in usearch_setText()
936 ucol_setText(strsrch->textIter, text, textlength, status); in usearch_setText()
937 strsrch->search->matchedIndex = USEARCH_DONE; in usearch_setText()
938 strsrch->search->matchedLength = 0; in usearch_setText()
939 strsrch->search->reset = true; in usearch_setText()
941 if (strsrch->search->breakIter != nullptr) { in usearch_setText()
942 ubrk_setText(strsrch->search->breakIter, text, in usearch_setText()
945 if (strsrch->search->internalBreakIter != nullptr) { in usearch_setText()
946 ubrk_setText(strsrch->search->internalBreakIter, text, textlength, status); in usearch_setText()
953 U_CAPI const UChar * U_EXPORT2 usearch_getText(const UStringSearch *strsrch, in usearch_getText() argument
956 if (strsrch) { in usearch_getText()
957 *length = strsrch->search->textLength; in usearch_getText()
958 return strsrch->search->text; in usearch_getText()
963 U_CAPI void U_EXPORT2 usearch_setCollator( UStringSearch *strsrch, in usearch_setCollator() argument
973 if (strsrch) { in usearch_setCollator()
974 delete strsrch->textProcessedIter; in usearch_setCollator()
975 strsrch->textProcessedIter = nullptr; in usearch_setCollator()
976 ucol_closeElements(strsrch->textIter); in usearch_setCollator()
977 ucol_closeElements(strsrch->utilIter); in usearch_setCollator()
978 strsrch->textIter = strsrch->utilIter = nullptr; in usearch_setCollator()
979 if (strsrch->ownCollator && (strsrch->collator != collator)) { in usearch_setCollator()
980 ucol_close((UCollator *)strsrch->collator); in usearch_setCollator()
981 strsrch->ownCollator = false; in usearch_setCollator()
983 strsrch->collator = collator; in usearch_setCollator()
984 strsrch->strength = ucol_getStrength(collator); in usearch_setCollator()
985 strsrch->ceMask = getMask(strsrch->strength); in usearch_setCollator()
987 if (strsrch->search->internalBreakIter != nullptr) { in usearch_setCollator()
988 ubrk_close(strsrch->search->internalBreakIter); in usearch_setCollator()
989 strsrch->search->internalBreakIter = nullptr; // Lazily created. in usearch_setCollator()
993 strsrch->toShift = in usearch_setCollator()
997 strsrch->variableTop = ucol_getVariableTop(collator, status); in usearch_setCollator()
998 strsrch->textIter = ucol_openElements(collator, in usearch_setCollator()
999 strsrch->search->text, in usearch_setCollator()
1000 strsrch->search->textLength, in usearch_setCollator()
1002 strsrch->utilIter = ucol_openElements( in usearch_setCollator()
1003 collator, strsrch->pattern.text, strsrch->pattern.textLength, status); in usearch_setCollator()
1005 initialize(strsrch, status); in usearch_setCollator()
1012 uprv_init_pce(strsrch->textIter); in usearch_setCollator()
1013 uprv_init_pce(strsrch->utilIter); in usearch_setCollator()
1018 U_CAPI UCollator * U_EXPORT2 usearch_getCollator(const UStringSearch *strsrch) in usearch_getCollator() argument
1020 if (strsrch) { in usearch_getCollator()
1021 return (UCollator *)strsrch->collator; in usearch_getCollator()
1026 U_CAPI void U_EXPORT2 usearch_setPattern( UStringSearch *strsrch, in usearch_setPattern() argument
1032 if (strsrch == nullptr || pattern == nullptr) { in usearch_setPattern()
1043 strsrch->pattern.text = pattern; in usearch_setPattern()
1044 strsrch->pattern.textLength = patternlength; in usearch_setPattern()
1045 initialize(strsrch, status); in usearch_setPattern()
1051 usearch_getPattern(const UStringSearch *strsrch, in usearch_getPattern() argument
1054 if (strsrch) { in usearch_getPattern()
1055 *length = strsrch->pattern.textLength; in usearch_getPattern()
1056 return strsrch->pattern.text; in usearch_getPattern()
1063 U_CAPI int32_t U_EXPORT2 usearch_first(UStringSearch *strsrch, in usearch_first() argument
1066 if (strsrch && U_SUCCESS(*status)) { in usearch_first()
1067 strsrch->search->isForwardSearching = true; in usearch_first()
1068 usearch_setOffset(strsrch, 0, status); in usearch_first()
1070 return usearch_next(strsrch, status); in usearch_first()
1076 U_CAPI int32_t U_EXPORT2 usearch_following(UStringSearch *strsrch, in usearch_following() argument
1080 if (strsrch && U_SUCCESS(*status)) { in usearch_following()
1081 strsrch->search->isForwardSearching = true; in usearch_following()
1083 usearch_setOffset(strsrch, position, status); in usearch_following()
1085 return usearch_next(strsrch, status); in usearch_following()
1091 U_CAPI int32_t U_EXPORT2 usearch_last(UStringSearch *strsrch, in usearch_last() argument
1094 if (strsrch && U_SUCCESS(*status)) { in usearch_last()
1095 strsrch->search->isForwardSearching = false; in usearch_last()
1096 usearch_setOffset(strsrch, strsrch->search->textLength, status); in usearch_last()
1098 return usearch_previous(strsrch, status); in usearch_last()
1104 U_CAPI int32_t U_EXPORT2 usearch_preceding(UStringSearch *strsrch, in usearch_preceding() argument
1108 if (strsrch && U_SUCCESS(*status)) { in usearch_preceding()
1109 strsrch->search->isForwardSearching = false; in usearch_preceding()
1111 usearch_setOffset(strsrch, position, status); in usearch_preceding()
1113 return usearch_previous(strsrch, status); in usearch_preceding()
1141 U_CAPI int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch, in usearch_next() argument
1144 if (U_SUCCESS(*status) && strsrch) { in usearch_next()
1147 int32_t offset = usearch_getOffset(strsrch); in usearch_next()
1148 USearch *search = strsrch->search; in usearch_next()
1157 setMatchNotFound(strsrch, *status); in usearch_next()
1176 if (strsrch->pattern.cesLength == 0) { in usearch_next()
1185 setColEIterOffset(strsrch->textIter, search->matchedIndex, *status); in usearch_next()
1195 ucol_setOffset(strsrch->textIter, offset + 1, status); in usearch_next()
1198 ucol_setOffset(strsrch->textIter, in usearch_next()
1212 usearch_handleNextCanonical(strsrch, status); in usearch_next()
1215 usearch_handleNextExact(strsrch, status); in usearch_next()
1224 ucol_setOffset(strsrch->textIter, search->textLength, status); in usearch_next()
1226 ucol_setOffset(strsrch->textIter, search->matchedIndex, status); in usearch_next()
1235 U_CAPI int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch, in usearch_previous() argument
1238 if (U_SUCCESS(*status) && strsrch) { in usearch_previous()
1240 USearch *search = strsrch->search; in usearch_previous()
1245 setColEIterOffset(strsrch->textIter, offset, *status); in usearch_previous()
1248 offset = usearch_getOffset(strsrch); in usearch_previous()
1268 setMatchNotFound(strsrch, *status); in usearch_previous()
1274 if (strsrch->pattern.cesLength == 0) { in usearch_previous()
1278 setMatchNotFound(strsrch, *status); in usearch_previous()
1283 setColEIterOffset(strsrch->textIter, search->matchedIndex, *status); in usearch_previous()
1289 if (strsrch->search->isCanonicalMatch) { in usearch_previous()
1291 usearch_handlePreviousCanonical(strsrch, status); in usearch_previous()
1295 usearch_handlePreviousExact(strsrch, status); in usearch_previous()
1312 U_CAPI void U_EXPORT2 usearch_reset(UStringSearch *strsrch) in usearch_reset() argument
1319 if (strsrch) { in usearch_reset()
1327 UCollationStrength newStrength = ucol_getStrength(strsrch->collator); in usearch_reset()
1328 if ((strsrch->strength < UCOL_QUATERNARY && newStrength >= UCOL_QUATERNARY) || in usearch_reset()
1329 (strsrch->strength >= UCOL_QUATERNARY && newStrength < UCOL_QUATERNARY)) { in usearch_reset()
1333 strsrch->strength = ucol_getStrength(strsrch->collator); in usearch_reset()
1334 ceMask = getMask(strsrch->strength); in usearch_reset()
1335 if (strsrch->ceMask != ceMask) { in usearch_reset()
1336 strsrch->ceMask = ceMask; in usearch_reset()
1341 shift = ucol_getAttribute(strsrch->collator, UCOL_ALTERNATE_HANDLING, in usearch_reset()
1343 if (strsrch->toShift != shift) { in usearch_reset()
1344 strsrch->toShift = shift; in usearch_reset()
1349 varTop = ucol_getVariableTop(strsrch->collator, &status); in usearch_reset()
1350 if (strsrch->variableTop != varTop) { in usearch_reset()
1351 strsrch->variableTop = varTop; in usearch_reset()
1355 initialize(strsrch, &status); in usearch_reset()
1357 ucol_setText(strsrch->textIter, strsrch->search->text, in usearch_reset()
1358 strsrch->search->textLength, in usearch_reset()
1360 strsrch->search->matchedLength = 0; in usearch_reset()
1361 strsrch->search->matchedIndex = USEARCH_DONE; in usearch_reset()
1362 strsrch->search->isOverlap = false; in usearch_reset()
1363 strsrch->search->isCanonicalMatch = false; in usearch_reset()
1364 strsrch->search->elementComparisonType = 0; in usearch_reset()
1365 strsrch->search->isForwardSearching = true; in usearch_reset()
1366 strsrch->search->reset = true; in usearch_reset()
1557 static int32_t nextBoundaryAfter(UStringSearch *strsrch, int32_t startIndex, UErrorCode &status) { in nextBoundaryAfter() argument
1562 const UChar *text = strsrch->search->text; in nextBoundaryAfter()
1563 int32_t textLen = strsrch->search->textLength; in nextBoundaryAfter()
1599 UBreakIterator *breakiterator = getBreakIterator(strsrch, status); in nextBoundaryAfter()
1617 static UBool isBreakBoundary(UStringSearch *strsrch, int32_t index, UErrorCode &status) { in isBreakBoundary() argument
1622 const UChar *text = strsrch->search->text; in isBreakBoundary()
1623 int32_t textLen = strsrch->search->textLength; in isBreakBoundary()
1648 UBreakIterator *breakiterator = getBreakIterator(strsrch, status); in isBreakBoundary()
1661 static UBool onBreakBoundaries(const UStringSearch *strsrch, int32_t start, int32_t end, UErrorCode…
1668 UBreakIterator *breakiterator = getBreakIterator(strsrch, status);
1769 U_CAPI UBool U_EXPORT2 usearch_search(UStringSearch *strsrch, in usearch_search() argument
1784 for (int ii=0; ii<strsrch->pattern.cesLength; ii++) { in usearch_search()
1785 printf(" %8x", strsrch->pattern.ces[ii]); in usearch_search()
1794 if(strsrch->pattern.cesLength == 0 || in usearch_search()
1796 startIdx > strsrch->search->textLength || in usearch_search()
1797 strsrch->pattern.ces == nullptr) { in usearch_search()
1802 if (strsrch->pattern.pces == nullptr) { in usearch_search()
1803 initializePatternPCETable(strsrch, status); in usearch_search()
1806 ucol_setOffset(strsrch->textIter, startIdx, status); in usearch_search()
1807 CEIBuffer ceb(strsrch, status); in usearch_search()
1858 for (patIx=0; patIx<strsrch->pattern.pcesLength; patIx++) { in usearch_search()
1859 patCE = strsrch->pattern.pces[patIx]; in usearch_search()
1864 …UCompareCEsResult ceMatch = compareCE64s(targetCEI->ce, patCE, strsrch->search->elementComparisonT… in usearch_search()
1879 …targetIxOffset += strsrch->pattern.pcesLength; // this is now the offset in target CE space to end… in usearch_search()
1911 if (strsrch->search->elementComparisonType == 0) { in usearch_search()
1929 …UCompareCEsResult ceMatch = compareCE64s(nextCEI->ce, patCE, strsrch->search->elementComparisonTyp… in usearch_search()
1953 if (!isBreakBoundary(strsrch, mStart, *status)) { in usearch_search()
1982 if (strsrch->search->text != nullptr && strsrch->search->textLength > maxLimit) { in usearch_search()
1984 strsrch->search->breakIter == nullptr && in usearch_search()
1987 (strsrch->nfd->hasBoundaryBefore(codePointAt(*strsrch->search, maxLimit)) || in usearch_search()
1988strsrch->nfd->hasBoundaryAfter(codePointBefore(*strsrch->search, maxLimit))); in usearch_search()
2008 if (minLimit == lastCEI->highIndex && isBreakBoundary(strsrch, minLimit, *status)) { in usearch_search()
2011 int32_t nba = nextBoundaryAfter(strsrch, minLimit, *status); in usearch_search()
2038 if (!isBreakBoundary(strsrch, mLimit, *status)) { in usearch_search()
2046 if (! checkIdentical(strsrch, mStart, mLimit)) { in usearch_search()
2089 U_CAPI UBool U_EXPORT2 usearch_searchBackwards(UStringSearch *strsrch, in usearch_searchBackwards() argument
2104 for (int ii=0; ii<strsrch->pattern.cesLength; ii++) { in usearch_searchBackwards()
2105 printf(" %8x", strsrch->pattern.ces[ii]); in usearch_searchBackwards()
2114 if(strsrch->pattern.cesLength == 0 || in usearch_searchBackwards()
2116 startIdx > strsrch->search->textLength || in usearch_searchBackwards()
2117 strsrch->pattern.ces == nullptr) { in usearch_searchBackwards()
2122 if (strsrch->pattern.pces == nullptr) { in usearch_searchBackwards()
2123 initializePatternPCETable(strsrch, status); in usearch_searchBackwards()
2126 CEIBuffer ceb(strsrch, status); in usearch_searchBackwards()
2138 if (startIdx < strsrch->search->textLength) { in usearch_searchBackwards()
2139 UBreakIterator *breakiterator = getBreakIterator(strsrch, *status); in usearch_searchBackwards()
2145 ucol_setOffset(strsrch->textIter, next, status); in usearch_searchBackwards()
2153 ucol_setOffset(strsrch->textIter, startIdx, status); in usearch_searchBackwards()
2194 for (patIx = strsrch->pattern.pcesLength - 1; patIx >= 0; patIx -= 1) { in usearch_searchBackwards()
2195 int64_t patCE = strsrch->pattern.pces[patIx]; in usearch_searchBackwards()
2197 … targetCEI = ceb.getPrevious(targetIx + strsrch->pattern.pcesLength - 1 - patIx + targetIxOffset); in usearch_searchBackwards()
2201 …UCompareCEsResult ceMatch = compareCE64s(targetCEI->ce, patCE, strsrch->search->elementComparisonT… in usearch_searchBackwards()
2233 …const CEI *firstCEI = ceb.getPrevious(targetIx + strsrch->pattern.pcesLength - 1 + targetIxOffset); in usearch_searchBackwards()
2242 if (!isBreakBoundary(strsrch, mStart, *status)) { in usearch_searchBackwards()
2287 if (strsrch->search->text != nullptr && strsrch->search->textLength > maxLimit) { in usearch_searchBackwards()
2289 strsrch->search->breakIter == nullptr && in usearch_searchBackwards()
2292 (strsrch->nfd->hasBoundaryBefore(codePointAt(*strsrch->search, maxLimit)) || in usearch_searchBackwards()
2293strsrch->nfd->hasBoundaryAfter(codePointBefore(*strsrch->search, maxLimit))); in usearch_searchBackwards()
2306 int32_t nba = nextBoundaryAfter(strsrch, minLimit, *status); in usearch_searchBackwards()
2323 if (!isBreakBoundary(strsrch, mLimit, *status)) { in usearch_searchBackwards()
2336 int32_t nba = nextBoundaryAfter(strsrch, minLimit, *status); in usearch_searchBackwards()
2347 if (! checkIdentical(strsrch, mStart, mLimit)) { in usearch_searchBackwards()
2392 UBool usearch_handleNextExact(UStringSearch *strsrch, UErrorCode *status) in usearch_handleNextExact() argument
2395 setMatchNotFound(strsrch, *status); in usearch_handleNextExact()
2399 int32_t textOffset = ucol_getOffset(strsrch->textIter); in usearch_handleNextExact()
2403 if (usearch_search(strsrch, textOffset, &start, &end, status)) { in usearch_handleNextExact()
2404 strsrch->search->matchedIndex = start; in usearch_handleNextExact()
2405 strsrch->search->matchedLength = end - start; in usearch_handleNextExact()
2408 setMatchNotFound(strsrch, *status); in usearch_handleNextExact()
2413 UBool usearch_handleNextCanonical(UStringSearch *strsrch, UErrorCode *status) in usearch_handleNextCanonical() argument
2416 setMatchNotFound(strsrch, *status); in usearch_handleNextCanonical()
2420 int32_t textOffset = ucol_getOffset(strsrch->textIter); in usearch_handleNextCanonical()
2424 if (usearch_search(strsrch, textOffset, &start, &end, status)) { in usearch_handleNextCanonical()
2425 strsrch->search->matchedIndex = start; in usearch_handleNextCanonical()
2426 strsrch->search->matchedLength = end - start; in usearch_handleNextCanonical()
2429 setMatchNotFound(strsrch, *status); in usearch_handleNextCanonical()
2434 UBool usearch_handlePreviousExact(UStringSearch *strsrch, UErrorCode *status) in usearch_handlePreviousExact() argument
2437 setMatchNotFound(strsrch, *status); in usearch_handlePreviousExact()
2443 if (strsrch->search->isOverlap) { in usearch_handlePreviousExact()
2444 if (strsrch->search->matchedIndex != USEARCH_DONE) { in usearch_handlePreviousExact()
2445 textOffset = strsrch->search->matchedIndex + strsrch->search->matchedLength - 1; in usearch_handlePreviousExact()
2448 initializePatternPCETable(strsrch, status); in usearch_handlePreviousExact()
2449 if (!initTextProcessedIter(strsrch, status)) { in usearch_handlePreviousExact()
2450 setMatchNotFound(strsrch, *status); in usearch_handlePreviousExact()
2453 for (int32_t nPCEs = 0; nPCEs < strsrch->pattern.pcesLength - 1; nPCEs++) { in usearch_handlePreviousExact()
2454 int64_t pce = strsrch->textProcessedIter->nextProcessed(nullptr, nullptr, status); in usearch_handlePreviousExact()
2461 setMatchNotFound(strsrch, *status); in usearch_handlePreviousExact()
2464 textOffset = ucol_getOffset(strsrch->textIter); in usearch_handlePreviousExact()
2467 textOffset = ucol_getOffset(strsrch->textIter); in usearch_handlePreviousExact()
2473 if (usearch_searchBackwards(strsrch, textOffset, &start, &end, status)) { in usearch_handlePreviousExact()
2474 strsrch->search->matchedIndex = start; in usearch_handlePreviousExact()
2475 strsrch->search->matchedLength = end - start; in usearch_handlePreviousExact()
2478 setMatchNotFound(strsrch, *status); in usearch_handlePreviousExact()
2483 UBool usearch_handlePreviousCanonical(UStringSearch *strsrch, in usearch_handlePreviousCanonical() argument
2487 setMatchNotFound(strsrch, *status); in usearch_handlePreviousCanonical()
2493 if (strsrch->search->isOverlap) { in usearch_handlePreviousCanonical()
2494 if (strsrch->search->matchedIndex != USEARCH_DONE) { in usearch_handlePreviousCanonical()
2495 textOffset = strsrch->search->matchedIndex + strsrch->search->matchedLength - 1; in usearch_handlePreviousCanonical()
2498 initializePatternPCETable(strsrch, status); in usearch_handlePreviousCanonical()
2499 if (!initTextProcessedIter(strsrch, status)) { in usearch_handlePreviousCanonical()
2500 setMatchNotFound(strsrch, *status); in usearch_handlePreviousCanonical()
2503 for (int32_t nPCEs = 0; nPCEs < strsrch->pattern.pcesLength - 1; nPCEs++) { in usearch_handlePreviousCanonical()
2504 int64_t pce = strsrch->textProcessedIter->nextProcessed(nullptr, nullptr, status); in usearch_handlePreviousCanonical()
2511 setMatchNotFound(strsrch, *status); in usearch_handlePreviousCanonical()
2514 textOffset = ucol_getOffset(strsrch->textIter); in usearch_handlePreviousCanonical()
2517 textOffset = ucol_getOffset(strsrch->textIter); in usearch_handlePreviousCanonical()
2523 if (usearch_searchBackwards(strsrch, textOffset, &start, &end, status)) { in usearch_handlePreviousCanonical()
2524 strsrch->search->matchedIndex = start; in usearch_handlePreviousCanonical()
2525 strsrch->search->matchedLength = end - start; in usearch_handlePreviousCanonical()
2528 setMatchNotFound(strsrch, *status); in usearch_handlePreviousCanonical()