ICU 4.8.1.1
4.8.1.1
|
00001 /* 00002 ******************************************************************************* 00003 * 00004 * Copyright (C) 2002-2010, International Business Machines 00005 * Corporation and others. All Rights Reserved. 00006 * 00007 ******************************************************************************* 00008 * file name: uset.h 00009 * encoding: US-ASCII 00010 * tab size: 8 (not used) 00011 * indentation:4 00012 * 00013 * created on: 2002mar07 00014 * created by: Markus W. Scherer 00015 * 00016 * C version of UnicodeSet. 00017 */ 00018 00019 00027 #ifndef __USET_H__ 00028 #define __USET_H__ 00029 00030 #include "unicode/utypes.h" 00031 #include "unicode/uchar.h" 00032 #include "unicode/localpointer.h" 00033 00034 #ifndef UCNV_H 00035 struct USet; 00041 typedef struct USet USet; 00042 #endif 00043 00049 enum { 00054 USET_IGNORE_SPACE = 1, 00055 00082 USET_CASE_INSENSITIVE = 2, 00083 00092 USET_ADD_CASE_MAPPINGS = 4, 00093 00098 USET_SERIALIZED_STATIC_ARRAY_CAPACITY=8 00099 }; 00100 00156 typedef enum USetSpanCondition { 00168 USET_SPAN_NOT_CONTAINED = 0, 00183 USET_SPAN_CONTAINED = 1, 00202 USET_SPAN_SIMPLE = 2, 00207 USET_SPAN_CONDITION_COUNT 00208 } USetSpanCondition; 00209 00215 typedef struct USerializedSet { 00220 const uint16_t *array; 00225 int32_t bmpLength; 00230 int32_t length; 00235 uint16_t staticArray[USET_SERIALIZED_STATIC_ARRAY_CAPACITY]; 00236 } USerializedSet; 00237 00238 /********************************************************************* 00239 * USet API 00240 *********************************************************************/ 00241 00249 U_STABLE USet* U_EXPORT2 00250 uset_openEmpty(); 00251 00262 U_STABLE USet* U_EXPORT2 00263 uset_open(UChar32 start, UChar32 end); 00264 00274 U_STABLE USet* U_EXPORT2 00275 uset_openPattern(const UChar* pattern, int32_t patternLength, 00276 UErrorCode* ec); 00277 00289 U_STABLE USet* U_EXPORT2 00290 uset_openPatternOptions(const UChar* pattern, int32_t patternLength, 00291 uint32_t options, 00292 UErrorCode* ec); 00293 00300 U_STABLE void U_EXPORT2 00301 uset_close(USet* set); 00302 00303 #if U_SHOW_CPLUSPLUS_API 00304 00305 U_NAMESPACE_BEGIN 00306 00316 U_DEFINE_LOCAL_OPEN_POINTER(LocalUSetPointer, USet, uset_close); 00317 00318 U_NAMESPACE_END 00319 00320 #endif 00321 00331 U_STABLE USet * U_EXPORT2 00332 uset_clone(const USet *set); 00333 00343 U_STABLE UBool U_EXPORT2 00344 uset_isFrozen(const USet *set); 00345 00360 U_STABLE void U_EXPORT2 00361 uset_freeze(USet *set); 00362 00373 U_STABLE USet * U_EXPORT2 00374 uset_cloneAsThawed(const USet *set); 00375 00385 U_STABLE void U_EXPORT2 00386 uset_set(USet* set, 00387 UChar32 start, UChar32 end); 00388 00410 U_STABLE int32_t U_EXPORT2 00411 uset_applyPattern(USet *set, 00412 const UChar *pattern, int32_t patternLength, 00413 uint32_t options, 00414 UErrorCode *status); 00415 00438 U_STABLE void U_EXPORT2 00439 uset_applyIntPropertyValue(USet* set, 00440 UProperty prop, int32_t value, UErrorCode* ec); 00441 00477 U_STABLE void U_EXPORT2 00478 uset_applyPropertyAlias(USet* set, 00479 const UChar *prop, int32_t propLength, 00480 const UChar *value, int32_t valueLength, 00481 UErrorCode* ec); 00482 00492 U_STABLE UBool U_EXPORT2 00493 uset_resemblesPattern(const UChar *pattern, int32_t patternLength, 00494 int32_t pos); 00495 00511 U_STABLE int32_t U_EXPORT2 00512 uset_toPattern(const USet* set, 00513 UChar* result, int32_t resultCapacity, 00514 UBool escapeUnprintable, 00515 UErrorCode* ec); 00516 00525 U_STABLE void U_EXPORT2 00526 uset_add(USet* set, UChar32 c); 00527 00540 U_STABLE void U_EXPORT2 00541 uset_addAll(USet* set, const USet *additionalSet); 00542 00552 U_STABLE void U_EXPORT2 00553 uset_addRange(USet* set, UChar32 start, UChar32 end); 00554 00564 U_STABLE void U_EXPORT2 00565 uset_addString(USet* set, const UChar* str, int32_t strLen); 00566 00576 U_STABLE void U_EXPORT2 00577 uset_addAllCodePoints(USet* set, const UChar *str, int32_t strLen); 00578 00587 U_STABLE void U_EXPORT2 00588 uset_remove(USet* set, UChar32 c); 00589 00599 U_STABLE void U_EXPORT2 00600 uset_removeRange(USet* set, UChar32 start, UChar32 end); 00601 00611 U_STABLE void U_EXPORT2 00612 uset_removeString(USet* set, const UChar* str, int32_t strLen); 00613 00625 U_STABLE void U_EXPORT2 00626 uset_removeAll(USet* set, const USet* removeSet); 00627 00642 U_STABLE void U_EXPORT2 00643 uset_retain(USet* set, UChar32 start, UChar32 end); 00644 00657 U_STABLE void U_EXPORT2 00658 uset_retainAll(USet* set, const USet* retain); 00659 00668 U_STABLE void U_EXPORT2 00669 uset_compact(USet* set); 00670 00679 U_STABLE void U_EXPORT2 00680 uset_complement(USet* set); 00681 00693 U_STABLE void U_EXPORT2 00694 uset_complementAll(USet* set, const USet* complement); 00695 00703 U_STABLE void U_EXPORT2 00704 uset_clear(USet* set); 00705 00732 U_STABLE void U_EXPORT2 00733 uset_closeOver(USet* set, int32_t attributes); 00734 00741 U_STABLE void U_EXPORT2 00742 uset_removeAllStrings(USet* set); 00743 00751 U_STABLE UBool U_EXPORT2 00752 uset_isEmpty(const USet* set); 00753 00762 U_STABLE UBool U_EXPORT2 00763 uset_contains(const USet* set, UChar32 c); 00764 00774 U_STABLE UBool U_EXPORT2 00775 uset_containsRange(const USet* set, UChar32 start, UChar32 end); 00776 00785 U_STABLE UBool U_EXPORT2 00786 uset_containsString(const USet* set, const UChar* str, int32_t strLen); 00787 00798 U_STABLE int32_t U_EXPORT2 00799 uset_indexOf(const USet* set, UChar32 c); 00800 00811 U_STABLE UChar32 U_EXPORT2 00812 uset_charAt(const USet* set, int32_t charIndex); 00813 00822 U_STABLE int32_t U_EXPORT2 00823 uset_size(const USet* set); 00824 00833 U_STABLE int32_t U_EXPORT2 00834 uset_getItemCount(const USet* set); 00835 00854 U_STABLE int32_t U_EXPORT2 00855 uset_getItem(const USet* set, int32_t itemIndex, 00856 UChar32* start, UChar32* end, 00857 UChar* str, int32_t strCapacity, 00858 UErrorCode* ec); 00859 00868 U_STABLE UBool U_EXPORT2 00869 uset_containsAll(const USet* set1, const USet* set2); 00870 00881 U_STABLE UBool U_EXPORT2 00882 uset_containsAllCodePoints(const USet* set, const UChar *str, int32_t strLen); 00883 00892 U_STABLE UBool U_EXPORT2 00893 uset_containsNone(const USet* set1, const USet* set2); 00894 00903 U_STABLE UBool U_EXPORT2 00904 uset_containsSome(const USet* set1, const USet* set2); 00905 00925 U_STABLE int32_t U_EXPORT2 00926 uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); 00927 00946 U_STABLE int32_t U_EXPORT2 00947 uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); 00948 00968 U_STABLE int32_t U_EXPORT2 00969 uset_spanUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); 00970 00989 U_STABLE int32_t U_EXPORT2 00990 uset_spanBackUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); 00991 01000 U_STABLE UBool U_EXPORT2 01001 uset_equals(const USet* set1, const USet* set2); 01002 01003 /********************************************************************* 01004 * Serialized set API 01005 *********************************************************************/ 01006 01056 U_STABLE int32_t U_EXPORT2 01057 uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode* pErrorCode); 01058 01067 U_STABLE UBool U_EXPORT2 01068 uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcLength); 01069 01077 U_STABLE void U_EXPORT2 01078 uset_setSerializedToOne(USerializedSet* fillSet, UChar32 c); 01079 01088 U_STABLE UBool U_EXPORT2 01089 uset_serializedContains(const USerializedSet* set, UChar32 c); 01090 01100 U_STABLE int32_t U_EXPORT2 01101 uset_getSerializedRangeCount(const USerializedSet* set); 01102 01116 U_STABLE UBool U_EXPORT2 01117 uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, 01118 UChar32* pStart, UChar32* pEnd); 01119 01120 #endif