+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*
-* Copyright (C) 2002-2007, International Business Machines
+* Copyright (C) 2002-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
-* file name: uset.c
-* encoding: US-ASCII
+* file name: uset.cpp
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
* created on: 2002mar07
* created by: Markus W. Scherer
*
-* The serialized structure, the array of range limits, is
-* the same as in UnicodeSet, except that the HIGH value is not stored.
-*
* There are functions to efficiently serialize a USet into an array of uint16_t
* and functions to use such a serialized form efficiently without
* instantiating a new USet.
U_NAMESPACE_USE
+U_CAPI USet* U_EXPORT2
+uset_openEmpty() {
+ return (USet*) new UnicodeSet();
+}
+
U_CAPI USet* U_EXPORT2
uset_open(UChar32 start, UChar32 end) {
return (USet*) new UnicodeSet(start, end);
((UnicodeSet*) set)->UnicodeSet::clear();
}
+U_CAPI void U_EXPORT2
+uset_removeAllStrings(USet* set) {
+ ((UnicodeSet*) set)->UnicodeSet::removeAllStrings();
+}
+
U_CAPI UBool U_EXPORT2
uset_isEmpty(const USet* set) {
return ((const UnicodeSet*) set)->UnicodeSet::isEmpty();
public:
/* Try to have the compiler inline these*/
inline static int32_t getStringCount(const UnicodeSet& set) {
- return set.getStringCount();
+ return set.stringsSize();
}
inline static const UnicodeString* getString(const UnicodeSet& set,
int32_t i) {
if(rangeIndex<bmpLength) {
*pStart=array[rangeIndex++];
if(rangeIndex<bmpLength) {
- *pEnd=array[rangeIndex];
+ *pEnd=array[rangeIndex]-1;
} else if(rangeIndex<length) {
- *pEnd=(((int32_t)array[rangeIndex])<<16)|array[rangeIndex+1];
+ *pEnd=((((int32_t)array[rangeIndex])<<16)|array[rangeIndex+1])-1;
} else {
- *pEnd=0x110000;
+ *pEnd=0x10ffff;
}
- --*pEnd;
return TRUE;
} else {
rangeIndex-=bmpLength;
*pStart=(((int32_t)array[rangeIndex])<<16)|array[rangeIndex+1];
rangeIndex+=2;
if(rangeIndex<length) {
- *pEnd=(((int32_t)array[rangeIndex])<<16)|array[rangeIndex+1];
+ *pEnd=((((int32_t)array[rangeIndex])<<16)|array[rangeIndex+1])-1;
} else {
- *pEnd=0x110000;
+ *pEnd=0x10ffff;
}
- --*pEnd;
return TRUE;
} else {
return FALSE;
// ---
// #define USET_GROW_DELTA 20
//
-// static U_INLINE int32_t
+// static int32_t
// findChar(const UChar32* array, int32_t length, UChar32 c) {
// int32_t i;
//