ICU 63.1  63.1
uniset.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ***************************************************************************
5 * Copyright (C) 1999-2016, International Business Machines Corporation
6 * and others. All Rights Reserved.
7 ***************************************************************************
8 * Date Name Description
9 * 10/20/99 alan Creation.
10 ***************************************************************************
11 */
12 
13 #ifndef UNICODESET_H
14 #define UNICODESET_H
15 
16 #include "unicode/ucpmap.h"
17 #include "unicode/unifilt.h"
18 #include "unicode/unistr.h"
19 #include "unicode/uset.h"
20 
27 
28 // Forward Declarations.
29 class BMPSet;
30 class CharacterProperties;
31 class ParsePosition;
32 class RBBIRuleScanner;
33 class SymbolTable;
34 class UnicodeSetStringSpan;
35 class UVector;
36 class RuleCharacterIterator;
37 
279 
280  int32_t len; // length of list used; 0 <= len <= capacity
281  int32_t capacity; // capacity of list
282  UChar32* list; // MUST be terminated with HIGH
283  BMPSet *bmpSet; // The set is frozen iff either bmpSet or stringSpan is not NULL.
284  UChar32* buffer; // internal buffer, may be NULL
285  int32_t bufferCapacity; // capacity of buffer
286  int32_t patLen;
287 
297  char16_t *pat;
298  UVector* strings; // maintained in sorted order
299  UnicodeSetStringSpan *stringSpan;
300 
301 private:
302  enum { // constants
303  kIsBogus = 1 // This set is bogus (i.e. not valid)
304  };
305  uint8_t fFlags; // Bit flag (see constants above)
306 public:
316  inline UBool isBogus(void) const;
317 
334  void setToBogus();
335 
336 public:
337 
338  enum {
343  MIN_VALUE = 0,
344 
349  MAX_VALUE = 0x10ffff
350  };
351 
352  //----------------------------------------------------------------
353  // Constructors &c
354  //----------------------------------------------------------------
355 
356 public:
357 
363 
373 
374 #ifndef U_HIDE_INTERNAL_API
375 
379  kSerialized /* result of serialize() */
380  };
381 
392  UnicodeSet(const uint16_t buffer[], int32_t bufferLen,
393  ESerialization serialization, UErrorCode &status);
394 #endif /* U_HIDE_INTERNAL_API */
395 
404  UnicodeSet(const UnicodeString& pattern,
405  UErrorCode& status);
406 
407 #ifndef U_HIDE_INTERNAL_API
408 
420  UnicodeSet(const UnicodeString& pattern,
421  uint32_t options,
422  const SymbolTable* symbols,
423  UErrorCode& status);
424 #endif /* U_HIDE_INTERNAL_API */
425 
439  UnicodeSet(const UnicodeString& pattern, ParsePosition& pos,
440  uint32_t options,
441  const SymbolTable* symbols,
442  UErrorCode& status);
443 
449 
454  virtual ~UnicodeSet();
455 
462 
474  virtual UBool operator==(const UnicodeSet& o) const;
475 
481  UBool operator!=(const UnicodeSet& o) const;
482 
492  virtual UnicodeFunctor* clone() const;
493 
501  virtual int32_t hashCode(void) const;
502 
511  inline static UnicodeSet *fromUSet(USet *uset);
512 
521  inline static const UnicodeSet *fromUSet(const USet *uset);
522 
530  inline USet *toUSet();
531 
532 
540  inline const USet * toUSet() const;
541 
542 
543  //----------------------------------------------------------------
544  // Freezable API
545  //----------------------------------------------------------------
546 
555  inline UBool isFrozen() const;
556 
571 
581 
582  //----------------------------------------------------------------
583  // Public API
584  //----------------------------------------------------------------
585 
596 
602  static UBool resemblesPattern(const UnicodeString& pattern,
603  int32_t pos);
604 
618  UErrorCode& status);
619 
620 #ifndef U_HIDE_INTERNAL_API
621 
638  uint32_t options,
639  const SymbolTable* symbols,
640  UErrorCode& status);
641 #endif /* U_HIDE_INTERNAL_API */
642 
675  ParsePosition& pos,
676  uint32_t options,
677  const SymbolTable* symbols,
678  UErrorCode& status);
679 
694  UBool escapeUnprintable = FALSE) const;
695 
719  int32_t value,
720  UErrorCode& ec);
721 
752  const UnicodeString& value,
753  UErrorCode& ec);
754 
763  virtual int32_t size(void) const;
764 
771  virtual UBool isEmpty(void) const;
772 
780  virtual UBool contains(UChar32 c) const;
781 
790  virtual UBool contains(UChar32 start, UChar32 end) const;
791 
799  UBool contains(const UnicodeString& s) const;
800 
808  virtual UBool containsAll(const UnicodeSet& c) const;
809 
817  UBool containsAll(const UnicodeString& s) const;
818 
827  UBool containsNone(UChar32 start, UChar32 end) const;
828 
836  UBool containsNone(const UnicodeSet& c) const;
837 
846 
855  inline UBool containsSome(UChar32 start, UChar32 end) const;
856 
864  inline UBool containsSome(const UnicodeSet& s) const;
865 
873  inline UBool containsSome(const UnicodeString& s) const;
874 
893  int32_t span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const;
894 
907  inline int32_t span(const UnicodeString &s, int32_t start, USetSpanCondition spanCondition) const;
908 
926  int32_t spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const;
927 
941  inline int32_t spanBack(const UnicodeString &s, int32_t limit, USetSpanCondition spanCondition) const;
942 
961  int32_t spanUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const;
962 
980  int32_t spanBackUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const;
981 
986  virtual UMatchDegree matches(const Replaceable& text,
987  int32_t& offset,
988  int32_t limit,
989  UBool incremental);
990 
991 private:
1014  static int32_t matchRest(const Replaceable& text,
1015  int32_t start, int32_t limit,
1016  const UnicodeString& s);
1017 
1027  int32_t findCodePoint(UChar32 c) const;
1028 
1029 public:
1030 
1038  virtual void addMatchSetTo(UnicodeSet& toUnionTo) const;
1039 
1048  int32_t indexOf(UChar32 c) const;
1049 
1059  UChar32 charAt(int32_t index) const;
1060 
1075  virtual UnicodeSet& add(UChar32 start, UChar32 end);
1076 
1085 
1098 
1099  private:
1105  static int32_t getSingleCP(const UnicodeString& s);
1106 
1107  void _add(const UnicodeString& s);
1108 
1109  public:
1119 
1129 
1139 
1149 
1158  static UnicodeSet* U_EXPORT2 createFrom(const UnicodeString& s);
1159 
1160 
1168  static UnicodeSet* U_EXPORT2 createFromAll(const UnicodeString& s);
1169 
1183  virtual UnicodeSet& retain(UChar32 start, UChar32 end);
1184 
1185 
1192 
1206  virtual UnicodeSet& remove(UChar32 start, UChar32 end);
1207 
1216 
1227 
1235  virtual UnicodeSet& complement(void);
1236 
1251  virtual UnicodeSet& complement(UChar32 start, UChar32 end);
1252 
1261 
1273 
1286  virtual UnicodeSet& addAll(const UnicodeSet& c);
1287 
1299  virtual UnicodeSet& retainAll(const UnicodeSet& c);
1300 
1312  virtual UnicodeSet& removeAll(const UnicodeSet& c);
1313 
1325 
1332  virtual UnicodeSet& clear(void);
1333 
1359  UnicodeSet& closeOver(int32_t attribute);
1360 
1368 
1376  virtual int32_t getRangeCount(void) const;
1377 
1385  virtual UChar32 getRangeStart(int32_t index) const;
1386 
1394  virtual UChar32 getRangeEnd(int32_t index) const;
1395 
1444  int32_t serialize(uint16_t *dest, int32_t destCapacity, UErrorCode& ec) const;
1445 
1452  virtual UnicodeSet& compact();
1453 
1465  static UClassID U_EXPORT2 getStaticClassID(void);
1466 
1475  virtual UClassID getDynamicClassID(void) const;
1476 
1477 private:
1478 
1479  // Private API for the USet API
1480 
1481  friend class USetAccess;
1482 
1483  int32_t getStringCount() const;
1484 
1485  const UnicodeString* getString(int32_t index) const;
1486 
1487  //----------------------------------------------------------------
1488  // RuleBasedTransliterator support
1489  //----------------------------------------------------------------
1490 
1491 private:
1492 
1498  virtual UBool matchesIndexValue(uint8_t v) const;
1499 
1500 private:
1501  friend class RBBIRuleScanner;
1502 
1503  //----------------------------------------------------------------
1504  // Implementation: Clone as thawed (see ICU4J Freezable)
1505  //----------------------------------------------------------------
1506 
1507  UnicodeSet(const UnicodeSet& o, UBool /* asThawed */);
1508  UnicodeSet& copyFrom(const UnicodeSet& o, UBool asThawed);
1509 
1510  //----------------------------------------------------------------
1511  // Implementation: Pattern parsing
1512  //----------------------------------------------------------------
1513 
1514  void applyPatternIgnoreSpace(const UnicodeString& pattern,
1515  ParsePosition& pos,
1516  const SymbolTable* symbols,
1517  UErrorCode& status);
1518 
1519  void applyPattern(RuleCharacterIterator& chars,
1520  const SymbolTable* symbols,
1521  UnicodeString& rebuiltPat,
1522  uint32_t options,
1523  UnicodeSet& (UnicodeSet::*caseClosure)(int32_t attribute),
1524  int32_t depth,
1525  UErrorCode& ec);
1526 
1527  //----------------------------------------------------------------
1528  // Implementation: Utility methods
1529  //----------------------------------------------------------------
1530 
1531  void ensureCapacity(int32_t newLen, UErrorCode& ec);
1532 
1533  void ensureBufferCapacity(int32_t newLen, UErrorCode& ec);
1534 
1535  void swapBuffers(void);
1536 
1537  UBool allocateStrings(UErrorCode &status);
1538 
1539  UnicodeString& _toPattern(UnicodeString& result,
1540  UBool escapeUnprintable) const;
1541 
1542  UnicodeString& _generatePattern(UnicodeString& result,
1543  UBool escapeUnprintable) const;
1544 
1545  static void _appendToPat(UnicodeString& buf, const UnicodeString& s, UBool escapeUnprintable);
1546 
1547  static void _appendToPat(UnicodeString& buf, UChar32 c, UBool escapeUnprintable);
1548 
1549  //----------------------------------------------------------------
1550  // Implementation: Fundamental operators
1551  //----------------------------------------------------------------
1552 
1553  void exclusiveOr(const UChar32* other, int32_t otherLen, int8_t polarity);
1554 
1555  void add(const UChar32* other, int32_t otherLen, int8_t polarity);
1556 
1557  void retain(const UChar32* other, int32_t otherLen, int8_t polarity);
1558 
1564  static UBool resemblesPropertyPattern(const UnicodeString& pattern,
1565  int32_t pos);
1566 
1567  static UBool resemblesPropertyPattern(RuleCharacterIterator& chars,
1568  int32_t iterOpts);
1569 
1609  UnicodeSet& applyPropertyPattern(const UnicodeString& pattern,
1610  ParsePosition& ppos,
1611  UErrorCode &ec);
1612 
1613  void applyPropertyPattern(RuleCharacterIterator& chars,
1614  UnicodeString& rebuiltPat,
1615  UErrorCode& ec);
1616 
1617  friend class CharacterProperties;
1618  static const UnicodeSet* getInclusions(int32_t src, UErrorCode &status);
1619 
1624  typedef UBool (*Filter)(UChar32 codePoint, void* context);
1625 
1635  void applyFilter(Filter filter,
1636  void* context,
1637  const UnicodeSet* inclusions,
1638  UErrorCode &status);
1639 
1640 #ifndef U_HIDE_DRAFT_API // Skipped: ucpmap.h is draft only.
1641  void applyIntPropertyValue(const UCPMap *map,
1642  UCPMapValueFilter *filter, const void *context,
1643  UErrorCode &errorCode);
1644 #endif /* U_HIDE_DRAFT_API */
1645 
1649  void setPattern(const UnicodeString& newPat);
1653  void releasePattern();
1654 
1655  friend class UnicodeSetIterator;
1656 };
1657 
1658 
1659 
1660 inline UBool UnicodeSet::operator!=(const UnicodeSet& o) const {
1661  return !operator==(o);
1662 }
1663 
1664 inline UBool UnicodeSet::isFrozen() const {
1665  return (UBool)(bmpSet!=NULL || stringSpan!=NULL);
1666 }
1667 
1668 inline UBool UnicodeSet::containsSome(UChar32 start, UChar32 end) const {
1669  return !containsNone(start, end);
1670 }
1671 
1672 inline UBool UnicodeSet::containsSome(const UnicodeSet& s) const {
1673  return !containsNone(s);
1674 }
1675 
1676 inline UBool UnicodeSet::containsSome(const UnicodeString& s) const {
1677  return !containsNone(s);
1678 }
1679 
1680 inline UBool UnicodeSet::isBogus() const {
1681  return (UBool)(fFlags & kIsBogus);
1682 }
1683 
1684 inline UnicodeSet *UnicodeSet::fromUSet(USet *uset) {
1685  return reinterpret_cast<UnicodeSet *>(uset);
1686 }
1687 
1688 inline const UnicodeSet *UnicodeSet::fromUSet(const USet *uset) {
1689  return reinterpret_cast<const UnicodeSet *>(uset);
1690 }
1691 
1692 inline USet *UnicodeSet::toUSet() {
1693  return reinterpret_cast<USet *>(this);
1694 }
1695 
1696 inline const USet *UnicodeSet::toUSet() const {
1697  return reinterpret_cast<const USet *>(this);
1698 }
1699 
1700 inline int32_t UnicodeSet::span(const UnicodeString &s, int32_t start, USetSpanCondition spanCondition) const {
1701  int32_t sLength=s.length();
1702  if(start<0) {
1703  start=0;
1704  } else if(start>sLength) {
1705  start=sLength;
1706  }
1707  return start+span(s.getBuffer()+start, sLength-start, spanCondition);
1708 }
1709 
1710 inline int32_t UnicodeSet::spanBack(const UnicodeString &s, int32_t limit, USetSpanCondition spanCondition) const {
1711  int32_t sLength=s.length();
1712  if(limit<0) {
1713  limit=0;
1714  } else if(limit>sLength) {
1715  limit=sLength;
1716  }
1717  return spanBack(s.getBuffer(), limit, spanCondition);
1718 }
1719 
1721 
1722 #endif
icu::UnicodeSet::clear
virtual UnicodeSet & clear(void)
Removes all of the elements from this set.
icu::UnicodeSet::contains
UBool contains(const UnicodeString &s) const
Returns true if this set contains the given multicharacter string.
U_FINAL
#define U_FINAL
Defined to the C++11 "final" keyword if available.
Definition: umachine.h:140
icu::UnicodeSet::contains
virtual UBool contains(UChar32 start, UChar32 end) const
Returns true if this set contains every character of the given range.
FALSE
#define FALSE
The FALSE value of a UBool.
Definition: umachine.h:233
icu::UnicodeString::getBuffer
char16_t * getBuffer(int32_t minCapacity)
Get a read/write pointer to the internal buffer.
icu::UnicodeSet::indexOf
int32_t indexOf(UChar32 c) const
Returns the index of the given character within this set, where the set is ordered by ascending code ...
icu::UnicodeSet::add
virtual UnicodeSet & add(UChar32 start, UChar32 end)
Adds the specified range to this set if it is not already present.
icu::UnicodeSet::remove
virtual UnicodeSet & remove(UChar32 start, UChar32 end)
Removes the specified range from this set if it is present.
icu::UnicodeSet::UnicodeSet
UnicodeSet(const uint16_t buffer[], int32_t bufferLen, ESerialization serialization, UErrorCode &status)
Constructs a set from the output of serialize().
icu::UnicodeSet::resemblesPattern
static UBool resemblesPattern(const UnicodeString &pattern, int32_t pos)
Return true if the given position, in the given pattern, appears to be the start of a UnicodeSet patt...
icu::UnicodeSet::UnicodeSet
UnicodeSet(const UnicodeSet &o)
Constructs a set that is identical to the given UnicodeSet.
icu::UnicodeSet::complement
virtual UnicodeSet & complement(void)
Inverts this set.
icu::UnicodeSet::spanBack
int32_t spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const
Returns the start of the trailing substring of the input string which consists only of characters and...
icu::UnicodeSet
A mutable set of Unicode characters and multicharacter strings.
Definition: uniset.h:278
icu::UnicodeSet::getRangeStart
virtual UChar32 getRangeStart(int32_t index) const
Iteration method that returns the first character in the specified range of this set.
icu::UnicodeSet::applyPattern
UnicodeSet & applyPattern(const UnicodeString &pattern, uint32_t options, const SymbolTable *symbols, UErrorCode &status)
Modifies this set to represent the set specified by the given pattern, optionally ignoring Unicode Pa...
icu::UnicodeSet::span
int32_t span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const
Returns the length of the initial substring of the input string which consists only of characters and...
icu::UnicodeSet::remove
UnicodeSet & remove(UChar32 c)
Removes the specified character from this set if it is present.
icu::UnicodeSet::ESerialization
ESerialization
Definition: uniset.h:378
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:225
icu::UnicodeSet::getDynamicClassID
virtual UClassID getDynamicClassID(void) const
Implement UnicodeFunctor API.
icu::UnicodeSet::spanBackUTF8
int32_t spanBackUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const
Returns the start of the trailing substring of the input string which consists only of characters and...
icu::Replaceable
Replaceable is an abstract base class representing a string of characters that supports the replaceme...
Definition: rep.h:73
icu::UnicodeSet::compact
virtual UnicodeSet & compact()
Reallocate this objects internal structures to take up the least possible space, without changing thi...
icu::UnicodeSet::isEmpty
virtual UBool isEmpty(void) const
Returns true if this set contains no elements.
icu::UnicodeSet::operator==
virtual UBool operator==(const UnicodeSet &o) const
Compares the specified object with this set for equality.
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
icu::UnicodeSet::add
UnicodeSet & add(const UnicodeString &s)
Adds the specified multicharacter to this set if it is not already present.
icu::UnicodeSet::getStaticClassID
static UClassID getStaticClassID(void)
Return the class ID for this class.
icu::UnicodeSet::complement
UnicodeSet & complement(const UnicodeString &s)
Complement the specified string in this set.
icu::UnicodeSet::toPattern
virtual UnicodeString & toPattern(UnicodeString &result, UBool escapeUnprintable=FALSE) const
Returns a string representation of this set.
icu::UnicodeMatcher::matchesIndexValue
virtual UBool matchesIndexValue(uint8_t v) const =0
Returns TRUE if this matcher will match a character c, where c & 0xFF == v, at offset,...
U_COMMON_API
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.
Definition: utypes.h:300
UProperty
UProperty
Selection constants for Unicode properties.
Definition: uchar.h:195
icu::UnicodeSet::charAt
UChar32 charAt(int32_t index) const
Returns the character at the given index within this set, where the set is ordered by ascending code ...
icu::SymbolTable
An interface that defines both lookup protocol and parsing of symbolic names.
Definition: symtable.h:56
icu::UnicodeSet::addAll
virtual UnicodeSet & addAll(const UnicodeSet &c)
Adds all of the elements in the specified set to this set if they're not already present.
icu::UnicodeSet::containsNone
UBool containsNone(UChar32 start, UChar32 end) const
Returns true if this set contains none of the characters of the given range.
USetSpanCondition
USetSpanCondition
Argument values for whether span() and similar functions continue while the current character is cont...
Definition: uset.h:156
icu::UnicodeSet::closeOver
UnicodeSet & closeOver(int32_t attribute)
Close this set over the given attribute.
icu::UnicodeSet::removeAll
UnicodeSet & removeAll(const UnicodeString &s)
Remove EACH of the characters in this string.
icu::UnicodeSet::complementAll
UnicodeSet & complementAll(const UnicodeString &s)
Complement EACH of the characters in this string.
icu::UnicodeString::length
int32_t length(void) const
Return the length of the UnicodeString object.
Definition: unistr.h:3909
icu::UnicodeSet::serialize
int32_t serialize(uint16_t *dest, int32_t destCapacity, UErrorCode &ec) const
Serializes this set into an array of 16-bit integers.
NULL
#define NULL
Define NULL if necessary, to nullptr for C++ and to ((void *)0) for C.
Definition: utypes.h:188
icu::UnicodeSetIterator
UnicodeSetIterator iterates over the contents of a UnicodeSet.
Definition: usetiter.h:63
icu::UnicodeSet::retain
UnicodeSet & retain(UChar32 c)
Retain the specified character from this set if it is present.
unifilt.h
C++ API: Unicode Filter.
icu::UnicodeSet::complement
UnicodeSet & complement(UChar32 c)
Complements the specified character in this set.
icu::UnicodeSet::addMatchSetTo
virtual void addMatchSetTo(UnicodeSet &toUnionTo) const
Implementation of UnicodeMatcher API.
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:290
icu::UnicodeSet::applyPropertyAlias
UnicodeSet & applyPropertyAlias(const UnicodeString &prop, const UnicodeString &value, UErrorCode &ec)
Modifies this set to contain those code points which have the given value for the given property.
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:389
icu::UnicodeFunctor
UnicodeFunctor is an abstract base class for objects that perform match and/or replace operations on ...
Definition: unifunct.h:35
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:90
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition: utypes.h:401
icu::UnicodeSet::remove
UnicodeSet & remove(const UnicodeString &s)
Removes the specified string from this set if it is present.
icu::UnicodeSet::contains
virtual UBool contains(UChar32 c) const
Returns true if this set contains the given character.
icu::UnicodeSet::spanUTF8
int32_t spanUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const
Returns the length of the initial substring of the input string which consists only of characters and...
icu::UnicodeSet::containsAll
UBool containsAll(const UnicodeString &s) const
Returns true if this set contains all the characters of the given string.
icu::UnicodeSet::removeAll
virtual UnicodeSet & removeAll(const UnicodeSet &c)
Removes from this set all of its elements that are contained in the specified set.
UCPMapValueFilter
uint32_t UCPMapValueFilter(const void *context, uint32_t value)
Callback function type: Modifies a map value.
Definition: ucpmap.h:116
icu::UnicodeSet::retainAll
virtual UnicodeSet & retainAll(const UnicodeSet &c)
Retains only the elements in this set that are contained in the specified set.
icu::UnicodeSet::containsNone
UBool containsNone(const UnicodeString &s) const
Returns true if this set contains none of the characters of the given string.
icu::UnicodeSet::matches
virtual UMatchDegree matches(const Replaceable &text, int32_t &offset, int32_t limit, UBool incremental)
Implement UnicodeMatcher::matches()
icu::operator!=
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
Definition: stringpiece.h:218
UCPMap
struct UCPMap UCPMap
Abstract map from Unicode code points (U+0000..U+10FFFF) to integer values.
Definition: ucpmap.h:33
icu::UnicodeSet::applyPattern
UnicodeSet & applyPattern(const UnicodeString &pattern, UErrorCode &status)
Modifies this set to represent the set specified by the given pattern, ignoring Unicode Pattern_White...
icu::UMatchDegree
UMatchDegree
Constants returned by UnicodeMatcher::matches() indicating the degree of match.
Definition: unimatch.h:32
icu::UnicodeSet::complement
virtual UnicodeSet & complement(UChar32 start, UChar32 end)
Complements the specified range in this set.
icu::UnicodeSet::containsAll
virtual UBool containsAll(const UnicodeSet &c) const
Returns true if this set contains all the characters and strings of the given set.
icu::UnicodeSet::UnicodeSet
UnicodeSet(const UnicodeString &pattern, uint32_t options, const SymbolTable *symbols, UErrorCode &status)
Constructs a set from the given pattern.
icu::UnicodeSet::setToBogus
void setToBogus()
Make this UnicodeSet object invalid.
icu::UnicodeSet::removeAllStrings
virtual UnicodeSet & removeAllStrings()
Remove all strings from this set.
icu::UnicodeSet::addAll
UnicodeSet & addAll(const UnicodeString &s)
Adds each of the characters in this string to the set.
icu::UnicodeSet::add
UnicodeSet & add(UChar32 c)
Adds the specified character to this set if it is not already present.
icu::UnicodeSet::applyIntPropertyValue
UnicodeSet & applyIntPropertyValue(UProperty prop, int32_t value, UErrorCode &ec)
Modifies this set to contain those code points which have the given value for the given binary or enu...
ucpmap.h
This file defines an abstract map from Unicode code points to integer values.
icu::UnicodeSet::UnicodeSet
UnicodeSet()
Constructs an empty set.
uset.h
C API: Unicode Set.
icu::UnicodeSet::containsNone
UBool containsNone(const UnicodeSet &c) const
Returns true if this set contains none of the characters and strings of the given set.
icu::UnicodeSet::freeze
UnicodeFunctor * freeze()
Freeze the set (make it immutable).
icu::UnicodeSet::getRangeEnd
virtual UChar32 getRangeEnd(int32_t index) const
Iteration method that returns the last character in the specified range of this set.
icu::UnicodeSet::createFrom
static UnicodeSet * createFrom(const UnicodeString &s)
Makes a set from a multicharacter string.
icu::UnicodeSet::cloneAsThawed
UnicodeFunctor * cloneAsThawed() const
Clone the set and make the clone mutable.
icu::UnicodeSet::UnicodeSet
UnicodeSet(UChar32 start, UChar32 end)
Constructs a set containing the given range.
icu::UnicodeSet::~UnicodeSet
virtual ~UnicodeSet()
Destructs the set.
icu::UnicodeSet::size
virtual int32_t size(void) const
Returns the number of elements in this set (its cardinality).
icu::UnicodeSet::operator=
UnicodeSet & operator=(const UnicodeSet &o)
Assigns this object to be a copy of another.
icu::UnicodeSet::UnicodeSet
UnicodeSet(const UnicodeString &pattern, ParsePosition &pos, uint32_t options, const SymbolTable *symbols, UErrorCode &status)
Constructs a set from the given pattern.
icu::UnicodeSet::set
UnicodeSet & set(UChar32 start, UChar32 end)
Make this object represent the range start - end.
icu::UnicodeSet::hashCode
virtual int32_t hashCode(void) const
Returns the hash code value for this set.
icu::UnicodeSet::applyPattern
UnicodeSet & applyPattern(const UnicodeString &pattern, ParsePosition &pos, uint32_t options, const SymbolTable *symbols, UErrorCode &status)
Parses the given pattern, starting at the given position.
icu::UnicodeSet::createFromAll
static UnicodeSet * createFromAll(const UnicodeString &s)
Makes a set from each of the characters in the string.
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:138
icu::UnicodeFilter
UnicodeFilter defines a protocol for selecting a subset of the full range (U+0000 to U+10FFFF) of Uni...
Definition: unifilt.h:61
icu::ParsePosition
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:49
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:137
icu::UnicodeSet::clone
virtual UnicodeFunctor * clone() const
Returns a copy of this object.
icu::UnicodeSet::UnicodeSet
UnicodeSet(const UnicodeString &pattern, UErrorCode &status)
Constructs a set from the given pattern.
icu::UnicodeSet::retain
virtual UnicodeSet & retain(UChar32 start, UChar32 end)
Retain only the elements in this set that are contained in the specified range.
USet
struct USet USet
USet is the C API type corresponding to C++ class UnicodeSet.
Definition: uset.h:47
icu::UnicodeSet::retainAll
UnicodeSet & retainAll(const UnicodeString &s)
Retains EACH of the characters in this string.
icu::UnicodeSet::getRangeCount
virtual int32_t getRangeCount(void) const
Iteration method that returns the number of ranges contained in this set.
unistr.h
C++ API: Unicode String.
icu::UnicodeSet::complementAll
virtual UnicodeSet & complementAll(const UnicodeSet &c)
Complements in this set all elements contained in the specified set.