18 #if U_SHOW_CPLUSPLUS_API 35 class RBBIRuleScanner;
37 class UnicodeSetStringSpan;
39 class RuleCharacterIterator;
293 static constexpr uint8_t kIsBogus = 1;
300 BMPSet *bmpSet =
nullptr;
302 int32_t bufferCapacity = 0;
313 char16_t *pat =
nullptr;
316 UVector* strings_ =
nullptr;
317 UnicodeSetStringSpan *stringSpan =
nullptr;
336 inline UBool isBogus()
const;
394 #ifndef U_HIDE_INTERNAL_API 412 UnicodeSet(
const uint16_t buffer[], int32_t bufferLen,
413 ESerialization serialization,
UErrorCode &status);
427 #ifndef U_HIDE_INTERNAL_API 525 virtual int32_t hashCode()
const;
554 inline USet *toUSet();
564 inline const USet * toUSet()
const;
579 inline UBool isFrozen()
const;
644 #ifndef U_HIDE_INTERNAL_API 722 UBool escapeUnprintable =
false)
const override;
795 virtual int32_t size()
const;
803 virtual UBool isEmpty()
const;
809 UBool hasStrings()
const;
931 int32_t span(
const char16_t *s, int32_t length,
USetSpanCondition spanCondition)
const;
964 int32_t spanBack(
const char16_t *s, int32_t length,
USetSpanCondition spanCondition)
const;
999 int32_t spanUTF8(
const char *s, int32_t length,
USetSpanCondition spanCondition)
const;
1018 int32_t spanBackUTF8(
const char *s, int32_t length,
USetSpanCondition spanCondition)
const;
1027 UBool incremental)
override;
1053 int32_t start, int32_t limit,
1065 int32_t findCodePoint(
UChar32 c)
const;
1086 int32_t indexOf(
UChar32 c)
const;
1103 UChar32 charAt(int32_t index)
const;
1105 #ifndef U_HIDE_DRAFT_API 1123 inline U_HEADER_NESTED_NAMESPACE::USetCodePoints
codePoints()
const {
1124 return U_HEADER_NESTED_NAMESPACE::USetCodePoints(toUSet());
1149 inline U_HEADER_NESTED_NAMESPACE::USetRanges
ranges()
const {
1150 return U_HEADER_NESTED_NAMESPACE::USetRanges(toUSet());
1173 inline U_HEADER_NESTED_NAMESPACE::USetStrings
strings()
const {
1174 return U_HEADER_NESTED_NAMESPACE::USetStrings(toUSet());
1200 inline U_HEADER_NESTED_NAMESPACE::USetElementIterator
begin()
const {
1201 return U_HEADER_NESTED_NAMESPACE::USetElements(toUSet()).begin();
1212 inline U_HEADER_NESTED_NAMESPACE::USetElementIterator
end()
const {
1213 return U_HEADER_NESTED_NAMESPACE::USetElements(toUSet()).end();
1215 #endif // U_HIDE_DRAFT_API 1555 virtual int32_t getRangeCount()
const;
1564 virtual UChar32 getRangeStart(int32_t index)
const;
1573 virtual UChar32 getRangeEnd(int32_t index)
const;
1623 int32_t serialize(uint16_t *dest, int32_t destCapacity,
UErrorCode& ec)
const;
1660 friend class USetAccess;
1678 friend class RBBIRuleScanner;
1696 void applyPattern(RuleCharacterIterator& chars,
1704 void closeOverCaseInsensitive(
bool simple);
1705 void closeOverAddCaseMappings();
1711 static int32_t nextCapacity(int32_t minCapacity);
1713 bool ensureCapacity(int32_t newLen);
1715 bool ensureBufferCapacity(int32_t newLen);
1720 int32_t stringsSize()
const;
1724 UBool escapeUnprintable)
const;
1727 UBool escapeUnprintable)
const;
1734 UBool escapeUnprintable);
1740 void exclusiveOr(
const UChar32* other, int32_t otherLen, int8_t polarity);
1742 void add(
const UChar32* other, int32_t otherLen, int8_t polarity);
1744 void retain(
const UChar32* other, int32_t otherLen, int8_t polarity);
1754 static UBool resemblesPropertyPattern(RuleCharacterIterator& chars,
1800 void applyPropertyPattern(RuleCharacterIterator& chars,
1808 typedef UBool (*Filter)(
UChar32 codePoint,
void* context);
1819 void applyFilter(Filter filter,
1830 void setPattern(
const char16_t *newPat, int32_t newPatLen);
1834 void releasePattern();
1836 friend class UnicodeSetIterator;
1845 inline UBool UnicodeSet::isFrozen()
const {
1846 return bmpSet !=
nullptr || stringSpan !=
nullptr;
1850 return !containsNone(start, end);
1854 return !containsNone(s);
1858 return !containsNone(s);
1861 inline UBool UnicodeSet::isBogus()
const {
1862 return fFlags & kIsBogus;
1870 return reinterpret_cast<const UnicodeSet *
>(uset);
1873 inline USet *UnicodeSet::toUSet() {
1874 return reinterpret_cast<USet *
>(
this);
1877 inline const USet *UnicodeSet::toUSet()
const {
1878 return reinterpret_cast<const USet *
>(
this);
1882 int32_t sLength=s.
length();
1885 }
else if(start>sLength) {
1888 return start+span(s.
getBuffer()+start, sLength-start, spanCondition);
1892 int32_t sLength=s.
length();
1895 }
else if(limit>sLength) {
1898 return spanBack(s.
getBuffer(), limit, spanCondition);
#define INITIAL_CAPACITY
The initial size of an array if it is unspecified.
bool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
virtual UMatchDegree matches(const Replaceable &text, int32_t &offset, int32_t limit, UBool incremental) override
Implement UnicodeMatcher API.
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
int32_t length() const
Return the length of the UnicodeString object.
UMatchDegree
Constants returned by UnicodeMatcher::matches() indicating the degree of match.
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
C API: This file defines an abstract map from Unicode code points to integer values.
virtual UBool matchesIndexValue(uint8_t v) const =0
Returns true if this matcher will match a character c, where c & 0xFF == v, at offset, in the forward direction (with limit > offset).
An interface that defines both lookup protocol and parsing of symbolic names.
virtual UnicodeString & toPattern(UnicodeString &result, UBool escapeUnprintable=false) const =0
Returns a string representation of this matcher.
Replaceable is an abstract base class representing a string of characters that supports the replaceme...
UnicodeFilter defines a protocol for selecting a subset of the full range (U+0000 to U+10FFFF) of Uni...
U_HEADER_NESTED_NAMESPACE::USetCodePoints codePoints() const
Returns a C++ "range" for iterating over the code points of this set.
U_HEADER_NESTED_NAMESPACE::USetRanges ranges() const
Returns a C++ "range" for iterating over the code point ranges of this set.
virtual void addMatchSetTo(UnicodeSet &toUnionTo) const =0
Union the set of all characters that may be matched by this object into the given set...
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
A mutable set of Unicode characters and multicharacter strings.
virtual UClassID getDynamicClassID() const override=0
Returns a unique class ID polymorphically.
USetSpanCondition
Argument values for whether span() and similar functions continue while the current character is cont...
UProperty
Selection constants for Unicode properties.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
struct USet USet
USet is the C API type corresponding to C++ class UnicodeSet.
U_HEADER_NESTED_NAMESPACE::USetElementIterator end() const
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
char16_t * getBuffer(int32_t minCapacity)
Get a read/write pointer to the internal buffer.
virtual UnicodeFilter * clone() const override=0
Clones this object polymorphically.
Basic definitions for ICU, for both C and C++ APIs.
U_HEADER_NESTED_NAMESPACE::USetElementIterator begin() const
Returns a C++ iterator for iterating over all of the elements of this set.
virtual UBool contains(UChar32 c) const =0
Returns true for characters that are in the selected subset.
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside...
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
U_HEADER_NESTED_NAMESPACE::USetStrings strings() const
Returns a C++ "range" for iterating over the empty and multi-character strings of this set...
int8_t UBool
The ICU boolean type, a signed-byte integer.