00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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/localpointer.h"
00034 #include "unicode/parseerr.h"
00035
00036 struct URegularExpression;
00042 typedef struct URegularExpression URegularExpression;
00043
00044
00049 typedef enum URegexpFlag{
00050
00051 #ifndef U_HIDE_DRAFT_API
00052
00055 UREGEX_CANON_EQ = 128,
00056 #endif
00057
00058 UREGEX_CASE_INSENSITIVE = 2,
00059
00061 UREGEX_COMMENTS = 4,
00062
00065 UREGEX_DOTALL = 32,
00066
00077 UREGEX_LITERAL = 16,
00078
00083 UREGEX_MULTILINE = 8,
00084
00090 UREGEX_UNIX_LINES = 1,
00091
00099 UREGEX_UWORD = 256,
00100
00108 UREGEX_ERROR_ON_UNKNOWN_ESCAPES = 512
00109
00110 } URegexpFlag;
00111
00134 U_STABLE URegularExpression * U_EXPORT2
00135 uregex_open( const UChar *pattern,
00136 int32_t patternLength,
00137 uint32_t flags,
00138 UParseError *pe,
00139 UErrorCode *status);
00140
00164 U_STABLE URegularExpression * U_EXPORT2
00165 uregex_openUText(UText *pattern,
00166 uint32_t flags,
00167 UParseError *pe,
00168 UErrorCode *status);
00169
00170 #if !UCONFIG_NO_CONVERSION
00171
00194 U_STABLE URegularExpression * U_EXPORT2
00195 uregex_openC( const char *pattern,
00196 uint32_t flags,
00197 UParseError *pe,
00198 UErrorCode *status);
00199 #endif
00200
00201
00202
00210 U_STABLE void U_EXPORT2
00211 uregex_close(URegularExpression *regexp);
00212
00213 #if U_SHOW_CPLUSPLUS_API
00214
00215 U_NAMESPACE_BEGIN
00216
00226 U_DEFINE_LOCAL_OPEN_POINTER(LocalURegularExpressionPointer, URegularExpression, uregex_close);
00227
00228 U_NAMESPACE_END
00229
00230 #endif
00231
00250 U_STABLE URegularExpression * U_EXPORT2
00251 uregex_clone(const URegularExpression *regexp, UErrorCode *status);
00252
00270 U_STABLE const UChar * U_EXPORT2
00271 uregex_pattern(const URegularExpression *regexp,
00272 int32_t *patLength,
00273 UErrorCode *status);
00274
00286 U_STABLE UText * U_EXPORT2
00287 uregex_patternUText(const URegularExpression *regexp,
00288 UErrorCode *status);
00289
00298 U_STABLE int32_t U_EXPORT2
00299 uregex_flags(const URegularExpression *regexp,
00300 UErrorCode *status);
00301
00302
00323 U_STABLE void U_EXPORT2
00324 uregex_setText(URegularExpression *regexp,
00325 const UChar *text,
00326 int32_t textLength,
00327 UErrorCode *status);
00328
00329
00346 U_STABLE void U_EXPORT2
00347 uregex_setUText(URegularExpression *regexp,
00348 UText *text,
00349 UErrorCode *status);
00350
00371 U_STABLE const UChar * U_EXPORT2
00372 uregex_getText(URegularExpression *regexp,
00373 int32_t *textLength,
00374 UErrorCode *status);
00375
00392 U_STABLE UText * U_EXPORT2
00393 uregex_getUText(URegularExpression *regexp,
00394 UText *dest,
00395 UErrorCode *status);
00396
00422 U_STABLE void U_EXPORT2
00423 uregex_refreshUText(URegularExpression *regexp,
00424 UText *text,
00425 UErrorCode *status);
00426
00447 U_STABLE UBool U_EXPORT2
00448 uregex_matches(URegularExpression *regexp,
00449 int32_t startIndex,
00450 UErrorCode *status);
00451
00473 U_STABLE UBool U_EXPORT2
00474 uregex_matches64(URegularExpression *regexp,
00475 int64_t startIndex,
00476 UErrorCode *status);
00477
00501 U_STABLE UBool U_EXPORT2
00502 uregex_lookingAt(URegularExpression *regexp,
00503 int32_t startIndex,
00504 UErrorCode *status);
00505
00530 U_STABLE UBool U_EXPORT2
00531 uregex_lookingAt64(URegularExpression *regexp,
00532 int64_t startIndex,
00533 UErrorCode *status);
00534
00554 U_STABLE UBool U_EXPORT2
00555 uregex_find(URegularExpression *regexp,
00556 int32_t startIndex,
00557 UErrorCode *status);
00558
00579 U_STABLE UBool U_EXPORT2
00580 uregex_find64(URegularExpression *regexp,
00581 int64_t startIndex,
00582 UErrorCode *status);
00583
00597 U_STABLE UBool U_EXPORT2
00598 uregex_findNext(URegularExpression *regexp,
00599 UErrorCode *status);
00600
00608 U_STABLE int32_t U_EXPORT2
00609 uregex_groupCount(URegularExpression *regexp,
00610 UErrorCode *status);
00611
00628 U_STABLE int32_t U_EXPORT2
00629 uregex_groupNumberFromName(URegularExpression *regexp,
00630 const UChar *groupName,
00631 int32_t nameLength,
00632 UErrorCode *status);
00633
00634
00652 U_STABLE int32_t U_EXPORT2
00653 uregex_groupNumberFromCName(URegularExpression *regexp,
00654 const char *groupName,
00655 int32_t nameLength,
00656 UErrorCode *status);
00657
00674 U_STABLE int32_t U_EXPORT2
00675 uregex_group(URegularExpression *regexp,
00676 int32_t groupNum,
00677 UChar *dest,
00678 int32_t destCapacity,
00679 UErrorCode *status);
00680
00703 U_STABLE UText * U_EXPORT2
00704 uregex_groupUText(URegularExpression *regexp,
00705 int32_t groupNum,
00706 UText *dest,
00707 int64_t *groupLength,
00708 UErrorCode *status);
00709
00724 U_STABLE int32_t U_EXPORT2
00725 uregex_start(URegularExpression *regexp,
00726 int32_t groupNum,
00727 UErrorCode *status);
00728
00744 U_STABLE int64_t U_EXPORT2
00745 uregex_start64(URegularExpression *regexp,
00746 int32_t groupNum,
00747 UErrorCode *status);
00748
00762 U_STABLE int32_t U_EXPORT2
00763 uregex_end(URegularExpression *regexp,
00764 int32_t groupNum,
00765 UErrorCode *status);
00766
00781 U_STABLE int64_t U_EXPORT2
00782 uregex_end64(URegularExpression *regexp,
00783 int32_t groupNum,
00784 UErrorCode *status);
00785
00799 U_STABLE void U_EXPORT2
00800 uregex_reset(URegularExpression *regexp,
00801 int32_t index,
00802 UErrorCode *status);
00803
00818 U_STABLE void U_EXPORT2
00819 uregex_reset64(URegularExpression *regexp,
00820 int64_t index,
00821 UErrorCode *status);
00822
00843 U_STABLE void U_EXPORT2
00844 uregex_setRegion(URegularExpression *regexp,
00845 int32_t regionStart,
00846 int32_t regionLimit,
00847 UErrorCode *status);
00848
00870 U_STABLE void U_EXPORT2
00871 uregex_setRegion64(URegularExpression *regexp,
00872 int64_t regionStart,
00873 int64_t regionLimit,
00874 UErrorCode *status);
00875
00890 U_STABLE void U_EXPORT2
00891 uregex_setRegionAndStart(URegularExpression *regexp,
00892 int64_t regionStart,
00893 int64_t regionLimit,
00894 int64_t startIndex,
00895 UErrorCode *status);
00896
00906 U_STABLE int32_t U_EXPORT2
00907 uregex_regionStart(const URegularExpression *regexp,
00908 UErrorCode *status);
00909
00920 U_STABLE int64_t U_EXPORT2
00921 uregex_regionStart64(const URegularExpression *regexp,
00922 UErrorCode *status);
00923
00934 U_STABLE int32_t U_EXPORT2
00935 uregex_regionEnd(const URegularExpression *regexp,
00936 UErrorCode *status);
00937
00949 U_STABLE int64_t U_EXPORT2
00950 uregex_regionEnd64(const URegularExpression *regexp,
00951 UErrorCode *status);
00952
00963 U_STABLE UBool U_EXPORT2
00964 uregex_hasTransparentBounds(const URegularExpression *regexp,
00965 UErrorCode *status);
00966
00967
00987 U_STABLE void U_EXPORT2
00988 uregex_useTransparentBounds(URegularExpression *regexp,
00989 UBool b,
00990 UErrorCode *status);
00991
00992
01002 U_STABLE UBool U_EXPORT2
01003 uregex_hasAnchoringBounds(const URegularExpression *regexp,
01004 UErrorCode *status);
01005
01006
01020 U_STABLE void U_EXPORT2
01021 uregex_useAnchoringBounds(URegularExpression *regexp,
01022 UBool b,
01023 UErrorCode *status);
01024
01035 U_STABLE UBool U_EXPORT2
01036 uregex_hitEnd(const URegularExpression *regexp,
01037 UErrorCode *status);
01038
01050 U_STABLE UBool U_EXPORT2
01051 uregex_requireEnd(const URegularExpression *regexp,
01052 UErrorCode *status);
01053
01054
01055
01056
01057
01082 U_STABLE int32_t U_EXPORT2
01083 uregex_replaceAll(URegularExpression *regexp,
01084 const UChar *replacementText,
01085 int32_t replacementLength,
01086 UChar *destBuf,
01087 int32_t destCapacity,
01088 UErrorCode *status);
01089
01111 U_STABLE UText * U_EXPORT2
01112 uregex_replaceAllUText(URegularExpression *regexp,
01113 UText *replacement,
01114 UText *dest,
01115 UErrorCode *status);
01116
01141 U_STABLE int32_t U_EXPORT2
01142 uregex_replaceFirst(URegularExpression *regexp,
01143 const UChar *replacementText,
01144 int32_t replacementLength,
01145 UChar *destBuf,
01146 int32_t destCapacity,
01147 UErrorCode *status);
01148
01170 U_STABLE UText * U_EXPORT2
01171 uregex_replaceFirstUText(URegularExpression *regexp,
01172 UText *replacement,
01173 UText *dest,
01174 UErrorCode *status);
01175
01222 U_STABLE int32_t U_EXPORT2
01223 uregex_appendReplacement(URegularExpression *regexp,
01224 const UChar *replacementText,
01225 int32_t replacementLength,
01226 UChar **destBuf,
01227 int32_t *destCapacity,
01228 UErrorCode *status);
01229
01252 U_STABLE void U_EXPORT2
01253 uregex_appendReplacementUText(URegularExpression *regexp,
01254 UText *replacementText,
01255 UText *dest,
01256 UErrorCode *status);
01257
01282 U_STABLE int32_t U_EXPORT2
01283 uregex_appendTail(URegularExpression *regexp,
01284 UChar **destBuf,
01285 int32_t *destCapacity,
01286 UErrorCode *status);
01287
01306 U_STABLE UText * U_EXPORT2
01307 uregex_appendTailUText(URegularExpression *regexp,
01308 UText *dest,
01309 UErrorCode *status);
01310
01362 U_STABLE int32_t U_EXPORT2
01363 uregex_split( URegularExpression *regexp,
01364 UChar *destBuf,
01365 int32_t destCapacity,
01366 int32_t *requiredCapacity,
01367 UChar *destFields[],
01368 int32_t destFieldsCapacity,
01369 UErrorCode *status);
01370
01397 U_STABLE int32_t U_EXPORT2
01398 uregex_splitUText(URegularExpression *regexp,
01399 UText *destFields[],
01400 int32_t destFieldsCapacity,
01401 UErrorCode *status);
01402
01425 U_STABLE void U_EXPORT2
01426 uregex_setTimeLimit(URegularExpression *regexp,
01427 int32_t limit,
01428 UErrorCode *status);
01429
01439 U_STABLE int32_t U_EXPORT2
01440 uregex_getTimeLimit(const URegularExpression *regexp,
01441 UErrorCode *status);
01442
01463 U_STABLE void U_EXPORT2
01464 uregex_setStackLimit(URegularExpression *regexp,
01465 int32_t limit,
01466 UErrorCode *status);
01467
01475 U_STABLE int32_t U_EXPORT2
01476 uregex_getStackLimit(const URegularExpression *regexp,
01477 UErrorCode *status);
01478
01479
01498 U_CDECL_BEGIN
01499 typedef UBool U_CALLCONV URegexMatchCallback (
01500 const void *context,
01501 int32_t steps);
01502 U_CDECL_END
01503
01518 U_STABLE void U_EXPORT2
01519 uregex_setMatchCallback(URegularExpression *regexp,
01520 URegexMatchCallback *callback,
01521 const void *context,
01522 UErrorCode *status);
01523
01524
01536 U_STABLE void U_EXPORT2
01537 uregex_getMatchCallback(const URegularExpression *regexp,
01538 URegexMatchCallback **callback,
01539 const void **context,
01540 UErrorCode *status);
01541
01572 U_CDECL_BEGIN
01573 typedef UBool U_CALLCONV URegexFindProgressCallback (
01574 const void *context,
01575 int64_t matchIndex);
01576 U_CDECL_END
01577
01578
01590 U_STABLE void U_EXPORT2
01591 uregex_setFindProgressCallback(URegularExpression *regexp,
01592 URegexFindProgressCallback *callback,
01593 const void *context,
01594 UErrorCode *status);
01595
01607 U_STABLE void U_EXPORT2
01608 uregex_getFindProgressCallback(const URegularExpression *regexp,
01609 URegexFindProgressCallback **callback,
01610 const void **context,
01611 UErrorCode *status);
01612
01613 #endif
01614 #endif