ICU 50.1.2  50.1.2
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
icu::RuleBasedCollator Class Reference

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

#include <tblcoll.h>

Inheritance diagram for icu::RuleBasedCollator:
icu::Collator icu::UObject icu::UMemory

Public Member Functions

 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...
 
 RuleBasedCollator (const uint8_t *bin, int32_t length, const RuleBasedCollator *base, UErrorCode &status)
 Opens a collator from a collator binary image created using cloneBinary. More...
 
virtual ~RuleBasedCollator ()
 Destructor. More...
 
RuleBasedCollatoroperator= (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 Collatorclone (void) const
 Makes a copy of this 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 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 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 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 UCollationResult compare (UCharIterator &sIter, UCharIterator &tIter, UErrorCode &status) const
 Compares two strings using the Collator. 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 Locale getLocale (ULocDataLocaleType type, UErrorCode &status) const
 Gets the locale of the Collator. More...
 
const UnicodeStringgetRules (void) const
 Gets the tailoring rules for this collator. 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...
 
int32_t cloneBinary (uint8_t *buffer, int32_t capacity, UErrorCode &status)
 Creates a binary image of a collator. 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) const
 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 (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 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 int32_t getReorderCodes (int32_t *dest, int32_t destCapacity, UErrorCode &status) const
 Retrieves the reordering codes for this collator. More...
 
virtual void setReorderCodes (const int32_t *reorderCodes, int32_t reorderCodesLength, UErrorCode &status)
 Sets the ordering of scripts for this collator. More...
 
const UCollatorgetUCollator ()
 Get UCollator data struct. More...
 
virtual int32_t internalGetShortDefinitionString (const char *locale, char *buffer, int32_t capacity, UErrorCode &status) const
 Get the short definition string for a collator. More...
 
- Public Member Functions inherited from icu::Collator
virtual ~Collator ()
 Destructor. More...
 
virtual UBool operator!= (const Collator &other) const
 Returns true if "other" is not the same as "this". More...
 
virtual EComparisonResult compare (const UnicodeString &source, const UnicodeString &target) 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
 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 compareUTF8 (const StringPiece &source, const StringPiece &target, UErrorCode &status) const
 Compares two UTF-8 strings using the Collator. More...
 
UBool greater (const UnicodeString &source, const UnicodeString &target) const
 Convenience method for comparing two strings based on the collation rules. More...
 
UBool greaterOrEqual (const UnicodeString &source, const UnicodeString &target) const
 Convenience method for comparing two strings based on the collation rules. More...
 
UBool equals (const UnicodeString &source, const UnicodeString &target) const
 Convenience method for comparing two strings based on the collation rules. More...
 
virtual ECollationStrength getStrength (void) const
 Determines the minimum strength that will be used in comparison or transformation. More...
 
virtual void setStrength (ECollationStrength newStrength)
 Sets the minimum strength to be used in comparison or transformation. More...
 
virtual CollatorsafeClone (void) const
 Same as clone(). More...
 
- Public Member Functions inherited from icu::UObject
virtual ~UObject ()
 Destructor. More...
 

Static Public Member Functions

static UClassID getStaticClassID (void)
 Returns the class ID for this class. More...
 
static int32_t getEquivalentReorderCodes (int32_t reorderCode, int32_t *dest, int32_t destCapacity, UErrorCode &status)
 Retrieves the reorder codes that are grouped with the given reorder code. More...
 
- Static Public Member Functions inherited from icu::Collator
static CollatorcreateInstance (UErrorCode &err)
 Creates the Collator object for the current default locale. More...
 
static CollatorcreateInstance (const Locale &loc, UErrorCode &err)
 Gets the table-based collation object for the desired locale. More...
 
static int32_t getEquivalentReorderCodes (int32_t reorderCode, int32_t *dest, int32_t destCapacity, UErrorCode &status)
 Retrieves the reorder codes that are grouped with the given reorder code. More...
 
static UnicodeStringgetDisplayName (const Locale &objectLocale, const Locale &displayLocale, UnicodeString &name)
 Get name of the object for the desired Locale, in the desired langauge. More...
 
static UnicodeStringgetDisplayName (const Locale &objectLocale, UnicodeString &name)
 Get name of the object for the desired Locale, in the langauge of the default locale. More...
 
static const LocalegetAvailableLocales (int32_t &count)
 Get the set of Locales for which Collations are installed. More...
 
static StringEnumerationgetAvailableLocales (void)
 Return a StringEnumeration over the locales available at the time of the call, including registered locales. More...
 
static StringEnumerationgetKeywords (UErrorCode &status)
 Create a string enumerator of all possible keywords that are relevant to collation. More...
 
static StringEnumerationgetKeywordValues (const char *keyword, UErrorCode &status)
 Given a keyword, create a string enumeration of all values for that keyword that are currently in use. More...
 
static StringEnumerationgetKeywordValuesForLocale (const char *keyword, const Locale &locale, UBool commonlyUsed, UErrorCode &status)
 Given a key and a locale, returns an array of string values in a preferred order that would make a difference. More...
 
static Locale getFunctionalEquivalent (const char *keyword, const Locale &locale, UBool &isAvailable, UErrorCode &status)
 Return the functionally equivalent locale for the given requested locale, with respect to given keyword, for the collation service. More...
 
static URegistryKey registerInstance (Collator *toAdopt, const Locale &locale, UErrorCode &status)
 Register a new Collator. More...
 
static URegistryKey registerFactory (CollatorFactory *toAdopt, UErrorCode &status)
 Register a new CollatorFactory. More...
 
static UBool unregister (URegistryKey key, UErrorCode &status)
 Unregister a previously-registered Collator or CollatorFactory using the key returned from the register call. More...
 
static int32_t getBound (const uint8_t *source, int32_t sourceLength, UColBoundMode boundType, uint32_t noOfLevels, uint8_t *result, int32_t resultLength, UErrorCode &status)
 Produce a bound for a given sortkey and a number of levels. More...
 
static UCollatorcreateUCollator (const char *loc, UErrorCode *status)
 used only by ucol_open, not for public use More...
 

Protected Member Functions

virtual void setLocales (const Locale &requestedLocale, const Locale &validLocale, const Locale &actualLocale)
 Used internally by registraton to define the requested and valid locales. More...
 
- Protected Member Functions inherited from icu::Collator
 Collator ()
 Default constructor. More...
 
 Collator (UCollationStrength collationStrength, UNormalizationMode decompositionMode)
 Constructor. More...
 
 Collator (const Collator &other)
 Copy constructor. More...
 

Friends

class CollationElementIterator
 Used to iterate over collation elements in a character source.
 
class Collator
 Collator ONLY needs access to RuleBasedCollator(const Locale&, UErrorCode&)
 
class StringSearch
 Searching over collation elements in a character source.
 

Additional Inherited Members

- Public Types inherited from icu::Collator
enum  ECollationStrength {
  PRIMARY = UCOL_PRIMARY, SECONDARY = UCOL_SECONDARY, TERTIARY = UCOL_TERTIARY, QUATERNARY = UCOL_QUATERNARY,
  IDENTICAL = UCOL_IDENTICAL
}
 Base letter represents a primary difference. More...
 
enum  EComparisonResult { LESS = UCOL_LESS, EQUAL = UCOL_EQUAL, GREATER = UCOL_GREATER }
 LESS is returned if source string is compared to be less than target string in the compare() method. 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 111 of file tblcoll.h.

Constructor & Destructor Documentation

icu::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
rulesthe collation rules to build the collation table from.
statusreporting a success or an error.
See Also
Locale
Stable:
ICU 2.0
icu::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
rulesthe collation rules to build the collation table from.
collationStrengthdefault strength for comparison
statusreporting a success or an error.
See Also
Locale
Stable:
ICU 2.0
icu::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
rulesthe collation rules to build the collation table from.
decompositionModethe normalisation mode
statusreporting a success or an error.
See Also
Locale
Stable:
ICU 2.0
icu::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
rulesthe collation rules to build the collation table from.
collationStrengthdefault strength for comparison
decompositionModethe normalisation mode
statusreporting a success or an error.
See Also
Locale
Stable:
ICU 2.0
icu::RuleBasedCollator::RuleBasedCollator ( const RuleBasedCollator other)

Copy constructor.

Parameters
otherthe RuleBasedCollator object to be copied
See Also
Locale
Stable:
ICU 2.0
icu::RuleBasedCollator::RuleBasedCollator ( const uint8_t *  bin,
int32_t  length,
const RuleBasedCollator base,
UErrorCode status 
)

Opens a collator from a collator binary image created using cloneBinary.

Binary image used in instantiation of the collator remains owned by the user and should stay around for the lifetime of the collator. The API also takes a base collator which usualy should be UCA.

Parameters
binbinary image owned by the user and required through the lifetime of the collator
lengthsize of the image. If negative, the API will try to figure out the length of the image
basefallback collator, usually UCA. Base is required to be present through the lifetime of the collator. Currently it cannot be NULL.
statusfor catching errors
Returns
newly created collator
See Also
cloneBinary
Stable:
ICU 3.4
virtual icu::RuleBasedCollator::~RuleBasedCollator ( )
virtual

Destructor.

Stable:
ICU 2.0

Member Function Documentation

virtual Collator* icu::RuleBasedCollator::clone ( void  ) const
virtual

Makes a copy of this object.

Returns
a copy of this object, owned by the caller
Stable:
ICU 2.0

Implements icu::Collator.

int32_t icu::RuleBasedCollator::cloneBinary ( uint8_t *  buffer,
int32_t  capacity,
UErrorCode status 
)

Creates a binary image of a collator.

This binary image can be stored and later used to instantiate a collator using ucol_openBinary. This API supports preflighting.

Parameters
buffera fill-in buffer to receive the binary image
capacitycapacity of the destination buffer
statusfor catching errors
Returns
size of the image
See Also
ucol_openBinary
Stable:
ICU 3.4
uint8_t* icu::RuleBasedCollator::cloneRuleData ( int32_t &  length,
UErrorCode status 
)

Returns the binary format of the class's rules.

The format is that of .col files.

Parameters
lengthReturns the length of the data, in bytes
statusthe error code status.
Returns
memory, owned by the caller, of size 'length' bytes.
Stable:
ICU 2.2
virtual UCollationResult icu::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
sourcethe source string to be compared with.
targetthe string that is to be compared with the source string.
statuspossible 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
Stable:
ICU 2.6

Implements icu::Collator.

virtual UCollationResult icu::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
sourcethe source string to be compared with.
targetthe string that is to be compared with the source string.
lengththe length the comparison is limited to
statuspossible 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.
Stable:
ICU 2.6

Implements icu::Collator.

virtual UCollationResult icu::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
sourcethe source string array to be compared with.
sourceLengththe length of the source string array. If this value is equal to -1, the string array is null-terminated.
targetthe string that is to be compared with the source string.
targetLengththe length of the target string array. If this value is equal to -1, the string array is null-terminated.
statuspossible 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
Stable:
ICU 2.6

Implements icu::Collator.

virtual UCollationResult icu::RuleBasedCollator::compare ( UCharIterator sIter,
UCharIterator tIter,
UErrorCode status 
) const
virtual

Compares two strings using the Collator.

Returns whether the first one compares less than/equal to/greater than the second one. This version takes UCharIterator input.

Parameters
sIterthe first ("source") string iterator
tIterthe second ("target") string iterator
statusICU status
Returns
UCOL_LESS, UCOL_EQUAL or UCOL_GREATER
Stable:
ICU 4.2

Reimplemented from icu::Collator.

virtual CollationElementIterator* icu::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
sourcethe 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 CollationElementIterator* icu::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
sourcethe 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 UColAttributeValue icu::RuleBasedCollator::getAttribute ( UColAttribute  attr,
UErrorCode status 
) const
virtual

Universal attribute getter.

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

Implements icu::Collator.

virtual CollationKey& icu::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
sourcethe source string.
keythe transformed key of the source string.
statusthe error code status.
Returns
the transformed key.
See Also
CollationKey
Stable:
ICU 2.0

Implements icu::Collator.

virtual CollationKey& icu::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
sourcethe source string.
sourceLengththe length of the source string.
keythe transformed key of the source string.
statusthe error code status.
Returns
the transformed key.
See Also
CollationKey
Stable:
ICU 2.0

Implements icu::Collator.

virtual UClassID icu::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

Implements icu::Collator.

static int32_t icu::RuleBasedCollator::getEquivalentReorderCodes ( int32_t  reorderCode,
int32_t *  dest,
int32_t  destCapacity,
UErrorCode status 
)
static

Retrieves the reorder codes that are grouped with the given reorder code.

Some reorder codes will be grouped and must reorder together.

Parameters
reorderCodeThe reorder code to determine equivalence for.
destThe array to fill with the script equivalene reordering codes.
destCapacityThe length of dest. If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string (pre-flighting).
statusA reference to an error code value, which must not indicate a failure before the function call.
Returns
The length of the of the reordering code equivalence array.
See Also
ucol_setReorderCodes
Collator::getReorderCodes
Collator::setReorderCodes
Stable:
ICU 4.8
virtual Locale icu::RuleBasedCollator::getLocale ( ULocDataLocaleType  type,
UErrorCode status 
) const
virtual

Gets the locale of the Collator.

Parameters
typecan be either requested, valid or actual locale. For more information see the definition of ULocDataLocaleType in uloc.h
statusthe error code status.
Returns
locale where the collation data lives. If the collator was instantiated from rules, locale is empty.
Deprecated:
ICU 2.8 likely to change in ICU 3.0, based on feedback

Implements icu::Collator.

int32_t icu::RuleBasedCollator::getMaxExpansion ( int32_t  order) const

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

Parameters
ordera 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
virtual int32_t icu::RuleBasedCollator::getReorderCodes ( int32_t *  dest,
int32_t  destCapacity,
UErrorCode status 
) const
virtual

Retrieves the reordering codes for this collator.

Parameters
destThe array to fill with the script ordering.
destCapacityThe length of dest. If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string (pre-flighting).
statusA reference to an error code value, which must not indicate a failure before the function call.
Returns
The length of the script ordering array.
See Also
ucol_setReorderCodes
Collator::getEquivalentReorderCodes
Collator::setReorderCodes
Stable:
ICU 4.8

Reimplemented from icu::Collator.

const UnicodeString& icu::RuleBasedCollator::getRules ( void  ) const

Gets the tailoring rules for this collator.

Returns
the collation tailoring from which this collator was created
Stable:
ICU 2.0
void icu::RuleBasedCollator::getRules ( UColRuleOption  delta,
UnicodeString buffer 
)

Returns current rules.

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

getRules(void) should normally be used instead. See http://userguide.icu-project.org/collation/customization#TOC-Building-on-Existing-Locales

Parameters
deltaone of UCOL_TAILORING_ONLY, UCOL_FULL_RULES.
bufferUnicodeString to store the result rules
Stable:
ICU 2.2
See Also
UCOL_FULL_RULES
virtual int32_t icu::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
sourcestring to be processed.
resultbuffer to store result in. If NULL, number of bytes needed will be returned.
resultLengthlength 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

Implements icu::Collator.

virtual int32_t icu::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
sourcestring to be processed.
sourceLengthlength of string to be processed. If -1, the string is 0 terminated and length will be decided by the function.
resultbuffer to store result in. If NULL, number of bytes needed will be returned.
resultLengthlength 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

Implements icu::Collator.

static UClassID icu::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 UnicodeSet* icu::RuleBasedCollator::getTailoredSet ( UErrorCode status) const
virtual

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

Parameters
statuserror 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
Stable:
ICU 2.4

Reimplemented from icu::Collator.

const UCollator * icu::RuleBasedCollator::getUCollator ( )
inline

Get UCollator data struct.

Used only by StringSearch & intltest.

Returns
UCollator data struct
Internal:
Do not use. This API is for internal use only.

Definition at line 839 of file tblcoll.h.

virtual uint32_t icu::RuleBasedCollator::getVariableTop ( UErrorCode status) const
virtual

Gets the variable top value of a Collator.

Lower 16 bits are undefined and should be ignored.

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

Implements icu::Collator.

virtual void icu::RuleBasedCollator::getVersion ( UVersionInfo  info) const
virtual

Gets the version information for a Collator.

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

Implements icu::Collator.

virtual int32_t icu::RuleBasedCollator::hashCode ( void  ) const
virtual

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

Returns
the hash code.
Stable:
ICU 2.0

Implements icu::Collator.

virtual int32_t icu::RuleBasedCollator::internalGetShortDefinitionString ( const char *  locale,
char *  buffer,
int32_t  capacity,
UErrorCode status 
) const
virtual

Get the short definition string for a collator.

This internal API harvests the collator's locale and the attribute set and produces a string that can be used for opening a collator with the same properties using the ucol_openFromShortString API. This string will be normalized. The structure and the syntax of the string is defined in the "Naming collators" section of the users guide: http://icu-project.org/userguide/Collate_Concepts.html#Naming_Collators This function supports preflighting.

This is internal, and intended to be used with delegate converters.

Parameters
localea locale that will appear as a collators locale in the resulting short string definition. If NULL, the locale will be harvested from the collator.
bufferspace to hold the resulting string
capacitycapacity of the buffer
statusfor returning errors. All the preflighting errors are featured
Returns
length of the resulting string
See Also
ucol_openFromShortString
ucol_normalizeShortDefinitionString
ucol_getShortDefinitionString
Internal:
Do not use. This API is for internal use only.

Reimplemented from icu::Collator.

RuleBasedCollator& icu::RuleBasedCollator::operator= ( const RuleBasedCollator other)

Assignment operator.

Parameters
otherother RuleBasedCollator object to compare with.
Stable:
ICU 2.0
virtual UBool icu::RuleBasedCollator::operator== ( const Collator other) const
virtual

Returns true if argument is the same as this object.

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

Reimplemented from icu::Collator.

virtual void icu::RuleBasedCollator::setAttribute ( UColAttribute  attr,
UColAttributeValue  value,
UErrorCode status 
)
virtual

Universal attribute setter.

Parameters
attrattribute type
valueattribute value
statusto indicate whether the operation went on smoothly or there were errors
Stable:
ICU 2.2

Implements icu::Collator.

virtual void icu::RuleBasedCollator::setLocales ( const Locale requestedLocale,
const Locale validLocale,
const Locale actualLocale 
)
protectedvirtual

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

Parameters
requestedLocalethe requsted locale
validLocalethe valid locale
actualLocalethe actual locale
Internal:
Do not use. This API is for internal use only.

Reimplemented from icu::Collator.

virtual void icu::RuleBasedCollator::setReorderCodes ( const int32_t *  reorderCodes,
int32_t  reorderCodesLength,
UErrorCode status 
)
virtual

Sets the ordering of scripts for this collator.

Parameters
reorderCodesAn array of script codes in the new order. This can be NULL if the length is also set to 0. An empty array will clear any reordering codes on the collator.
reorderCodesLengthThe length of reorderCodes.
statuserror code
See Also
Collator::getReorderCodes
Collator::getEquivalentReorderCodes
Stable:
ICU 4.8

Reimplemented from icu::Collator.

virtual uint32_t icu::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
varTopone or more (if contraction) UChars to which the variable top should be set
lenlength of variable top string. If -1 it is considered to be zero terminated.
statuserror 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

Implements icu::Collator.

virtual uint32_t icu::RuleBasedCollator::setVariableTop ( const UnicodeString varTop,
UErrorCode status 
)
virtual

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

Parameters
varTopan UnicodeString size 1 or more (if contraction) of UChars to which the variable top should be set
statuserror 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

Implements icu::Collator.

virtual void icu::RuleBasedCollator::setVariableTop ( 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
varTopCE value, as returned by setVariableTop or ucol)getVariableTop
statuserror code (not changed by function)
Stable:
ICU 2.0

Implements icu::Collator.


The documentation for this class was generated from the following file: