ICU 49.1.1
49.1.1
|
00001 /* 00002 ******************************************************************************* 00003 * 00004 * Copyright (C) 2002-2011, 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 }; 00094 00150 typedef enum USetSpanCondition { 00162 USET_SPAN_NOT_CONTAINED = 0, 00177 USET_SPAN_CONTAINED = 1, 00196 USET_SPAN_SIMPLE = 2, 00201 USET_SPAN_CONDITION_COUNT 00202 } USetSpanCondition; 00203 00204 enum { 00211 USET_SERIALIZED_STATIC_ARRAY_CAPACITY=8 00212 }; 00213 00219 typedef struct USerializedSet { 00224 const uint16_t *array; 00229 int32_t bmpLength; 00234 int32_t length; 00239 uint16_t staticArray[USET_SERIALIZED_STATIC_ARRAY_CAPACITY]; 00240 } USerializedSet; 00241 00242 /********************************************************************* 00243 * USet API 00244 *********************************************************************/ 00245 00253 U_STABLE USet* U_EXPORT2 00254 uset_openEmpty(); 00255 00266 U_STABLE USet* U_EXPORT2 00267 uset_open(UChar32 start, UChar32 end); 00268 00278 U_STABLE USet* U_EXPORT2 00279 uset_openPattern(const UChar* pattern, int32_t patternLength, 00280 UErrorCode* ec); 00281 00293 U_STABLE USet* U_EXPORT2 00294 uset_openPatternOptions(const UChar* pattern, int32_t patternLength, 00295 uint32_t options, 00296 UErrorCode* ec); 00297 00304 U_STABLE void U_EXPORT2 00305 uset_close(USet* set); 00306 00307 #if U_SHOW_CPLUSPLUS_API 00308 00309 U_NAMESPACE_BEGIN 00310 00320 U_DEFINE_LOCAL_OPEN_POINTER(LocalUSetPointer, USet, uset_close); 00321 00322 U_NAMESPACE_END 00323 00324 #endif 00325 00335 U_STABLE USet * U_EXPORT2 00336 uset_clone(const USet *set); 00337 00347 U_STABLE UBool U_EXPORT2 00348 uset_isFrozen(const USet *set); 00349 00364 U_STABLE void U_EXPORT2 00365 uset_freeze(USet *set); 00366 00377 U_STABLE USet * U_EXPORT2 00378 uset_cloneAsThawed(const USet *set); 00379 00389 U_STABLE void U_EXPORT2 00390 uset_set(USet* set, 00391 UChar32 start, UChar32 end); 00392 00414 U_STABLE int32_t U_EXPORT2 00415 uset_applyPattern(USet *set, 00416 const UChar *pattern, int32_t patternLength, 00417 uint32_t options, 00418 UErrorCode *status); 00419 00442 U_STABLE void U_EXPORT2 00443 uset_applyIntPropertyValue(USet* set, 00444 UProperty prop, int32_t value, UErrorCode* ec); 00445 00481 U_STABLE void U_EXPORT2 00482 uset_applyPropertyAlias(USet* set, 00483 const UChar *prop, int32_t propLength, 00484 const UChar *value, int32_t valueLength, 00485 UErrorCode* ec); 00486 00496 U_STABLE UBool U_EXPORT2 00497 uset_resemblesPattern(const UChar *pattern, int32_t patternLength, 00498 int32_t pos); 00499 00515 U_STABLE int32_t U_EXPORT2 00516 uset_toPattern(const USet* set, 00517 UChar* result, int32_t resultCapacity, 00518 UBool escapeUnprintable, 00519 UErrorCode* ec); 00520 00529 U_STABLE void U_EXPORT2 00530 uset_add(USet* set, UChar32 c); 00531 00544 U_STABLE void U_EXPORT2 00545 uset_addAll(USet* set, const USet *additionalSet); 00546 00556 U_STABLE void U_EXPORT2 00557 uset_addRange(USet* set, UChar32 start, UChar32 end); 00558 00568 U_STABLE void U_EXPORT2 00569 uset_addString(USet* set, const UChar* str, int32_t strLen); 00570 00580 U_STABLE void U_EXPORT2 00581 uset_addAllCodePoints(USet* set, const UChar *str, int32_t strLen); 00582 00591 U_STABLE void U_EXPORT2 00592 uset_remove(USet* set, UChar32 c); 00593 00603 U_STABLE void U_EXPORT2 00604 uset_removeRange(USet* set, UChar32 start, UChar32 end); 00605 00615 U_STABLE void U_EXPORT2 00616 uset_removeString(USet* set, const UChar* str, int32_t strLen); 00617 00629 U_STABLE void U_EXPORT2 00630 uset_removeAll(USet* set, const USet* removeSet); 00631 00646 U_STABLE void U_EXPORT2 00647 uset_retain(USet* set, UChar32 start, UChar32 end); 00648 00661 U_STABLE void U_EXPORT2 00662 uset_retainAll(USet* set, const USet* retain); 00663 00672 U_STABLE void U_EXPORT2 00673 uset_compact(USet* set); 00674 00683 U_STABLE void U_EXPORT2 00684 uset_complement(USet* set); 00685 00697 U_STABLE void U_EXPORT2 00698 uset_complementAll(USet* set, const USet* complement); 00699 00707 U_STABLE void U_EXPORT2 00708 uset_clear(USet* set); 00709 00736 U_STABLE void U_EXPORT2 00737 uset_closeOver(USet* set, int32_t attributes); 00738 00745 U_STABLE void U_EXPORT2 00746 uset_removeAllStrings(USet* set); 00747 00755 U_STABLE UBool U_EXPORT2 00756 uset_isEmpty(const USet* set); 00757 00766 U_STABLE UBool U_EXPORT2 00767 uset_contains(const USet* set, UChar32 c); 00768 00778 U_STABLE UBool U_EXPORT2 00779 uset_containsRange(const USet* set, UChar32 start, UChar32 end); 00780 00789 U_STABLE UBool U_EXPORT2 00790 uset_containsString(const USet* set, const UChar* str, int32_t strLen); 00791 00802 U_STABLE int32_t U_EXPORT2 00803 uset_indexOf(const USet* set, UChar32 c); 00804 00815 U_STABLE UChar32 U_EXPORT2 00816 uset_charAt(const USet* set, int32_t charIndex); 00817 00826 U_STABLE int32_t U_EXPORT2 00827 uset_size(const USet* set); 00828 00837 U_STABLE int32_t U_EXPORT2 00838 uset_getItemCount(const USet* set); 00839 00858 U_STABLE int32_t U_EXPORT2 00859 uset_getItem(const USet* set, int32_t itemIndex, 00860 UChar32* start, UChar32* end, 00861 UChar* str, int32_t strCapacity, 00862 UErrorCode* ec); 00863 00872 U_STABLE UBool U_EXPORT2 00873 uset_containsAll(const USet* set1, const USet* set2); 00874 00885 U_STABLE UBool U_EXPORT2 00886 uset_containsAllCodePoints(const USet* set, const UChar *str, int32_t strLen); 00887 00896 U_STABLE UBool U_EXPORT2 00897 uset_containsNone(const USet* set1, const USet* set2); 00898 00907 U_STABLE UBool U_EXPORT2 00908 uset_containsSome(const USet* set1, const USet* set2); 00909 00929 U_STABLE int32_t U_EXPORT2 00930 uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); 00931 00950 U_STABLE int32_t U_EXPORT2 00951 uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); 00952 00972 U_STABLE int32_t U_EXPORT2 00973 uset_spanUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); 00974 00993 U_STABLE int32_t U_EXPORT2 00994 uset_spanBackUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); 00995 01004 U_STABLE UBool U_EXPORT2 01005 uset_equals(const USet* set1, const USet* set2); 01006 01007 /********************************************************************* 01008 * Serialized set API 01009 *********************************************************************/ 01010 01060 U_STABLE int32_t U_EXPORT2 01061 uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode* pErrorCode); 01062 01071 U_STABLE UBool U_EXPORT2 01072 uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcLength); 01073 01081 U_STABLE void U_EXPORT2 01082 uset_setSerializedToOne(USerializedSet* fillSet, UChar32 c); 01083 01092 U_STABLE UBool U_EXPORT2 01093 uset_serializedContains(const USerializedSet* set, UChar32 c); 01094 01104 U_STABLE int32_t U_EXPORT2 01105 uset_getSerializedRangeCount(const USerializedSet* set); 01106 01120 U_STABLE UBool U_EXPORT2 01121 uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, 01122 UChar32* pStart, UChar32* pEnd); 01123 01124 #endif