uniset.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
* Copyright (C) 1999-2016, International Business Machines Corporation
* and others. All Rights Reserved.
***************************************************************************
* Date Name Description
* 10/20/99 alan Creation.
***************************************************************************
*/
#ifndef UNICODESET_H
#define UNICODESET_H
#include "unicode/utypes.h"
#if U_SHOW_CPLUSPLUS_API
#include "unicode/ucpmap.h"
#include "unicode/unifilt.h"
#include "unicode/unistr.h"
#include "unicode/uset.h"
U_NAMESPACE_BEGIN
// Forward Declarations.
class BMPSet;
class ParsePosition;
class RBBIRuleScanner;
class SymbolTable;
class UnicodeSetStringSpan;
class UVector;
class RuleCharacterIterator;
class U_COMMON_API UnicodeSet final : public UnicodeFilter {
private:
static constexpr int32_t INITIAL_CAPACITY = 25;
// fFlags constant
static constexpr uint8_t kIsBogus = 1; // This set is bogus (i.e. not valid)
UChar32* list = stackList; // MUST be terminated with HIGH
int32_t capacity = INITIAL_CAPACITY; // capacity of list
int32_t len = 1; // length of list used; 1 <= len <= capacity
uint8_t fFlags = 0; // Bit flag (see constants above)
BMPSet *bmpSet = nullptr; // The set is frozen iff either bmpSet or stringSpan is not nullptr.
UChar32* buffer = nullptr; // internal buffer, may be nullptr
int32_t bufferCapacity = 0; // capacity of buffer
char16_t *pat = nullptr;
int32_t patLen = 0;
UVector* strings_ = nullptr; // maintained in sorted order
UnicodeSetStringSpan *stringSpan = nullptr;
UChar32 stackList[INITIAL_CAPACITY];
public:
inline UBool isBogus() const;
void setToBogus();
public:
enum {
MIN_VALUE = 0,
MAX_VALUE = 0x10ffff
};
//----------------------------------------------------------------
// Constructors &c
//----------------------------------------------------------------
public:
UnicodeSet();
UnicodeSet(UChar32 start, UChar32 end);
#ifndef U_HIDE_INTERNAL_API
enum ESerialization {
kSerialized /* result of serialize() */
};
UnicodeSet(const uint16_t buffer[], int32_t bufferLen,
ESerialization serialization, UErrorCode &status);
#endif /* U_HIDE_INTERNAL_API */
UnicodeSet(const UnicodeString& pattern,
UErrorCode& status);
#ifndef U_HIDE_INTERNAL_API
UnicodeSet(const UnicodeString& pattern,
uint32_t options,
const SymbolTable* symbols,
UErrorCode& status);
#endif /* U_HIDE_INTERNAL_API */
UnicodeSet(const UnicodeString& pattern, ParsePosition& pos,
uint32_t options,
const SymbolTable* symbols,
UErrorCode& status);
UnicodeSet(const UnicodeSet& o);
virtual ~UnicodeSet();
UnicodeSet& operator=(const UnicodeSet& o);
virtual bool operator==(const UnicodeSet& o) const;
inline bool operator!=(const UnicodeSet& o) const;
virtual UnicodeSet* clone() const override;
virtual int32_t hashCode() const;
inline static UnicodeSet *fromUSet(USet *uset);
inline static const UnicodeSet *fromUSet(const USet *uset);
inline USet *toUSet();
inline const USet * toUSet() const;
//----------------------------------------------------------------
// Freezable API
//----------------------------------------------------------------
inline UBool isFrozen() const;
UnicodeSet *freeze();
UnicodeSet *cloneAsThawed() const;
//----------------------------------------------------------------
// Public API
//----------------------------------------------------------------
UnicodeSet& set(UChar32 start, UChar32 end);
static UBool resemblesPattern(const UnicodeString& pattern,
int32_t pos);
UnicodeSet& applyPattern(const UnicodeString& pattern,
UErrorCode& status);
#ifndef U_HIDE_INTERNAL_API
UnicodeSet& applyPattern(const UnicodeString& pattern,
uint32_t options,
const SymbolTable* symbols,
UErrorCode& status);
#endif /* U_HIDE_INTERNAL_API */
UnicodeSet& applyPattern(const UnicodeString& pattern,
ParsePosition& pos,
uint32_t options,
const SymbolTable* symbols,
UErrorCode& status);
virtual UnicodeString& toPattern(UnicodeString& result,
UBool escapeUnprintable = false) const override;
UnicodeSet& applyIntPropertyValue(UProperty prop,
int32_t value,
UErrorCode& ec);
UnicodeSet& applyPropertyAlias(const UnicodeString& prop,
const UnicodeString& value,
UErrorCode& ec);
virtual int32_t size() const;
virtual UBool isEmpty() const;
UBool hasStrings() const;
virtual UBool contains(UChar32 c) const override;
virtual UBool contains(UChar32 start, UChar32 end) const;
UBool contains(const UnicodeString& s) const;
virtual UBool containsAll(const UnicodeSet& c) const;
UBool containsAll(const UnicodeString& s) const;
UBool containsNone(UChar32 start, UChar32 end) const;
UBool containsNone(const UnicodeSet& c) const;
UBool containsNone(const UnicodeString& s) const;
inline UBool containsSome(UChar32 start, UChar32 end) const;
inline UBool containsSome(const UnicodeSet& s) const;
inline UBool containsSome(const UnicodeString& s) const;
int32_t span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const;
inline int32_t span(const UnicodeString &s, int32_t start, USetSpanCondition spanCondition) const;
int32_t spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const;
inline int32_t spanBack(const UnicodeString &s, int32_t limit, USetSpanCondition spanCondition) const;
int32_t spanUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const;
int32_t spanBackUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const;
virtual UMatchDegree matches(const Replaceable& text,
int32_t& offset,
int32_t limit,
UBool incremental) override;
private:
static int32_t matchRest(const Replaceable& text,
int32_t start, int32_t limit,
const UnicodeString& s);
int32_t findCodePoint(UChar32 c) const;
public:
virtual void addMatchSetTo(UnicodeSet& toUnionTo) const override;
int32_t indexOf(UChar32 c) const;
UChar32 charAt(int32_t index) const;
#ifndef U_HIDE_DRAFT_API
inline U_HEADER_NESTED_NAMESPACE::USetCodePoints codePoints() const {
return U_HEADER_NESTED_NAMESPACE::USetCodePoints(toUSet());
}
inline U_HEADER_NESTED_NAMESPACE::USetRanges ranges() const {
return U_HEADER_NESTED_NAMESPACE::USetRanges(toUSet());
}
inline U_HEADER_NESTED_NAMESPACE::USetStrings strings() const {
return U_HEADER_NESTED_NAMESPACE::USetStrings(toUSet());
}
inline U_HEADER_NESTED_NAMESPACE::USetElementIterator begin() const {
return U_HEADER_NESTED_NAMESPACE::USetElements(toUSet()).begin();
}
inline U_HEADER_NESTED_NAMESPACE::USetElementIterator end() const {
return U_HEADER_NESTED_NAMESPACE::USetElements(toUSet()).end();
}
#endif // U_HIDE_DRAFT_API
virtual UnicodeSet& add(UChar32 start, UChar32 end);
UnicodeSet& add(UChar32 c);
UnicodeSet& add(const UnicodeString& s);
private:
static int32_t getSingleCP(const UnicodeString& s);
void _add(const UnicodeString& s);
public:
UnicodeSet& addAll(const UnicodeString& s);
UnicodeSet& retainAll(const UnicodeString& s);
UnicodeSet& complementAll(const UnicodeString& s);
UnicodeSet& removeAll(const UnicodeString& s);
static UnicodeSet* U_EXPORT2 createFrom(const UnicodeString& s);
static UnicodeSet* U_EXPORT2 createFromAll(const UnicodeString& s);
virtual UnicodeSet& retain(UChar32 start, UChar32 end);
UnicodeSet& retain(UChar32 c);
UnicodeSet& retain(const UnicodeString &s);
virtual UnicodeSet& remove(UChar32 start, UChar32 end);
UnicodeSet& remove(UChar32 c);
UnicodeSet& remove(const UnicodeString& s);
virtual UnicodeSet& complement();
virtual UnicodeSet& complement(UChar32 start, UChar32 end);
UnicodeSet& complement(UChar32 c);
UnicodeSet& complement(const UnicodeString& s);
virtual UnicodeSet& addAll(const UnicodeSet& c);
virtual UnicodeSet& retainAll(const UnicodeSet& c);
virtual UnicodeSet& removeAll(const UnicodeSet& c);
virtual UnicodeSet& complementAll(const UnicodeSet& c);
virtual UnicodeSet& clear();
UnicodeSet& closeOver(int32_t attribute);
virtual UnicodeSet &removeAllStrings();
virtual int32_t getRangeCount() const;
virtual UChar32 getRangeStart(int32_t index) const;
virtual UChar32 getRangeEnd(int32_t index) const;
int32_t serialize(uint16_t *dest, int32_t destCapacity, UErrorCode& ec) const;
virtual UnicodeSet& compact();
static UClassID U_EXPORT2 getStaticClassID();
virtual UClassID getDynamicClassID() const override;
private:
// Private API for the USet API
friend class USetAccess;
const UnicodeString* getString(int32_t index) const;
//----------------------------------------------------------------
// RuleBasedTransliterator support
//----------------------------------------------------------------
private:
virtual UBool matchesIndexValue(uint8_t v) const override;
private:
friend class RBBIRuleScanner;
//----------------------------------------------------------------
// Implementation: Clone as thawed (see ICU4J Freezable)
//----------------------------------------------------------------
UnicodeSet(const UnicodeSet& o, UBool /* asThawed */);
UnicodeSet& copyFrom(const UnicodeSet& o, UBool asThawed);
//----------------------------------------------------------------
// Implementation: Pattern parsing
//----------------------------------------------------------------
void applyPatternIgnoreSpace(const UnicodeString& pattern,
ParsePosition& pos,
const SymbolTable* symbols,
UErrorCode& status);
void applyPattern(RuleCharacterIterator& chars,
const SymbolTable* symbols,
UnicodeString& rebuiltPat,
uint32_t options,
UnicodeSet& (UnicodeSet::*caseClosure)(int32_t attribute),
int32_t depth,
UErrorCode& ec);
void closeOverCaseInsensitive(bool simple);
void closeOverAddCaseMappings();
//----------------------------------------------------------------
// Implementation: Utility methods
//----------------------------------------------------------------
static int32_t nextCapacity(int32_t minCapacity);
bool ensureCapacity(int32_t newLen);
bool ensureBufferCapacity(int32_t newLen);
void swapBuffers();
UBool allocateStrings(UErrorCode &status);
int32_t stringsSize() const;
UBool stringsContains(const UnicodeString &s) const;
UnicodeString& _toPattern(UnicodeString& result,
UBool escapeUnprintable) const;
UnicodeString& _generatePattern(UnicodeString& result,
UBool escapeUnprintable) const;
static void _appendToPat(UnicodeString& buf, const UnicodeString& s, UBool escapeUnprintable);
static void _appendToPat(UnicodeString& buf, UChar32 c, UBool escapeUnprintable);
static void _appendToPat(UnicodeString &result, UChar32 start, UChar32 end,
UBool escapeUnprintable);
//----------------------------------------------------------------
// Implementation: Fundamental operators
//----------------------------------------------------------------
void exclusiveOr(const UChar32* other, int32_t otherLen, int8_t polarity);
void add(const UChar32* other, int32_t otherLen, int8_t polarity);
void retain(const UChar32* other, int32_t otherLen, int8_t polarity);
static UBool resemblesPropertyPattern(const UnicodeString& pattern,
int32_t pos);
static UBool resemblesPropertyPattern(RuleCharacterIterator& chars,
int32_t iterOpts);
UnicodeSet& applyPropertyPattern(const UnicodeString& pattern,
ParsePosition& ppos,
UErrorCode &ec);
void applyPropertyPattern(RuleCharacterIterator& chars,
UnicodeString& rebuiltPat,
UErrorCode& ec);
typedef UBool (*Filter)(UChar32 codePoint, void* context);
void applyFilter(Filter filter,
void* context,
const UnicodeSet* inclusions,
UErrorCode &status);
void setPattern(const UnicodeString& newPat) {
setPattern(newPat.getBuffer(), newPat.length());
}
void setPattern(const char16_t *newPat, int32_t newPatLen);
void releasePattern();
friend class UnicodeSetIterator;
};
inline bool UnicodeSet::operator!=(const UnicodeSet& o) const {
return !operator==(o);
}
inline UBool UnicodeSet::isFrozen() const {
return bmpSet != nullptr || stringSpan != nullptr;
}
inline UBool UnicodeSet::containsSome(UChar32 start, UChar32 end) const {
return !containsNone(start, end);
}
inline UBool UnicodeSet::containsSome(const UnicodeSet& s) const {
return !containsNone(s);
}
inline UBool UnicodeSet::containsSome(const UnicodeString& s) const {
return !containsNone(s);
}
inline UBool UnicodeSet::isBogus() const {
return fFlags & kIsBogus;
}
inline UnicodeSet *UnicodeSet::fromUSet(USet *uset) {
return reinterpret_cast< UnicodeSet *>(uset);
}
inline const UnicodeSet *UnicodeSet::fromUSet(const USet *uset) {
return reinterpret_cast<const UnicodeSet *>(uset);
}
inline USet *UnicodeSet::toUSet() {
return reinterpret_cast< USet *>(this);
}
inline const USet *UnicodeSet::toUSet() const {
return reinterpret_cast<const USet *>(this);
}
inline int32_t UnicodeSet::span(const UnicodeString &s, int32_t start, USetSpanCondition spanCondition) const {
int32_t sLength=s.length();
if(start<0) {
start=0;
} else if(start>sLength) {
start=sLength;
}
return start+span(s.getBuffer()+start, sLength-start, spanCondition);
}
inline int32_t UnicodeSet::spanBack(const UnicodeString &s, int32_t limit, USetSpanCondition spanCondition) const {
int32_t sLength=s.length();
if(limit<0) {
limit=0;
} else if(limit>sLength) {
limit=sLength;
}
return spanBack(s.getBuffer(), limit, spanCondition);
}
U_NAMESPACE_END
#endif /* U_SHOW_CPLUSPLUS_API */
#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:1173
icu::UnicodeSet::removeAll
virtual 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::getRangeEnd
virtual UChar32 getRangeEnd(int32_t index) const
Iteration method that returns the last character in the specified range of this set.
icu::UnicodeSet::UnicodeSet
UnicodeSet()
Constructs an empty 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::complement
virtual UnicodeSet & complement(UChar32 start, UChar32 end)
Complements the specified range in this set.
icu::UnicodeSet::remove
UnicodeSet & remove(UChar32 c)
Removes the specified character from this set if it is present.
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::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::isEmpty
virtual UBool isEmpty() const
Returns true if this set contains no elements.
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::size
virtual int32_t size() const
Returns the number of elements in this set (its cardinality).
icu::UnicodeSet::retain
virtual UnicodeSet & retain(UChar32 start, UChar32 end)
Retain only the elements in this set that are contained in the specified range.
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::getRangeStart
virtual 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(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::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:1123
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::end
U_HEADER_NESTED_NAMESPACE::USetElementIterator end() const
Definition: uniset.h:1212
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:1200
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
virtual UnicodeSet & complement()
This is equivalent to complement(MIN_VALUE, MAX_VALUE).
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:1149
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::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::retainAll
virtual UnicodeSet & retainAll(const UnicodeSet &c)
Retains only the elements in this set that are contained in the specified set.
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::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::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::contains
virtual UBool contains(UChar32 start, UChar32 end) const
Returns true if this set contains every character of the given range.
icu::UnicodeSet::getRangeCount
virtual int32_t getRangeCount() const
Iteration method that returns the number of ranges contained in this set.
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::contains
UBool contains(const UnicodeString &s) const
Returns true if this set contains the given multicharacter string.
icu::UnicodeSet::removeAllStrings
virtual UnicodeSet & removeAllStrings()
Remove all strings from this set.
icu::UnicodeSet::clone
virtual UnicodeSet * clone() const override
Returns a copy of this object.
icu::UnicodeSet::hashCode
virtual int32_t hashCode() const
Returns the hash code value for this set.
icu::UnicodeSet::operator==
virtual bool operator==(const UnicodeSet &o) const
Compares the specified object with this set for equality.
icu::UnicodeSet::UnicodeSet
UnicodeSet(const UnicodeString &pattern, UErrorCode &status)
Constructs a set from the given pattern.
icu::UnicodeSet::hasStrings
UBool hasStrings() const
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::compact
virtual UnicodeSet & compact()
Reallocate this objects internal structures to take up the least possible space, without changing thi...
icu::UnicodeSet::matches
virtual UMatchDegree matches(const Replaceable &text, int32_t &offset, int32_t limit, UBool incremental) override
Implement UnicodeMatcher::matches()
icu::UnicodeSet::removeAll
UnicodeSet & removeAll(const UnicodeString &s)
Remove EACH of the characters in this string.
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::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::remove
virtual UnicodeSet & remove(UChar32 start, UChar32 end)
Removes the specified range from this set if it is present.
icu::UnicodeSet::complementAll
virtual UnicodeSet & complementAll(const UnicodeSet &c)
Complements in this set all elements contained in the specified 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::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::clear
virtual UnicodeSet & clear()
Removes all of the elements from this 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::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:296
icu::UnicodeString::length
int32_t length() const
Return the length of the UnicodeString object.
Definition: unistr.h:4214
icu::UnicodeString::getBuffer
char16_t * getBuffer(int32_t minCapacity)
Get a read/write pointer to the internal buffer.
icu::operator==
U_EXPORT 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:427
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:247
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:185
USet
struct USet USet
USet is the C API type corresponding to C++ class UnicodeSet.
Definition: uset.h:53
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:430
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