summaryrefslogtreecommitdiff
path: root/thirdparty/icu4c/common/unicode/uset.h
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2021-10-28 09:15:28 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2021-10-28 09:15:28 +0300
commit44a241b241af6453d4459c79b1a562c447e36636 (patch)
tree0b90326241b6e647b9f8991cddeee5e8d4d93e9f /thirdparty/icu4c/common/unicode/uset.h
parent157cba39331c5ca945c8c3bb2173c5363550a680 (diff)
ICU: Update to version 70.1
Diffstat (limited to 'thirdparty/icu4c/common/unicode/uset.h')
-rw-r--r--thirdparty/icu4c/common/unicode/uset.h86
1 files changed, 67 insertions, 19 deletions
diff --git a/thirdparty/icu4c/common/unicode/uset.h b/thirdparty/icu4c/common/unicode/uset.h
index 1d0daf9d09..2ef352ef56 100644
--- a/thirdparty/icu4c/common/unicode/uset.h
+++ b/thirdparty/icu4c/common/unicode/uset.h
@@ -719,16 +719,21 @@ uset_retainAll(USet* set, const USet* retain);
* possible space, without changing this object's value.
* A frozen set will not be modified.
*
- * @param set the object on which to perfrom the compact
+ * @param set the object on which to perform the compact
* @stable ICU 3.2
*/
U_CAPI void U_EXPORT2
uset_compact(USet* set);
/**
- * Inverts this set. This operation modifies this set so that
- * its value is its complement. This operation does not affect
- * the multicharacter strings, if any.
+ * This is equivalent to
+ * <code>uset_complementRange(set, 0, 0x10FFFF)</code>.
+ *
+ * <strong>Note:</strong> This performs a symmetric difference with all code points
+ * <em>and thus retains all multicharacter strings</em>.
+ * In order to achieve a “code point complement” (all code points minus this set),
+ * the easiest is to <code>uset_complement(set); uset_removeAllStrings(set);</code>.
+ *
* A frozen set will not be modified.
* @param set the set
* @stable ICU 2.4
@@ -851,6 +856,16 @@ uset_removeAllStrings(USet* set);
U_CAPI UBool U_EXPORT2
uset_isEmpty(const USet* set);
+#ifndef U_HIDE_DRAFT_API
+/**
+ * @param set the set
+ * @return true if this set contains multi-character strings or the empty string.
+ * @draft ICU 70
+ */
+U_CAPI UBool U_EXPORT2
+uset_hasStrings(const USet *set);
+#endif // U_HIDE_DRAFT_API
+
/**
* Returns true if the given USet contains the given character.
* This function works faster with a frozen set.
@@ -901,8 +916,13 @@ uset_indexOf(const USet* set, UChar32 c);
/**
* Returns the character at the given index within this set, where
* the set is ordered by ascending code point. If the index is
- * out of range, return (UChar32)-1. The inverse of this method is
- * <code>indexOf()</code>.
+ * out of range for characters, returns (UChar32)-1.
+ * The inverse of this method is <code>indexOf()</code>.
+ *
+ * For iteration, this is slower than uset_getRangeCount()/uset_getItemCount()
+ * with uset_getItem(), because for each call it skips linearly over <code>index</code>
+ * characters in the ranges.
+ *
* @param set the set
* @param charIndex an index from 0..size()-1 to obtain the char for
* @return the character at the given index, or (UChar32)-1.
@@ -912,16 +932,34 @@ U_CAPI UChar32 U_EXPORT2
uset_charAt(const USet* set, int32_t charIndex);
/**
- * Returns the number of characters and strings contained in the given
- * USet.
+ * Returns the number of characters and strings contained in this set.
+ * The last (uset_getItemCount() - uset_getRangeCount()) items are strings.
+ *
+ * This is slower than uset_getRangeCount() and uset_getItemCount() because
+ * it counts the code points of all ranges.
+ *
* @param set the set
* @return a non-negative integer counting the characters and strings
* contained in set
* @stable ICU 2.4
+ * @see uset_getRangeCount
*/
U_CAPI int32_t U_EXPORT2
uset_size(const USet* set);
+#ifndef U_HIDE_DRAFT_API
+/**
+ * @param set the set
+ * @return the number of ranges in this set.
+ * @draft ICU 70
+ * @see uset_getItemCount
+ * @see uset_getItem
+ * @see uset_size
+ */
+U_CAPI int32_t U_EXPORT2
+uset_getRangeCount(const USet *set);
+#endif // U_HIDE_DRAFT_API
+
/**
* Returns the number of items in this set. An item is either a range
* of characters or a single multicharacter string.
@@ -935,20 +973,30 @@ uset_getItemCount(const USet* set);
/**
* Returns an item of this set. An item is either a range of
- * characters or a single multicharacter string.
+ * characters or a single multicharacter string (which can be the empty string).
+ *
+ * If <code>itemIndex</code> is less than uset_getRangeCount(), then this function returns 0,
+ * and the range is <code>*start</code>..<code>*end</code>.
+ *
+ * If <code>itemIndex</code> is at least uset_getRangeCount() and less than uset_getItemCount(), then
+ * this function copies the string into <code>str[strCapacity]</code> and
+ * returns the length of the string (0 for the empty string).
+ *
+ * If <code>itemIndex</code> is out of range, then this function returns -1.
+ *
+ * Note that 0 is returned for each range as well as for the empty string.
+ *
* @param set the set
- * @param itemIndex a non-negative integer in the range 0..
- * uset_getItemCount(set)-1
- * @param start pointer to variable to receive first character
- * in range, inclusive
- * @param end pointer to variable to receive last character in range,
- * inclusive
+ * @param itemIndex a non-negative integer in the range 0..uset_getItemCount(set)-1
+ * @param start pointer to variable to receive first character in range, inclusive;
+ * can be NULL for a string item
+ * @param end pointer to variable to receive last character in range, inclusive;
+ * can be NULL for a string item
* @param str buffer to receive the string, may be NULL
* @param strCapacity capacity of str, or 0 if str is NULL
- * @param ec error code
- * @return the length of the string (>= 2), or 0 if the item is a
- * range, in which case it is the range *start..*end, or -1 if
- * itemIndex is out of range
+ * @param ec error code; U_INDEX_OUTOFBOUNDS_ERROR if the itemIndex is out of range
+ * @return the length of the string (0 or >= 2), or 0 if the item is a range,
+ * or -1 if the itemIndex is out of range
* @stable ICU 2.4
*/
U_CAPI int32_t U_EXPORT2