+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
-* Copyright (C) 2002-2015, International Business Machines
+* Copyright (C) 2002-2016, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: regex.h
-* encoding: US-ASCII
+* encoding: UTF-8
* indentation:4
*
* created on: 2002oct22
struct UHashtable;
+#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
struct Regex8BitSet;
private:
/**
* Cause a compilation error if an application accidentally attempts to
- * create a matcher with a (UChar *) string as input rather than
+ * create a matcher with a (char16_t *) string as input rather than
* a UnicodeString. Avoids a dangling reference to a temporary string.
* <p>
- * To efficiently work with UChar *strings, wrap the data in a UnicodeString
+ * To efficiently work with char16_t *strings, wrap the data in a UnicodeString
* using one of the aliasing constructors, such as
- * <code>UnicodeString(UBool isTerminated, const UChar *text, int32_t textLength);</code>
+ * <code>UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);</code>
* or in a UText, using
- * <code>utext_openUChars(UText *ut, const UChar *text, int64_t textLength, UErrorCode *status);</code>
+ * <code>utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);</code>
*
*/
- RegexMatcher *matcher(const UChar *input,
+ RegexMatcher *matcher(const char16_t *input,
UErrorCode &status) const;
public:
* @param groupName The capture group name.
* @param status A UErrorCode to receive any errors.
*
- * @draft ICU 55
+ * @stable ICU 55
*/
virtual int32_t groupNumberFromName(const UnicodeString &groupName, UErrorCode &status) const;
* nul-terminated.
* @param status A UErrorCode to receive any errors.
*
- * @draft ICU 55
+ * @stable ICU 55
*/
virtual int32_t groupNumberFromName(const char *groupName, int32_t nameLength, UErrorCode &status) const;
private:
/**
* Cause a compilation error if an application accidentally attempts to
- * create a matcher with a (UChar *) string as input rather than
+ * create a matcher with a (char16_t *) string as input rather than
* a UnicodeString. Avoids a dangling reference to a temporary string.
* <p>
- * To efficiently work with UChar *strings, wrap the data in a UnicodeString
+ * To efficiently work with char16_t *strings, wrap the data in a UnicodeString
* using one of the aliasing constructors, such as
- * <code>UnicodeString(UBool isTerminated, const UChar *text, int32_t textLength);</code>
+ * <code>UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);</code>
* or in a UText, using
- * <code>utext_openUChars(UText *ut, const UChar *text, int64_t textLength, UErrorCode *status);</code>
+ * <code>utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);</code>
*
*/
- RegexMatcher(const UnicodeString ®exp, const UChar *input,
+ RegexMatcher(const UnicodeString ®exp, const char16_t *input,
uint32_t flags, UErrorCode &status);
public:
* position may not be valid with the altered input string.</p>
* @param status A reference to a UErrorCode to receive any errors.
* @return TRUE if a match is found.
- * @draft ICU 55
+ * @stable ICU 55
*/
virtual UBool find(UErrorCode &status);
* Returns a string containing the text captured by the given group
* during the previous match operation. Group(0) is the entire match.
*
+ * A zero length string is returned both for capture groups that did not
+ * participate in the match and for actual zero length matches.
+ * To distinguish between these two cases use the function start(),
+ * which returns -1 for non-participating groups.
+ *
* @param groupNum the capture group number
* @param status A reference to a UErrorCode to receive any errors.
* Possible errors are U_REGEX_INVALID_STATE if no match
* Returns a shallow clone of the entire live input string with the UText current native index
* set to the beginning of the requested group.
*
+ * A group length of zero is returned both for capture groups that did not
+ * participate in the match and for actual zero length matches.
+ * To distinguish between these two cases use the function start(),
+ * which returns -1 for non-participating groups.
+ *
* @param groupNum The capture group number.
* @param dest The UText into which the input should be cloned, or NULL to create a new UText.
* @param group_len A reference to receive the length of the desired capture group
private:
/**
* Cause a compilation error if an application accidentally attempts to
- * reset a matcher with a (UChar *) string as input rather than
+ * reset a matcher with a (char16_t *) string as input rather than
* a UnicodeString. Avoids a dangling reference to a temporary string.
* <p>
- * To efficiently work with UChar *strings, wrap the data in a UnicodeString
+ * To efficiently work with char16_t *strings, wrap the data in a UnicodeString
* using one of the aliasing constructors, such as
- * <code>UnicodeString(UBool isTerminated, const UChar *text, int32_t textLength);</code>
+ * <code>UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);</code>
* or in a UText, using
- * <code>utext_openUChars(UText *ut, const UChar *text, int64_t textLength, UErrorCode *status);</code>
+ * <code>utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);</code>
*
*/
- RegexMatcher &reset(const UChar *input);
+ RegexMatcher &reset(const char16_t *input);
public:
/**
};
U_NAMESPACE_END
+#endif // U_SHOW_CPLUSPLUS_API
+
#endif // UCONFIG_NO_REGULAR_EXPRESSIONS
#endif