00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00023 #ifndef UREGEX_H
00024 #define UREGEX_H
00025
00026 #include "unicode/utext.h"
00027 #include "unicode/utypes.h"
00028
00029 #if !UCONFIG_NO_REGULAR_EXPRESSIONS
00030
00031 #include "unicode/localpointer.h"
00032 #include "unicode/parseerr.h"
00033
00034 struct URegularExpression;
00040 typedef struct URegularExpression URegularExpression;
00041
00042
00047 typedef enum URegexpFlag{
00048
00049 #ifndef U_HIDE_DRAFT_API
00050
00053 UREGEX_CANON_EQ = 128,
00054 #endif
00055
00056 UREGEX_CASE_INSENSITIVE = 2,
00057
00059 UREGEX_COMMENTS = 4,
00060
00063 UREGEX_DOTALL = 32,
00064
00075 UREGEX_LITERAL = 16,
00076
00081 UREGEX_MULTILINE = 8,
00082
00088 UREGEX_UNIX_LINES = 1,
00089
00097 UREGEX_UWORD = 256,
00098
00106 UREGEX_ERROR_ON_UNKNOWN_ESCAPES = 512
00107
00108 } URegexpFlag;
00109
00132 U_STABLE URegularExpression * U_EXPORT2
00133 uregex_open( const UChar *pattern,
00134 int32_t patternLength,
00135 uint32_t flags,
00136 UParseError *pe,
00137 UErrorCode *status);
00138
00162 U_STABLE URegularExpression * U_EXPORT2
00163 uregex_openUText(UText *pattern,
00164 uint32_t flags,
00165 UParseError *pe,
00166 UErrorCode *status);
00167
00191 #if !UCONFIG_NO_CONVERSION
00192 U_STABLE URegularExpression * U_EXPORT2
00193 uregex_openC( const char *pattern,
00194 uint32_t flags,
00195 UParseError *pe,
00196 UErrorCode *status);
00197 #endif
00198
00199
00200
00208 U_STABLE void U_EXPORT2
00209 uregex_close(URegularExpression *regexp);
00210
00211 #if U_SHOW_CPLUSPLUS_API
00212
00213 U_NAMESPACE_BEGIN
00214
00224 U_DEFINE_LOCAL_OPEN_POINTER(LocalURegularExpressionPointer, URegularExpression, uregex_close);
00225
00226 U_NAMESPACE_END
00227
00228 #endif
00229
00248 U_STABLE URegularExpression * U_EXPORT2
00249 uregex_clone(const URegularExpression *regexp, UErrorCode *status);
00250
00268 U_STABLE const UChar * U_EXPORT2
00269 uregex_pattern(const URegularExpression *regexp,
00270 int32_t *patLength,
00271 UErrorCode *status);
00272
00284 U_STABLE UText * U_EXPORT2
00285 uregex_patternUText(const URegularExpression *regexp,
00286 UErrorCode *status);
00287
00296 U_STABLE int32_t U_EXPORT2
00297 uregex_flags(const URegularExpression *regexp,
00298 UErrorCode *status);
00299
00300
00321 U_STABLE void U_EXPORT2
00322 uregex_setText(URegularExpression *regexp,
00323 const UChar *text,
00324 int32_t textLength,
00325 UErrorCode *status);
00326
00327
00344 U_STABLE void U_EXPORT2
00345 uregex_setUText(URegularExpression *regexp,
00346 UText *text,
00347 UErrorCode *status);
00348
00369 U_STABLE const UChar * U_EXPORT2
00370 uregex_getText(URegularExpression *regexp,
00371 int32_t *textLength,
00372 UErrorCode *status);
00373
00390 U_STABLE UText * U_EXPORT2
00391 uregex_getUText(URegularExpression *regexp,
00392 UText *dest,
00393 UErrorCode *status);
00394
00420 U_STABLE void U_EXPORT2
00421 uregex_refreshUText(URegularExpression *regexp,
00422 UText *text,
00423 UErrorCode *status);
00424
00445 U_STABLE UBool U_EXPORT2
00446 uregex_matches(URegularExpression *regexp,
00447 int32_t startIndex,
00448 UErrorCode *status);
00449
00471 U_STABLE UBool U_EXPORT2
00472 uregex_matches64(URegularExpression *regexp,
00473 int64_t startIndex,
00474 UErrorCode *status);
00475
00499 U_STABLE UBool U_EXPORT2
00500 uregex_lookingAt(URegularExpression *regexp,
00501 int32_t startIndex,
00502 UErrorCode *status);
00503
00528 U_STABLE UBool U_EXPORT2
00529 uregex_lookingAt64(URegularExpression *regexp,
00530 int64_t startIndex,
00531 UErrorCode *status);
00532
00552 U_STABLE UBool U_EXPORT2
00553 uregex_find(URegularExpression *regexp,
00554 int32_t startIndex,
00555 UErrorCode *status);
00556
00577 U_STABLE UBool U_EXPORT2
00578 uregex_find64(URegularExpression *regexp,
00579 int64_t startIndex,
00580 UErrorCode *status);
00581
00595 U_STABLE UBool U_EXPORT2
00596 uregex_findNext(URegularExpression *regexp,
00597 UErrorCode *status);
00598
00606 U_STABLE int32_t U_EXPORT2
00607 uregex_groupCount(URegularExpression *regexp,
00608 UErrorCode *status);
00609
00626 U_STABLE int32_t U_EXPORT2
00627 uregex_groupNumberFromName(URegularExpression *regexp,
00628 const UChar *groupName,
00629 int32_t nameLength,
00630 UErrorCode *status);
00631
00632
00650 U_STABLE int32_t U_EXPORT2
00651 uregex_groupNumberFromCName(URegularExpression *regexp,
00652 const char *groupName,
00653 int32_t nameLength,
00654 UErrorCode *status);
00655
00672 U_STABLE int32_t U_EXPORT2
00673 uregex_group(URegularExpression *regexp,
00674 int32_t groupNum,
00675 UChar *dest,
00676 int32_t destCapacity,
00677 UErrorCode *status);
00678
00701 U_STABLE UText * U_EXPORT2
00702 uregex_groupUText(URegularExpression *regexp,
00703 int32_t groupNum,
00704 UText *dest,
00705 int64_t *groupLength,
00706 UErrorCode *status);
00707
00722 U_STABLE int32_t U_EXPORT2
00723 uregex_start(URegularExpression *regexp,
00724 int32_t groupNum,
00725 UErrorCode *status);
00726
00742 U_STABLE int64_t U_EXPORT2
00743 uregex_start64(URegularExpression *regexp,
00744 int32_t groupNum,
00745 UErrorCode *status);
00746
00760 U_STABLE int32_t U_EXPORT2
00761 uregex_end(URegularExpression *regexp,
00762 int32_t groupNum,
00763 UErrorCode *status);
00764
00779 U_STABLE int64_t U_EXPORT2
00780 uregex_end64(URegularExpression *regexp,
00781 int32_t groupNum,
00782 UErrorCode *status);
00783
00797 U_STABLE void U_EXPORT2
00798 uregex_reset(URegularExpression *regexp,
00799 int32_t index,
00800 UErrorCode *status);
00801
00816 U_STABLE void U_EXPORT2
00817 uregex_reset64(URegularExpression *regexp,
00818 int64_t index,
00819 UErrorCode *status);
00820
00841 U_STABLE void U_EXPORT2
00842 uregex_setRegion(URegularExpression *regexp,
00843 int32_t regionStart,
00844 int32_t regionLimit,
00845 UErrorCode *status);
00846
00868 U_STABLE void U_EXPORT2
00869 uregex_setRegion64(URegularExpression *regexp,
00870 int64_t regionStart,
00871 int64_t regionLimit,
00872 UErrorCode *status);
00873
00888 U_STABLE void U_EXPORT2
00889 uregex_setRegionAndStart(URegularExpression *regexp,
00890 int64_t regionStart,
00891 int64_t regionLimit,
00892 int64_t startIndex,
00893 UErrorCode *status);
00894
00904 U_STABLE int32_t U_EXPORT2
00905 uregex_regionStart(const URegularExpression *regexp,
00906 UErrorCode *status);
00907
00918 U_STABLE int64_t U_EXPORT2
00919 uregex_regionStart64(const URegularExpression *regexp,
00920 UErrorCode *status);
00921
00932 U_STABLE int32_t U_EXPORT2
00933 uregex_regionEnd(const URegularExpression *regexp,
00934 UErrorCode *status);
00935
00947 U_STABLE int64_t U_EXPORT2
00948 uregex_regionEnd64(const URegularExpression *regexp,
00949 UErrorCode *status);
00950
00961 U_STABLE UBool U_EXPORT2
00962 uregex_hasTransparentBounds(const URegularExpression *regexp,
00963 UErrorCode *status);
00964
00965
00985 U_STABLE void U_EXPORT2
00986 uregex_useTransparentBounds(URegularExpression *regexp,
00987 UBool b,
00988 UErrorCode *status);
00989
00990
01000 U_STABLE UBool U_EXPORT2
01001 uregex_hasAnchoringBounds(const URegularExpression *regexp,
01002 UErrorCode *status);
01003
01004
01018 U_STABLE void U_EXPORT2
01019 uregex_useAnchoringBounds(URegularExpression *regexp,
01020 UBool b,
01021 UErrorCode *status);
01022
01033 U_STABLE UBool U_EXPORT2
01034 uregex_hitEnd(const URegularExpression *regexp,
01035 UErrorCode *status);
01036
01048 U_STABLE UBool U_EXPORT2
01049 uregex_requireEnd(const URegularExpression *regexp,
01050 UErrorCode *status);
01051
01052
01053
01054
01055
01080 U_STABLE int32_t U_EXPORT2
01081 uregex_replaceAll(URegularExpression *regexp,
01082 const UChar *replacementText,
01083 int32_t replacementLength,
01084 UChar *destBuf,
01085 int32_t destCapacity,
01086 UErrorCode *status);
01087
01109 U_STABLE UText * U_EXPORT2
01110 uregex_replaceAllUText(URegularExpression *regexp,
01111 UText *replacement,
01112 UText *dest,
01113 UErrorCode *status);
01114
01139 U_STABLE int32_t U_EXPORT2
01140 uregex_replaceFirst(URegularExpression *regexp,
01141 const UChar *replacementText,
01142 int32_t replacementLength,
01143 UChar *destBuf,
01144 int32_t destCapacity,
01145 UErrorCode *status);
01146
01168 U_STABLE UText * U_EXPORT2
01169 uregex_replaceFirstUText(URegularExpression *regexp,
01170 UText *replacement,
01171 UText *dest,
01172 UErrorCode *status);
01173
01220 U_STABLE int32_t U_EXPORT2
01221 uregex_appendReplacement(URegularExpression *regexp,
01222 const UChar *replacementText,
01223 int32_t replacementLength,
01224 UChar **destBuf,
01225 int32_t *destCapacity,
01226 UErrorCode *status);
01227
01250 U_STABLE void U_EXPORT2
01251 uregex_appendReplacementUText(URegularExpression *regexp,
01252 UText *replacementText,
01253 UText *dest,
01254 UErrorCode *status);
01255
01280 U_STABLE int32_t U_EXPORT2
01281 uregex_appendTail(URegularExpression *regexp,
01282 UChar **destBuf,
01283 int32_t *destCapacity,
01284 UErrorCode *status);
01285
01304 U_STABLE UText * U_EXPORT2
01305 uregex_appendTailUText(URegularExpression *regexp,
01306 UText *dest,
01307 UErrorCode *status);
01308
01360 U_STABLE int32_t U_EXPORT2
01361 uregex_split( URegularExpression *regexp,
01362 UChar *destBuf,
01363 int32_t destCapacity,
01364 int32_t *requiredCapacity,
01365 UChar *destFields[],
01366 int32_t destFieldsCapacity,
01367 UErrorCode *status);
01368
01395 U_STABLE int32_t U_EXPORT2
01396 uregex_splitUText(URegularExpression *regexp,
01397 UText *destFields[],
01398 int32_t destFieldsCapacity,
01399 UErrorCode *status);
01400
01423 U_STABLE void U_EXPORT2
01424 uregex_setTimeLimit(URegularExpression *regexp,
01425 int32_t limit,
01426 UErrorCode *status);
01427
01437 U_STABLE int32_t U_EXPORT2
01438 uregex_getTimeLimit(const URegularExpression *regexp,
01439 UErrorCode *status);
01440
01461 U_STABLE void U_EXPORT2
01462 uregex_setStackLimit(URegularExpression *regexp,
01463 int32_t limit,
01464 UErrorCode *status);
01465
01473 U_STABLE int32_t U_EXPORT2
01474 uregex_getStackLimit(const URegularExpression *regexp,
01475 UErrorCode *status);
01476
01477
01496 U_CDECL_BEGIN
01497 typedef UBool U_CALLCONV URegexMatchCallback (
01498 const void *context,
01499 int32_t steps);
01500 U_CDECL_END
01501
01516 U_STABLE void U_EXPORT2
01517 uregex_setMatchCallback(URegularExpression *regexp,
01518 URegexMatchCallback *callback,
01519 const void *context,
01520 UErrorCode *status);
01521
01522
01534 U_STABLE void U_EXPORT2
01535 uregex_getMatchCallback(const URegularExpression *regexp,
01536 URegexMatchCallback **callback,
01537 const void **context,
01538 UErrorCode *status);
01539
01570 U_CDECL_BEGIN
01571 typedef UBool U_CALLCONV URegexFindProgressCallback (
01572 const void *context,
01573 int64_t matchIndex);
01574 U_CDECL_END
01575
01576
01588 U_STABLE void U_EXPORT2
01589 uregex_setFindProgressCallback(URegularExpression *regexp,
01590 URegexFindProgressCallback *callback,
01591 const void *context,
01592 UErrorCode *status);
01593
01605 U_STABLE void U_EXPORT2
01606 uregex_getFindProgressCallback(const URegularExpression *regexp,
01607 URegexFindProgressCallback **callback,
01608 const void **context,
01609 UErrorCode *status);
01610
01611 #endif
01612 #endif