ICU-2447 add range functions for add, remove, contains

X-SVN-Rev: 10085
This commit is contained in:
Alan Liu 2002-10-29 19:05:03 +00:00
parent 9d2d251ac2
commit 98d8629ada
2 changed files with 48 additions and 0 deletions

View file

@ -104,6 +104,17 @@ uset_toPattern(const USet* set,
U_CAPI void U_EXPORT2
uset_add(USet* set, UChar32 c);
/**
* Adds the given range of characters to the given USet. After this call,
* uset_contains(set, start, end) will return TRUE.
* @param set the object to which to add the character
* @param start the first character of the range to add, inclusive
* @param end the last character of the range to add, inclusive
* @draft ICU 2.2
*/
U_CAPI void U_EXPORT2
uset_addRange(USet* set, UChar32 start, UChar32 end);
/**
* Adds the given string to the given USet. After this call,
* uset_containsString(set, str, strLen) will return TRUE.
@ -123,6 +134,17 @@ uset_addString(USet* set, const UChar* str, int32_t strLen);
U_CAPI void U_EXPORT2
uset_remove(USet* set, UChar32 c);
/**
* Removes the given range of characters from the given USet. After this call,
* uset_contains(set, start, end) will return FALSE.
* @param set the object to which to add the character
* @param start the first character of the range to remove, inclusive
* @param end the last character of the range to remove, inclusive
* @draft ICU 2.2
*/
U_CAPI void U_EXPORT2
uset_removeRange(USet* set, UChar32 start, UChar32 end);
/**
* Removes the given string to the given USet. After this call,
* uset_containsString(set, str, strLen) will return FALSE.
@ -167,6 +189,17 @@ uset_isEmpty(const USet* set);
U_CAPI UBool U_EXPORT2
uset_contains(const USet* set, UChar32 c);
/**
* Returns TRUE if the given USet contains all characters c
* where start <= c && c <= end.
* @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
* @draft ICU 2.2
*/
U_CAPI UBool U_EXPORT2
uset_containsRange(const USet* set, UChar32 start, UChar32 end);
/**
* Returns TRUE if the given USet contains the given string.
* @param set the set

View file

@ -71,6 +71,11 @@ uset_add(USet* set, UChar32 c) {
((UnicodeSet*) set)->add(c);
}
U_CAPI void U_EXPORT2
uset_addRange(USet* set, UChar32 start, UChar32 end) {
((UnicodeSet*) set)->add(start, end);
}
U_CAPI void U_EXPORT2
uset_addString(USet* set, const UChar* str, int32_t strLen) {
// WRONG! Do not alias, it will stay aliased, even after
@ -89,6 +94,11 @@ uset_remove(USet* set, UChar32 c) {
((UnicodeSet*) set)->remove(c);
}
U_CAPI void U_EXPORT2
uset_removeRange(USet* set, UChar32 start, UChar32 end) {
((UnicodeSet*) set)->remove(start, end);
}
U_CAPI void U_EXPORT2
uset_removeString(USet* set, const UChar* str, int32_t strLen) {
UnicodeString s(strLen==-1, str, strLen);
@ -115,6 +125,11 @@ uset_contains(const USet* set, UChar32 c) {
return ((const UnicodeSet*) set)->contains(c);
}
U_CAPI UBool U_EXPORT2
uset_containsRange(const USet* set, UChar32 start, UChar32 end) {
return ((const UnicodeSet*) set)->contains(start, end);
}
U_CAPI UBool U_EXPORT2
uset_containsString(const USet* set, const UChar* str, int32_t strLen) {
UnicodeString s(strLen==-1, str, strLen);