|
ICU 73.2
73.2
|
00001 // © 2016 and later: Unicode, Inc. and others. 00002 // License & terms of use: http://www.unicode.org/copyright.html 00003 /* 00004 ******************************************************************************* 00005 * 00006 * Copyright (C) 2002-2014, International Business Machines 00007 * Corporation and others. All Rights Reserved. 00008 * 00009 ******************************************************************************* 00010 * file name: uset.h 00011 * encoding: UTF-8 00012 * tab size: 8 (not used) 00013 * indentation:4 00014 * 00015 * created on: 2002mar07 00016 * created by: Markus W. Scherer 00017 * 00018 * C version of UnicodeSet. 00019 */ 00020 00021 00029 #ifndef __USET_H__ 00030 #define __USET_H__ 00031 00032 #include "unicode/utypes.h" 00033 #include "unicode/uchar.h" 00034 00035 #if U_SHOW_CPLUSPLUS_API 00036 #include "unicode/localpointer.h" 00037 #endif // U_SHOW_CPLUSPLUS_API 00038 00039 #ifndef USET_DEFINED 00040 00041 #ifndef U_IN_DOXYGEN 00042 #define USET_DEFINED 00043 #endif 00044 00050 typedef struct USet USet; 00051 #endif 00052 00064 enum { 00069 USET_IGNORE_SPACE = 1, 00070 00097 USET_CASE_INSENSITIVE = 2, 00098 00110 USET_ADD_CASE_MAPPINGS = 4, 00111 00112 #ifndef U_HIDE_DRAFT_API 00113 00125 USET_SIMPLE_CASE_INSENSITIVE = 6 00126 #endif // U_HIDE_DRAFT_API 00127 }; 00128 00184 typedef enum USetSpanCondition { 00197 USET_SPAN_NOT_CONTAINED = 0, 00212 USET_SPAN_CONTAINED = 1, 00232 USET_SPAN_SIMPLE = 2, 00233 #ifndef U_HIDE_DEPRECATED_API 00234 00238 USET_SPAN_CONDITION_COUNT 00239 #endif // U_HIDE_DEPRECATED_API 00240 } USetSpanCondition; 00241 00242 enum { 00249 USET_SERIALIZED_STATIC_ARRAY_CAPACITY=8 00250 }; 00251 00257 typedef struct USerializedSet { 00262 const uint16_t *array; 00267 int32_t bmpLength; 00272 int32_t length; 00277 uint16_t staticArray[USET_SERIALIZED_STATIC_ARRAY_CAPACITY]; 00278 } USerializedSet; 00279 00280 /********************************************************************* 00281 * USet API 00282 *********************************************************************/ 00283 00291 U_CAPI USet* U_EXPORT2 00292 uset_openEmpty(void); 00293 00304 U_CAPI USet* U_EXPORT2 00305 uset_open(UChar32 start, UChar32 end); 00306 00316 U_CAPI USet* U_EXPORT2 00317 uset_openPattern(const UChar* pattern, int32_t patternLength, 00318 UErrorCode* ec); 00319 00333 U_CAPI USet* U_EXPORT2 00334 uset_openPatternOptions(const UChar* pattern, int32_t patternLength, 00335 uint32_t options, 00336 UErrorCode* ec); 00337 00344 U_CAPI void U_EXPORT2 00345 uset_close(USet* set); 00346 00347 #if U_SHOW_CPLUSPLUS_API 00348 00349 U_NAMESPACE_BEGIN 00350 00360 U_DEFINE_LOCAL_OPEN_POINTER(LocalUSetPointer, USet, uset_close); 00361 00362 U_NAMESPACE_END 00363 00364 #endif 00365 00375 U_CAPI USet * U_EXPORT2 00376 uset_clone(const USet *set); 00377 00387 U_CAPI UBool U_EXPORT2 00388 uset_isFrozen(const USet *set); 00389 00404 U_CAPI void U_EXPORT2 00405 uset_freeze(USet *set); 00406 00417 U_CAPI USet * U_EXPORT2 00418 uset_cloneAsThawed(const USet *set); 00419 00429 U_CAPI void U_EXPORT2 00430 uset_set(USet* set, 00431 UChar32 start, UChar32 end); 00432 00457 U_CAPI int32_t U_EXPORT2 00458 uset_applyPattern(USet *set, 00459 const UChar *pattern, int32_t patternLength, 00460 uint32_t options, 00461 UErrorCode *status); 00462 00485 U_CAPI void U_EXPORT2 00486 uset_applyIntPropertyValue(USet* set, 00487 UProperty prop, int32_t value, UErrorCode* ec); 00488 00524 U_CAPI void U_EXPORT2 00525 uset_applyPropertyAlias(USet* set, 00526 const UChar *prop, int32_t propLength, 00527 const UChar *value, int32_t valueLength, 00528 UErrorCode* ec); 00529 00539 U_CAPI UBool U_EXPORT2 00540 uset_resemblesPattern(const UChar *pattern, int32_t patternLength, 00541 int32_t pos); 00542 00558 U_CAPI int32_t U_EXPORT2 00559 uset_toPattern(const USet* set, 00560 UChar* result, int32_t resultCapacity, 00561 UBool escapeUnprintable, 00562 UErrorCode* ec); 00563 00572 U_CAPI void U_EXPORT2 00573 uset_add(USet* set, UChar32 c); 00574 00587 U_CAPI void U_EXPORT2 00588 uset_addAll(USet* set, const USet *additionalSet); 00589 00599 U_CAPI void U_EXPORT2 00600 uset_addRange(USet* set, UChar32 start, UChar32 end); 00601 00611 U_CAPI void U_EXPORT2 00612 uset_addString(USet* set, const UChar* str, int32_t strLen); 00613 00623 U_CAPI void U_EXPORT2 00624 uset_addAllCodePoints(USet* set, const UChar *str, int32_t strLen); 00625 00634 U_CAPI void U_EXPORT2 00635 uset_remove(USet* set, UChar32 c); 00636 00646 U_CAPI void U_EXPORT2 00647 uset_removeRange(USet* set, UChar32 start, UChar32 end); 00648 00658 U_CAPI void U_EXPORT2 00659 uset_removeString(USet* set, const UChar* str, int32_t strLen); 00660 00670 U_CAPI void U_EXPORT2 00671 uset_removeAllCodePoints(USet *set, const UChar *str, int32_t length); 00672 00684 U_CAPI void U_EXPORT2 00685 uset_removeAll(USet* set, const USet* removeSet); 00686 00699 U_CAPI void U_EXPORT2 00700 uset_retain(USet* set, UChar32 start, UChar32 end); 00701 00713 U_CAPI void U_EXPORT2 00714 uset_retainString(USet *set, const UChar *str, int32_t length); 00715 00725 U_CAPI void U_EXPORT2 00726 uset_retainAllCodePoints(USet *set, const UChar *str, int32_t length); 00727 00740 U_CAPI void U_EXPORT2 00741 uset_retainAll(USet* set, const USet* retain); 00742 00751 U_CAPI void U_EXPORT2 00752 uset_compact(USet* set); 00753 00767 U_CAPI void U_EXPORT2 00768 uset_complement(USet* set); 00769 00783 U_CAPI void U_EXPORT2 00784 uset_complementRange(USet *set, UChar32 start, UChar32 end); 00785 00796 U_CAPI void U_EXPORT2 00797 uset_complementString(USet *set, const UChar *str, int32_t length); 00798 00808 U_CAPI void U_EXPORT2 00809 uset_complementAllCodePoints(USet *set, const UChar *str, int32_t length); 00810 00822 U_CAPI void U_EXPORT2 00823 uset_complementAll(USet* set, const USet* complement); 00824 00832 U_CAPI void U_EXPORT2 00833 uset_clear(USet* set); 00834 00863 U_CAPI void U_EXPORT2 00864 uset_closeOver(USet* set, int32_t attributes); 00865 00872 U_CAPI void U_EXPORT2 00873 uset_removeAllStrings(USet* set); 00874 00882 U_CAPI UBool U_EXPORT2 00883 uset_isEmpty(const USet* set); 00884 00890 U_CAPI UBool U_EXPORT2 00891 uset_hasStrings(const USet *set); 00892 00901 U_CAPI UBool U_EXPORT2 00902 uset_contains(const USet* set, UChar32 c); 00903 00913 U_CAPI UBool U_EXPORT2 00914 uset_containsRange(const USet* set, UChar32 start, UChar32 end); 00915 00924 U_CAPI UBool U_EXPORT2 00925 uset_containsString(const USet* set, const UChar* str, int32_t strLen); 00926 00937 U_CAPI int32_t U_EXPORT2 00938 uset_indexOf(const USet* set, UChar32 c); 00939 00955 U_CAPI UChar32 U_EXPORT2 00956 uset_charAt(const USet* set, int32_t charIndex); 00957 00971 U_CAPI int32_t U_EXPORT2 00972 uset_size(const USet* set); 00973 00982 U_CAPI int32_t U_EXPORT2 00983 uset_getRangeCount(const USet *set); 00984 00993 U_CAPI int32_t U_EXPORT2 00994 uset_getItemCount(const USet* set); 00995 01024 U_CAPI int32_t U_EXPORT2 01025 uset_getItem(const USet* set, int32_t itemIndex, 01026 UChar32* start, UChar32* end, 01027 UChar* str, int32_t strCapacity, 01028 UErrorCode* ec); 01029 01038 U_CAPI UBool U_EXPORT2 01039 uset_containsAll(const USet* set1, const USet* set2); 01040 01051 U_CAPI UBool U_EXPORT2 01052 uset_containsAllCodePoints(const USet* set, const UChar *str, int32_t strLen); 01053 01062 U_CAPI UBool U_EXPORT2 01063 uset_containsNone(const USet* set1, const USet* set2); 01064 01073 U_CAPI UBool U_EXPORT2 01074 uset_containsSome(const USet* set1, const USet* set2); 01075 01095 U_CAPI int32_t U_EXPORT2 01096 uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); 01097 01116 U_CAPI int32_t U_EXPORT2 01117 uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); 01118 01138 U_CAPI int32_t U_EXPORT2 01139 uset_spanUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); 01140 01159 U_CAPI int32_t U_EXPORT2 01160 uset_spanBackUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); 01161 01170 U_CAPI UBool U_EXPORT2 01171 uset_equals(const USet* set1, const USet* set2); 01172 01173 /********************************************************************* 01174 * Serialized set API 01175 *********************************************************************/ 01176 01226 U_CAPI int32_t U_EXPORT2 01227 uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode* pErrorCode); 01228 01237 U_CAPI UBool U_EXPORT2 01238 uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcLength); 01239 01247 U_CAPI void U_EXPORT2 01248 uset_setSerializedToOne(USerializedSet* fillSet, UChar32 c); 01249 01258 U_CAPI UBool U_EXPORT2 01259 uset_serializedContains(const USerializedSet* set, UChar32 c); 01260 01270 U_CAPI int32_t U_EXPORT2 01271 uset_getSerializedRangeCount(const USerializedSet* set); 01272 01286 U_CAPI UBool U_EXPORT2 01287 uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, 01288 UChar32* pStart, UChar32* pEnd); 01289 01290 #endif
1.7.6.1