From 3dd19f8a5b2dcaa0bf4f6546db2b35a85b02fe8c Mon Sep 17 00:00:00 2001 From: Andy Heninger Date: Tue, 2 Sep 2014 21:39:18 +0000 Subject: [PATCH] ICU-10815 Regex error handling, minor cleanups. X-SVN-Rev: 36306 --- icu4c/source/i18n/rematch.cpp | 35 +++++++++++++++---------------- icu4c/source/i18n/unicode/regex.h | 2 +- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/icu4c/source/i18n/rematch.cpp b/icu4c/source/i18n/rematch.cpp index 667cb84f69c..4389985e9ed 100644 --- a/icu4c/source/i18n/rematch.cpp +++ b/icu4c/source/i18n/rematch.cpp @@ -557,6 +557,23 @@ int32_t RegexMatcher::end(int32_t group, UErrorCode &err) const { return (int32_t)end64(group, err); } +//-------------------------------------------------------------------------------- +// +// findProgressInterrupt This function is called once for each advance in the target +// string from the find() function, and calls the user progress callback +// function if there is one installed. +// +// Return: TRUE if the find operation is to be terminated. +// FALSE if the find operation is to continue running. +// +//-------------------------------------------------------------------------------- +UBool RegexMatcher::findProgressInterrupt(int64_t pos, UErrorCode &status) { + if (fFindProgressCallbackFn && !(*fFindProgressCallbackFn)(fFindProgressCallbackContext, pos)) { + status = U_REGEX_STOPPED_BY_CALLER; + return TRUE; + } + return FALSE; +} //-------------------------------------------------------------------------------- // @@ -2621,24 +2638,6 @@ void RegexMatcher::IncrementTime(UErrorCode &status) { } } -//-------------------------------------------------------------------------------- -// -// findProgressInterrupt This function is called once for each advance in the target -// string from the find() function, and calls the user progress callback -// function if there is one installed. -// -// Return: TRUE if the find operation is to be terminated. -// FALSE if the find operation is to continue running. -// -//-------------------------------------------------------------------------------- -UBool RegexMatcher::findProgressInterrupt(int64_t pos, UErrorCode &status) { - if (fFindProgressCallbackFn && !(*fFindProgressCallbackFn)(fFindProgressCallbackContext, pos)) { - status = U_REGEX_STOPPED_BY_CALLER; - return TRUE; - } - return FALSE; -} - //-------------------------------------------------------------------------------- // // StateSave diff --git a/icu4c/source/i18n/unicode/regex.h b/icu4c/source/i18n/unicode/regex.h index 950088e192b..ed3b062ca39 100644 --- a/icu4c/source/i18n/unicode/regex.h +++ b/icu4c/source/i18n/unicode/regex.h @@ -812,7 +812,7 @@ public: * position may not be valid with the altered input string.

* @param status A reference to a UErrorCode to receive any errors. * @return TRUE if a match is found. - * @stable @internal + * @internal */ virtual UBool find(UErrorCode &status); -- 2.40.0