//
/*
***************************************************************************
-* Copyright (C) 2002-2010 International Business Machines Corporation *
+* Copyright (C) 2002-2012 International Business Machines Corporation *
* and others. All rights reserved. *
***************************************************************************
*/
//
//--------------------------------------------------------------------------
RegexPattern::RegexPattern() {
- UErrorCode status = U_ZERO_ERROR;
- u_init(&status);
-
// Init all of this instances data.
init();
}
return NULL;
}
- if ((flags & (UREGEX_CANON_EQ | UREGEX_LITERAL)) != 0) {
+ if ((flags & UREGEX_CANON_EQ) != 0) {
status = U_REGEX_UNIMPLEMENTED;
return NULL;
}
return NULL;
}
- if ((flags & (UREGEX_CANON_EQ | UREGEX_LITERAL)) != 0) {
+ if ((flags & UREGEX_CANON_EQ) != 0) {
status = U_REGEX_UNIMPLEMENTED;
return NULL;
}
return retMatcher;
}
-//
-// matcher, UText mode
-//
-RegexMatcher *RegexPattern::matcher(UText *input,
- PatternIsUTextFlag /*flag*/,
- UErrorCode &status) const {
- RegexMatcher *retMatcher = matcher(status);
- if (retMatcher != NULL) {
- retMatcher->fDeferredStatus = status;
- retMatcher->reset(input);
- }
- return retMatcher;
-}
-
-#if 0
-RegexMatcher *RegexPattern::matcher(const UChar * /*input*/,
- UErrorCode &status) const
-{
- /* This should never get called. The API with UnicodeString should be called instead. */
- if (U_SUCCESS(status)) {
- status = U_UNSUPPORTED_ERROR;
- }
- return NULL;
-}
-#endif
//---------------------------------------------------------------------
//
if (U_FAILURE(status)) {return FALSE;}
- UBool retVal;
+ UBool retVal = FALSE;
RegexPattern *pat = NULL;
RegexMatcher *matcher = NULL;
pat = RegexPattern::compile(regex, 0, pe, status);
- matcher = pat->matcher(input, PATTERN_IS_UTEXT, status);
- retVal = matcher->matches(status);
+ matcher = pat->matcher(status);
+ if (U_SUCCESS(status)) {
+ matcher->reset(input);
+ retVal = matcher->matches(status);
+ }
delete matcher;
delete pat;