ICU 78.2 78.2

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/utypes.h"
17
18 #if U_SHOW_CPLUSPLUS_API
19
20 #include "unicode/ucpmap.h"
21 #include "unicode/unifilt.h"
22 #include "unicode/unistr.h"
23 #include "unicode/uset.h"
24
30 U_NAMESPACE_BEGIN
31
32 // Forward Declarations.
33 class BMPSet;
34 class ParsePosition;
35 class RBBIRuleScanner;
36 class SymbolTable;
37 class UnicodeSetStringSpan;
38 class UVector;
39 class RuleCharacterIterator;
40
285 class U_COMMON_API UnicodeSet final : public UnicodeFilter {
286 private:
291 static constexpr int32_t INITIAL_CAPACITY = 25;
292 // fFlags constant
293 static constexpr uint8_t kIsBogus = 1; // This set is bogus (i.e. not valid)
294
295 UChar32* list = stackList; // MUST be terminated with HIGH
296 int32_t capacity = INITIAL_CAPACITY; // capacity of list
297 int32_t len = 1; // length of list used; 1 <= len <= capacity
298 uint8_t fFlags = 0; // Bit flag (see constants above)
299
300 BMPSet *bmpSet = nullptr; // The set is frozen iff either bmpSet or stringSpan is not nullptr.
301 UChar32* buffer = nullptr; // internal buffer, may be nullptr
302 int32_t bufferCapacity = 0; // capacity of buffer
303
313 char16_t *pat = nullptr;
314 int32_t patLen = 0;
315
316 UVector* strings_ = nullptr; // maintained in sorted order
317 UnicodeSetStringSpan *stringSpan = nullptr;
318
324 UChar32 stackList[INITIAL_CAPACITY];
325
326 public:
336 inline UBool isBogus() const;
337
354 void setToBogus();
355
356 public:
357
358 enum {
363 MIN_VALUE = 0,
364
369 MAX_VALUE = 0x10ffff
370 };
371
372 //----------------------------------------------------------------
373 // Constructors &c
374 //----------------------------------------------------------------
375
376 public:
377
382 UnicodeSet();
383
392 UnicodeSet(UChar32 start, UChar32 end);
393
394 #ifndef U_HIDE_INTERNAL_API
398 enum ESerialization {
399 kSerialized /* result of serialize() */
400 };
401
412 UnicodeSet(const uint16_t buffer[], int32_t bufferLen,
413 ESerialization serialization, UErrorCode &status);
414 #endif /* U_HIDE_INTERNAL_API */
415
424 UnicodeSet(const UnicodeString& pattern,
425 UErrorCode& status);
426
427 #ifndef U_HIDE_INTERNAL_API
442 UnicodeSet(const UnicodeString& pattern,
443 uint32_t options,
444 const SymbolTable* symbols,
445 UErrorCode& status);
446 #endif /* U_HIDE_INTERNAL_API */
447
463 UnicodeSet(const UnicodeString& pattern, ParsePosition& pos,
464 uint32_t options,
465 const SymbolTable* symbols,
466 UErrorCode& status);
467
472 UnicodeSet(const UnicodeSet& o);
473
478 virtual ~UnicodeSet();
479
485 UnicodeSet& operator=(const UnicodeSet& o);
486
498 bool operator==(const UnicodeSet& o) const;
499
505 inline bool operator!=(const UnicodeSet& o) const;
506
516 virtual UnicodeSet* clone() const override;
517
525 int32_t hashCode() const;
526
535 inline static UnicodeSet *fromUSet(USet *uset);
536
545 inline static const UnicodeSet *fromUSet(const USet *uset);
546
554 inline USet *toUSet();
555
556
564 inline const USet * toUSet() const;
565
566
567 //----------------------------------------------------------------
568 // Freezable API
569 //----------------------------------------------------------------
570
579 inline UBool isFrozen() const;
580
594 UnicodeSet *freeze();
595
604 UnicodeSet *cloneAsThawed() const;
605
606 //----------------------------------------------------------------
607 // Public API
608 //----------------------------------------------------------------
609
619 UnicodeSet& set(UChar32 start, UChar32 end);
620
626 static UBool resemblesPattern(const UnicodeString& pattern,
627 int32_t pos);
628
641 UnicodeSet& applyPattern(const UnicodeString& pattern,
642 UErrorCode& status);
643
644 #ifndef U_HIDE_INTERNAL_API
663 UnicodeSet& applyPattern(const UnicodeString& pattern,
664 uint32_t options,
665 const SymbolTable* symbols,
666 UErrorCode& status);
667 #endif /* U_HIDE_INTERNAL_API */
668
702 UnicodeSet& applyPattern(const UnicodeString& pattern,
703 ParsePosition& pos,
704 uint32_t options,
705 const SymbolTable* symbols,
706 UErrorCode& status);
707
721 virtual UnicodeString& toPattern(UnicodeString& result,
722 UBool escapeUnprintable = false) const override;
723
746 UnicodeSet& applyIntPropertyValue(UProperty prop,
747 int32_t value,
748 UErrorCode& ec);
749
779 UnicodeSet& applyPropertyAlias(const UnicodeString& prop,
780 const UnicodeString& value,
781 UErrorCode& ec);
782
795 int32_t size() const;
796
803 UBool isEmpty() const;
804
809 UBool hasStrings() const;
810
818 virtual UBool contains(UChar32 c) const override;
819
828 UBool contains(UChar32 start, UChar32 end) const;
829
837 UBool contains(const UnicodeString& s) const;
838
846 UBool containsAll(const UnicodeSet& c) const;
847
855 UBool containsAll(const UnicodeString& s) const;
856
865 UBool containsNone(UChar32 start, UChar32 end) const;
866
874 UBool containsNone(const UnicodeSet& c) const;
875
883 UBool containsNone(const UnicodeString& s) const;
884
893 inline UBool containsSome(UChar32 start, UChar32 end) const;
894
902 inline UBool containsSome(const UnicodeSet& s) const;
903
911 inline UBool containsSome(const UnicodeString& s) const;
912
931 int32_t span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const;
932
945 inline int32_t span(const UnicodeString &s, int32_t start, USetSpanCondition spanCondition) const;
946
964 int32_t spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const;
965
979 inline int32_t spanBack(const UnicodeString &s, int32_t limit, USetSpanCondition spanCondition) const;
980
999 int32_t spanUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const;
1000
1018 int32_t spanBackUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const;
1019
1024 UMatchDegree matches(const Replaceable& text,
1025 int32_t& offset,
1026 int32_t limit,
1027 UBool incremental) override;
1028
1029 private:
1052 static int32_t matchRest(const Replaceable& text,
1053 int32_t start, int32_t limit,
1054 const UnicodeString& s);
1055
1065 int32_t findCodePoint(UChar32 c) const;
1066
1067 public:
1068
1076 virtual void addMatchSetTo(UnicodeSet& toUnionTo) const override;
1077
1086 int32_t indexOf(UChar32 c) const;
1087
1103 UChar32 charAt(int32_t index) const;
1104
1122 inline U_HEADER_NESTED_NAMESPACE::USetCodePoints codePoints() const {
1123 return U_HEADER_NESTED_NAMESPACE::USetCodePoints(toUSet());
1124 }
1125
1148 inline U_HEADER_NESTED_NAMESPACE::USetRanges ranges() const {
1149 return U_HEADER_NESTED_NAMESPACE::USetRanges(toUSet());
1150 }
1151
1172 inline U_HEADER_NESTED_NAMESPACE::USetStrings strings() const {
1173 return U_HEADER_NESTED_NAMESPACE::USetStrings(toUSet());
1174 }
1175
1176 #ifndef U_HIDE_DRAFT_API
1201 inline U_HEADER_NESTED_NAMESPACE::USetElementIterator begin() const {
1202 return U_HEADER_NESTED_NAMESPACE::USetElements(toUSet()).begin();
1203 }
1204
1213 inline U_HEADER_NESTED_NAMESPACE::USetElementIterator end() const {
1214 return U_HEADER_NESTED_NAMESPACE::USetElements(toUSet()).end();
1215 }
1216 #endif // U_HIDE_DRAFT_API
1217
1232 UnicodeSet& add(UChar32 start, UChar32 end);
1233
1244 UnicodeSet& add(UChar32 c);
1245
1257 UnicodeSet& add(const UnicodeString& s);
1258
1259 private:
1265 static int32_t getSingleCP(const UnicodeString& s);
1266
1267 void _add(const UnicodeString& s);
1268
1269 public:
1278 UnicodeSet& addAll(const UnicodeString& s);
1279
1287 UnicodeSet& retainAll(const UnicodeString& s);
1288
1296 UnicodeSet& complementAll(const UnicodeString& s);
1297
1305 UnicodeSet& removeAll(const UnicodeString& s);
1306
1315 static UnicodeSet* U_EXPORT2 createFrom(const UnicodeString& s);
1316
1317
1325 static UnicodeSet* U_EXPORT2 createFromAll(const UnicodeString& s);
1326
1338 UnicodeSet& retain(UChar32 start, UChar32 end);
1339
1340
1349 UnicodeSet& retain(UChar32 c);
1350
1361 UnicodeSet& retain(const UnicodeString &s);
1362
1376 UnicodeSet& remove(UChar32 start, UChar32 end);
1377
1388 UnicodeSet& remove(UChar32 c);
1389
1399 UnicodeSet& remove(const UnicodeString& s);
1400
1413 UnicodeSet& complement();
1414
1427 UnicodeSet& complement(UChar32 start, UChar32 end);
1428
1439 UnicodeSet& complement(UChar32 c);
1440
1450 UnicodeSet& complement(const UnicodeString& s);
1451
1464 UnicodeSet& addAll(const UnicodeSet& c);
1465
1477 UnicodeSet& retainAll(const UnicodeSet& c);
1478
1490 UnicodeSet& removeAll(const UnicodeSet& c);
1491
1502 UnicodeSet& complementAll(const UnicodeSet& c);
1503
1510 UnicodeSet& clear();
1511
1539 UnicodeSet& closeOver(int32_t attribute);
1540
1547 UnicodeSet &removeAllStrings();
1548
1556 int32_t getRangeCount() const;
1557
1565 UChar32 getRangeStart(int32_t index) const;
1566
1574 UChar32 getRangeEnd(int32_t index) const;
1575
1624 int32_t serialize(uint16_t *dest, int32_t destCapacity, UErrorCode& ec) const;
1625
1632 UnicodeSet& compact();
1633
1645 static UClassID U_EXPORT2 getStaticClassID();
1646
1655 virtual UClassID getDynamicClassID() const override;
1656
1657 private:
1658
1659 // Private API for the USet API
1660
1661 friend class USetAccess;
1662
1663 const UnicodeString* getString(int32_t index) const;
1664
1665 //----------------------------------------------------------------
1666 // RuleBasedTransliterator support
1667 //----------------------------------------------------------------
1668
1669 private:
1670
1676 virtual UBool matchesIndexValue(uint8_t v) const override;
1677
1678 private:
1679 friend class RBBIRuleScanner;
1680
1681 //----------------------------------------------------------------
1682 // Implementation: Clone as thawed (see ICU4J Freezable)
1683 //----------------------------------------------------------------
1684
1685 UnicodeSet(const UnicodeSet& o, UBool /* asThawed */);
1686 UnicodeSet& copyFrom(const UnicodeSet& o, UBool asThawed);
1687
1688 //----------------------------------------------------------------
1689 // Implementation: Pattern parsing
1690 //----------------------------------------------------------------
1691
1692 void applyPatternIgnoreSpace(const UnicodeString& pattern,
1693 ParsePosition& pos,
1694 const SymbolTable* symbols,
1695 UErrorCode& status);
1696
1697 void applyPattern(RuleCharacterIterator& chars,
1698 const SymbolTable* symbols,
1699 UnicodeString& rebuiltPat,
1700 uint32_t options,
1701 UnicodeSet& (UnicodeSet::*caseClosure)(int32_t attribute),
1702 int32_t depth,
1703 UErrorCode& ec);
1704
1705 void closeOverCaseInsensitive(bool simple);
1706 void closeOverAddCaseMappings();
1707
1708 //----------------------------------------------------------------
1709 // Implementation: Utility methods
1710 //----------------------------------------------------------------
1711
1712 static int32_t nextCapacity(int32_t minCapacity);
1713
1714 bool ensureCapacity(int32_t newLen);
1715
1716 bool ensureBufferCapacity(int32_t newLen);
1717
1718 void swapBuffers();
1719
1720 UBool allocateStrings(UErrorCode &status);
1721 int32_t stringsSize() const;
1722 UBool stringsContains(const UnicodeString &s) const;
1723
1724 UnicodeString& _toPattern(UnicodeString& result,
1725 UBool escapeUnprintable) const;
1726
1727 UnicodeString& _generatePattern(UnicodeString& result,
1728 UBool escapeUnprintable) const;
1729
1730 static void _appendToPat(UnicodeString& buf, const UnicodeString& s, UBool escapeUnprintable);
1731
1732 static void _appendToPat(UnicodeString& buf, UChar32 c, UBool escapeUnprintable);
1733
1734 static void _appendToPat(UnicodeString &result, UChar32 start, UChar32 end,
1735 UBool escapeUnprintable);
1736
1737 //----------------------------------------------------------------
1738 // Implementation: Fundamental operators
1739 //----------------------------------------------------------------
1740
1741 void exclusiveOr(const UChar32* other, int32_t otherLen, int8_t polarity);
1742
1743 void add(const UChar32* other, int32_t otherLen, int8_t polarity);
1744
1745 void retain(const UChar32* other, int32_t otherLen, int8_t polarity);
1746
1752 static UBool resemblesPropertyPattern(const UnicodeString& pattern,
1753 int32_t pos);
1754
1755 static UBool resemblesPropertyPattern(RuleCharacterIterator& chars,
1756 int32_t iterOpts);
1757
1797 UnicodeSet& applyPropertyPattern(const UnicodeString& pattern,
1798 ParsePosition& ppos,
1799 UErrorCode &ec);
1800
1801 void applyPropertyPattern(RuleCharacterIterator& chars,
1802 UnicodeString& rebuiltPat,
1803 UErrorCode& ec);
1804
1809 typedef UBool (*Filter)(UChar32 codePoint, void* context);
1810
1820 void applyFilter(Filter filter,
1821 void* context,
1822 const UnicodeSet* inclusions,
1823 UErrorCode &status);
1824
1828 void setPattern(const UnicodeString& newPat) {
1829 setPattern(newPat.getBuffer(), newPat.length());
1830 }
1831 void setPattern(const char16_t *newPat, int32_t newPatLen);
1835 void releasePattern();
1836
1837 friend class UnicodeSetIterator;
1838 };
1839
1840
1841
1842 inline bool UnicodeSet::operator!=(const UnicodeSet& o) const {
1843 return !operator==(o);
1844 }
1845
1846 inline UBool UnicodeSet::isFrozen() const {
1847 return bmpSet != nullptr || stringSpan != nullptr;
1848 }
1849
1850 inline UBool UnicodeSet::containsSome(UChar32 start, UChar32 end) const {
1851 return !containsNone(start, end);
1852 }
1853
1854 inline UBool UnicodeSet::containsSome(const UnicodeSet& s) const {
1855 return !containsNone(s);
1856 }
1857
1858 inline UBool UnicodeSet::containsSome(const UnicodeString& s) const {
1859 return !containsNone(s);
1860 }
1861
1862 inline UBool UnicodeSet::isBogus() const {
1863 return fFlags & kIsBogus;
1864 }
1865
1866 inline UnicodeSet *UnicodeSet::fromUSet(USet *uset) {
1867 return reinterpret_cast<UnicodeSet *>(uset);
1868 }
1869
1870 inline const UnicodeSet *UnicodeSet::fromUSet(const USet *uset) {
1871 return reinterpret_cast<const UnicodeSet *>(uset);
1872 }
1873
1874 inline USet *UnicodeSet::toUSet() {
1875 return reinterpret_cast<USet *>(this);
1876 }
1877
1878 inline const USet *UnicodeSet::toUSet() const {
1879 return reinterpret_cast<const USet *>(this);
1880 }
1881
1882 inline int32_t UnicodeSet::span(const UnicodeString &s, int32_t start, USetSpanCondition spanCondition) const {
1883 int32_t sLength=s.length();
1884 if(start<0) {
1885 start=0;
1886 } else if(start>sLength) {
1887 start=sLength;
1888 }
1889 return start+span(s.getBuffer()+start, sLength-start, spanCondition);
1890 }
1891
1892 inline int32_t UnicodeSet::spanBack(const UnicodeString &s, int32_t limit, USetSpanCondition spanCondition) const {
1893 int32_t sLength=s.length();
1894 if(limit<0) {
1895 limit=0;
1896 } else if(limit>sLength) {
1897 limit=sLength;
1898 }
1899 return spanBack(s.getBuffer(), limit, spanCondition);
1900 }
1901
1902 U_NAMESPACE_END
1903
1904 #endif /* U_SHOW_CPLUSPLUS_API */
1905
1906 #endif
INITIAL_CAPACITY
#define INITIAL_CAPACITY
The initial size of an array if it is unspecified.
Definition: RunArrays.h:32
icu::ParsePosition
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:52
icu::Replaceable
Replaceable is an abstract base class representing a string of characters that supports the replaceme...
Definition: rep.h:77
icu::SymbolTable
An interface that defines both lookup protocol and parsing of symbolic names.
Definition: symtable.h:59
icu::UnicodeFilter
UnicodeFilter defines a protocol for selecting a subset of the full range (U+0000 to U+10FFFF) of Uni...
Definition: unifilt.h:65
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,...
icu::UnicodeSetIterator
UnicodeSetIterator iterates over the contents of a UnicodeSet.
Definition: usetiter.h:67
icu::UnicodeSet
A mutable set of Unicode characters and multicharacter strings.
Definition: uniset.h:285
icu::UnicodeSet::ESerialization
ESerialization
Definition: uniset.h:398
icu::UnicodeSet::strings
U_HEADER_NESTED_NAMESPACE::USetStrings strings() const
Returns a C++ "range" for iterating over the empty and multi-character strings of this set.
Definition: uniset.h:1172
icu::UnicodeSet::removeAll
UnicodeSet & removeAll(const UnicodeSet &c)
Removes from this set all of its elements that are contained in the specified set.
icu::UnicodeSet::cloneAsThawed
UnicodeSet * cloneAsThawed() const
Clone the set and make the clone mutable.
icu::UnicodeSet::UnicodeSet
UnicodeSet()
Constructs an empty set.
icu::UnicodeSet::complementAll
UnicodeSet & complementAll(const UnicodeSet &c)
Complements in this set all elements contained in the specified set.
icu::UnicodeSet::clear
UnicodeSet & clear()
Removes all of the elements from this set.
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::UnicodeSet::getRangeEnd
UChar32 getRangeEnd(int32_t index) const
Iteration method that returns the last character in the specified range of this set.
icu::UnicodeSet::remove
UnicodeSet & remove(UChar32 c)
Removes the specified character from this set if it is present.
icu::UnicodeSet::size
int32_t size() const
Returns the number of elements in this set (its cardinality).
icu::UnicodeSet::UnicodeSet
UnicodeSet(UChar32 start, UChar32 end)
Constructs a set containing the given range.
icu::UnicodeSet::complementAll
UnicodeSet & complementAll(const UnicodeString &s)
Complement EACH of the characters in this string.
icu::UnicodeSet::retain
UnicodeSet & retain(UChar32 start, UChar32 end)
Retain only the elements in this set that are contained in the specified range.
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::setToBogus
void setToBogus()
Make this UnicodeSet object invalid.
icu::UnicodeSet::retain
UnicodeSet & retain(UChar32 c)
Retain the specified character from this set if it is present.
icu::UnicodeSet::getDynamicClassID
virtual UClassID getDynamicClassID() const override
Implement UnicodeFunctor API.
icu::UnicodeSet::hashCode
int32_t hashCode() const
Returns the hash code value for this set.
icu::UnicodeSet::addMatchSetTo
virtual void addMatchSetTo(UnicodeSet &toUnionTo) const override
Implementation of UnicodeMatcher API.
icu::UnicodeSet::retainAll
UnicodeSet & retainAll(const UnicodeString &s)
Retains EACH of the characters in this string.
icu::UnicodeSet::compact
UnicodeSet & compact()
Reallocate this objects internal structures to take up the least possible space, without changing thi...
icu::UnicodeSet::complement
UnicodeSet & complement(const UnicodeString &s)
Complement the specified string in this set.
icu::UnicodeSet::freeze
UnicodeSet * freeze()
Freeze the set (make it immutable).
icu::UnicodeSet::addAll
UnicodeSet & addAll(const UnicodeString &s)
Adds each of the characters in this string to the set.
icu::UnicodeSet::remove
UnicodeSet & remove(const UnicodeString &s)
Removes the specified string from this set if it is present.
icu::UnicodeSet::addAll
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::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::codePoints
U_HEADER_NESTED_NAMESPACE::USetCodePoints codePoints() const
Returns a C++ "range" for iterating over the code points of this set.
Definition: uniset.h:1122
icu::UnicodeSet::end
U_HEADER_NESTED_NAMESPACE::USetElementIterator end() const
Definition: uniset.h:1213
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::toPattern
virtual UnicodeString & toPattern(UnicodeString &result, UBool escapeUnprintable=false) const override
Returns a string representation of this set.
icu::UnicodeSet::begin
U_HEADER_NESTED_NAMESPACE::USetElementIterator begin() const
Returns a C++ iterator for iterating over all of the elements of this set.
Definition: uniset.h:1201
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::complement
UnicodeSet & complement(UChar32 start, UChar32 end)
Complements the specified range in this set.
icu::UnicodeSet::retain
UnicodeSet & retain(const UnicodeString &s)
Retains only the specified string from this set if it is present.
icu::UnicodeSet::ranges
U_HEADER_NESTED_NAMESPACE::USetRanges ranges() const
Returns a C++ "range" for iterating over the code point ranges of this set.
Definition: uniset.h:1148
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::UnicodeSet::createFrom
static UnicodeSet * createFrom(const UnicodeString &s)
Makes a set from a multicharacter string.
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::createFromAll
static UnicodeSet * createFromAll(const UnicodeString &s)
Makes a set from each of the characters in the string.
icu::UnicodeSet::UnicodeSet
UnicodeSet(const UnicodeSet &o)
Constructs a set that is identical to the given UnicodeSet.
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
virtual ~UnicodeSet()
Destructs the set.
icu::UnicodeSet::removeAllStrings
UnicodeSet & removeAllStrings()
Remove all strings from this set.
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::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::UnicodeSet::getStaticClassID
static UClassID getStaticClassID()
Return the class ID for this class.
icu::UnicodeSet::closeOver
UnicodeSet & closeOver(int32_t attribute)
Close this set over the given attribute.
icu::UnicodeSet::add
UnicodeSet & add(UChar32 start, UChar32 end)
Adds the specified range to this set if it is not already present.
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::containsNone
UBool containsNone(UChar32 start, UChar32 end) const
Returns true if this set contains none of the characters of the given range.
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...
icu::UnicodeSet::remove
UnicodeSet & remove(UChar32 start, UChar32 end)
Removes the specified range from this set if it is present.
icu::UnicodeSet::containsAll
UBool containsAll(const UnicodeString &s) const
Returns true if this set contains all the characters of the given string.
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.
icu::UnicodeSet::add
UnicodeSet & add(const UnicodeString &s)
Adds the specified multicharacter to this set if it is not already present.
icu::UnicodeSet::complement
UnicodeSet & complement()
This is equivalent to complement(MIN_VALUE, MAX_VALUE).
icu::UnicodeSet::contains
UBool contains(const UnicodeString &s) const
Returns true if this set contains the given multicharacter string.
icu::UnicodeSet::matches
UMatchDegree matches(const Replaceable &text, int32_t &offset, int32_t limit, UBool incremental) override
Implement UnicodeMatcher::matches()
icu::UnicodeSet::operator==
bool operator==(const UnicodeSet &o) const
Compares the specified object with this set for equality.
icu::UnicodeSet::clone
virtual UnicodeSet * clone() const override
Returns a copy of this object.
icu::UnicodeSet::retainAll
UnicodeSet & retainAll(const UnicodeSet &c)
Retains only the elements in this set that are contained in the specified set.
icu::UnicodeSet::UnicodeSet
UnicodeSet(const UnicodeString &pattern, UErrorCode &status)
Constructs a set from the given pattern.
icu::UnicodeSet::hasStrings
UBool hasStrings() const
icu::UnicodeSet::getRangeCount
int32_t getRangeCount() const
Iteration method that returns the number of ranges contained in this set.
icu::UnicodeSet::getRangeStart
UChar32 getRangeStart(int32_t index) const
Iteration method that returns the first character in the specified range of this set.
icu::UnicodeSet::complement
UnicodeSet & complement(UChar32 c)
Complements the specified character in 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::isEmpty
UBool isEmpty() const
Returns true if this set contains no elements.
icu::UnicodeSet::containsAll
UBool containsAll(const UnicodeSet &c) const
Returns true if this set contains all the characters and strings of the given set.
icu::UnicodeSet::removeAll
UnicodeSet & removeAll(const UnicodeString &s)
Remove EACH of the characters in this string.
icu::UnicodeSet::contains
virtual UBool contains(UChar32 c) const override
Returns true if this set contains the given character.
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::UnicodeSet
UnicodeSet(const UnicodeString &pattern, uint32_t options, const SymbolTable *symbols, UErrorCode &status)
Constructs a set from the given pattern.
icu::UnicodeSet::contains
UBool contains(UChar32 start, UChar32 end) const
Returns true if this set contains every character of the given range.
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.
icu::UnicodeSet::set
UnicodeSet & set(UChar32 start, UChar32 end)
Make this object represent the range start - end.
icu::UnicodeSet::operator=
UnicodeSet & operator=(const UnicodeSet &o)
Assigns this object to be a copy of another.
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::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:303
icu::UnicodeString::length
int32_t length() const
Return the length of the UnicodeString object.
Definition: unistr.h:4275
icu::UnicodeString::getBuffer
char16_t * getBuffer(int32_t minCapacity)
Get a read/write pointer to the internal buffer.
icu::operator==
U_COMMON_API UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
icu::UMatchDegree
UMatchDegree
Constants returned by UnicodeMatcher::matches() indicating the degree of match.
Definition: unimatch.h:33
icu::operator!=
bool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
Definition: stringpiece.h:346
UProperty
UProperty
Selection constants for Unicode properties.
Definition: uchar.h:196
ucpmap.h
C API: This file defines an abstract map from Unicode code points to integer values.
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:449
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
unifilt.h
C++ API: Unicode Filter.
unistr.h
C++ API: Unicode String.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
uset.h
C API: Unicode Set.
USetSpanCondition
USetSpanCondition
Argument values for whether span() and similar functions continue while the current character is cont...
Definition: uset.h:186
USet
struct USet USet
USet is the C API type corresponding to C++ class UnicodeSet.
Definition: uset.h:54
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:509
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:315