|
ICU 73.2
73.2
|
00001 // © 2016 and later: Unicode, Inc. and others. 00002 // License & terms of use: http://www.unicode.org/copyright.html 00003 /* 00004 ********************************************************************** 00005 * Copyright (C) 2001-2011,2014 IBM and others. All rights reserved. 00006 ********************************************************************** 00007 * Date Name Description 00008 * 06/28/2001 synwee Creation. 00009 ********************************************************************** 00010 */ 00011 #ifndef USEARCH_H 00012 #define USEARCH_H 00013 00014 #include "unicode/utypes.h" 00015 00016 #if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION 00017 00018 #include "unicode/ucol.h" 00019 #include "unicode/ucoleitr.h" 00020 #include "unicode/ubrk.h" 00021 00022 #if U_SHOW_CPLUSPLUS_API 00023 #include "unicode/localpointer.h" 00024 #endif // U_SHOW_CPLUSPLUS_API 00025 00151 #define USEARCH_DONE -1 00152 00157 struct UStringSearch; 00162 typedef struct UStringSearch UStringSearch; 00163 00167 typedef enum { 00172 USEARCH_OVERLAP = 0, 00173 #ifndef U_HIDE_DEPRECATED_API 00174 00188 USEARCH_CANONICAL_MATCH = 1, 00189 #endif /* U_HIDE_DEPRECATED_API */ 00190 00195 USEARCH_ELEMENT_COMPARISON = 2, 00196 00197 #ifndef U_HIDE_DEPRECATED_API 00198 00202 USEARCH_ATTRIBUTE_COUNT = 3 00203 #endif /* U_HIDE_DEPRECATED_API */ 00204 } USearchAttribute; 00205 00209 typedef enum { 00214 USEARCH_DEFAULT = -1, 00219 USEARCH_OFF, 00224 USEARCH_ON, 00231 USEARCH_STANDARD_ELEMENT_COMPARISON, 00250 USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, 00270 USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD, 00271 00272 #ifndef U_HIDE_DEPRECATED_API 00273 00277 USEARCH_ATTRIBUTE_VALUE_COUNT 00278 #endif /* U_HIDE_DEPRECATED_API */ 00279 } USearchAttributeValue; 00280 00281 /* open and close ------------------------------------------------------ */ 00282 00309 U_CAPI UStringSearch * U_EXPORT2 usearch_open(const UChar *pattern, 00310 int32_t patternlength, 00311 const UChar *text, 00312 int32_t textlength, 00313 const char *locale, 00314 UBreakIterator *breakiter, 00315 UErrorCode *status); 00316 00346 U_CAPI UStringSearch * U_EXPORT2 usearch_openFromCollator( 00347 const UChar *pattern, 00348 int32_t patternlength, 00349 const UChar *text, 00350 int32_t textlength, 00351 const UCollator *collator, 00352 UBreakIterator *breakiter, 00353 UErrorCode *status); 00354 00361 U_CAPI void U_EXPORT2 usearch_close(UStringSearch *searchiter); 00362 00363 #if U_SHOW_CPLUSPLUS_API 00364 00365 U_NAMESPACE_BEGIN 00366 00376 U_DEFINE_LOCAL_OPEN_POINTER(LocalUStringSearchPointer, UStringSearch, usearch_close); 00377 00378 U_NAMESPACE_END 00379 00380 #endif 00381 00382 /* get and set methods -------------------------------------------------- */ 00383 00399 U_CAPI void U_EXPORT2 usearch_setOffset(UStringSearch *strsrch, 00400 int32_t position, 00401 UErrorCode *status); 00402 00411 U_CAPI int32_t U_EXPORT2 usearch_getOffset(const UStringSearch *strsrch); 00412 00424 U_CAPI void U_EXPORT2 usearch_setAttribute(UStringSearch *strsrch, 00425 USearchAttribute attribute, 00426 USearchAttributeValue value, 00427 UErrorCode *status); 00428 00437 U_CAPI USearchAttributeValue U_EXPORT2 usearch_getAttribute( 00438 const UStringSearch *strsrch, 00439 USearchAttribute attribute); 00440 00460 U_CAPI int32_t U_EXPORT2 usearch_getMatchedStart( 00461 const UStringSearch *strsrch); 00462 00480 U_CAPI int32_t U_EXPORT2 usearch_getMatchedLength( 00481 const UStringSearch *strsrch); 00482 00508 U_CAPI int32_t U_EXPORT2 usearch_getMatchedText(const UStringSearch *strsrch, 00509 UChar *result, 00510 int32_t resultCapacity, 00511 UErrorCode *status); 00512 00513 #if !UCONFIG_NO_BREAK_ITERATION 00514 00530 U_CAPI void U_EXPORT2 usearch_setBreakIterator(UStringSearch *strsrch, 00531 UBreakIterator *breakiter, 00532 UErrorCode *status); 00533 00545 U_CAPI const UBreakIterator * U_EXPORT2 usearch_getBreakIterator( 00546 const UStringSearch *strsrch); 00547 00548 #endif 00549 00567 U_CAPI void U_EXPORT2 usearch_setText( UStringSearch *strsrch, 00568 const UChar *text, 00569 int32_t textlength, 00570 UErrorCode *status); 00571 00580 U_CAPI const UChar * U_EXPORT2 usearch_getText(const UStringSearch *strsrch, 00581 int32_t *length); 00582 00593 U_CAPI UCollator * U_EXPORT2 usearch_getCollator( 00594 const UStringSearch *strsrch); 00595 00606 U_CAPI void U_EXPORT2 usearch_setCollator( UStringSearch *strsrch, 00607 const UCollator *collator, 00608 UErrorCode *status); 00609 00626 U_CAPI void U_EXPORT2 usearch_setPattern( UStringSearch *strsrch, 00627 const UChar *pattern, 00628 int32_t patternlength, 00629 UErrorCode *status); 00630 00639 U_CAPI const UChar * U_EXPORT2 usearch_getPattern( 00640 const UStringSearch *strsrch, 00641 int32_t *length); 00642 00643 /* methods ------------------------------------------------------------- */ 00644 00660 U_CAPI int32_t U_EXPORT2 usearch_first(UStringSearch *strsrch, 00661 UErrorCode *status); 00662 00684 U_CAPI int32_t U_EXPORT2 usearch_following(UStringSearch *strsrch, 00685 int32_t position, 00686 UErrorCode *status); 00687 00703 U_CAPI int32_t U_EXPORT2 usearch_last(UStringSearch *strsrch, 00704 UErrorCode *status); 00705 00731 U_CAPI int32_t U_EXPORT2 usearch_preceding(UStringSearch *strsrch, 00732 int32_t position, 00733 UErrorCode *status); 00734 00752 U_CAPI int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch, 00753 UErrorCode *status); 00754 00772 U_CAPI int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch, 00773 UErrorCode *status); 00774 00785 U_CAPI void U_EXPORT2 usearch_reset(UStringSearch *strsrch); 00786 00787 #ifndef U_HIDE_INTERNAL_API 00788 00842 U_CAPI UBool U_EXPORT2 usearch_search(UStringSearch *strsrch, 00843 int32_t startIdx, 00844 int32_t *matchStart, 00845 int32_t *matchLimit, 00846 UErrorCode *status); 00847 00902 U_CAPI UBool U_EXPORT2 usearch_searchBackwards(UStringSearch *strsrch, 00903 int32_t startIdx, 00904 int32_t *matchStart, 00905 int32_t *matchLimit, 00906 UErrorCode *status); 00907 #endif /* U_HIDE_INTERNAL_API */ 00908 00909 #endif /* #if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION */ 00910 00911 #endif
1.7.6.1