Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

UnicodeSet Class Reference

A mutable set of Unicode characters. More...

#include <uniset.h>

Inheritance diagram for UnicodeSet::

UnicodeFilter UnicodeFunctor UnicodeMatcher List of all members.

Public Methods

 UnicodeSet ()
 Constructs an empty set. More...

 UnicodeSet (UChar32 start, UChar32 end)
 Constructs a set containing the given range. More...

 UnicodeSet (const UnicodeString &pattern, UErrorCode &status)
 Constructs a set from the given pattern. More...

 UnicodeSet (int8_t category, UErrorCode &status)
 DEPRECATED Constructs a set from the given Unicode character category. More...

 UnicodeSet (const UnicodeSet &o)
 Constructs a set that is identical to the given UnicodeSet. More...

virtual ~UnicodeSet ()
 Destructs the set. More...

UnicodeSet & operator= (const UnicodeSet &o)
 Assigns this object to be a copy of another. More...

virtual UBool operator== (const UnicodeSet &o) const
 Compares the specified object with this set for equality. More...

UBool operator!= (const UnicodeSet &o) const
 Compares the specified object with this set for equality. More...

virtual UnicodeFunctorclone () const
 Returns a copy of this object. More...

virtual int32_t hashCode (void) const
 Returns the hash code value for this set. More...

void set (UChar32 start, UChar32 end)
 Make this object represent the range start - end. More...

virtual void applyPattern (const UnicodeString &pattern, UErrorCode &status)
 Modifies this set to represent the set specified by the given pattern, optionally ignoring white space. More...

virtual UnicodeStringtoPattern (UnicodeString &result, UBool escapeUnprintable=FALSE) const
 Returns a string representation of this set. More...

virtual int32_t size (void) const
 Returns the number of elements in this set (its cardinality), n, where 0 <= n <= 65536. More...

virtual UBool isEmpty (void) const
 Returns true if this set contains no elements. More...

virtual UBool contains (UChar32 start, UChar32 end) const
 Returns true if this set contains the specified range of chars. More...

virtual UBool contains (UChar32 c) const
 Returns true if this set contains the specified char. More...

UMatchDegree matches (const Replaceable &text, int32_t &offset, int32_t limit, UBool incremental)
 Implement UnicodeMatcher::matches(). More...

int32_t indexOf (UChar32 c) const
 Returns the index of the given character within this set, where the set is ordered by ascending code point. More...

UChar32 charAt (int32_t index) const
 Returns the character at the given index within this set, where the set is ordered by ascending code point. More...

virtual void add (UChar32 start, UChar32 end)
 Adds the specified range to this set if it is not already present. More...

void add (UChar32 c)
 Adds the specified character to this set if it is not already present. More...

virtual void retain (UChar32 start, UChar32 end)
 Retain only the elements in this set that are contained in the specified range. More...

void retain (UChar32 c)
 Retain the specified character from this set if it is present. More...

virtual void remove (UChar32 start, UChar32 end)
 Removes the specified range from this set if it is present. More...

void remove (UChar32 c)
 Removes the specified character from this set if it is present. More...

virtual void complement (void)
 Inverts this set. More...

virtual void complement (UChar32 start, UChar32 end)
 Complements the specified range in this set. More...

void complement (UChar32 c)
 Complements the specified character in this set. More...

virtual UBool containsAll (const UnicodeSet &c) const
 Returns true if the specified set is a subset of this set. More...

virtual void addAll (const UnicodeSet &c)
 Adds all of the elements in the specified set to this set if they're not already present. More...

virtual void retainAll (const UnicodeSet &c)
 Retains only the elements in this set that are contained in the specified set. More...

virtual void removeAll (const UnicodeSet &c)
 Removes from this set all of its elements that are contained in the specified set. More...

virtual void complementAll (const UnicodeSet &c)
 Complements in this set all elements contained in the specified set. More...

virtual void clear (void)
 Removes all of the elements from this set. More...

virtual int32_t getRangeCount (void) const
 Iteration method that returns the number of ranges contained in this set. More...

virtual UChar32 getRangeStart (int32_t index) const
 Iteration method that returns the first character in the specified range of this set. More...

virtual UChar32 getRangeEnd (int32_t index) const
 Iteration method that returns the last character in the specified range of this set. More...

virtual void compact ()
 Reallocate this objects internal structures to take up the least possible space, without changing this object's value. More...

virtual UClassID getDynamicClassID (void) const
 Implement UnicodeFunctor API. More...


Static Public Methods

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 pattern. More...

UClassID getStaticClassID (void)
 Return the class ID for this class. More...


Static Public Attributes

const UChar32 MIN_VALUE
 Minimum value that can be stored in a UnicodeSet. More...

const UChar32 MAX_VALUE
 Maximum value that can be stored in a UnicodeSet. More...


Private Methods

UBool containsAll (const UnicodeString &s) const
 Return TRUE if every character in s is in this set. More...

 UnicodeSet (const UnicodeString &pattern, ParsePosition &pos, const SymbolTable &symbols, UErrorCode &status)
 Constructs a set from the given pattern. More...

 UnicodeSet (const UnicodeString &pattern, ParsePosition &pos, UErrorCode &status)
 Constructs a set from the given pattern. More...

virtual UBool matchesIndexValue (uint8_t v) const
 Returns true if this set contains any character whose low byte is the given value. More...

void applyPattern (const UnicodeString &pattern, ParsePosition &pos, const SymbolTable *symbols, UErrorCode &status)
 Parses the given pattern, starting at the given position. More...

void ensureCapacity (int32_t newLen)
void ensureBufferCapacity (int32_t newLen)
void swapBuffers (void)
void _applyPattern (const UnicodeString &pattern, ParsePosition &pos, const SymbolTable *symbols, UnicodeString &rebuiltPat, UErrorCode &status)
UnicodeString_toPattern (UnicodeString &result, UBool escapeUnprintable) const
UnicodeString_generatePattern (UnicodeString &result, UBool escapeUnprintable) const
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 Private Methods

void _appendToPat (UnicodeString &buf, UChar32 c, UBool escapeUnprintable)

Private Attributes

int32_t len
int32_t capacity
int32_t bufferCapacity
UChar32list
UChar32buffer
UnicodeString pat
 The pattern representation of this set. More...


Static Private Attributes

const char fgClassID
 Class identifier for subclasses of UnicodeFunctor that do not define their class (anonymous subclasses). More...


Friends

class NormalizationTransliterator
class Transliterator
class TransliteratorParser
class TransliteratorIDParser
class TransliterationRule

Detailed Description

A mutable set of Unicode characters.

Objects of this class represent character classes used in regular expressions. A character specifies a subset of Unicode code points. Legal code points are U+0000 to U+10FFFF, inclusive.

UnicodeSet supports two APIs. The first is the operand API that allows the caller to modify the value of a UnicodeSet object. It conforms to Java 2's java.util.Set interface, although UnicodeSet does not actually implement that interface. All methods of Set are supported, with the modification that they take a character range or single character instead of an Object, and they take a UnicodeSet instead of a Collection. The operand API may be thought of in terms of boolean logic: a boolean OR is implemented by add, a boolean AND is implemented by retain, a boolean XOR is implemented by complement taking an argument, and a boolean NOT is implemented by complement with no argument. In terms of traditional set theory function names, add is a union, retain is an intersection, remove is an asymmetric difference, and complement with no argument is a set complement with respect to the superset range MIN_VALUE-MAX_VALUE

The second API is the applyPattern()/toPattern() API from the java.text.Format-derived classes. Unlike the methods that add characters, add categories, and control the logic of the set, the method applyPattern() sets all attributes of a UnicodeSet at once, based on a string pattern.

Pattern syntax

Patterns are accepted by the constructors and the applyPattern() methods and returned by the toPattern() method. These patterns follow a syntax similar to that employed by version 8 regular expression character classes:

pattern :=  ('[' '^'? item* ']') | property
item :=  char | (char '-' char) | pattern-expr
pattern-expr :=  pattern | pattern-expr pattern | pattern-expr op pattern
op :=  '&' | '-'
special :=  '[' | ']' | '-'
char :=  any character that is not special
| ('\u005C'
any character)
| ('\u005Cu' hex hex hex hex)
hex :=  any character for which Character.digit(c, 16) returns a non-negative result
property :=  a Unicode property set pattern

Legend:
a := b   a may be replaced by b
a? zero or one instance of a
a* one or more instances of a
a | b either a or b
'a' the literal string between the quotes

Any character may be preceded by a backslash in order to remove any special meaning. White space characters, as defined by UCharacter.isWhitespace(), are ignored, unless they are escaped.

Property patterns specify a set of characters having a certain property as defined by the Unicode standard. Both the POSIX-like "[:Lu:]" and the Perl-like syntax "\p{Lu}" are recognized. For a complete list of supported property patterns, see the User's Guide for UnicodeSet at http://oss.software.ibm.com/icu/userguide/unicodeset.html. Actual determination of property data is defined by the underlying Unicode database as implemented by UCharacter.

Patterns specify individual characters, ranges of characters, and Unicode property sets. When elements are concatenated, they specify their union. To complement a set, place a '^' immediately after the opening '['. Property patterns are inverted by modifying their delimiters; "[:^foo]" and "\P{foo}". In any other location, '^' has no special meaning.

Ranges are indicated by placing two a '-' between two characters, as in "a-z". This specifies the range of all characters from the left to the right, in Unicode order. If the left character is greater than or equal to the right character it is a syntax error. If a '-' occurs as the first character after the opening '[' or '[^', or if it occurs as the last character before the closing ']', then it is taken as a literal. Thus "[a\u005C-b]", "[-ab]", and "[ab-]" all indicate the same set of three characters, 'a', 'b', and '-'.

Sets may be intersected using the '&' operator or the asymmetric set difference may be taken using the '-' operator, for example, "[[:L:]&[\u005Cu0000-\u005Cu0FFF]]" indicates the set of all Unicode letters with values less than 4096. Operators ('&' and '|') have equal precedence and bind left-to-right. Thus "[[:L:]-[a-z]-[\u005Cu0100-\u005Cu01FF]]" is equivalent to "[[[:L:]-[a-z]]-[\u005Cu0100-\u005Cu01FF]]". This only really matters for difference; intersection is commutative.

[a]The set containing 'a'
[a-z]The set containing 'a' through 'z' and all letters in between, in Unicode order
[^a-z]The set containing all characters but 'a' through 'z', that is, U+0000 through 'a'-1 and 'z'+1 through U+10FFFF
[[pat1][pat2]] The union of sets specified by pat1 and pat2
[[pat1]&[pat2]] The intersection of sets specified by pat1 and pat2
[[pat1]-[pat2]] The asymmetric difference of sets specified by pat1 and pat2
[:Lu:] or \p{Lu} The set of characters having the specified Unicode property; in this case, Unicode uppercase letters
[:^Lu:] or \P{Lu} The set of characters not having the given Unicode property

Author:
Alan Liu
Stable:

Definition at line 217 of file uniset.h.


Constructor & Destructor Documentation

UnicodeSet::UnicodeSet  
 

Constructs an empty set.

Stable:

UnicodeSet::UnicodeSet UChar32    start,
UChar32    end
 

Constructs a set containing the given range.

If end > start then an empty set is created.

Parameters:
start  first character, inclusive, of range
end  last character, inclusive, of range

UnicodeSet::UnicodeSet const UnicodeString   pattern,
UErrorCode   status
 

Constructs a set from the given pattern.

See the class description for the syntax of the pattern language.

Parameters:
pattern  a string specifying what characters are in the set
Exceptions:
code  >IllegalArgumentException if the pattern contains a syntax error.
Stable:

UnicodeSet::UnicodeSet int8_t    category,
UErrorCode   status
 

DEPRECATED Constructs a set from the given Unicode character category.

Parameters:
category  an integer indicating the character category as defined in uchar.h.
Deprecated:
To be removed after 2002-DEC-31

UnicodeSet::UnicodeSet const UnicodeSet &    o
 

Constructs a set that is identical to the given UnicodeSet.

Stable:

virtual UnicodeSet::~UnicodeSet   [virtual]
 

Destructs the set.

Stable:

UnicodeSet::UnicodeSet const UnicodeString   pattern,
ParsePosition   pos,
const SymbolTable &    symbols,
UErrorCode   status
[private]
 

Constructs a set from the given pattern.

See the class description for the syntax of the pattern language.

Parameters:
pattern  a string specifying what characters are in the set
pos  on input, the position in pattern at which to start parsing. On output, the position after the last character parsed.
varNameToChar  a mapping from variable names (String) to characters (Character). May be null. If varCharToSet is non-null, then names may map to either single characters or sets, depending on whether a mapping exists in varCharToSet. If varCharToSet is null then all names map to single characters.
varCharToSet  a mapping from characters (Character objects from varNameToChar) to UnicodeSet objects. May be null. Is only used if varNameToChar is also non-null.
Exceptions:
code  >IllegalArgumentException if the pattern contains a syntax error.

UnicodeSet::UnicodeSet const UnicodeString   pattern,
ParsePosition   pos,
UErrorCode   status
[private]
 

Constructs a set from the given pattern.

Identical to the 4-parameter ParsePosition contstructor, but does not take a SymbolTable, and does not recognize embedded variables.


Member Function Documentation

void UnicodeSet::_appendToPat UnicodeString   buf,
UChar32    c,
UBool    escapeUnprintable
[static, private]
 

void UnicodeSet::_applyPattern const UnicodeString   pattern,
ParsePosition   pos,
const SymbolTable *    symbols,
UnicodeString   rebuiltPat,
UErrorCode   status
[private]
 

UnicodeString& UnicodeSet::_generatePattern UnicodeString   result,
UBool    escapeUnprintable
const [private]
 

UnicodeString& UnicodeSet::_toPattern UnicodeString   result,
UBool    escapeUnprintable
const [private]
 

void UnicodeSet::add const UChar32   other,
int32_t    otherLen,
int8_t    polarity
[private]
 

void UnicodeSet::add UChar32    c
 

Adds the specified character to this set if it is not already present.

If this set already contains the specified character, the call leaves this set unchanged.

Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

virtual void UnicodeSet::add UChar32    start,
UChar32    end
[virtual]
 

Adds the specified range to this set if it is not already present.

If this set already contains the specified range, the call leaves this set unchanged. If end > start then an empty range is added, leaving the set unchanged. This is equivalent to a boolean logic OR, or a set UNION.

Parameters:
start  first character, inclusive, of range to be added to this set.
end  last character, inclusive, of range to be added to this set.
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

virtual void UnicodeSet::addAll const UnicodeSet &    c [virtual]
 

Adds all of the elements in the specified set to this set if they're not already present.

This operation effectively modifies this set so that its value is the union of the two sets. The behavior of this operation is unspecified if the specified collection is modified while the operation is in progress.

Parameters:
c  set whose elements are to be added to this set.
See also:
add(char, char)
Stable:

void UnicodeSet::applyPattern const UnicodeString   pattern,
ParsePosition   pos,
const SymbolTable *    symbols,
UErrorCode   status
[private]
 

Parses the given pattern, starting at the given position.

The character at pattern.charAt(pos.getIndex()) must be '[', or the parse fails. Parsing continues until the corresponding closing ']'. If a syntax error is encountered between the opening and closing brace, the parse fails. Upon return from a successful parse, the ParsePosition is updated to point to the character following the closing ']', and a StringBuffer containing a pairs list for the parsed pattern is returned. This method calls itself recursively to parse embedded subpatterns.

Parameters:
pattern  the string containing the pattern to be parsed. The portion of the string from pos.getIndex(), which must be a '[', to the corresponding closing ']', is parsed.
pos  upon entry, the position at which to being parsing. The character at pattern.charAt(pos.getIndex()) must be a '['. Upon return from a successful parse, pos.getIndex() is either the character after the closing ']' of the parsed pattern, or pattern.length() if the closing ']' is the last character of the pattern string.
Returns:
a StringBuffer containing a pairs list for the parsed substring of pattern
Exceptions:
IllegalArgumentException  if the parse fails.

virtual void UnicodeSet::applyPattern const UnicodeString   pattern,
UErrorCode   status
[virtual]
 

Modifies this set to represent the set specified by the given pattern, optionally ignoring white space.

See the class description for the syntax of the pattern language.

Parameters:
pattern  a string specifying what characters are in the set
Exceptions:
code  >IllegalArgumentException if the pattern contains a syntax error.
Stable:

UChar32 UnicodeSet::charAt int32_t    index const
 

Returns the character at the given index within this set, where the set is ordered by ascending code point.

If the index is out of range, return (UChar32)-1. The inverse of this method is indexOf().

Parameters:
index  an index from 0..size()-1
Returns:
the character at the given index, or (UChar32)-1.

virtual void UnicodeSet::clear void    [virtual]
 

Removes all of the elements from this set.

This set will be empty after this call returns.

Stable:

virtual UnicodeFunctor* UnicodeSet::clone void    const [virtual]
 

Returns a copy of this object.

All UnicodeFunctor objects have to support cloning in order to allow classes using UnicodeFunctors, such as Transliterator, to implement cloning.

Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

Reimplemented from UnicodeFunctor.

virtual void UnicodeSet::compact   [virtual]
 

Reallocate this objects internal structures to take up the least possible space, without changing this object's value.

void UnicodeSet::complement UChar32    c
 

Complements the specified character in this set.

The character will be removed if it is in this set, or will be added if it is not in this set.

Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

virtual void UnicodeSet::complement UChar32    start,
UChar32    end
[virtual]
 

Complements the specified range in this set.

Any character in the range will be removed if it is in this set, or will be added if it is not in this set. If end > start then an empty range is complemented, leaving the set unchanged. This is equivalent to a boolean logic XOR.

Parameters:
start  first character, inclusive, of range to be removed from this set.
end  last character, inclusive, of range to be removed from this set.
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

virtual void UnicodeSet::complement void    [virtual]
 

Inverts this set.

This operation modifies this set so that its value is its complement. This is equivalent to complement(MIN_VALUE, MAX_VALUE).

Stable:

virtual void UnicodeSet::complementAll const UnicodeSet &    c [virtual]
 

Complements in this set all elements contained in the specified set.

Any character in the other set will be removed if it is in this set, or will be added if it is not in this set.

Parameters:
c  set that defines which elements will be xor'ed from this set.

virtual UBool UnicodeSet::contains UChar32    c const [virtual]
 

Returns true if this set contains the specified char.

Returns:
true if this set contains the specified char.
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

Reimplemented from UnicodeFilter.

virtual UBool UnicodeSet::contains UChar32    start,
UChar32    end
const [virtual]
 

Returns true if this set contains the specified range of chars.

Returns:
true if this set contains the specified range of chars.
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

UBool UnicodeSet::containsAll const UnicodeString   s const [private]
 

Return TRUE if every character in s is in this set.

virtual UBool UnicodeSet::containsAll const UnicodeSet &    c const [virtual]
 

Returns true if the specified set is a subset of this set.

Parameters:
c  set to be checked for containment in this set.
Returns:
true if this set contains all of the elements of the specified set.
Stable:

void UnicodeSet::ensureBufferCapacity int32_t    newLen [private]
 

void UnicodeSet::ensureCapacity int32_t    newLen [private]
 

void UnicodeSet::exclusiveOr const UChar32   other,
int32_t    otherLen,
int8_t    polarity
[private]
 

virtual UClassID UnicodeSet::getDynamicClassID void    const [inline, virtual]
 

Implement UnicodeFunctor API.

Returns:
The class ID for this object. All objects of a given class have the same class ID. Objects of other classes have different class IDs.

Reimplemented from UnicodeFunctor.

Definition at line 676 of file uniset.h.

virtual int32_t UnicodeSet::getRangeCount void    const [virtual]
 

Iteration method that returns the number of ranges contained in this set.

See also:
getRangeStart , getRangeEnd

virtual UChar32 UnicodeSet::getRangeEnd int32_t    index const [virtual]
 

Iteration method that returns the last character in the specified range of this set.

See also:
getRangeStart , getRangeEnd

virtual UChar32 UnicodeSet::getRangeStart int32_t    index const [virtual]
 

Iteration method that returns the first character in the specified range of this set.

See also:
getRangeCount , getRangeEnd

UClassID UnicodeSet::getStaticClassID void    [inline, static]
 

Return the class ID for this class.

This is useful only for comparing to a return value from getDynamicClassID(). For example:

 .      Base* polymorphic_pointer = createPolymorphicObject();
 .      if (polymorphic_pointer->getDynamicClassID() ==
 .          Derived::getStaticClassID()) ...
 
Returns:
The class ID for all objects of this class.
Stable:

Reimplemented from UnicodeFunctor.

Definition at line 667 of file uniset.h.

virtual int32_t UnicodeSet::hashCode void    const [virtual]
 

Returns the hash code value for this set.

Returns:
the hash code value for this set.
See also:
Object::hashCode()
Stable:

int32_t UnicodeSet::indexOf UChar32    c const
 

Returns the index of the given character within this set, where the set is ordered by ascending code point.

If the character is not in this set, return -1. The inverse of this method is charAt().

Returns:
an index from 0..size()-1, or -1

virtual UBool UnicodeSet::isEmpty void    const [virtual]
 

Returns true if this set contains no elements.

Returns:
true if this set contains no elements.
Stable:

UMatchDegree UnicodeSet::matches const Replaceable   text,
int32_t   offset,
int32_t    limit,
UBool    incremental
[virtual]
 

Implement UnicodeMatcher::matches().

Reimplemented from UnicodeFilter.

virtual UBool UnicodeSet::matchesIndexValue uint8_t    v const [private, virtual]
 

Returns true if this set contains any character whose low byte is the given value.

This is used by RuleBasedTransliterator for indexing.

Reimplemented from UnicodeFilter.

UBool UnicodeSet::operator!= const UnicodeSet &    o const [inline]
 

Compares the specified object with this set for equality.

Returns true if the specified set is not equal to this set.

Stable:

Definition at line 800 of file uniset.h.

UnicodeSet& UnicodeSet::operator= const UnicodeSet &    o
 

Assigns this object to be a copy of another.

Stable:

virtual UBool UnicodeSet::operator== const UnicodeSet &    o const [virtual]
 

Compares the specified object with this set for equality.

Returns true if the two sets have the same size, and every member of the specified set is contained in this set (or equivalently, every member of this set is contained in the specified set).

Parameters:
o  set to be compared for equality with this set.
Returns:
true if the specified set is equal to this set.
Stable:

Referenced by operator!=().

void UnicodeSet::remove UChar32    c
 

Removes the specified character from this set if it is present.

The set will not contain the specified range once the call returns.

Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

virtual void UnicodeSet::remove UChar32    start,
UChar32    end
[virtual]
 

Removes the specified range from this set if it is present.

The set will not contain the specified range once the call returns. If end > start then an empty range is removed, leaving the set unchanged.

Parameters:
start  first character, inclusive, of range to be removed from this set.
end  last character, inclusive, of range to be removed from this set.
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

virtual void UnicodeSet::removeAll const UnicodeSet &    c [virtual]
 

Removes from this set all of its elements that are contained in the specified set.

This operation effectively modifies this set so that its value is the asymmetric set difference of the two sets.

Parameters:
c  set that defines which elements will be removed from this set.
Stable:

UBool UnicodeSet::resemblesPattern const UnicodeString   pattern,
int32_t    pos
[static]
 

Return true if the given position, in the given pattern, appears to be the start of a UnicodeSet pattern.

void UnicodeSet::retain const UChar32   other,
int32_t    otherLen,
int8_t    polarity
[private]
 

void UnicodeSet::retain UChar32    c
 

Retain the specified character from this set if it is present.

Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

virtual void UnicodeSet::retain UChar32    start,
UChar32    end
[virtual]
 

Retain only the elements in this set that are contained in the specified range.

If end > start then an empty range is retained, leaving the set empty. This is equivalent to a boolean logic AND, or a set INTERSECTION.

Parameters:
start  first character, inclusive, of range to be retained to this set.
end  last character, inclusive, of range to be retained to this set.
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

virtual void UnicodeSet::retainAll const UnicodeSet &    c [virtual]
 

Retains only the elements in this set that are contained in the specified set.

In other words, removes from this set all of its elements that are not contained in the specified set. This operation effectively modifies this set so that its value is the intersection of the two sets.

Parameters:
c  set that defines which elements this set will retain.
Stable:

void UnicodeSet::set UChar32    start,
UChar32    end
 

Make this object represent the range start - end.

If end > start then this object is set to an an empty range.

Parameters:
start  first character in the set, inclusive @rparam end last character in the set, inclusive

virtual int32_t UnicodeSet::size void    const [virtual]
 

Returns the number of elements in this set (its cardinality), n, where 0 <= n <= 65536.

Returns:
the number of elements in this set (its cardinality).
Stable:

void UnicodeSet::swapBuffers void    [private]
 

virtual UnicodeString& UnicodeSet::toPattern UnicodeString   result,
UBool    escapeUnprintable = FALSE
const [virtual]
 

Returns a string representation of this set.

If the result of calling this function is passed to a UnicodeSet constructor, it will produce another set that is equal to this one.

Parameters:
result  the string to receive the rules. Previous contents will be deleted.
escapeUnprintable  if TRUE then convert unprintable character to their hex escape representations, \uxxxx or \Uxxxxxxxx. Unprintable characters are those other than U+000A, U+0020..U+007E.
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

Reimplemented from UnicodeFilter.


Friends And Related Function Documentation

friend class NormalizationTransliterator [friend]
 

Definition at line 563 of file uniset.h.

friend class TransliterationRule [friend]
 

Definition at line 691 of file uniset.h.

friend class Transliterator [friend]
 

Definition at line 688 of file uniset.h.

friend class TransliteratorIDParser [friend]
 

Definition at line 690 of file uniset.h.

friend class TransliteratorParser [friend]
 

Definition at line 689 of file uniset.h.


Member Data Documentation

const UChar32 UnicodeSet::MAX_VALUE [static]
 

Maximum value that can be stored in a UnicodeSet.

Definition at line 246 of file uniset.h.

const UChar32 UnicodeSet::MIN_VALUE [static]
 

Minimum value that can be stored in a UnicodeSet.

Definition at line 241 of file uniset.h.

UChar32* UnicodeSet::buffer [private]
 

Definition at line 223 of file uniset.h.

int32_t UnicodeSet::bufferCapacity [private]
 

Definition at line 221 of file uniset.h.

int32_t UnicodeSet::capacity [private]
 

Definition at line 220 of file uniset.h.

const char UnicodeSet::fgClassID [static, private]
 

Class identifier for subclasses of UnicodeFunctor that do not define their class (anonymous subclasses).

Reimplemented from UnicodeFunctor.

Definition at line 680 of file uniset.h.

int32_t UnicodeSet::len [private]
 

Definition at line 219 of file uniset.h.

UChar32* UnicodeSet::list [private]
 

Definition at line 222 of file uniset.h.

UnicodeString UnicodeSet::pat [private]
 

The pattern representation of this set.

This may not be the most economical pattern. It is the pattern supplied to applyPattern(), with variables substituted and whitespace removed. For sets constructed without applyPattern(), or modified using the non-pattern API, this string will be empty, indicating that toPattern() must generate a pattern representation from the inversion list.

Definition at line 234 of file uniset.h.


The documentation for this class was generated from the following file:
Generated on Tue Apr 9 11:30:51 2002 for ICU 2.1 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001