16#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
22#if U_SHOW_CPLUSPLUS_API
151#define USEARCH_DONE -1
173#ifndef U_HIDE_DEPRECATED_API
197#ifndef U_HIDE_DEPRECATED_API
272#ifndef U_HIDE_DEPRECATED_API
310 int32_t patternlength,
347 const UChar *pattern,
348 int32_t patternlength,
363#if U_SHOW_CPLUSPLUS_API
510 int32_t resultCapacity,
513#if !UCONFIG_NO_BREAK_ITERATION
627 const UChar *pattern,
628 int32_t patternlength,
787#ifndef U_HIDE_INTERNAL_API
"Smart pointer" class, closes a UStringSearch via usearch_close().
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
struct UBreakIterator UBreakIterator
Opaque type representing an ICU Break iterator object.
struct UCollator UCollator
structure representing a collator object instance
C API: UCollationElements.
int8_t UBool
The ICU boolean type, a signed-byte integer.
#define U_CAPI
This is used to declare a function as a public ICU C API.
char16_t UChar
The base type for UTF-16 code units and pointers.
U_CAPI int32_t usearch_getMatchedText(const UStringSearch *strsrch, UChar *result, int32_t resultCapacity, UErrorCode *status)
Returns the text that was matched by the most recent call to usearch_first, usearch_next,...
U_CAPI int32_t usearch_getMatchedLength(const UStringSearch *strsrch)
Returns the length of text in the string which matches the search pattern.
U_CAPI UStringSearch * usearch_open(const UChar *pattern, int32_t patternlength, const UChar *text, int32_t textlength, const char *locale, UBreakIterator *breakiter, UErrorCode *status)
Creates a String Search iterator data struct using the argument locale language rule set.
U_CAPI void usearch_setPattern(UStringSearch *strsrch, const UChar *pattern, int32_t patternlength, UErrorCode *status)
Sets the pattern used for matching.
U_CAPI UStringSearch * usearch_openFromCollator(const UChar *pattern, int32_t patternlength, const UChar *text, int32_t textlength, const UCollator *collator, UBreakIterator *breakiter, UErrorCode *status)
Creates a String Search iterator data struct using the argument collator language rule set.
U_CAPI UCollator * usearch_getCollator(const UStringSearch *strsrch)
Gets the collator used for the language rules.
U_CAPI int32_t usearch_following(UStringSearch *strsrch, int32_t position, UErrorCode *status)
Returns the first index equal or greater than position at which the string text matches the search pa...
U_CAPI void usearch_reset(UStringSearch *strsrch)
Reset the iteration.
U_CAPI int32_t usearch_getMatchedStart(const UStringSearch *strsrch)
Returns the index to the match in the text string that was searched.
U_CAPI void usearch_close(UStringSearch *searchiter)
Destroys and cleans up the String Search iterator data struct.
U_CAPI void usearch_setText(UStringSearch *strsrch, const UChar *text, int32_t textlength, UErrorCode *status)
Set the string text to be searched.
U_CAPI int32_t usearch_previous(UStringSearch *strsrch, UErrorCode *status)
Returns the index of the previous point at which the string text matches the search pattern,...
U_CAPI const UChar * usearch_getPattern(const UStringSearch *strsrch, int32_t *length)
Gets the search pattern.
U_CAPI int32_t usearch_last(UStringSearch *strsrch, UErrorCode *status)
Returns the last index in the target text at which it matches the search pattern.
U_CAPI const UBreakIterator * usearch_getBreakIterator(const UStringSearch *strsrch)
Returns the BreakIterator that is used to restrict the points at which matches are detected.
U_CAPI int32_t usearch_preceding(UStringSearch *strsrch, int32_t position, UErrorCode *status)
Returns the first index less than position at which the string text matches the search pattern.
U_CAPI void usearch_setBreakIterator(UStringSearch *strsrch, UBreakIterator *breakiter, UErrorCode *status)
Set the BreakIterator that will be used to restrict the points at which matches are detected.
U_CAPI void usearch_setAttribute(UStringSearch *strsrch, USearchAttribute attribute, USearchAttributeValue value, UErrorCode *status)
Sets the text searching attributes located in the enum USearchAttribute with values from the enum USe...
U_CAPI UBool usearch_searchBackwards(UStringSearch *strsrch, int32_t startIdx, int32_t *matchStart, int32_t *matchLimit, UErrorCode *status)
Simple backwards search for the pattern, starting at a specified index, and using using a default set...
@ USEARCH_CANONICAL_MATCH
Option for canonical matches; option 1 in header documentation.
@ USEARCH_ELEMENT_COMPARISON
Option to control how collation elements are compared.
@ USEARCH_OVERLAP
Option for overlapping matches.
@ USEARCH_ATTRIBUTE_COUNT
One more than the highest normal USearchAttribute value.
U_CAPI const UChar * usearch_getText(const UStringSearch *strsrch, int32_t *length)
Return the string text to be searched.
U_CAPI USearchAttributeValue usearch_getAttribute(const UStringSearch *strsrch, USearchAttribute attribute)
Gets the text searching attributes.
struct UStringSearch UStringSearch
Data structure for searching.
U_CAPI int32_t usearch_first(UStringSearch *strsrch, UErrorCode *status)
Returns the first index at which the string text matches the search pattern.
U_CAPI int32_t usearch_next(UStringSearch *strsrch, UErrorCode *status)
Returns the index of the next point at which the string text matches the search pattern,...
U_CAPI void usearch_setOffset(UStringSearch *strsrch, int32_t position, UErrorCode *status)
Sets the current position in the text string which the next search will start from.
U_CAPI void usearch_setCollator(UStringSearch *strsrch, const UCollator *collator, UErrorCode *status)
Sets the collator used for the language rules.
U_CAPI int32_t usearch_getOffset(const UStringSearch *strsrch)
Return the current index in the string text being searched.
@ USEARCH_ATTRIBUTE_VALUE_COUNT
One more than the highest normal USearchAttributeValue value.
@ USEARCH_DEFAULT
Default value for any USearchAttribute.
@ USEARCH_OFF
Value for USEARCH_OVERLAP and USEARCH_CANONICAL_MATCH.
@ USEARCH_ON
Value for USEARCH_OVERLAP and USEARCH_CANONICAL_MATCH.
@ USEARCH_STANDARD_ELEMENT_COMPARISON
Value (default) for USEARCH_ELEMENT_COMPARISON; standard collation element comparison at the specifie...
@ USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD
Value for USEARCH_ELEMENT_COMPARISON; collation element comparison is modified to effectively provide...
@ USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD
Value for USEARCH_ELEMENT_COMPARISON.
U_CAPI UBool usearch_search(UStringSearch *strsrch, int32_t startIdx, int32_t *matchStart, int32_t *matchLimit, UErrorCode *status)
Simple forward search for the pattern, starting at a specified index, and using a default set search ...
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.