os/textandloc/fontservices/textshaperplugin/IcuSource/common/unicode/uset.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 *******************************************************************************
     3 *
     4 *   Copyright (C) 2002-2005, International Business Machines
     5 *   Corporation and others.  All Rights Reserved.
     6 *
     7 *******************************************************************************
     8 *   file name:  uset.h
     9 *   encoding:   US-ASCII
    10 *   tab size:   8 (not used)
    11 *   indentation:4
    12 *
    13 *   created on: 2002mar07
    14 *   created by: Markus W. Scherer
    15 *
    16 *   C version of UnicodeSet.
    17 */
    18 
    19 
    20 /**
    21  * \file
    22  * \brief C API: Unicode Set
    23  *
    24  * <p>This is a C wrapper around the C++ UnicodeSet class.</p>
    25  */
    26 
    27 #ifndef __USET_H__
    28 #define __USET_H__
    29 
    30 #include "unicode/utypes.h"
    31 #include "unicode/uchar.h"
    32 
    33 #ifndef UCNV_H
    34 struct USet;
    35 /**
    36  * A UnicodeSet.  Use the uset_* API to manipulate.  Create with
    37  * uset_open*, and destroy with uset_close.
    38  * @stable ICU 2.4
    39  */
    40 typedef struct USet USet;
    41 #endif
    42 
    43 /**
    44  * Bitmask values to be passed to uset_openPatternOptions() or
    45  * uset_applyPattern() taking an option parameter.
    46  * @stable ICU 2.4
    47  */
    48 enum {
    49     /**
    50      * Ignore white space within patterns unless quoted or escaped.
    51      * @stable ICU 2.4
    52      */
    53     USET_IGNORE_SPACE = 1,  
    54 
    55     /**
    56      * Enable case insensitive matching.  E.g., "[ab]" with this flag
    57      * will match 'a', 'A', 'b', and 'B'.  "[^ab]" with this flag will
    58      * match all except 'a', 'A', 'b', and 'B'. This performs a full
    59      * closure over case mappings, e.g. U+017F for s.
    60      *
    61      * The resulting set is a superset of the input for the code points but
    62      * not for the strings.
    63      * It performs a case mapping closure of the code points and adds
    64      * full case folding strings for the code points, and reduces strings of
    65      * the original set to their full case folding equivalents.
    66      *
    67      * This is designed for case-insensitive matches, for example
    68      * in regular expressions. The full code point case closure allows checking of
    69      * an input character directly against the closure set.
    70      * Strings are matched by comparing the case-folded form from the closure
    71      * set with an incremental case folding of the string in question.
    72      *
    73      * The closure set will also contain single code points if the original
    74      * set contained case-equivalent strings (like U+00DF for "ss" or "Ss" etc.).
    75      * This is not necessary (that is, redundant) for the above matching method
    76      * but results in the same closure sets regardless of whether the original
    77      * set contained the code point or a string.
    78      *
    79      * @stable ICU 2.4
    80      */
    81     USET_CASE_INSENSITIVE = 2,  
    82 
    83     /**
    84      * Bitmask for UnicodeSet::closeOver() indicating letter case.
    85      * This may be ORed together with other selectors.
    86      * @internal
    87      */
    88     USET_CASE = 2,
    89 
    90     /**
    91      * Enable case insensitive matching.  E.g., "[ab]" with this flag
    92      * will match 'a', 'A', 'b', and 'B'.  "[^ab]" with this flag will
    93      * match all except 'a', 'A', 'b', and 'B'. This adds the lower-,
    94      * title-, and uppercase mappings as well as the case folding
    95      * of each existing element in the set.
    96      * @draft ICU 3.2
    97      */
    98     USET_ADD_CASE_MAPPINGS = 4,
    99 
   100     /**
   101      * Enough for any single-code point set
   102      * @internal
   103      */
   104     USET_SERIALIZED_STATIC_ARRAY_CAPACITY=8
   105 };
   106 
   107 /**
   108  * A serialized form of a Unicode set.  Limited manipulations are
   109  * possible directly on a serialized set.  See below.
   110  * @stable ICU 2.4
   111  */
   112 typedef struct USerializedSet {
   113     /**
   114      * The serialized Unicode Set.
   115      * @stable ICU 2.4
   116      */
   117     const uint16_t *array;
   118     /**
   119      * The length of the array that contains BMP characters.
   120      * @stable ICU 2.4
   121      */
   122     int32_t bmpLength;
   123     /**
   124      * The total length of the array.
   125      * @stable ICU 2.4
   126      */
   127     int32_t length;
   128     /**
   129      * A small buffer for the array to reduce memory allocations.
   130      * @stable ICU 2.4
   131      */
   132     uint16_t staticArray[USET_SERIALIZED_STATIC_ARRAY_CAPACITY];
   133 } USerializedSet;
   134 
   135 /*********************************************************************
   136  * USet API
   137  *********************************************************************/
   138 
   139 /**
   140  * Creates a USet object that contains the range of characters
   141  * start..end, inclusive.
   142  * @param start first character of the range, inclusive
   143  * @param end last character of the range, inclusive
   144  * @return a newly created USet.  The caller must call uset_close() on
   145  * it when done.
   146  * @stable ICU 2.4
   147  */
   148 U_STABLE USet* U_EXPORT2
   149 uset_open(UChar32 start, UChar32 end);
   150 
   151 /**
   152  * Creates a set from the given pattern.  See the UnicodeSet class
   153  * description for the syntax of the pattern language.
   154  * @param pattern a string specifying what characters are in the set
   155  * @param patternLength the length of the pattern, or -1 if null
   156  * terminated
   157  * @param ec the error code
   158  * @stable ICU 2.4
   159  */
   160 U_STABLE USet* U_EXPORT2
   161 uset_openPattern(const UChar* pattern, int32_t patternLength,
   162                  UErrorCode* ec);
   163 
   164 /**
   165  * Creates a set from the given pattern.  See the UnicodeSet class
   166  * description for the syntax of the pattern language.
   167  * @param pattern a string specifying what characters are in the set
   168  * @param patternLength the length of the pattern, or -1 if null
   169  * terminated
   170  * @param options bitmask for options to apply to the pattern.
   171  * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
   172  * @param ec the error code
   173  * @stable ICU 2.4
   174  */
   175 U_STABLE USet* U_EXPORT2
   176 uset_openPatternOptions(const UChar* pattern, int32_t patternLength,
   177                  uint32_t options,
   178                  UErrorCode* ec);
   179 
   180 /**
   181  * Disposes of the storage used by a USet object.  This function should
   182  * be called exactly once for objects returned by uset_open().
   183  * @param set the object to dispose of
   184  * @stable ICU 2.4
   185  */
   186 U_STABLE void U_EXPORT2
   187 uset_close(USet* set);
   188 
   189 /**
   190  * Causes the USet object to represent the range <code>start - end</code>.
   191  * If <code>start > end</code> then this USet is set to an empty range.
   192  * @param set the object to set to the given range
   193  * @param start first character in the set, inclusive
   194  * @param end last character in the set, inclusive
   195  * @draft ICU 3.2
   196  */
   197 U_DRAFT void U_EXPORT2
   198 uset_set(USet* set,
   199          UChar32 start, UChar32 end);
   200 
   201 /**
   202  * Modifies the set to represent the set specified by the given
   203  * pattern. See the UnicodeSet class description for the syntax of 
   204  * the pattern language. See also the User Guide chapter about UnicodeSet.
   205  * <em>Empties the set passed before applying the pattern.</em>
   206  * @param set               The set to which the pattern is to be applied. 
   207  * @param pattern           A pointer to UChar string specifying what characters are in the set.
   208  *                          The character at pattern[0] must be a '['.
   209  * @param patternLength     The length of the UChar string. -1 if NUL terminated.
   210  * @param options           A bitmask for options to apply to the pattern.
   211  *                          Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
   212  * @param status            Returns an error if the pattern cannot be parsed.
   213  * @return                  Upon successful parse, the value is either
   214  *                          the index of the character after the closing ']' 
   215  *                          of the parsed pattern.
   216  *                          If the status code indicates failure, then the return value 
   217  *                          is the index of the error in the source.
   218  *                                  
   219  * @stable ICU 2.8
   220  */
   221 U_STABLE int32_t U_EXPORT2 
   222 uset_applyPattern(USet *set,
   223                   const UChar *pattern, int32_t patternLength,
   224                   uint32_t options,
   225                   UErrorCode *status);
   226 
   227 /**
   228  * Modifies the set to contain those code points which have the given value
   229  * for the given binary or enumerated property, as returned by
   230  * u_getIntPropertyValue.  Prior contents of this set are lost.
   231  *
   232  * @param set the object to contain the code points defined by the property
   233  *
   234  * @param prop a property in the range UCHAR_BIN_START..UCHAR_BIN_LIMIT-1
   235  * or UCHAR_INT_START..UCHAR_INT_LIMIT-1
   236  * or UCHAR_MASK_START..UCHAR_MASK_LIMIT-1.
   237  *
   238  * @param value a value in the range u_getIntPropertyMinValue(prop)..
   239  * u_getIntPropertyMaxValue(prop), with one exception.  If prop is
   240  * UCHAR_GENERAL_CATEGORY_MASK, then value should not be a UCharCategory, but
   241  * rather a mask value produced by U_GET_GC_MASK().  This allows grouped
   242  * categories such as [:L:] to be represented.
   243  *
   244  * @param ec error code input/output parameter
   245  *
   246  * @draft ICU 3.2
   247  */
   248 U_DRAFT void U_EXPORT2
   249 uset_applyIntPropertyValue(USet* set,
   250                            UProperty prop, int32_t value, UErrorCode* ec);
   251 
   252 /**
   253  * Modifies the set to contain those code points which have the
   254  * given value for the given property.  Prior contents of this
   255  * set are lost.
   256  *
   257  * @param set the object to contain the code points defined by the given
   258  * property and value alias
   259  *
   260  * @param prop a string specifying a property alias, either short or long.
   261  * The name is matched loosely.  See PropertyAliases.txt for names and a
   262  * description of loose matching.  If the value string is empty, then this
   263  * string is interpreted as either a General_Category value alias, a Script
   264  * value alias, a binary property alias, or a special ID.  Special IDs are
   265  * matched loosely and correspond to the following sets:
   266  *
   267  * "ANY" = [\\u0000-\\U0010FFFF],
   268  * "ASCII" = [\\u0000-\\u007F],
   269  * "Assigned" = [:^Cn:].
   270  *
   271  * @param propLength the length of the prop, or -1 if NULL
   272  *
   273  * @param value a string specifying a value alias, either short or long.
   274  * The name is matched loosely.  See PropertyValueAliases.txt for names
   275  * and a description of loose matching.  In addition to aliases listed,
   276  * numeric values and canonical combining classes may be expressed
   277  * numerically, e.g., ("nv", "0.5") or ("ccc", "220").  The value string
   278  * may also be empty.
   279  *
   280  * @param valueLength the length of the value, or -1 if NULL
   281  *
   282  * @param ec error code input/output parameter
   283  *
   284  * @draft ICU 3.2
   285  */
   286 U_DRAFT void U_EXPORT2
   287 uset_applyPropertyAlias(USet* set,
   288                         const UChar *prop, int32_t propLength,
   289                         const UChar *value, int32_t valueLength,
   290                         UErrorCode* ec);
   291 
   292 /**
   293  * Return true if the given position, in the given pattern, appears
   294  * to be the start of a UnicodeSet pattern.
   295  *
   296  * @param pattern a string specifying the pattern
   297  * @param patternLength the length of the pattern, or -1 if NULL
   298  * @param pos the given position
   299  * @draft ICU 3.2
   300  */
   301 U_DRAFT UBool U_EXPORT2
   302 uset_resemblesPattern(const UChar *pattern, int32_t patternLength,
   303                       int32_t pos);
   304 
   305 /**
   306  * Returns a string representation of this set.  If the result of
   307  * calling this function is passed to a uset_openPattern(), it
   308  * will produce another set that is equal to this one.
   309  * @param set the set
   310  * @param result the string to receive the rules, may be NULL
   311  * @param resultCapacity the capacity of result, may be 0 if result is NULL
   312  * @param escapeUnprintable if TRUE then convert unprintable
   313  * character to their hex escape representations, \\uxxxx or
   314  * \\Uxxxxxxxx.  Unprintable characters are those other than
   315  * U+000A, U+0020..U+007E.
   316  * @param ec error code.
   317  * @return length of string, possibly larger than resultCapacity
   318  * @stable ICU 2.4
   319  */
   320 U_STABLE int32_t U_EXPORT2
   321 uset_toPattern(const USet* set,
   322                UChar* result, int32_t resultCapacity,
   323                UBool escapeUnprintable,
   324                UErrorCode* ec);
   325 
   326 /**
   327  * Adds the given character to the given USet.  After this call,
   328  * uset_contains(set, c) will return TRUE.
   329  * @param set the object to which to add the character
   330  * @param c the character to add
   331  * @stable ICU 2.4
   332  */
   333 U_STABLE void U_EXPORT2
   334 uset_add(USet* set, UChar32 c);
   335 
   336 /**
   337  * Adds all of the elements in the specified set to this set if
   338  * they're not already present.  This operation effectively
   339  * modifies this set so that its value is the <i>union</i> of the two
   340  * sets.  The behavior of this operation is unspecified if the specified
   341  * collection is modified while the operation is in progress.
   342  *
   343  * @param set the object to which to add the set
   344  * @param additionalSet the source set whose elements are to be added to this set.
   345  * @stable ICU 2.6
   346  */
   347 U_STABLE void U_EXPORT2
   348 uset_addAll(USet* set, const USet *additionalSet);
   349 
   350 /**
   351  * Adds the given range of characters to the given USet.  After this call,
   352  * uset_contains(set, start, end) will return TRUE.
   353  * @param set the object to which to add the character
   354  * @param start the first character of the range to add, inclusive
   355  * @param end the last character of the range to add, inclusive
   356  * @stable ICU 2.2
   357  */
   358 U_STABLE void U_EXPORT2
   359 uset_addRange(USet* set, UChar32 start, UChar32 end);
   360 
   361 /**
   362  * Adds the given string to the given USet.  After this call,
   363  * uset_containsString(set, str, strLen) will return TRUE.
   364  * @param set the object to which to add the character
   365  * @param str the string to add
   366  * @param strLen the length of the string or -1 if null terminated.
   367  * @stable ICU 2.4
   368  */
   369 U_STABLE void U_EXPORT2
   370 uset_addString(USet* set, const UChar* str, int32_t strLen);
   371 
   372 /**
   373  * Adds each of the characters in this string to the set. Thus "ch" => {"c", "h"}
   374  * If this set already any particular character, it has no effect on that character.
   375  * @param set the object to which to add the character
   376  * @param str the source string
   377  * @param strLen the length of the string or -1 if null terminated.
   378  * @draft ICU 3.4
   379  */
   380 U_DRAFT void U_EXPORT2
   381 uset_addAllCodePoints(USet* set, const UChar *str, int32_t strLen);
   382 
   383 /**
   384  * Removes the given character from the given USet.  After this call,
   385  * uset_contains(set, c) will return FALSE.
   386  * @param set the object from which to remove the character
   387  * @param c the character to remove
   388  * @stable ICU 2.4
   389  */
   390 U_STABLE void U_EXPORT2
   391 uset_remove(USet* set, UChar32 c);
   392 
   393 /**
   394  * Removes the given range of characters from the given USet.  After this call,
   395  * uset_contains(set, start, end) will return FALSE.
   396  * @param set the object to which to add the character
   397  * @param start the first character of the range to remove, inclusive
   398  * @param end the last character of the range to remove, inclusive
   399  * @stable ICU 2.2
   400  */
   401 U_STABLE void U_EXPORT2
   402 uset_removeRange(USet* set, UChar32 start, UChar32 end);
   403 
   404 /**
   405  * Removes the given string to the given USet.  After this call,
   406  * uset_containsString(set, str, strLen) will return FALSE.
   407  * @param set the object to which to add the character
   408  * @param str the string to remove
   409  * @param strLen the length of the string or -1 if null terminated.
   410  * @stable ICU 2.4
   411  */
   412 U_STABLE void U_EXPORT2
   413 uset_removeString(USet* set, const UChar* str, int32_t strLen);
   414 
   415 /**
   416  * Removes from this set all of its elements that are contained in the
   417  * specified set.  This operation effectively modifies this
   418  * set so that its value is the <i>asymmetric set difference</i> of
   419  * the two sets.
   420  * @param set the object from which the elements are to be removed
   421  * @param removeSet the object that defines which elements will be
   422  * removed from this set
   423  * @draft ICU 3.2
   424  */
   425 U_DRAFT void U_EXPORT2
   426 uset_removeAll(USet* set, const USet* removeSet);
   427 
   428 /**
   429  * Retain only the elements in this set that are contained in the
   430  * specified range.  If <code>start > end</code> then an empty range is
   431  * retained, leaving the set empty.  This is equivalent to
   432  * a boolean logic AND, or a set INTERSECTION.
   433  *
   434  * @param set the object for which to retain only the specified range
   435  * @param start first character, inclusive, of range to be retained
   436  * to this set.
   437  * @param end last character, inclusive, of range to be retained
   438  * to this set.
   439  * @draft ICU 3.2
   440  */
   441 U_DRAFT void U_EXPORT2
   442 uset_retain(USet* set, UChar32 start, UChar32 end);
   443 
   444 /**
   445  * Retains only the elements in this set that are contained in the
   446  * specified set.  In other words, removes from this set all of
   447  * its elements that are not contained in the specified set.  This
   448  * operation effectively modifies this set so that its value is
   449  * the <i>intersection</i> of the two sets.
   450  *
   451  * @param set the object on which to perform the retain
   452  * @param retain set that defines which elements this set will retain
   453  * @draft ICU 3.2
   454  */
   455 U_DRAFT void U_EXPORT2
   456 uset_retainAll(USet* set, const USet* retain);
   457 
   458 /**
   459  * Reallocate this objects internal structures to take up the least
   460  * possible space, without changing this object's value.
   461  *
   462  * @param set the object on which to perfrom the compact
   463  * @draft ICU 3.2
   464  */
   465 U_DRAFT void U_EXPORT2
   466 uset_compact(USet* set);
   467 
   468 /**
   469  * Inverts this set.  This operation modifies this set so that
   470  * its value is its complement.  This operation does not affect
   471  * the multicharacter strings, if any.
   472  * @param set the set
   473  * @stable ICU 2.4
   474  */
   475 U_STABLE void U_EXPORT2
   476 uset_complement(USet* set);
   477 
   478 /**
   479  * Complements in this set all elements contained in the specified
   480  * set.  Any character in the other set will be removed if it is
   481  * in this set, or will be added if it is not in this set.
   482  *
   483  * @param set the set with which to complement
   484  * @param complement set that defines which elements will be xor'ed
   485  * from this set.
   486  * @draft ICU 3.2
   487  */
   488 U_DRAFT void U_EXPORT2
   489 uset_complementAll(USet* set, const USet* complement);
   490 
   491 /**
   492  * Removes all of the elements from this set.  This set will be
   493  * empty after this call returns.
   494  * @param set the set
   495  * @stable ICU 2.4
   496  */
   497 U_STABLE void U_EXPORT2
   498 uset_clear(USet* set);
   499 
   500 /**
   501  * Returns TRUE if the given USet contains no characters and no
   502  * strings.
   503  * @param set the set
   504  * @return true if set is empty
   505  * @stable ICU 2.4
   506  */
   507 U_STABLE UBool U_EXPORT2
   508 uset_isEmpty(const USet* set);
   509 
   510 /**
   511  * Returns TRUE if the given USet contains the given character.
   512  * @param set the set
   513  * @param c The codepoint to check for within the set
   514  * @return true if set contains c
   515  * @stable ICU 2.4
   516  */
   517 U_STABLE UBool U_EXPORT2
   518 uset_contains(const USet* set, UChar32 c);
   519 
   520 /**
   521  * Returns TRUE if the given USet contains all characters c
   522  * where start <= c && c <= end.
   523  * @param set the set
   524  * @param start the first character of the range to test, inclusive
   525  * @param end the last character of the range to test, inclusive
   526  * @return TRUE if set contains the range
   527  * @stable ICU 2.2
   528  */
   529 U_STABLE UBool U_EXPORT2
   530 uset_containsRange(const USet* set, UChar32 start, UChar32 end);
   531 
   532 /**
   533  * Returns TRUE if the given USet contains the given string.
   534  * @param set the set
   535  * @param str the string
   536  * @param strLen the length of the string or -1 if null terminated.
   537  * @return true if set contains str
   538  * @stable ICU 2.4
   539  */
   540 U_STABLE UBool U_EXPORT2
   541 uset_containsString(const USet* set, const UChar* str, int32_t strLen);
   542 
   543 /**
   544  * Returns the index of the given character within this set, where
   545  * the set is ordered by ascending code point.  If the character
   546  * is not in this set, return -1.  The inverse of this method is
   547  * <code>charAt()</code>.
   548  * @param set the set
   549  * @param c the character to obtain the index for
   550  * @return an index from 0..size()-1, or -1
   551  * @draft ICU 3.2
   552  */
   553 U_DRAFT int32_t U_EXPORT2
   554 uset_indexOf(const USet* set, UChar32 c);
   555 
   556 /**
   557  * Returns the character at the given index within this set, where
   558  * the set is ordered by ascending code point.  If the index is
   559  * out of range, return (UChar32)-1.  The inverse of this method is
   560  * <code>indexOf()</code>.
   561  * @param set the set
   562  * @param index an index from 0..size()-1 to obtain the char for
   563  * @return the character at the given index, or (UChar32)-1.
   564  * @draft ICU 3.2
   565  */
   566 U_DRAFT UChar32 U_EXPORT2
   567 uset_charAt(const USet* set, int32_t index);
   568 
   569 /**
   570  * Returns the number of characters and strings contained in the given
   571  * USet.
   572  * @param set the set
   573  * @return a non-negative integer counting the characters and strings
   574  * contained in set
   575  * @stable ICU 2.4
   576  */
   577 U_STABLE int32_t U_EXPORT2
   578 uset_size(const USet* set);
   579 
   580 /**
   581  * Returns the number of items in this set.  An item is either a range
   582  * of characters or a single multicharacter string.
   583  * @param set the set
   584  * @return a non-negative integer counting the character ranges
   585  * and/or strings contained in set
   586  * @stable ICU 2.4
   587  */
   588 U_STABLE int32_t U_EXPORT2
   589 uset_getItemCount(const USet* set);
   590 
   591 /**
   592  * Returns an item of this set.  An item is either a range of
   593  * characters or a single multicharacter string.
   594  * @param set the set
   595  * @param itemIndex a non-negative integer in the range 0..
   596  * uset_getItemCount(set)-1
   597  * @param start pointer to variable to receive first character
   598  * in range, inclusive
   599  * @param end pointer to variable to receive last character in range,
   600  * inclusive
   601  * @param str buffer to receive the string, may be NULL
   602  * @param strCapacity capacity of str, or 0 if str is NULL
   603  * @param ec error code
   604  * @return the length of the string (>= 2), or 0 if the item is a
   605  * range, in which case it is the range *start..*end, or -1 if
   606  * itemIndex is out of range
   607  * @stable ICU 2.4
   608  */
   609 U_STABLE int32_t U_EXPORT2
   610 uset_getItem(const USet* set, int32_t itemIndex,
   611              UChar32* start, UChar32* end,
   612              UChar* str, int32_t strCapacity,
   613              UErrorCode* ec);
   614 
   615 /**
   616  * Returns true if set1 contains all the characters and strings
   617  * of set2. It answers the question, 'Is set1 a subset of set2?'
   618  * @param set1 set to be checked for containment
   619  * @param set2 set to be checked for containment
   620  * @return true if the test condition is met
   621  * @draft ICU 3.2
   622  */
   623 U_DRAFT UBool U_EXPORT2
   624 uset_containsAll(const USet* set1, const USet* set2);
   625 
   626 /**
   627  * Returns true if this set contains all the characters
   628  * of the given string. This is does not check containment of grapheme
   629  * clusters, like uset_containsString.
   630  * @param set set of characters to be checked for containment
   631  * @param str string containing codepoints to be checked for containment
   632  * @param strLen the length of the string or -1 if null terminated.
   633  * @return true if the test condition is met
   634  * @draft ICU 3.4
   635  */
   636 U_DRAFT UBool U_EXPORT2
   637 uset_containsAllCodePoints(const USet* set, const UChar *str, int32_t strLen);
   638 
   639 /**
   640  * Returns true if set1 contains none of the characters and strings
   641  * of set2. It answers the question, 'Is set1 a disjoint set of set2?'
   642  * @param set1 set to be checked for containment
   643  * @param set2 set to be checked for containment
   644  * @return true if the test condition is met
   645  * @draft ICU 3.2
   646  */
   647 U_DRAFT UBool U_EXPORT2
   648 uset_containsNone(const USet* set1, const USet* set2);
   649 
   650 /**
   651  * Returns true if set1 contains some of the characters and strings
   652  * of set2. It answers the question, 'Does set1 and set2 have an intersection?'
   653  * @param set1 set to be checked for containment
   654  * @param set2 set to be checked for containment
   655  * @return true if the test condition is met
   656  * @draft ICU 3.2
   657  */
   658 U_DRAFT UBool U_EXPORT2
   659 uset_containsSome(const USet* set1, const USet* set2);
   660 
   661 /**
   662  * Returns true if set1 contains all of the characters and strings
   663  * of set2, and vis versa. It answers the question, 'Is set1 equal to set2?'
   664  * @param set1 set to be checked for containment
   665  * @param set2 set to be checked for containment
   666  * @return true if the test condition is met
   667  * @draft ICU 3.2
   668  */
   669 U_DRAFT UBool U_EXPORT2
   670 uset_equals(const USet* set1, const USet* set2);
   671 
   672 /*********************************************************************
   673  * Serialized set API
   674  *********************************************************************/
   675 
   676 /**
   677  * Serializes this set into an array of 16-bit integers.  Serialization
   678  * (currently) only records the characters in the set; multicharacter
   679  * strings are ignored.
   680  *
   681  * The array
   682  * has following format (each line is one 16-bit integer):
   683  *
   684  *  length     = (n+2*m) | (m!=0?0x8000:0)
   685  *  bmpLength  = n; present if m!=0
   686  *  bmp[0]
   687  *  bmp[1]
   688  *  ...
   689  *  bmp[n-1]
   690  *  supp-high[0]
   691  *  supp-low[0]
   692  *  supp-high[1]
   693  *  supp-low[1]
   694  *  ...
   695  *  supp-high[m-1]
   696  *  supp-low[m-1]
   697  *
   698  * The array starts with a header.  After the header are n bmp
   699  * code points, then m supplementary code points.  Either n or m
   700  * or both may be zero.  n+2*m is always <= 0x7FFF.
   701  *
   702  * If there are no supplementary characters (if m==0) then the
   703  * header is one 16-bit integer, 'length', with value n.
   704  *
   705  * If there are supplementary characters (if m!=0) then the header
   706  * is two 16-bit integers.  The first, 'length', has value
   707  * (n+2*m)|0x8000.  The second, 'bmpLength', has value n.
   708  *
   709  * After the header the code points are stored in ascending order.
   710  * Supplementary code points are stored as most significant 16
   711  * bits followed by least significant 16 bits.
   712  *
   713  * @param set the set
   714  * @param dest pointer to buffer of destCapacity 16-bit integers.
   715  * May be NULL only if destCapacity is zero.
   716  * @param destCapacity size of dest, or zero.  Must not be negative.
   717  * @param pErrorCode pointer to the error code.  Will be set to
   718  * U_INDEX_OUTOFBOUNDS_ERROR if n+2*m > 0x7FFF.  Will be set to
   719  * U_BUFFER_OVERFLOW_ERROR if n+2*m+(m!=0?2:1) > destCapacity.
   720  * @return the total length of the serialized format, including
   721  * the header, that is, n+2*m+(m!=0?2:1), or 0 on error other
   722  * than U_BUFFER_OVERFLOW_ERROR.
   723  * @stable ICU 2.4
   724  */
   725 U_STABLE int32_t U_EXPORT2
   726 uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode* pErrorCode);
   727 
   728 /**
   729  * Given a serialized array, fill in the given serialized set object.
   730  * @param fillSet pointer to result
   731  * @param src pointer to start of array
   732  * @param srcLength length of array
   733  * @return true if the given array is valid, otherwise false
   734  * @stable ICU 2.4
   735  */
   736 U_STABLE UBool U_EXPORT2
   737 uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcLength);
   738 
   739 /**
   740  * Set the USerializedSet to contain the given character (and nothing
   741  * else).
   742  * @param fillSet pointer to result
   743  * @param c The codepoint to set
   744  * @stable ICU 2.4
   745  */
   746 U_STABLE void U_EXPORT2
   747 uset_setSerializedToOne(USerializedSet* fillSet, UChar32 c);
   748 
   749 /**
   750  * Returns TRUE if the given USerializedSet contains the given
   751  * character.
   752  * @param set the serialized set
   753  * @param c The codepoint to check for within the set
   754  * @return true if set contains c
   755  * @stable ICU 2.4
   756  */
   757 U_STABLE UBool U_EXPORT2
   758 uset_serializedContains(const USerializedSet* set, UChar32 c);
   759 
   760 /**
   761  * Returns the number of disjoint ranges of characters contained in
   762  * the given serialized set.  Ignores any strings contained in the
   763  * set.
   764  * @param set the serialized set
   765  * @return a non-negative integer counting the character ranges
   766  * contained in set
   767  * @stable ICU 2.4
   768  */
   769 U_STABLE int32_t U_EXPORT2
   770 uset_getSerializedRangeCount(const USerializedSet* set);
   771 
   772 /**
   773  * Returns a range of characters contained in the given serialized
   774  * set.
   775  * @param set the serialized set
   776  * @param rangeIndex a non-negative integer in the range 0..
   777  * uset_getSerializedRangeCount(set)-1
   778  * @param pStart pointer to variable to receive first character
   779  * in range, inclusive
   780  * @param pEnd pointer to variable to receive last character in range,
   781  * inclusive
   782  * @return true if rangeIndex is valid, otherwise false
   783  * @stable ICU 2.4
   784  */
   785 U_STABLE UBool U_EXPORT2
   786 uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex,
   787                         UChar32* pStart, UChar32* pEnd);
   788 
   789 #endif