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

RuleBasedCollator Class Reference

The RuleBasedCollator class provides the simple implementation of Collator, using data-driven tables. More...

#include <tblcoll.h>

Inheritance diagram for RuleBasedCollator::

Collator UObject UMemory List of all members.

Public Methods

 RuleBasedCollator (const UnicodeString &rules, UErrorCode &status)
 RuleBasedCollator constructor. More...

 RuleBasedCollator (const UnicodeString &rules, ECollationStrength collationStrength, UErrorCode &status)
 RuleBasedCollator constructor. More...

 RuleBasedCollator (const UnicodeString &rules, UColAttributeValue decompositionMode, UErrorCode &status)
 RuleBasedCollator constructor. More...

 RuleBasedCollator (const UnicodeString &rules, ECollationStrength collationStrength, UColAttributeValue decompositionMode, UErrorCode &status)
 RuleBasedCollator constructor. More...

 RuleBasedCollator (const RuleBasedCollator &other)
 Copy constructor. More...

virtual ~RuleBasedCollator ()
 Destructor. More...

RuleBasedCollator & operator= (const RuleBasedCollator &other)
 Assignment operator. More...

virtual UBool operator== (const Collator &other) const
 Returns true if argument is the same as this object. More...

virtual UBool operator!= (const Collator &other) const
 Returns true if argument is not the same as this object. More...

virtual Collatorclone (void) const
 Makes a deep copy of the object. More...

virtual CollationElementIteratorcreateCollationElementIterator (const UnicodeString &source) const
 Creates a collation element iterator for the source string. More...

virtual CollationElementIteratorcreateCollationElementIterator (const CharacterIterator &source) const
 Creates a collation element iterator for the source. More...

virtual EComparisonResult compare (const UnicodeString &source, const UnicodeString &target) const
 Compares a range of character data stored in two different strings based on the collation rules. More...

virtual UCollationResult compare (const UnicodeString &source, const UnicodeString &target, UErrorCode &status) const
 The comparison function compares the character data stored in two different strings. More...

virtual EComparisonResult compare (const UnicodeString &source, const UnicodeString &target, int32_t length) const
 Compares a range of character data stored in two different strings based on the collation rules up to the specified length. More...

virtual UCollationResult compare (const UnicodeString &source, const UnicodeString &target, int32_t length, UErrorCode &status) const
 Does the same thing as compare but limits the comparison to a specified length. More...

virtual EComparisonResult compare (const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength) const
 The comparison function compares the character data stored in two different string arrays. More...

virtual UCollationResult compare (const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength, UErrorCode &status) const
 The comparison function compares the character data stored in two different string arrays. More...

virtual CollationKeygetCollationKey (const UnicodeString &source, CollationKey &key, UErrorCode &status) const
 Transforms a specified region of the string into a series of characters that can be compared with CollationKey.compare. More...

virtual CollationKeygetCollationKey (const UChar *source, int32_t sourceLength, CollationKey &key, UErrorCode &status) const
 Transforms a specified region of the string into a series of characters that can be compared with CollationKey.compare. More...

virtual int32_t hashCode (void) const
 Generates the hash code for the rule-based collation object. More...

virtual const Locale getLocale (ULocDataLocaleType type, UErrorCode &status) const
 Gets the locale of the Collator. More...

const UnicodeStringgetRules (void) const
 Gets the table-based rules for the collation object. More...

virtual void getVersion (UVersionInfo info) const
 Gets the version information for a Collator. More...

int32_t getMaxExpansion (int32_t order) const
 Return the maximum length of any expansion sequences that end with the specified comparison order. More...

virtual UClassID getDynamicClassID (void) const
 Returns a unique class ID POLYMORPHICALLY. More...

uint8_t * cloneRuleData (int32_t &length, UErrorCode &status)
 Returns the binary format of the class's rules. More...

void getRules (UColRuleOption delta, UnicodeString &buffer)
 Returns current rules. More...

virtual void setAttribute (UColAttribute attr, UColAttributeValue value, UErrorCode &status)
 Universal attribute setter. More...

virtual UColAttributeValue getAttribute (UColAttribute attr, UErrorCode &status)
 Universal attribute getter. More...

virtual uint32_t setVariableTop (const UChar *varTop, int32_t len, UErrorCode &status)
 Sets the variable top to a collation element value of a string supplied. More...

virtual uint32_t setVariableTop (const UnicodeString varTop, UErrorCode &status)
 Sets the variable top to a collation element value of a string supplied. More...

virtual void setVariableTop (const uint32_t varTop, UErrorCode &status)
 Sets the variable top to a collation element value supplied. More...

virtual uint32_t getVariableTop (UErrorCode &status) const
 Gets the variable top value of a Collator. More...

virtual UnicodeSetgetTailoredSet (UErrorCode &status) const
 Get an UnicodeSet that contains all the characters and sequences tailored in this collator. More...

virtual CollatorsafeClone (void)
 Thread safe cloning operation. More...

virtual int32_t getSortKey (const UnicodeString &source, uint8_t *result, int32_t resultLength) const
 Get the sort key as an array of bytes from an UnicodeString. More...

virtual int32_t getSortKey (const UChar *source, int32_t sourceLength, uint8_t *result, int32_t resultLength) const
 Get the sort key as an array of bytes from an UChar buffer. More...

virtual ECollationStrength getStrength (void) const
 Determines the minimum strength that will be use in comparison or transformation. More...

virtual void setStrength (ECollationStrength newStrength)
 Sets the minimum strength to be used in comparison or transformation. More...

const UCollatorgetUCollator ()
 Get UCollator data struct. More...


Static Public Methods

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


Protected Methods

virtual void setLocales (const Locale &requestedLocale, const Locale &validLocale)
 Used internally by registraton to define the requested and valid locales. More...


Private Methods

 RuleBasedCollator ()
 Default constructor. More...

 RuleBasedCollator (UCollator *collator, UnicodeString *rule)
 Constructor that takes in a UCollator struct. More...

 RuleBasedCollator (const Locale &desiredLocale, UErrorCode &status)
 RuleBasedCollator constructor. More...

void construct (const UnicodeString &rules, UColAttributeValue collationStrength, UColAttributeValue decompositionMode, UErrorCode &status)
 common constructor implementation. More...

void setUCollator (const Locale &locale, UErrorCode &status)
 Creates the c struct for ucollator. More...

void setUCollator (const char *locale, UErrorCode &status)
 Creates the c struct for ucollator. More...

void setUCollator (UCollator *collator, UnicodeString *rules)
 Creates the c struct for ucollator. More...

void checkOwned (void)
void setRuleStringFromCollator (UErrorCode &status)
Collator::EComparisonResult getEComparisonResult (const UCollationResult &result) const
 Converts C's UCollationResult to EComparisonResult. More...

Collator::ECollationStrength getECollationStrength (const UCollationStrength &strength) const
 Converts C's UCollationStrength to ECollationStrength. More...

UCollationStrength getUCollationStrength (const Collator::ECollationStrength &strength) const
 Converts C++'s ECollationStrength to UCollationStrength. More...


Private Attributes

UBool dataIsOwned
UBool isWriteThroughAlias
UCollatorucollator
 c struct for collation. More...

UnicodeStringurulestring
 Rule UnicodeString. More...


Static Private Attributes

const int32_t UNMAPPED
const int32_t CHARINDEX
const int32_t EXPANDCHARINDEX
const int32_t CONTRACTCHARINDEX
const int32_t PRIMARYORDERINCREMENT
const int32_t SECONDARYORDERINCREMENT
const int32_t TERTIARYORDERINCREMENT
const int32_t PRIMARYORDERMASK
const int32_t SECONDARYORDERMASK
const int32_t TERTIARYORDERMASK
const int32_t IGNORABLEMASK
const int32_t PRIMARYDIFFERENCEONLY
const int32_t SECONDARYDIFFERENCEONLY
const int32_t PRIMARYORDERSHIFT
const int32_t SECONDARYORDERSHIFT
const int32_t COLELEMENTSTART
const int32_t PRIMARYLOWZEROMASK
const int32_t RESETSECONDARYTERTIARY
const int32_t RESETTERTIARY
const int32_t PRIMIGNORABLE

Friends

class CollationElementIterator
 Used to iterate over collation elements in a character source. More...

class Collator
 Collator ONLY needs access to RuleBasedCollator(const Locale&, UErrorCode&). More...

class StringSearch
 Searching over collation elements in a character source. More...


Detailed Description

The RuleBasedCollator class provides the simple implementation of Collator, using data-driven tables.

The user can create a customized table-based collation.

Important: The ICU collation service has been reimplemented in order to achieve better performance and UCA compliance. For details, see the collation design document.

RuleBasedCollator is a thin C++ wrapper over the C implementation.

For more information about the collation service see the users guide.

Collation service provides correct sorting orders for most locales supported in ICU. If specific data for a locale is not available, the orders eventually falls back to the UCA sort order.

Sort ordering may be customized by providing your own set of rules. For more on this subject see the Collation customization section of the users guide.

Note, RuleBasedCollator is not to be subclassed.

See also:
Collator
Version:
2.0 11/15/2001

Definition at line 105 of file tblcoll.h.


Constructor & Destructor Documentation

RuleBasedCollator::RuleBasedCollator const UnicodeString   rules,
UErrorCode   status
 

RuleBasedCollator constructor.

This takes the table rules and builds a collation table out of them. Please see RuleBasedCollator class description for more details on the collation rule syntax.

Parameters:
rules  the collation rules to build the collation table from.
status  reporting a success or an error.
See also:
Locale
Stable:
ICU 2.0

RuleBasedCollator::RuleBasedCollator const UnicodeString   rules,
ECollationStrength    collationStrength,
UErrorCode   status
 

RuleBasedCollator constructor.

This takes the table rules and builds a collation table out of them. Please see RuleBasedCollator class description for more details on the collation rule syntax.

Parameters:
rules  the collation rules to build the collation table from.
collationStrength  default strength for comparison
status  reporting a success or an error.
See also:
Locale
Stable:
ICU 2.0

RuleBasedCollator::RuleBasedCollator const UnicodeString   rules,
UColAttributeValue    decompositionMode,
UErrorCode   status
 

RuleBasedCollator constructor.

This takes the table rules and builds a collation table out of them. Please see RuleBasedCollator class description for more details on the collation rule syntax.

Parameters:
rules  the collation rules to build the collation table from.
decompositionMode  the normalisation mode
status  reporting a success or an error.
See also:
Locale
Stable:
ICU 2.0

RuleBasedCollator::RuleBasedCollator const UnicodeString   rules,
ECollationStrength    collationStrength,
UColAttributeValue    decompositionMode,
UErrorCode   status
 

RuleBasedCollator constructor.

This takes the table rules and builds a collation table out of them. Please see RuleBasedCollator class description for more details on the collation rule syntax.

Parameters:
rules  the collation rules to build the collation table from.
collationStrength  default strength for comparison
decompositionMode  the normalisation mode
status  reporting a success or an error.
See also:
Locale
Stable:
ICU 2.0

RuleBasedCollator::RuleBasedCollator const RuleBasedCollator &    other
 

Copy constructor.

Parameters:
other  the RuleBasedCollator object to be copied
See also:
Locale
Stable:
ICU 2.0

virtual RuleBasedCollator::~RuleBasedCollator   [virtual]
 

Destructor.

Stable:
ICU 2.0

RuleBasedCollator::RuleBasedCollator   [private]
 

Default constructor.

RuleBasedCollator::RuleBasedCollator UCollator   collator,
UnicodeString   rule
[private]
 

Constructor that takes in a UCollator struct.

Parameters:
collator  UCollator struct
rule  the rule for the collator.

RuleBasedCollator::RuleBasedCollator const Locale   desiredLocale,
UErrorCode   status
[private]
 

RuleBasedCollator constructor.

This constructor takes a locale. The only caller of this class should be Collator::createInstance(). If createInstance() happens to know that the requested locale's collation is implemented as a RuleBasedCollator, it can then call this constructor. OTHERWISE IT SHOULDN'T, since this constructor ALWAYS RETURNS A VALID COLLATION TABLE. It does this by falling back to defaults.

Parameters:
desiredLocale  locale used
status  error code status


Member Function Documentation

void RuleBasedCollator::checkOwned void    [private]
 

virtual Collator* RuleBasedCollator::clone void    const [virtual]
 

Makes a deep copy of the object.

The caller owns the returned object.

Returns:
the cloned object.
Stable:
ICU 2.0

Reimplemented from Collator.

uint8_t* RuleBasedCollator::cloneRuleData int32_t &    length,
UErrorCode   status
 

Returns the binary format of the class's rules.

The format is that of .col files.

Parameters:
length  Returns the length of the data, in bytes
status  the error code status.
Returns:
memory, owned by the caller, of size 'length' bytes.
Stable:
ICU 2.2

virtual UCollationResult RuleBasedCollator::compare const UChar *    source,
int32_t    sourceLength,
const UChar *    target,
int32_t    targetLength,
UErrorCode   status
const [virtual]
 

The comparison function compares the character data stored in two different string arrays.

Returns information about whether a string array is less than, greater than or equal to another string array.

Parameters:
source  the source string array to be compared with.
sourceLength  the length of the source string array. If this value is equal to -1, the string array is null-terminated.
target  the string that is to be compared with the source string.
targetLength  the length of the target string array. If this value is equal to -1, the string array is null-terminated.
status  possible error code
Returns:
Returns an enum value. UCOL_GREATER if source is greater than target; UCOL_EQUAL if source is equal to target; UCOL_LESS if source is less than target
Draft:
This API has been introduced in ICU 2.6. It is still in draft state and may be modified in a future release.

Reimplemented from Collator.

virtual EComparisonResult RuleBasedCollator::compare const UChar *    source,
int32_t    sourceLength,
const UChar *    target,
int32_t    targetLength
const [virtual]
 

The comparison function compares the character data stored in two different string arrays.

Returns information about whether a string array is less than, greater than or equal to another string array.

Example of use:

 .       UChar ABC[] = {0x41, 0x42, 0x43, 0};  // = "ABC"
 .       UChar abc[] = {0x61, 0x62, 0x63, 0};  // = "abc"
 .       UErrorCode status = U_ZERO_ERROR;
 .       Collator *myCollation =
 .                         Collator::createInstance(Locale::US, status);
 .       if (U_FAILURE(status)) return;
 .       myCollation->setStrength(Collator::PRIMARY);
 .       // result would be Collator::EQUAL ("abc" == "ABC")
 .       // (no primary difference between "abc" and "ABC")
 .       Collator::EComparisonResult result =
 .                             myCollation->compare(abc, 3, ABC, 3);
 .       myCollation->setStrength(Collator::TERTIARY);
 .       // result would be Collator::LESS ("abc" <<< "ABC")
 .       // (with tertiary difference between "abc" and "ABC")
 .       result =  myCollation->compare(abc, 3, ABC, 3);
 
Parameters:
source  the source string array to be compared with.
sourceLength  the length of the source string array. If this value is equal to -1, the string array is null-terminated.
target  the string that is to be compared with the source string.
targetLength  the length of the target string array. If this value is equal to -1, the string array is null-terminated.
Returns:
Returns a byte value. GREATER if source is greater than target; EQUAL if source is equal to target; LESS if source is less than target
Deprecated:
ICU 2.6 Use overload with UErrorCode&

Reimplemented from Collator.

virtual UCollationResult RuleBasedCollator::compare const UnicodeString   source,
const UnicodeString   target,
int32_t    length,
UErrorCode   status
const [virtual]
 

Does the same thing as compare but limits the comparison to a specified length.

Parameters:
source  the source string to be compared with.
target  the string that is to be compared with the source string.
length  the length the comparison is limited to
status  possible error code
Returns:
Returns an enum value. UCOL_GREATER if source (up to the specified length) is greater than target; UCOL_EQUAL if source (up to specified length) is equal to target; UCOL_LESS if source (up to the specified length) is less than target.
Draft:
This API has been introduced in ICU 2.6. It is still in draft state and may be modified in a future release.

Reimplemented from Collator.

virtual EComparisonResult RuleBasedCollator::compare const UnicodeString   source,
const UnicodeString   target,
int32_t    length
const [virtual]
 

Compares a range of character data stored in two different strings based on the collation rules up to the specified length.

Returns information about whether a string is less than, greater than or equal to another string in a language. This can be overriden in a subclass.

Parameters:
source  the source string.
target  the target string to be compared with the source string.
length  compares up to the specified length
Returns:
the comparison result. GREATER if the source string is greater than the target string, LESS if the source is less than the target. Otherwise, returns EQUAL.
Deprecated:
ICU 2.6 Use overload with UErrorCode&

Reimplemented from Collator.

virtual UCollationResult RuleBasedCollator::compare const UnicodeString   source,
const UnicodeString   target,
UErrorCode   status
const [virtual]
 

The comparison function compares the character data stored in two different strings.

Returns information about whether a string is less than, greater than or equal to another string.

Parameters:
source  the source string to be compared with.
target  the string that is to be compared with the source string.
status  possible error code
Returns:
Returns an enum value. UCOL_GREATER if source is greater than target; UCOL_EQUAL if source is equal to target; UCOL_LESS if source is less than target
Draft:
This API has been introduced in ICU 2.6. It is still in draft state and may be modified in a future release.

Reimplemented from Collator.

virtual EComparisonResult RuleBasedCollator::compare const UnicodeString   source,
const UnicodeString   target
const [virtual]
 

Compares a range of character data stored in two different strings based on the collation rules.

Returns information about whether a string is less than, greater than or equal to another string in a language. This can be overriden in a subclass.

Parameters:
source  the source string.
target  the target string to be compared with the source string.
Returns:
the comparison result. GREATER if the source string is greater than the target string, LESS if the source is less than the target. Otherwise, returns EQUAL.
Deprecated:
ICU 2.6 Use overload with UErrorCode&

Reimplemented from Collator.

void RuleBasedCollator::construct const UnicodeString   rules,
UColAttributeValue    collationStrength,
UColAttributeValue    decompositionMode,
UErrorCode   status
[private]
 

common constructor implementation.

Parameters:
rules  the collation rules to build the collation table from.
collationStrength  default strength for comparison
decompositionMode  the normalisation mode
status  reporting a success or an error.

virtual CollationElementIterator* RuleBasedCollator::createCollationElementIterator const CharacterIterator   source const [virtual]
 

Creates a collation element iterator for the source.

The caller of this method is responsible for the memory management of the returned pointer.

Parameters:
source  the CharacterIterator which produces the characters over which the CollationElementItgerator will iterate.
Returns:
the collation element iterator of the source using this as the based Collator.
Stable:
ICU 2.2

virtual CollationElementIterator* RuleBasedCollator::createCollationElementIterator const UnicodeString   source const [virtual]
 

Creates a collation element iterator for the source string.

The caller of this method is responsible for the memory management of the return pointer.

Parameters:
source  the string over which the CollationElementIterator will iterate.
Returns:
the collation element iterator of the source string using this as the based Collator.
Stable:
ICU 2.2

virtual UColAttributeValue RuleBasedCollator::getAttribute UColAttribute    attr,
UErrorCode   status
[virtual]
 

Universal attribute getter.

Parameters:
attr  attribute type
status  to indicate whether the operation went on smoothly or there were errors
Returns:
attribute value
Stable:
ICU 2.2

Reimplemented from Collator.

virtual CollationKey& RuleBasedCollator::getCollationKey const UChar *    source,
int32_t    sourceLength,
CollationKey   key,
UErrorCode   status
const [virtual]
 

Transforms a specified region of the string into a series of characters that can be compared with CollationKey.compare.

Use a CollationKey when you need to do repeated comparisions on the same string. For a single comparison the compare method will be faster.

Parameters:
source  the source string.
sourceLength  the length of the source string.
key  the transformed key of the source string.
status  the error code status.
Returns:
the transformed key.
See also:
CollationKey
Deprecated:
ICU 2.8 Use getSortKey(...) instead

Reimplemented from Collator.

virtual CollationKey& RuleBasedCollator::getCollationKey const UnicodeString   source,
CollationKey   key,
UErrorCode   status
const [virtual]
 

Transforms a specified region of the string into a series of characters that can be compared with CollationKey.compare.

Use a CollationKey when you need to do repeated comparisions on the same string. For a single comparison the compare method will be faster.

Parameters:
source  the source string.
key  the transformed key of the source string.
status  the error code status.
Returns:
the transformed key.
See also:
CollationKey
Deprecated:
ICU 2.8 Use getSortKey(...) instead

Reimplemented from Collator.

virtual UClassID RuleBasedCollator::getDynamicClassID void    const [virtual]
 

Returns a unique class ID POLYMORPHICALLY.

Pure virtual override. This method is to implement a simple version of RTTI, since not all C++ compilers support genuine RTTI. Polymorphic operator==() and clone() methods call this method.

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.
Stable:
ICU 2.0

Reimplemented from Collator.

Collator::ECollationStrength RuleBasedCollator::getECollationStrength const UCollationStrength   strength const [inline, private]
 

Converts C's UCollationStrength to ECollationStrength.

Parameters:
strength  member of the enum UCollationStrength
Returns:
ECollationStrength equivalent of UCollationStrength

Definition at line 834 of file tblcoll.h.

Collator::EComparisonResult RuleBasedCollator::getEComparisonResult const UCollationResult   result const [inline, private]
 

Converts C's UCollationResult to EComparisonResult.

Parameters:
result  member of the enum UComparisonResult
Returns:
EComparisonResult equivalent of UCollationResult
Deprecated:
ICU 2.6. We will not need it.

Definition at line 820 of file tblcoll.h.

virtual const Locale RuleBasedCollator::getLocale ULocDataLocaleType    type,
UErrorCode   status
const [virtual]
 

Gets the locale of the Collator.

Parameters:
type  can be either requested, valid or actual locale. For more information see the definition of ULocDataLocaleType in uloc.h
status  the error code status.
Returns:
locale where the collation data lives. If the collator was instantiated from rules, locale is empty.
Stable:
ICU 2.1

Reimplemented from Collator.

int32_t RuleBasedCollator::getMaxExpansion int32_t    order const
 

Return the maximum length of any expansion sequences that end with the specified comparison order.

Parameters:
order  a collation order returned by previous or next.
Returns:
maximum size of the expansion sequences ending with the collation element or 1 if collation element does not occur at the end of any expansion sequence
See also:
CollationElementIterator::getMaxExpansion
Stable:
ICU 2.0

void RuleBasedCollator::getRules UColRuleOption    delta,
UnicodeString   buffer
 

Returns current rules.

Delta defines whether full rules are returned or just the tailoring.

Parameters:
delta  one of UCOL_TAILORING_ONLY, UCOL_FULL_RULES.
buffer  UnicodeString to store the result rules
Stable:
ICU 2.2

const UnicodeString& RuleBasedCollator::getRules void    const
 

Gets the table-based rules for the collation object.

Returns:
returns the collation rules that the table collation object was created from.
Stable:
ICU 2.0

virtual int32_t RuleBasedCollator::getSortKey const UChar *    source,
int32_t    sourceLength,
uint8_t *    result,
int32_t    resultLength
const [virtual]
 

Get the sort key as an array of bytes from an UChar buffer.

Parameters:
source  string to be processed.
sourceLength  length of string to be processed. If -1, the string is 0 terminated and length will be decided by the function.
result  buffer to store result in. If NULL, number of bytes needed will be returned.
resultLength  length of the result buffer. If if not enough the buffer will be filled to capacity.
Returns:
Number of bytes needed for storing the sort key
Stable:
ICU 2.2

Reimplemented from Collator.

virtual int32_t RuleBasedCollator::getSortKey const UnicodeString   source,
uint8_t *    result,
int32_t    resultLength
const [virtual]
 

Get the sort key as an array of bytes from an UnicodeString.

Parameters:
source  string to be processed.
result  buffer to store result in. If NULL, number of bytes needed will be returned.
resultLength  length of the result buffer. If if not enough the buffer will be filled to capacity.
Returns:
Number of bytes needed for storing the sort key
Stable:
ICU 2.0

Reimplemented from Collator.

UClassID RuleBasedCollator::getStaticClassID void    [static]
 

Returns 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:
ICU 2.0

virtual ECollationStrength RuleBasedCollator::getStrength void    const [virtual]
 

Determines the minimum strength that will be use in comparison or transformation.

E.g. with strength == SECONDARY, the tertiary difference is ignored

E.g. with strength == PRIMARY, the secondary and tertiary difference are ignored.

Returns:
the current comparison level.
See also:
RuleBasedCollator::setStrength
Deprecated:
ICU 2.6 Use getAttribute(UCOL_STRENGTH...) instead

Reimplemented from Collator.

virtual UnicodeSet* RuleBasedCollator::getTailoredSet UErrorCode   status const [virtual]
 

Get an UnicodeSet that contains all the characters and sequences tailored in this collator.

Parameters:
status  error code of the operation
Returns:
a pointer to a UnicodeSet object containing all the code points and sequences that may sort differently than in the UCA. The object must be disposed of by using delete
Draft:
This API has been introduced in ICU 2.4. It is still in draft state and may be modified in a future release.

Reimplemented from Collator.

UCollationStrength RuleBasedCollator::getUCollationStrength const Collator::ECollationStrength   strength const [inline, private]
 

Converts C++'s ECollationStrength to UCollationStrength.

Parameters:
strength  member of the enum ECollationStrength
Returns:
UCollationStrength equivalent of ECollationStrength

Definition at line 852 of file tblcoll.h.

const UCollator * RuleBasedCollator::getUCollator   [inline]
 

Get UCollator data struct.

Used only by StringSearch & intltest.

Returns:
UCollator data struct
Internal:
For internal use only.

Definition at line 815 of file tblcoll.h.

virtual uint32_t RuleBasedCollator::getVariableTop UErrorCode   status const [virtual]
 

Gets the variable top value of a Collator.

Lower 16 bits are undefined and should be ignored.

Parameters:
status  error code (not changed by function). If error code is set, the return value is undefined.
Stable:
ICU 2.0

Reimplemented from Collator.

virtual void RuleBasedCollator::getVersion UVersionInfo    info const [virtual]
 

Gets the version information for a Collator.

Parameters:
info  the version # information, the result will be filled in
Stable:
ICU 2.0

Reimplemented from Collator.

virtual int32_t RuleBasedCollator::hashCode void    const [virtual]
 

Generates the hash code for the rule-based collation object.

Returns:
the hash code.
Stable:
ICU 2.0

Reimplemented from Collator.

virtual UBool RuleBasedCollator::operator!= const Collator   other const [virtual]
 

Returns true if argument is not the same as this object.

Parameters:
other  Collator object to be compared
Returns:
returns true if argument is not the same as this object.
Stable:
ICU 2.0

Reimplemented from Collator.

RuleBasedCollator& RuleBasedCollator::operator= const RuleBasedCollator &    other
 

Assignment operator.

Parameters:
other  other RuleBasedCollator object to compare with.
Stable:
ICU 2.0

virtual UBool RuleBasedCollator::operator== const Collator   other const [virtual]
 

Returns true if argument is the same as this object.

Parameters:
other  Collator object to be compared.
Returns:
true if arguments is the same as this object.
Stable:
ICU 2.0

Reimplemented from Collator.

virtual Collator* RuleBasedCollator::safeClone void    [virtual]
 

Thread safe cloning operation.

Returns:
pointer to the new clone, user should remove it.
Stable:
ICU 2.2

Reimplemented from Collator.

virtual void RuleBasedCollator::setAttribute UColAttribute    attr,
UColAttributeValue    value,
UErrorCode   status
[virtual]
 

Universal attribute setter.

Parameters:
attr  attribute type
value  attribute value
status  to indicate whether the operation went on smoothly or there were errors
Stable:
ICU 2.2

Reimplemented from Collator.

virtual void RuleBasedCollator::setLocales const Locale   requestedLocale,
const Locale   validLocale
[protected, virtual]
 

Used internally by registraton to define the requested and valid locales.

Parameters:
requestedLocale  the requsted locale
validLocale  the valid locale
Internal:
For internal use only.

Reimplemented from Collator.

void RuleBasedCollator::setRuleStringFromCollator UErrorCode   status [private]
 

virtual void RuleBasedCollator::setStrength ECollationStrength    newStrength [virtual]
 

Sets the minimum strength to be used in comparison or transformation.

See also:
RuleBasedCollator::getStrength
Parameters:
newStrength  the new comparison level.
Deprecated:
ICU 2.6 Use setAttribute(UCOL_STRENGTH...) instead

Reimplemented from Collator.

void RuleBasedCollator::setUCollator UCollator   collator,
UnicodeString   rules
[inline, private]
 

Creates the c struct for ucollator.

This used internally by StringSearch. Hence the responsibility of cleaning up the ucollator is not done by this RuleBasedCollator. The isDataOwned flag is set to FALSE.

Parameters:
collator  new ucollator data
rules  corresponding collation rules

Definition at line 802 of file tblcoll.h.

void RuleBasedCollator::setUCollator const char *    locale,
UErrorCode   status
[private]
 

Creates the c struct for ucollator.

Parameters:
locale  desired locale name
status  error status

void RuleBasedCollator::setUCollator const Locale   locale,
UErrorCode   status
[inline, private]
 

Creates the c struct for ucollator.

Parameters:
locale  desired locale
status  error status

Definition at line 795 of file tblcoll.h.

virtual void RuleBasedCollator::setVariableTop const uint32_t    varTop,
UErrorCode   status
[virtual]
 

Sets the variable top to a collation element value supplied.

Variable top is set to the upper 16 bits. Lower 16 bits are ignored.

Parameters:
varTop  CE value, as returned by setVariableTop or ucol)getVariableTop
status  error code (not changed by function)
Stable:
ICU 2.0

Reimplemented from Collator.

virtual uint32_t RuleBasedCollator::setVariableTop const UnicodeString    varTop,
UErrorCode   status
[virtual]
 

Sets the variable top to a collation element value of a string supplied.

Parameters:
varTop  an UnicodeString size 1 or more (if contraction) of UChars to which the variable top should be set
status  error code. If error code is set, the return value is undefined. Errors set by this function are:
U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such a contraction
U_PRIMARY_TOO_LONG_ERROR if the primary for the variable top has more than two bytes
Returns:
a 32 bit value containing the value of the variable top in upper 16 bits. Lower 16 bits are undefined
Stable:
ICU 2.0

Reimplemented from Collator.

virtual uint32_t RuleBasedCollator::setVariableTop const UChar *    varTop,
int32_t    len,
UErrorCode   status
[virtual]
 

Sets the variable top to a collation element value of a string supplied.

Parameters:
varTop  one or more (if contraction) UChars to which the variable top should be set
len  length of variable top string. If -1 it is considered to be zero terminated.
status  error code. If error code is set, the return value is undefined. Errors set by this function are:
U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such a contraction
U_PRIMARY_TOO_LONG_ERROR if the primary for the variable top has more than two bytes
Returns:
a 32 bit value containing the value of the variable top in upper 16 bits. Lower 16 bits are undefined
Stable:
ICU 2.0

Reimplemented from Collator.


Friends And Related Function Documentation

friend class CollationElementIterator [friend]
 

Used to iterate over collation elements in a character source.

Definition at line 664 of file tblcoll.h.

friend class Collator [friend]
 

Collator ONLY needs access to RuleBasedCollator(const Locale&, UErrorCode&).

Definition at line 670 of file tblcoll.h.

friend class StringSearch [friend]
 

Searching over collation elements in a character source.

Stable:
ICU 2.0

Definition at line 675 of file tblcoll.h.


Member Data Documentation

const int32_t RuleBasedCollator::CHARINDEX [static, private]
 

Definition at line 619 of file tblcoll.h.

const int32_t RuleBasedCollator::COLELEMENTSTART [static, private]
 

Definition at line 635 of file tblcoll.h.

const int32_t RuleBasedCollator::CONTRACTCHARINDEX [static, private]
 

Definition at line 621 of file tblcoll.h.

const int32_t RuleBasedCollator::EXPANDCHARINDEX [static, private]
 

Definition at line 620 of file tblcoll.h.

const int32_t RuleBasedCollator::IGNORABLEMASK [static, private]
 

Definition at line 629 of file tblcoll.h.

const int32_t RuleBasedCollator::PRIMARYDIFFERENCEONLY [static, private]
 

Definition at line 630 of file tblcoll.h.

const int32_t RuleBasedCollator::PRIMARYLOWZEROMASK [static, private]
 

Definition at line 636 of file tblcoll.h.

const int32_t RuleBasedCollator::PRIMARYORDERINCREMENT [static, private]
 

Definition at line 623 of file tblcoll.h.

const int32_t RuleBasedCollator::PRIMARYORDERMASK [static, private]
 

Definition at line 626 of file tblcoll.h.

const int32_t RuleBasedCollator::PRIMARYORDERSHIFT [static, private]
 

Definition at line 632 of file tblcoll.h.

const int32_t RuleBasedCollator::PRIMIGNORABLE [static, private]
 

Definition at line 640 of file tblcoll.h.

const int32_t RuleBasedCollator::RESETSECONDARYTERTIARY [static, private]
 

Definition at line 637 of file tblcoll.h.

const int32_t RuleBasedCollator::RESETTERTIARY [static, private]
 

Definition at line 638 of file tblcoll.h.

const int32_t RuleBasedCollator::SECONDARYDIFFERENCEONLY [static, private]
 

Definition at line 631 of file tblcoll.h.

const int32_t RuleBasedCollator::SECONDARYORDERINCREMENT [static, private]
 

Definition at line 624 of file tblcoll.h.

const int32_t RuleBasedCollator::SECONDARYORDERMASK [static, private]
 

Definition at line 627 of file tblcoll.h.

const int32_t RuleBasedCollator::SECONDARYORDERSHIFT [static, private]
 

Definition at line 633 of file tblcoll.h.

const int32_t RuleBasedCollator::TERTIARYORDERINCREMENT [static, private]
 

Definition at line 625 of file tblcoll.h.

const int32_t RuleBasedCollator::TERTIARYORDERMASK [static, private]
 

Definition at line 628 of file tblcoll.h.

const int32_t RuleBasedCollator::UNMAPPED [static, private]
 

Definition at line 618 of file tblcoll.h.

UBool RuleBasedCollator::dataIsOwned [private]
 

Definition at line 644 of file tblcoll.h.

UBool RuleBasedCollator::isWriteThroughAlias [private]
 

Definition at line 646 of file tblcoll.h.

UCollator* RuleBasedCollator::ucollator [private]
 

c struct for collation.

All initialisation for it has to be done through setUCollator().

Definition at line 652 of file tblcoll.h.

UnicodeString* RuleBasedCollator::urulestring [private]
 

Rule UnicodeString.

Definition at line 657 of file tblcoll.h.


The documentation for this class was generated from the following file:
Generated on Mon Nov 24 14:36:48 2003 for ICU 2.8 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001