|
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) 2004-2016, International Business Machines 00006 * Corporation and others. All Rights Reserved. 00007 ********************************************************************** 00008 * file name: uregex.h 00009 * encoding: UTF-8 00010 * indentation:4 00011 * 00012 * created on: 2004mar09 00013 * created by: Andy Heninger 00014 * 00015 * ICU Regular Expressions, API for C 00016 */ 00017 00025 #ifndef UREGEX_H 00026 #define UREGEX_H 00027 00028 #include "unicode/utext.h" 00029 #include "unicode/utypes.h" 00030 00031 #if !UCONFIG_NO_REGULAR_EXPRESSIONS 00032 00033 #include "unicode/parseerr.h" 00034 00035 #if U_SHOW_CPLUSPLUS_API 00036 #include "unicode/localpointer.h" 00037 #endif // U_SHOW_CPLUSPLUS_API 00038 00039 struct URegularExpression; 00045 typedef struct URegularExpression URegularExpression; 00046 00047 00052 typedef enum URegexpFlag{ 00053 00054 #ifndef U_HIDE_DRAFT_API 00055 00058 UREGEX_CANON_EQ = 128, 00059 #endif /* U_HIDE_DRAFT_API */ 00060 00061 UREGEX_CASE_INSENSITIVE = 2, 00062 00064 UREGEX_COMMENTS = 4, 00065 00068 UREGEX_DOTALL = 32, 00069 00080 UREGEX_LITERAL = 16, 00081 00086 UREGEX_MULTILINE = 8, 00087 00093 UREGEX_UNIX_LINES = 1, 00094 00102 UREGEX_UWORD = 256, 00103 00111 UREGEX_ERROR_ON_UNKNOWN_ESCAPES = 512 00112 00113 } URegexpFlag; 00114 00137 U_CAPI URegularExpression * U_EXPORT2 00138 uregex_open( const UChar *pattern, 00139 int32_t patternLength, 00140 uint32_t flags, 00141 UParseError *pe, 00142 UErrorCode *status); 00143 00167 U_CAPI URegularExpression * U_EXPORT2 00168 uregex_openUText(UText *pattern, 00169 uint32_t flags, 00170 UParseError *pe, 00171 UErrorCode *status); 00172 00173 #if !UCONFIG_NO_CONVERSION 00174 00197 U_CAPI URegularExpression * U_EXPORT2 00198 uregex_openC( const char *pattern, 00199 uint32_t flags, 00200 UParseError *pe, 00201 UErrorCode *status); 00202 #endif 00203 00204 00205 00213 U_CAPI void U_EXPORT2 00214 uregex_close(URegularExpression *regexp); 00215 00216 #if U_SHOW_CPLUSPLUS_API 00217 00218 U_NAMESPACE_BEGIN 00219 00229 U_DEFINE_LOCAL_OPEN_POINTER(LocalURegularExpressionPointer, URegularExpression, uregex_close); 00230 00231 U_NAMESPACE_END 00232 00233 #endif 00234 00253 U_CAPI URegularExpression * U_EXPORT2 00254 uregex_clone(const URegularExpression *regexp, UErrorCode *status); 00255 00273 U_CAPI const UChar * U_EXPORT2 00274 uregex_pattern(const URegularExpression *regexp, 00275 int32_t *patLength, 00276 UErrorCode *status); 00277 00289 U_CAPI UText * U_EXPORT2 00290 uregex_patternUText(const URegularExpression *regexp, 00291 UErrorCode *status); 00292 00301 U_CAPI int32_t U_EXPORT2 00302 uregex_flags(const URegularExpression *regexp, 00303 UErrorCode *status); 00304 00305 00326 U_CAPI void U_EXPORT2 00327 uregex_setText(URegularExpression *regexp, 00328 const UChar *text, 00329 int32_t textLength, 00330 UErrorCode *status); 00331 00332 00349 U_CAPI void U_EXPORT2 00350 uregex_setUText(URegularExpression *regexp, 00351 UText *text, 00352 UErrorCode *status); 00353 00374 U_CAPI const UChar * U_EXPORT2 00375 uregex_getText(URegularExpression *regexp, 00376 int32_t *textLength, 00377 UErrorCode *status); 00378 00395 U_CAPI UText * U_EXPORT2 00396 uregex_getUText(URegularExpression *regexp, 00397 UText *dest, 00398 UErrorCode *status); 00399 00425 U_CAPI void U_EXPORT2 00426 uregex_refreshUText(URegularExpression *regexp, 00427 UText *text, 00428 UErrorCode *status); 00429 00450 U_CAPI UBool U_EXPORT2 00451 uregex_matches(URegularExpression *regexp, 00452 int32_t startIndex, 00453 UErrorCode *status); 00454 00476 U_CAPI UBool U_EXPORT2 00477 uregex_matches64(URegularExpression *regexp, 00478 int64_t startIndex, 00479 UErrorCode *status); 00480 00504 U_CAPI UBool U_EXPORT2 00505 uregex_lookingAt(URegularExpression *regexp, 00506 int32_t startIndex, 00507 UErrorCode *status); 00508 00533 U_CAPI UBool U_EXPORT2 00534 uregex_lookingAt64(URegularExpression *regexp, 00535 int64_t startIndex, 00536 UErrorCode *status); 00537 00557 U_CAPI UBool U_EXPORT2 00558 uregex_find(URegularExpression *regexp, 00559 int32_t startIndex, 00560 UErrorCode *status); 00561 00582 U_CAPI UBool U_EXPORT2 00583 uregex_find64(URegularExpression *regexp, 00584 int64_t startIndex, 00585 UErrorCode *status); 00586 00600 U_CAPI UBool U_EXPORT2 00601 uregex_findNext(URegularExpression *regexp, 00602 UErrorCode *status); 00603 00611 U_CAPI int32_t U_EXPORT2 00612 uregex_groupCount(URegularExpression *regexp, 00613 UErrorCode *status); 00614 00631 U_CAPI int32_t U_EXPORT2 00632 uregex_groupNumberFromName(URegularExpression *regexp, 00633 const UChar *groupName, 00634 int32_t nameLength, 00635 UErrorCode *status); 00636 00637 00655 U_CAPI int32_t U_EXPORT2 00656 uregex_groupNumberFromCName(URegularExpression *regexp, 00657 const char *groupName, 00658 int32_t nameLength, 00659 UErrorCode *status); 00660 00677 U_CAPI int32_t U_EXPORT2 00678 uregex_group(URegularExpression *regexp, 00679 int32_t groupNum, 00680 UChar *dest, 00681 int32_t destCapacity, 00682 UErrorCode *status); 00683 00706 U_CAPI UText * U_EXPORT2 00707 uregex_groupUText(URegularExpression *regexp, 00708 int32_t groupNum, 00709 UText *dest, 00710 int64_t *groupLength, 00711 UErrorCode *status); 00712 00727 U_CAPI int32_t U_EXPORT2 00728 uregex_start(URegularExpression *regexp, 00729 int32_t groupNum, 00730 UErrorCode *status); 00731 00747 U_CAPI int64_t U_EXPORT2 00748 uregex_start64(URegularExpression *regexp, 00749 int32_t groupNum, 00750 UErrorCode *status); 00751 00765 U_CAPI int32_t U_EXPORT2 00766 uregex_end(URegularExpression *regexp, 00767 int32_t groupNum, 00768 UErrorCode *status); 00769 00784 U_CAPI int64_t U_EXPORT2 00785 uregex_end64(URegularExpression *regexp, 00786 int32_t groupNum, 00787 UErrorCode *status); 00788 00802 U_CAPI void U_EXPORT2 00803 uregex_reset(URegularExpression *regexp, 00804 int32_t index, 00805 UErrorCode *status); 00806 00821 U_CAPI void U_EXPORT2 00822 uregex_reset64(URegularExpression *regexp, 00823 int64_t index, 00824 UErrorCode *status); 00825 00846 U_CAPI void U_EXPORT2 00847 uregex_setRegion(URegularExpression *regexp, 00848 int32_t regionStart, 00849 int32_t regionLimit, 00850 UErrorCode *status); 00851 00873 U_CAPI void U_EXPORT2 00874 uregex_setRegion64(URegularExpression *regexp, 00875 int64_t regionStart, 00876 int64_t regionLimit, 00877 UErrorCode *status); 00878 00893 U_CAPI void U_EXPORT2 00894 uregex_setRegionAndStart(URegularExpression *regexp, 00895 int64_t regionStart, 00896 int64_t regionLimit, 00897 int64_t startIndex, 00898 UErrorCode *status); 00899 00909 U_CAPI int32_t U_EXPORT2 00910 uregex_regionStart(const URegularExpression *regexp, 00911 UErrorCode *status); 00912 00923 U_CAPI int64_t U_EXPORT2 00924 uregex_regionStart64(const URegularExpression *regexp, 00925 UErrorCode *status); 00926 00937 U_CAPI int32_t U_EXPORT2 00938 uregex_regionEnd(const URegularExpression *regexp, 00939 UErrorCode *status); 00940 00952 U_CAPI int64_t U_EXPORT2 00953 uregex_regionEnd64(const URegularExpression *regexp, 00954 UErrorCode *status); 00955 00966 U_CAPI UBool U_EXPORT2 00967 uregex_hasTransparentBounds(const URegularExpression *regexp, 00968 UErrorCode *status); 00969 00970 00990 U_CAPI void U_EXPORT2 00991 uregex_useTransparentBounds(URegularExpression *regexp, 00992 UBool b, 00993 UErrorCode *status); 00994 00995 01005 U_CAPI UBool U_EXPORT2 01006 uregex_hasAnchoringBounds(const URegularExpression *regexp, 01007 UErrorCode *status); 01008 01009 01023 U_CAPI void U_EXPORT2 01024 uregex_useAnchoringBounds(URegularExpression *regexp, 01025 UBool b, 01026 UErrorCode *status); 01027 01038 U_CAPI UBool U_EXPORT2 01039 uregex_hitEnd(const URegularExpression *regexp, 01040 UErrorCode *status); 01041 01053 U_CAPI UBool U_EXPORT2 01054 uregex_requireEnd(const URegularExpression *regexp, 01055 UErrorCode *status); 01056 01057 01058 01059 01060 01085 U_CAPI int32_t U_EXPORT2 01086 uregex_replaceAll(URegularExpression *regexp, 01087 const UChar *replacementText, 01088 int32_t replacementLength, 01089 UChar *destBuf, 01090 int32_t destCapacity, 01091 UErrorCode *status); 01092 01114 U_CAPI UText * U_EXPORT2 01115 uregex_replaceAllUText(URegularExpression *regexp, 01116 UText *replacement, 01117 UText *dest, 01118 UErrorCode *status); 01119 01144 U_CAPI int32_t U_EXPORT2 01145 uregex_replaceFirst(URegularExpression *regexp, 01146 const UChar *replacementText, 01147 int32_t replacementLength, 01148 UChar *destBuf, 01149 int32_t destCapacity, 01150 UErrorCode *status); 01151 01173 U_CAPI UText * U_EXPORT2 01174 uregex_replaceFirstUText(URegularExpression *regexp, 01175 UText *replacement, 01176 UText *dest, 01177 UErrorCode *status); 01178 01225 U_CAPI int32_t U_EXPORT2 01226 uregex_appendReplacement(URegularExpression *regexp, 01227 const UChar *replacementText, 01228 int32_t replacementLength, 01229 UChar **destBuf, 01230 int32_t *destCapacity, 01231 UErrorCode *status); 01232 01255 U_CAPI void U_EXPORT2 01256 uregex_appendReplacementUText(URegularExpression *regexp, 01257 UText *replacementText, 01258 UText *dest, 01259 UErrorCode *status); 01260 01285 U_CAPI int32_t U_EXPORT2 01286 uregex_appendTail(URegularExpression *regexp, 01287 UChar **destBuf, 01288 int32_t *destCapacity, 01289 UErrorCode *status); 01290 01309 U_CAPI UText * U_EXPORT2 01310 uregex_appendTailUText(URegularExpression *regexp, 01311 UText *dest, 01312 UErrorCode *status); 01313 01365 U_CAPI int32_t U_EXPORT2 01366 uregex_split( URegularExpression *regexp, 01367 UChar *destBuf, 01368 int32_t destCapacity, 01369 int32_t *requiredCapacity, 01370 UChar *destFields[], 01371 int32_t destFieldsCapacity, 01372 UErrorCode *status); 01373 01400 U_CAPI int32_t U_EXPORT2 01401 uregex_splitUText(URegularExpression *regexp, 01402 UText *destFields[], 01403 int32_t destFieldsCapacity, 01404 UErrorCode *status); 01405 01428 U_CAPI void U_EXPORT2 01429 uregex_setTimeLimit(URegularExpression *regexp, 01430 int32_t limit, 01431 UErrorCode *status); 01432 01442 U_CAPI int32_t U_EXPORT2 01443 uregex_getTimeLimit(const URegularExpression *regexp, 01444 UErrorCode *status); 01445 01466 U_CAPI void U_EXPORT2 01467 uregex_setStackLimit(URegularExpression *regexp, 01468 int32_t limit, 01469 UErrorCode *status); 01470 01478 U_CAPI int32_t U_EXPORT2 01479 uregex_getStackLimit(const URegularExpression *regexp, 01480 UErrorCode *status); 01481 01482 01501 U_CDECL_BEGIN 01502 typedef UBool U_CALLCONV URegexMatchCallback ( 01503 const void *context, 01504 int32_t steps); 01505 U_CDECL_END 01506 01521 U_CAPI void U_EXPORT2 01522 uregex_setMatchCallback(URegularExpression *regexp, 01523 URegexMatchCallback *callback, 01524 const void *context, 01525 UErrorCode *status); 01526 01527 01539 U_CAPI void U_EXPORT2 01540 uregex_getMatchCallback(const URegularExpression *regexp, 01541 URegexMatchCallback **callback, 01542 const void **context, 01543 UErrorCode *status); 01544 01575 U_CDECL_BEGIN 01576 typedef UBool U_CALLCONV URegexFindProgressCallback ( 01577 const void *context, 01578 int64_t matchIndex); 01579 U_CDECL_END 01580 01581 01593 U_CAPI void U_EXPORT2 01594 uregex_setFindProgressCallback(URegularExpression *regexp, 01595 URegexFindProgressCallback *callback, 01596 const void *context, 01597 UErrorCode *status); 01598 01610 U_CAPI void U_EXPORT2 01611 uregex_getFindProgressCallback(const URegularExpression *regexp, 01612 URegexFindProgressCallback **callback, 01613 const void **context, 01614 UErrorCode *status); 01615 01616 #endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS */ 01617 #endif /* UREGEX_H */
1.7.6.1