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(
void)
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 521 virtual int32_t hashCode(
void)
const;
550 inline USet *toUSet();
560 inline const USet * toUSet()
const;
575 inline UBool isFrozen()
const;
640 #ifndef U_HIDE_INTERNAL_API 714 UBool escapeUnprintable =
false)
const override;
787 virtual int32_t size(
void)
const;
795 virtual UBool isEmpty(
void)
const;
801 UBool hasStrings()
const;
923 int32_t span(
const char16_t *s, int32_t length,
USetSpanCondition spanCondition)
const;
956 int32_t spanBack(
const char16_t *s, int32_t length,
USetSpanCondition spanCondition)
const;
991 int32_t spanUTF8(
const char *s, int32_t length,
USetSpanCondition spanCondition)
const;
1010 int32_t spanBackUTF8(
const char *s, int32_t length,
USetSpanCondition spanCondition)
const;
1019 UBool incremental)
override;
1045 int32_t start, int32_t limit,
1057 int32_t findCodePoint(
UChar32 c)
const;
1078 int32_t indexOf(
UChar32 c)
const;
1095 UChar32 charAt(int32_t index)
const;
1433 virtual int32_t getRangeCount(
void)
const;
1442 virtual UChar32 getRangeStart(int32_t index)
const;
1451 virtual UChar32 getRangeEnd(int32_t index)
const;
1501 int32_t serialize(uint16_t *dest, int32_t destCapacity,
UErrorCode& ec)
const;
1538 friend class USetAccess;
1556 friend class RBBIRuleScanner;
1574 void applyPattern(RuleCharacterIterator& chars,
1586 static int32_t nextCapacity(int32_t minCapacity);
1588 bool ensureCapacity(int32_t newLen);
1590 bool ensureBufferCapacity(int32_t newLen);
1592 void swapBuffers(
void);
1595 int32_t stringsSize()
const;
1599 UBool escapeUnprintable)
const;
1602 UBool escapeUnprintable)
const;
1609 UBool escapeUnprintable);
1615 void exclusiveOr(
const UChar32* other, int32_t otherLen, int8_t polarity);
1617 void add(
const UChar32* other, int32_t otherLen, int8_t polarity);
1619 void retain(
const UChar32* other, int32_t otherLen, int8_t polarity);
1629 static UBool resemblesPropertyPattern(RuleCharacterIterator& chars,
1675 void applyPropertyPattern(RuleCharacterIterator& chars,
1683 typedef UBool (*Filter)(
UChar32 codePoint,
void* context);
1694 void applyFilter(Filter filter,
1705 void setPattern(
const char16_t *newPat, int32_t newPatLen);
1709 void releasePattern();
1711 friend class UnicodeSetIterator;
1720 inline UBool UnicodeSet::isFrozen()
const {
1725 return !containsNone(start, end);
1729 return !containsNone(s);
1733 return !containsNone(s);
1736 inline UBool UnicodeSet::isBogus()
const {
1737 return (
UBool)(fFlags & kIsBogus);
1745 return reinterpret_cast<const UnicodeSet *
>(uset);
1748 inline USet *UnicodeSet::toUSet() {
1749 return reinterpret_cast<USet *
>(
this);
1752 inline const USet *UnicodeSet::toUSet()
const {
1753 return reinterpret_cast<const USet *
>(
this);
1757 int32_t sLength=s.
length();
1760 }
else if(start>sLength) {
1763 return start+span(s.
getBuffer()+start, sLength-start, spanCondition);
1767 int32_t sLength=s.
length();
1770 }
else if(limit>sLength) {
1773 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.
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...
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.
#define NULL
Define NULL if necessary, to nullptr for C++ and to ((void *)0) for C.
A mutable set of Unicode characters and multicharacter strings.
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.
int32_t length(void) const
Return the length of the UnicodeString object.
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
#define U_FINAL
Defined to the C++11 "final" keyword if available.
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.
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...
int8_t UBool
The ICU boolean type, a signed-byte integer.
virtual UClassID getDynamicClassID(void) const override=0
Returns a unique class ID polymorphically.