ICU 54.1 54.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
usearch.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (C) 2001-2011,2014 IBM and others. All rights reserved.
4 **********************************************************************
5 * Date Name Description
6 * 06/28/2001 synwee Creation.
7 **********************************************************************
8 */
9 #ifndef USEARCH_H
10 #define USEARCH_H
11
12 #include "unicode/utypes.h"
13
14 #if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
15
16 #include "unicode/localpointer.h"
17 #include "unicode/ucol.h"
18 #include "unicode/ucoleitr.h"
19 #include "unicode/ubrk.h"
20
145 #define USEARCH_DONE -1
146
151 struct UStringSearch;
156 typedef struct UStringSearch UStringSearch;
157
161 typedef enum {
166 USEARCH_OVERLAP = 0,
167 #ifndef U_HIDE_DEPRECATED_API
168
182 USEARCH_CANONICAL_MATCH = 1,
183 #endif /* U_HIDE_DEPRECATED_API */
184
189 USEARCH_ELEMENT_COMPARISON = 2,
190
195 USEARCH_ATTRIBUTE_COUNT = 3
196 } USearchAttribute;
197
201 typedef enum {
206 USEARCH_DEFAULT = -1,
211 USEARCH_OFF,
216 USEARCH_ON,
223 USEARCH_STANDARD_ELEMENT_COMPARISON,
242 USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD,
263 USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD,
264
269 USEARCH_ATTRIBUTE_VALUE_COUNT
270 } USearchAttributeValue;
271
272 /* open and close ------------------------------------------------------ */
273
296 U_STABLE UStringSearch * U_EXPORT2 usearch_open(const UChar *pattern,
297 int32_t patternlength,
298 const UChar *text,
299 int32_t textlength,
300 const char *locale,
301 UBreakIterator *breakiter,
302 UErrorCode *status);
303
328 U_STABLE UStringSearch * U_EXPORT2 usearch_openFromCollator(
329 const UChar *pattern,
330 int32_t patternlength,
331 const UChar *text,
332 int32_t textlength,
333 const UCollator *collator,
334 UBreakIterator *breakiter,
335 UErrorCode *status);
336
343 U_STABLE void U_EXPORT2 usearch_close(UStringSearch *searchiter);
344
345 #if U_SHOW_CPLUSPLUS_API
346
347 U_NAMESPACE_BEGIN
348
358 U_DEFINE_LOCAL_OPEN_POINTER(LocalUStringSearchPointer, UStringSearch, usearch_close);
359
360 U_NAMESPACE_END
361
362 #endif
363
364 /* get and set methods -------------------------------------------------- */
365
381 U_STABLE void U_EXPORT2 usearch_setOffset(UStringSearch *strsrch,
382 int32_t position,
383 UErrorCode *status);
384
393 U_STABLE int32_t U_EXPORT2 usearch_getOffset(const UStringSearch *strsrch);
394
406 U_STABLE void U_EXPORT2 usearch_setAttribute(UStringSearch *strsrch,
407 USearchAttribute attribute,
408 USearchAttributeValue value,
409 UErrorCode *status);
410
419 U_STABLE USearchAttributeValue U_EXPORT2 usearch_getAttribute(
420 const UStringSearch *strsrch,
421 USearchAttribute attribute);
422
442 U_STABLE int32_t U_EXPORT2 usearch_getMatchedStart(
443 const UStringSearch *strsrch);
444
462 U_STABLE int32_t U_EXPORT2 usearch_getMatchedLength(
463 const UStringSearch *strsrch);
464
490 U_STABLE int32_t U_EXPORT2 usearch_getMatchedText(const UStringSearch *strsrch,
491 UChar *result,
492 int32_t resultCapacity,
493 UErrorCode *status);
494
495 #if !UCONFIG_NO_BREAK_ITERATION
496
512 U_STABLE void U_EXPORT2 usearch_setBreakIterator(UStringSearch *strsrch,
513 UBreakIterator *breakiter,
514 UErrorCode *status);
515
527 U_STABLE const UBreakIterator * U_EXPORT2 usearch_getBreakIterator(
528 const UStringSearch *strsrch);
529
530 #endif
531
545 U_STABLE void U_EXPORT2 usearch_setText( UStringSearch *strsrch,
546 const UChar *text,
547 int32_t textlength,
548 UErrorCode *status);
549
558 U_STABLE const UChar * U_EXPORT2 usearch_getText(const UStringSearch *strsrch,
559 int32_t *length);
560
571 U_STABLE UCollator * U_EXPORT2 usearch_getCollator(
572 const UStringSearch *strsrch);
573
584 U_STABLE void U_EXPORT2 usearch_setCollator( UStringSearch *strsrch,
585 const UCollator *collator,
586 UErrorCode *status);
587
600 U_STABLE void U_EXPORT2 usearch_setPattern( UStringSearch *strsrch,
601 const UChar *pattern,
602 int32_t patternlength,
603 UErrorCode *status);
604
613 U_STABLE const UChar * U_EXPORT2 usearch_getPattern(
614 const UStringSearch *strsrch,
615 int32_t *length);
616
617 /* methods ------------------------------------------------------------- */
618
634 U_STABLE int32_t U_EXPORT2 usearch_first(UStringSearch *strsrch,
635 UErrorCode *status);
636
658 U_STABLE int32_t U_EXPORT2 usearch_following(UStringSearch *strsrch,
659 int32_t position,
660 UErrorCode *status);
661
677 U_STABLE int32_t U_EXPORT2 usearch_last(UStringSearch *strsrch,
678 UErrorCode *status);
679
705 U_STABLE int32_t U_EXPORT2 usearch_preceding(UStringSearch *strsrch,
706 int32_t position,
707 UErrorCode *status);
708
726 U_STABLE int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch,
727 UErrorCode *status);
728
746 U_STABLE int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch,
747 UErrorCode *status);
748
759 U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch);
760
761 #ifndef U_HIDE_INTERNAL_API
762
816 U_INTERNAL UBool U_EXPORT2 usearch_search(UStringSearch *strsrch,
817 int32_t startIdx,
818 int32_t *matchStart,
819 int32_t *matchLimit,
820 UErrorCode *status);
821
876 U_INTERNAL UBool U_EXPORT2 usearch_searchBackwards(UStringSearch *strsrch,
877 int32_t startIdx,
878 int32_t *matchStart,
879 int32_t *matchLimit,
880 UErrorCode *status);
881 #endif /* U_HIDE_INTERNAL_API */
882
883 #endif /* #if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION */
884
885 #endif