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
00076 UREGEX_LITERAL = 16,
00077
00082 UREGEX_MULTILINE = 8,
00083
00089 UREGEX_UNIX_LINES = 1,
00090
00098 UREGEX_UWORD = 256,
00099
00107 UREGEX_ERROR_ON_UNKNOWN_ESCAPES = 512
00108
00109 } URegexpFlag;
00110
00133 U_STABLE URegularExpression * U_EXPORT2
00134 uregex_open( const UChar *pattern,
00135 int32_t patternLength,
00136 uint32_t flags,
00137 UParseError *pe,
00138 UErrorCode *status);
00139
00163 U_INTERNAL URegularExpression * U_EXPORT2
00164 uregex_openUText(UText *pattern,
00165 uint32_t flags,
00166 UParseError *pe,
00167 UErrorCode *status);
00168
00192 #if !UCONFIG_NO_CONVERSION
00193 U_STABLE URegularExpression * U_EXPORT2
00194 uregex_openC( const char *pattern,
00195 uint32_t flags,
00196 UParseError *pe,
00197 UErrorCode *status);
00198 #endif
00199
00200
00201
00209 U_STABLE void U_EXPORT2
00210 uregex_close(URegularExpression *regexp);
00211
00212 #if U_SHOW_CPLUSPLUS_API
00213
00214 U_NAMESPACE_BEGIN
00215
00225 U_DEFINE_LOCAL_OPEN_POINTER(LocalURegularExpressionPointer, URegularExpression, uregex_close);
00226
00227 U_NAMESPACE_END
00228
00229 #endif
00230
00249 U_STABLE URegularExpression * U_EXPORT2
00250 uregex_clone(const URegularExpression *regexp, UErrorCode *status);
00251
00269 U_STABLE const UChar * U_EXPORT2
00270 uregex_pattern(const URegularExpression *regexp,
00271 int32_t *patLength,
00272 UErrorCode *status);
00273
00285 U_INTERNAL UText * U_EXPORT2
00286 uregex_patternUText(const URegularExpression *regexp,
00287 UErrorCode *status);
00288
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_INTERNAL 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
00376
00393 U_INTERNAL UText * U_EXPORT2
00394 uregex_getUText(URegularExpression *regexp,
00395 UText *dest,
00396 UErrorCode *status);
00397
00418 U_STABLE UBool U_EXPORT2
00419 uregex_matches(URegularExpression *regexp,
00420 int32_t startIndex,
00421 UErrorCode *status);
00422
00446 U_STABLE UBool U_EXPORT2
00447 uregex_lookingAt(URegularExpression *regexp,
00448 int32_t startIndex,
00449 UErrorCode *status);
00450
00470 U_STABLE UBool U_EXPORT2
00471 uregex_find(URegularExpression *regexp,
00472 int32_t startIndex,
00473 UErrorCode *status);
00474
00488 U_STABLE UBool U_EXPORT2
00489 uregex_findNext(URegularExpression *regexp,
00490 UErrorCode *status);
00491
00499 U_STABLE int32_t U_EXPORT2
00500 uregex_groupCount(URegularExpression *regexp,
00501 UErrorCode *status);
00502
00519 U_STABLE int32_t U_EXPORT2
00520 uregex_group(URegularExpression *regexp,
00521 int32_t groupNum,
00522 UChar *dest,
00523 int32_t destCapacity,
00524 UErrorCode *status);
00525
00543 U_INTERNAL UText * U_EXPORT2
00544 uregex_groupUText(URegularExpression *regexp,
00545 int32_t groupNum,
00546 UText *dest,
00547 UErrorCode *status);
00548
00549
00564 U_STABLE int32_t U_EXPORT2
00565 uregex_start(URegularExpression *regexp,
00566 int32_t groupNum,
00567 UErrorCode *status);
00568
00582 U_STABLE int32_t U_EXPORT2
00583 uregex_end(URegularExpression *regexp,
00584 int32_t groupNum,
00585 UErrorCode *status);
00586
00600 U_STABLE void U_EXPORT2
00601 uregex_reset(URegularExpression *regexp,
00602 int32_t index,
00603 UErrorCode *status);
00604
00605
00625 U_STABLE void U_EXPORT2
00626 uregex_setRegion(URegularExpression *regexp,
00627 int32_t regionStart,
00628 int32_t regionLimit,
00629 UErrorCode *status);
00630
00640 U_STABLE int32_t U_EXPORT2
00641 uregex_regionStart(const URegularExpression *regexp,
00642 UErrorCode *status);
00643
00644
00645
00656 U_STABLE int32_t U_EXPORT2
00657 uregex_regionEnd(const URegularExpression *regexp,
00658 UErrorCode *status);
00659
00670 U_STABLE UBool U_EXPORT2
00671 uregex_hasTransparentBounds(const URegularExpression *regexp,
00672 UErrorCode *status);
00673
00674
00694 U_STABLE void U_EXPORT2
00695 uregex_useTransparentBounds(URegularExpression *regexp,
00696 UBool b,
00697 UErrorCode *status);
00698
00699
00709 U_STABLE UBool U_EXPORT2
00710 uregex_hasAnchoringBounds(const URegularExpression *regexp,
00711 UErrorCode *status);
00712
00713
00727 U_STABLE void U_EXPORT2
00728 uregex_useAnchoringBounds(URegularExpression *regexp,
00729 UBool b,
00730 UErrorCode *status);
00731
00742 U_STABLE UBool U_EXPORT2
00743 uregex_hitEnd(const URegularExpression *regexp,
00744 UErrorCode *status);
00745
00757 U_STABLE UBool U_EXPORT2
00758 uregex_requireEnd(const URegularExpression *regexp,
00759 UErrorCode *status);
00760
00761
00762
00763
00764
00789 U_STABLE int32_t U_EXPORT2
00790 uregex_replaceAll(URegularExpression *regexp,
00791 const UChar *replacementText,
00792 int32_t replacementLength,
00793 UChar *destBuf,
00794 int32_t destCapacity,
00795 UErrorCode *status);
00796
00818 U_INTERNAL UText * U_EXPORT2
00819 uregex_replaceAllUText(URegularExpression *regexp,
00820 UText *replacement,
00821 UText *dest,
00822 UErrorCode *status);
00823
00848 U_STABLE int32_t U_EXPORT2
00849 uregex_replaceFirst(URegularExpression *regexp,
00850 const UChar *replacementText,
00851 int32_t replacementLength,
00852 UChar *destBuf,
00853 int32_t destCapacity,
00854 UErrorCode *status);
00855
00877 U_INTERNAL UText * U_EXPORT2
00878 uregex_replaceFirstUText(URegularExpression *regexp,
00879 UText *replacement,
00880 UText *dest,
00881 UErrorCode *status);
00882
00883
00930 U_STABLE int32_t U_EXPORT2
00931 uregex_appendReplacement(URegularExpression *regexp,
00932 const UChar *replacementText,
00933 int32_t replacementLength,
00934 UChar **destBuf,
00935 int32_t *destCapacity,
00936 UErrorCode *status);
00937
00938
00961 U_INTERNAL void U_EXPORT2
00962 uregex_appendReplacementUText(URegularExpression *regexp,
00963 UText *replacementText,
00964 UText *dest,
00965 UErrorCode *status);
00966
00967
00992 U_STABLE int32_t U_EXPORT2
00993 uregex_appendTail(URegularExpression *regexp,
00994 UChar **destBuf,
00995 int32_t *destCapacity,
00996 UErrorCode *status);
00997
00998
01014 U_INTERNAL UText * U_EXPORT2
01015 uregex_appendTailUText(URegularExpression *regexp,
01016 UText *dest);
01017
01018
01019
01074 U_STABLE int32_t U_EXPORT2
01075 uregex_split( URegularExpression *regexp,
01076 UChar *destBuf,
01077 int32_t destCapacity,
01078 int32_t *requiredCapacity,
01079 UChar *destFields[],
01080 int32_t destFieldsCapacity,
01081 UErrorCode *status);
01082
01083
01110 U_INTERNAL int32_t U_EXPORT2
01111 uregex_splitUText(URegularExpression *regexp,
01112 UText *destFields[],
01113 int32_t destFieldsCapacity,
01114 UErrorCode *status);
01115
01116
01117
01118
01141 U_STABLE void U_EXPORT2
01142 uregex_setTimeLimit(URegularExpression *regexp,
01143 int32_t limit,
01144 UErrorCode *status);
01145
01155 U_STABLE int32_t U_EXPORT2
01156 uregex_getTimeLimit(const URegularExpression *regexp,
01157 UErrorCode *status);
01158
01179 U_STABLE void U_EXPORT2
01180 uregex_setStackLimit(URegularExpression *regexp,
01181 int32_t limit,
01182 UErrorCode *status);
01183
01191 U_STABLE int32_t U_EXPORT2
01192 uregex_getStackLimit(const URegularExpression *regexp,
01193 UErrorCode *status);
01194
01195
01214 U_CDECL_BEGIN
01215 typedef UBool U_CALLCONV URegexMatchCallback (
01216 const void *context,
01217 int32_t steps);
01218 U_CDECL_END
01219
01234 U_STABLE void U_EXPORT2
01235 uregex_setMatchCallback(URegularExpression *regexp,
01236 URegexMatchCallback *callback,
01237 const void *context,
01238 UErrorCode *status);
01239
01240
01252 U_STABLE void U_EXPORT2
01253 uregex_getMatchCallback(const URegularExpression *regexp,
01254 URegexMatchCallback **callback,
01255 const void **context,
01256 UErrorCode *status);
01257
01258
01259
01260 #endif
01261 #endif