Go to the documentation of this file.
18 #if U_SHOW_CPLUSPLUS_API
35 class RBBIRuleScanner;
37 class UnicodeSetStringSpan;
39 class RuleCharacterIterator;
289 static constexpr uint8_t kIsBogus = 1;
296 BMPSet *bmpSet =
nullptr;
298 int32_t bufferCapacity = 0;
309 char16_t *pat =
nullptr;
312 UVector* strings =
nullptr;
313 UnicodeSetStringSpan *stringSpan =
nullptr;
332 inline UBool isBogus(
void)
const;
390 #ifndef U_HIDE_INTERNAL_API
423 #ifndef U_HIDE_INTERNAL_API
546 inline USet *toUSet();
556 inline const USet * toUSet()
const;
571 inline UBool isFrozen()
const;
636 #ifndef U_HIDE_INTERNAL_API
779 virtual int32_t
size(
void)
const;
1031 int32_t start, int32_t limit,
1043 int32_t findCodePoint(
UChar32 c)
const;
1497 friend class USetAccess;
1515 friend class RBBIRuleScanner;
1533 void applyPattern(RuleCharacterIterator& chars,
1545 static int32_t nextCapacity(int32_t minCapacity);
1547 bool ensureCapacity(int32_t newLen);
1549 bool ensureBufferCapacity(int32_t newLen);
1551 void swapBuffers(
void);
1554 UBool hasStrings()
const;
1555 int32_t stringsSize()
const;
1559 UBool escapeUnprintable)
const;
1562 UBool escapeUnprintable)
const;
1572 void exclusiveOr(
const UChar32* other, int32_t otherLen, int8_t polarity);
1574 void add(
const UChar32* other, int32_t otherLen, int8_t polarity);
1576 void retain(
const UChar32* other, int32_t otherLen, int8_t polarity);
1586 static UBool resemblesPropertyPattern(RuleCharacterIterator& chars,
1632 void applyPropertyPattern(RuleCharacterIterator& chars,
1642 typedef UBool (*Filter)(
UChar32 codePoint,
void* context);
1653 void applyFilter(Filter filter,
1659 void applyIntPropertyValue(
const UCPMap *map,
1669 void setPattern(
const char16_t *newPat, int32_t newPatLen);
1673 void releasePattern();
1684 inline UBool UnicodeSet::isFrozen()
const {
1689 return !containsNone(start, end);
1693 return !containsNone(s);
1697 return !containsNone(s);
1700 inline UBool UnicodeSet::isBogus()
const {
1701 return (
UBool)(fFlags & kIsBogus);
1709 return reinterpret_cast<const UnicodeSet *
>(uset);
1712 inline USet *UnicodeSet::toUSet() {
1713 return reinterpret_cast<USet *
>(
this);
1716 inline const USet *UnicodeSet::toUSet()
const {
1717 return reinterpret_cast<const USet *
>(
this);
1721 int32_t sLength=s.
length();
1724 }
else if(start>sLength) {
1727 return start+span(s.
getBuffer()+start, sLength-start, spanCondition);
1731 int32_t sLength=s.
length();
1734 }
else if(limit>sLength) {
1737 return spanBack(s.
getBuffer(), limit, spanCondition);
virtual UnicodeSet & clear(void)
Removes all of the elements from this set.
UBool contains(const UnicodeString &s) const
Returns true if this set contains the given multicharacter string.
#define U_FINAL
Defined to the C++11 "final" keyword if available.
virtual UBool contains(UChar32 start, UChar32 end) const
Returns true if this set contains every character of the given range.
#define FALSE
The FALSE value of a UBool.
char16_t * getBuffer(int32_t minCapacity)
Get a read/write pointer to the internal buffer.
int32_t indexOf(UChar32 c) const
Returns the index of the given character within this set, where the set is ordered by ascending code ...
virtual UnicodeSet & add(UChar32 start, UChar32 end)
Adds the specified range to this set if it is not already present.
virtual UnicodeSet & remove(UChar32 start, UChar32 end)
Removes the specified range from this set if it is present.
UnicodeSet(const uint16_t buffer[], int32_t bufferLen, ESerialization serialization, UErrorCode &status)
Constructs a set from the output of serialize().
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...
UnicodeSet(const UnicodeSet &o)
Constructs a set that is identical to the given UnicodeSet.
virtual UnicodeSet & complement(void)
Inverts this set.
Basic definitions for ICU, for both C and C++ APIs.
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...
A mutable set of Unicode characters and multicharacter strings.
virtual UChar32 getRangeStart(int32_t index) const
Iteration method that returns the first character in the specified range of this set.
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...
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...
UnicodeSet & remove(UChar32 c)
Removes the specified character from this set if it is present.
int8_t UBool
The ICU boolean type.
virtual UClassID getDynamicClassID(void) const
Implement UnicodeFunctor API.
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...
Replaceable is an abstract base class representing a string of characters that supports the replaceme...
virtual UnicodeSet & compact()
Reallocate this objects internal structures to take up the least possible space, without changing thi...
virtual UBool isEmpty(void) const
Returns true if this set contains no elements.
virtual UBool operator==(const UnicodeSet &o) const
Compares the specified object with this set for equality.
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
UnicodeSet & add(const UnicodeString &s)
Adds the specified multicharacter to this set if it is not already present.
static UClassID getStaticClassID(void)
Return the class ID for this class.
UnicodeSet & complement(const UnicodeString &s)
Complement the specified string in this set.
virtual UnicodeString & toPattern(UnicodeString &result, UBool escapeUnprintable=FALSE) const
Returns a string representation of this set.
virtual UBool matchesIndexValue(uint8_t v) const =0
Returns TRUE if this matcher will match a character c, where c & 0xFF == v, at offset,...
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.
UProperty
Selection constants for Unicode properties.
UChar32 charAt(int32_t index) const
Returns the character at the given index within this set, where the set is ordered by ascending code ...
An interface that defines both lookup protocol and parsing of symbolic names.
virtual UnicodeSet & addAll(const UnicodeSet &c)
Adds all of the elements in the specified set to this set if they're not already present.
UBool containsNone(UChar32 start, UChar32 end) const
Returns true if this set contains none of the characters of the given range.
USetSpanCondition
Argument values for whether span() and similar functions continue while the current character is cont...
UnicodeSet & closeOver(int32_t attribute)
Close this set over the given attribute.
UnicodeSet & removeAll(const UnicodeString &s)
Remove EACH of the characters in this string.
UnicodeSet & complementAll(const UnicodeString &s)
Complement EACH of the characters in this string.
int32_t length(void) const
Return the length of the UnicodeString object.
int32_t serialize(uint16_t *dest, int32_t destCapacity, UErrorCode &ec) const
Serializes this set into an array of 16-bit integers.
#define NULL
Define NULL if necessary, to nullptr for C++ and to ((void *)0) for C.
UnicodeSetIterator iterates over the contents of a UnicodeSet.
UnicodeSet & retain(UChar32 c)
Retain the specified character from this set if it is present.
UnicodeSet & complement(UChar32 c)
Complements the specified character in this set.
virtual void addMatchSetTo(UnicodeSet &toUnionTo) const
Implementation of UnicodeMatcher API.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
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.
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
UnicodeSet & remove(const UnicodeString &s)
Removes the specified string from this set if it is present.
virtual UBool contains(UChar32 c) const
Returns true if this set contains the given character.
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...
virtual UnicodeSet * clone() const
Returns a copy of this object.
UBool containsAll(const UnicodeString &s) const
Returns true if this set contains all the characters of the given string.
virtual UnicodeSet & removeAll(const UnicodeSet &c)
Removes from this set all of its elements that are contained in the specified set.
UnicodeSet * cloneAsThawed() const
Clone the set and make the clone mutable.
uint32_t UCPMapValueFilter(const void *context, uint32_t value)
Callback function type: Modifies a map value.
virtual UnicodeSet & retainAll(const UnicodeSet &c)
Retains only the elements in this set that are contained in the specified set.
UBool containsNone(const UnicodeString &s) const
Returns true if this set contains none of the characters of the given string.
virtual UMatchDegree matches(const Replaceable &text, int32_t &offset, int32_t limit, UBool incremental)
Implement UnicodeMatcher::matches()
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
struct UCPMap UCPMap
Abstract map from Unicode code points (U+0000..U+10FFFF) to integer values.
UnicodeSet & applyPattern(const UnicodeString &pattern, UErrorCode &status)
Modifies this set to represent the set specified by the given pattern, ignoring Unicode Pattern_White...
UMatchDegree
Constants returned by UnicodeMatcher::matches() indicating the degree of match.
virtual UnicodeSet & complement(UChar32 start, UChar32 end)
Complements the specified range in this set.
virtual UBool containsAll(const UnicodeSet &c) const
Returns true if this set contains all the characters and strings of the given set.
UnicodeSet(const UnicodeString &pattern, uint32_t options, const SymbolTable *symbols, UErrorCode &status)
Constructs a set from the given pattern.
void setToBogus()
Make this UnicodeSet object invalid.
virtual UnicodeSet & removeAllStrings()
Remove all strings from this set.
UnicodeSet & addAll(const UnicodeString &s)
Adds each of the characters in this string to the set.
UnicodeSet & add(UChar32 c)
Adds the specified character to this set if it is not already present.
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...
This file defines an abstract map from Unicode code points to integer values.
UnicodeSet()
Constructs an empty set.
UBool containsNone(const UnicodeSet &c) const
Returns true if this set contains none of the characters and strings of the given set.
virtual UChar32 getRangeEnd(int32_t index) const
Iteration method that returns the last character in the specified range of this set.
static UnicodeSet * createFrom(const UnicodeString &s)
Makes a set from a multicharacter string.
UnicodeSet(UChar32 start, UChar32 end)
Constructs a set containing the given range.
virtual ~UnicodeSet()
Destructs the set.
virtual int32_t size(void) const
Returns the number of elements in this set (its cardinality).
UnicodeSet & operator=(const UnicodeSet &o)
Assigns this object to be a copy of another.
UnicodeSet(const UnicodeString &pattern, ParsePosition &pos, uint32_t options, const SymbolTable *symbols, UErrorCode &status)
Constructs a set from the given pattern.
UnicodeSet & set(UChar32 start, UChar32 end)
Make this object represent the range start - end.
virtual int32_t hashCode(void) const
Returns the hash code value for this set.
UnicodeSet & applyPattern(const UnicodeString &pattern, ParsePosition &pos, uint32_t options, const SymbolTable *symbols, UErrorCode &status)
Parses the given pattern, starting at the given position.
static UnicodeSet * createFromAll(const UnicodeString &s)
Makes a set from each of the characters in the string.
UnicodeSet * freeze()
Freeze the set (make it immutable).
UnicodeFilter defines a protocol for selecting a subset of the full range (U+0000 to U+10FFFF) of Uni...
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
UnicodeSet(const UnicodeString &pattern, UErrorCode &status)
Constructs a set from the given pattern.
virtual UnicodeSet & retain(UChar32 start, UChar32 end)
Retain only the elements in this set that are contained in the specified range.
struct USet USet
USet is the C API type corresponding to C++ class UnicodeSet.
UnicodeSet & retainAll(const UnicodeString &s)
Retains EACH of the characters in this string.
virtual int32_t getRangeCount(void) const
Iteration method that returns the number of ranges contained in this set.
#define INITIAL_CAPACITY
The initial size of an array if it is unspecified.
virtual UnicodeSet & complementAll(const UnicodeSet &c)
Complements in this set all elements contained in the specified set.