📄 uset.h
字号:
* Removes the given string to the given USet. After this call, * uset_containsString(set, str, strLen) will return FALSE. * @param set the object to which to add the character * @param str the string to remove * @param strLen the length of the string or -1 if null terminated. * @stable ICU 2.4 */U_STABLE void U_EXPORT2uset_removeString(USet* set, const UChar* str, int32_t strLen);/** * Removes from this set all of its elements that are contained in the * specified set. This operation effectively modifies this * set so that its value is the <i>asymmetric set difference</i> of * the two sets. * @param set the object from which the elements are to be removed * @param removeSet the object that defines which elements will be * removed from this set * @draft ICU 3.2 */U_DRAFT void U_EXPORT2uset_removeAll(USet* set, const USet* removeSet);/** * Retain only the elements in this set that are contained in the * specified range. If <code>start > end</code> then an empty range is * retained, leaving the set empty. This is equivalent to * a boolean logic AND, or a set INTERSECTION. * * @param set the object for which to retain only the specified range * @param start first character, inclusive, of range to be retained * to this set. * @param end last character, inclusive, of range to be retained * to this set. * @draft ICU 3.2 */U_DRAFT void U_EXPORT2uset_retain(USet* set, UChar32 start, UChar32 end);/** * Retains only the elements in this set that are contained in the * specified set. In other words, removes from this set all of * its elements that are not contained in the specified set. This * operation effectively modifies this set so that its value is * the <i>intersection</i> of the two sets. * * @param set the object on which to perform the retain * @param retain set that defines which elements this set will retain * @draft ICU 3.2 */U_DRAFT void U_EXPORT2uset_retainAll(USet* set, const USet* retain);/** * Reallocate this objects internal structures to take up the least * possible space, without changing this object's value. * * @param set the object on which to perfrom the compact * @draft ICU 3.2 */U_DRAFT void U_EXPORT2uset_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. * @param set the set * @stable ICU 2.4 */U_STABLE void U_EXPORT2uset_complement(USet* set);/** * Complements in this set all elements contained in the specified * set. Any character in the other set will be removed if it is * in this set, or will be added if it is not in this set. * * @param set the set with which to complement * @param complement set that defines which elements will be xor'ed * from this set. * @draft ICU 3.2 */U_DRAFT void U_EXPORT2uset_complementAll(USet* set, const USet* complement);/** * Removes all of the elements from this set. This set will be * empty after this call returns. * @param set the set * @stable ICU 2.4 */U_STABLE void U_EXPORT2uset_clear(USet* set);/** * Returns TRUE if the given USet contains no characters and no * strings. * @param set the set * @return true if set is empty * @stable ICU 2.4 */U_STABLE UBool U_EXPORT2uset_isEmpty(const USet* set);/** * Returns TRUE if the given USet contains the given character. * @param set the set * @param c The codepoint to check for within the set * @return true if set contains c * @stable ICU 2.4 */U_STABLE UBool U_EXPORT2uset_contains(const USet* set, UChar32 c);/** * Returns TRUE if the given USet contains all characters c * where start <= c && c <= end. * @param set the set * @param start the first character of the range to test, inclusive * @param end the last character of the range to test, inclusive * @return TRUE if set contains the range * @stable ICU 2.2 */U_STABLE UBool U_EXPORT2uset_containsRange(const USet* set, UChar32 start, UChar32 end);/** * Returns TRUE if the given USet contains the given string. * @param set the set * @param str the string * @param strLen the length of the string or -1 if null terminated. * @return true if set contains str * @stable ICU 2.4 */U_STABLE UBool U_EXPORT2uset_containsString(const USet* set, const UChar* str, int32_t strLen);/** * Returns the index of the given character within this set, where * the set is ordered by ascending code point. If the character * is not in this set, return -1. The inverse of this method is * <code>charAt()</code>. * @param set the set * @param c the character to obtain the index for * @return an index from 0..size()-1, or -1 * @draft ICU 3.2 */U_DRAFT int32_t U_EXPORT2uset_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>. * @param set the set * @param index an index from 0..size()-1 to obtain the char for * @return the character at the given index, or (UChar32)-1. * @draft ICU 3.2 */U_DRAFT UChar32 U_EXPORT2uset_charAt(const USet* set, int32_t index);/** * Returns the number of characters and strings contained in the given * USet. * @param set the set * @return a non-negative integer counting the characters and strings * contained in set * @stable ICU 2.4 */U_STABLE int32_t U_EXPORT2uset_size(const USet* set);/** * Returns the number of items in this set. An item is either a range * of characters or a single multicharacter string. * @param set the set * @return a non-negative integer counting the character ranges * and/or strings contained in set * @stable ICU 2.4 */U_STABLE int32_t U_EXPORT2uset_getItemCount(const USet* set);/** * Returns an item of this set. An item is either a range of * characters or a single multicharacter 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 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 * @stable ICU 2.4 */U_STABLE int32_t U_EXPORT2uset_getItem(const USet* set, int32_t itemIndex, UChar32* start, UChar32* end, UChar* str, int32_t strCapacity, UErrorCode* ec);/** * Returns true if set1 contains all the characters and strings * of set2. It answers the question, 'Is set1 a subset of set2?' * @param set1 set to be checked for containment * @param set2 set to be checked for containment * @return true if the test condition is met * @draft ICU 3.2 */U_DRAFT UBool U_EXPORT2uset_containsAll(const USet* set1, const USet* set2);/** * Returns true if set1 contains none of the characters and strings * of set2. It answers the question, 'Is set1 a disjoint set of set2?' * @param set1 set to be checked for containment * @param set2 set to be checked for containment * @return true if the test condition is met * @draft ICU 3.2 */U_DRAFT UBool U_EXPORT2uset_containsNone(const USet* set1, const USet* set2);/** * Returns true if set1 contains some of the characters and strings * of set2. It answers the question, 'Does set1 and set2 have an intersection?' * @param set1 set to be checked for containment * @param set2 set to be checked for containment * @return true if the test condition is met * @draft ICU 3.2 */U_DRAFT UBool U_EXPORT2uset_containsSome(const USet* set1, const USet* set2);/** * Returns true if set1 contains all of the characters and strings * of set2, and vis versa. It answers the question, 'Is set1 equal to set2?' * @param set1 set to be checked for containment * @param set2 set to be checked for containment * @return true if the test condition is met * @draft ICU 3.2 */U_DRAFT UBool U_EXPORT2uset_equals(const USet* set1, const USet* set2);/********************************************************************* * Serialized set API *********************************************************************//** * Serializes this set into an array of 16-bit integers. Serialization * (currently) only records the characters in the set; multicharacter * strings are ignored. * * The array * has following format (each line is one 16-bit integer): * * length = (n+2*m) | (m!=0?0x8000:0) * bmpLength = n; present if m!=0 * bmp[0] * bmp[1] * ... * bmp[n-1] * supp-high[0] * supp-low[0] * supp-high[1] * supp-low[1] * ... * supp-high[m-1] * supp-low[m-1] * * The array starts with a header. After the header are n bmp * code points, then m supplementary code points. Either n or m * or both may be zero. n+2*m is always <= 0x7FFF. * * If there are no supplementary characters (if m==0) then the * header is one 16-bit integer, 'length', with value n. * * If there are supplementary characters (if m!=0) then the header * is two 16-bit integers. The first, 'length', has value * (n+2*m)|0x8000. The second, 'bmpLength', has value n. * * After the header the code points are stored in ascending order. * Supplementary code points are stored as most significant 16 * bits followed by least significant 16 bits. * * @param set the set * @param dest pointer to buffer of destCapacity 16-bit integers. * May be NULL only if destCapacity is zero. * @param destCapacity size of dest, or zero. Must not be negative. * @param pErrorCode pointer to the error code. Will be set to * U_INDEX_OUTOFBOUNDS_ERROR if n+2*m > 0x7FFF. Will be set to * U_BUFFER_OVERFLOW_ERROR if n+2*m+(m!=0?2:1) > destCapacity. * @return the total length of the serialized format, including * the header, that is, n+2*m+(m!=0?2:1), or 0 on error other * than U_BUFFER_OVERFLOW_ERROR. * @stable ICU 2.4 */U_STABLE int32_t U_EXPORT2uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode* pErrorCode);/** * Given a serialized array, fill in the given serialized set object. * @param fillSet pointer to result * @param src pointer to start of array * @param srcLength length of array * @return true if the given array is valid, otherwise false * @stable ICU 2.4 */U_STABLE UBool U_EXPORT2uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcLength);/** * Set the USerializedSet to contain the given character (and nothing * else). * @param fillSet pointer to result * @param c The codepoint to set * @stable ICU 2.4 */U_STABLE void U_EXPORT2uset_setSerializedToOne(USerializedSet* fillSet, UChar32 c);/** * Returns TRUE if the given USerializedSet contains the given * character. * @param set the serialized set * @param c The codepoint to check for within the set * @return true if set contains c * @stable ICU 2.4 */U_STABLE UBool U_EXPORT2uset_serializedContains(const USerializedSet* set, UChar32 c);/** * Returns the number of disjoint ranges of characters contained in * the given serialized set. Ignores any strings contained in the * set. * @param set the serialized set * @return a non-negative integer counting the character ranges * contained in set * @stable ICU 2.4 */U_STABLE int32_t U_EXPORT2uset_getSerializedRangeCount(const USerializedSet* set);/** * Returns a range of characters contained in the given serialized * set. * @param set the serialized set * @param rangeIndex a non-negative integer in the range 0.. * uset_getSerializedRangeCount(set)-1 * @param pStart pointer to variable to receive first character * in range, inclusive * @param pEnd pointer to variable to receive last character in range, * inclusive * @return true if rangeIndex is valid, otherwise false * @stable ICU 2.4 */U_STABLE UBool U_EXPORT2uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, UChar32* pStart, UChar32* pEnd);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -