Logo Search packages:      
Sourcecode: icu version File versions  Download package

RuleBasedCollator Class Reference

#include <tblcoll.h>

Inheritance diagram for RuleBasedCollator:

Collator UObject UMemory

List of all members.


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.


Public Types

enum  ECollationStrength {
  PRIMARY = 0, SECONDARY = 1, TERTIARY = 2, QUATERNARY = 3,
  IDENTICAL = 15
}
enum  EComparisonResult { LESS = -1, EQUAL = 0, GREATER = 1 }

Public Member Functions

virtual Collatorclone (void) const
int32_t cloneBinary (uint8_t *buffer, int32_t capacity, UErrorCode &status)
uint8_t * cloneRuleData (int32_t &length, UErrorCode &status)
virtual UCollationResult compare (UCharIterator &sIter, UCharIterator &tIter, UErrorCode &status) const
virtual UCollationResult compare (const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength, UErrorCode &status) const
virtual EComparisonResult compare (const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength) const
virtual UCollationResult compare (const UnicodeString &source, const UnicodeString &target, int32_t length, UErrorCode &status) const
virtual EComparisonResult compare (const UnicodeString &source, const UnicodeString &target, int32_t length) const
virtual UCollationResult compare (const UnicodeString &source, const UnicodeString &target, UErrorCode &status) const
virtual EComparisonResult compare (const UnicodeString &source, const UnicodeString &target) const
virtual UCollationResult compareUTF8 (const StringPiece &source, const StringPiece &target, UErrorCode &status) const
virtual CollationElementIteratorcreateCollationElementIterator (const CharacterIterator &source) const
virtual CollationElementIteratorcreateCollationElementIterator (const UnicodeString &source) const
UBool equals (const UnicodeString &source, const UnicodeString &target) const
virtual UColAttributeValue getAttribute (UColAttribute attr, UErrorCode &status)
virtual CollationKeygetCollationKey (const UChar *source, int32_t sourceLength, CollationKey &key, UErrorCode &status) const
virtual CollationKeygetCollationKey (const UnicodeString &source, CollationKey &key, UErrorCode &status) const
virtual UClassID getDynamicClassID (void) const
virtual const Locale getLocale (ULocDataLocaleType type, UErrorCode &status) const
int32_t getMaxExpansion (int32_t order) const
void getRules (UColRuleOption delta, UnicodeString &buffer)
const UnicodeStringgetRules (void) const
virtual int32_t getSortKey (const UChar *source, int32_t sourceLength, uint8_t *result, int32_t resultLength) const
virtual int32_t getSortKey (const UnicodeString &source, uint8_t *result, int32_t resultLength) const
virtual ECollationStrength getStrength (void) const
virtual UnicodeSetgetTailoredSet (UErrorCode &status) const
const UCollatorgetUCollator ()
virtual uint32_t getVariableTop (UErrorCode &status) const
virtual void getVersion (UVersionInfo info) const
UBool greater (const UnicodeString &source, const UnicodeString &target) const
UBool greaterOrEqual (const UnicodeString &source, const UnicodeString &target) const
virtual int32_t hashCode (void) const
virtual UBool operator!= (const Collator &other) const
RuleBasedCollatoroperator= (const RuleBasedCollator &other)
virtual UBool operator== (const Collator &other) const
 RuleBasedCollator (const uint8_t *bin, int32_t length, const RuleBasedCollator *base, UErrorCode &status)
 RuleBasedCollator (const RuleBasedCollator &other)
 RuleBasedCollator (const UnicodeString &rules, ECollationStrength collationStrength, UColAttributeValue decompositionMode, UErrorCode &status)
 RuleBasedCollator (const UnicodeString &rules, UColAttributeValue decompositionMode, UErrorCode &status)
 RuleBasedCollator (const UnicodeString &rules, ECollationStrength collationStrength, UErrorCode &status)
 RuleBasedCollator (const UnicodeString &rules, UErrorCode &status)
virtual CollatorsafeClone (void)
virtual void setAttribute (UColAttribute attr, UColAttributeValue value, UErrorCode &status)
virtual void setStrength (ECollationStrength newStrength)
virtual void setVariableTop (const uint32_t varTop, UErrorCode &status)
virtual uint32_t setVariableTop (const UnicodeString varTop, UErrorCode &status)
virtual uint32_t setVariableTop (const UChar *varTop, int32_t len, UErrorCode &status)
virtual ~RuleBasedCollator ()

Static Public Member Functions

static Collator *U_EXPORT2 createInstance (const Locale &loc, UErrorCode &err)
static Collator *U_EXPORT2 createInstance (UErrorCode &err)
static UCollatorcreateUCollator (const char *loc, UErrorCode *status)
static StringEnumeration *U_EXPORT2 getAvailableLocales (void)
static const Locale *U_EXPORT2 getAvailableLocales (int32_t &count)
static int32_t U_EXPORT2 getBound (const uint8_t *source, int32_t sourceLength, UColBoundMode boundType, uint32_t noOfLevels, uint8_t *result, int32_t resultLength, UErrorCode &status)
static UnicodeString &U_EXPORT2 getDisplayName (const Locale &objectLocale, UnicodeString &name)
static UnicodeString &U_EXPORT2 getDisplayName (const Locale &objectLocale, const Locale &displayLocale, UnicodeString &name)
static Locale U_EXPORT2 getFunctionalEquivalent (const char *keyword, const Locale &locale, UBool &isAvailable, UErrorCode &status)
static StringEnumeration *U_EXPORT2 getKeywords (UErrorCode &status)
static StringEnumeration *U_EXPORT2 getKeywordValues (const char *keyword, UErrorCode &status)
static StringEnumeration *U_EXPORT2 getKeywordValuesForLocale (const char *keyword, const Locale &locale, UBool commonlyUsed, UErrorCode &status)
static UClassID U_EXPORT2 getStaticClassID (void)
static void U_EXPORT2 operator delete (void *, void *) U_NO_THROW
static void U_EXPORT2 operator delete (void *p) U_NO_THROW
static void U_EXPORT2 operator delete[] (void *p) U_NO_THROW
static void *U_EXPORT2 operator new (size_t, void *ptr) U_NO_THROW
static void *U_EXPORT2 operator new (size_t size) U_NO_THROW
static void *U_EXPORT2 operator new[] (size_t size) U_NO_THROW
static URegistryKey U_EXPORT2 registerFactory (CollatorFactory *toAdopt, UErrorCode &status)
static URegistryKey U_EXPORT2 registerInstance (Collator *toAdopt, const Locale &locale, UErrorCode &status)
static UBool U_EXPORT2 unregister (URegistryKey key, UErrorCode &status)

Protected Member Functions

virtual void setLocales (const Locale &requestedLocale, const Locale &validLocale, const Locale &actualLocale)

Private Types

enum  {
  CHARINDEX = 0x70000000, EXPANDCHARINDEX = 0x7E000000, CONTRACTCHARINDEX = 0x7F000000, UNMAPPED = 0xFFFFFFFF,
  PRIMARYORDERINCREMENT = 0x00010000, SECONDARYORDERINCREMENT = 0x00000100, TERTIARYORDERINCREMENT = 0x00000001, PRIMARYORDERMASK = 0xffff0000,
  SECONDARYORDERMASK = 0x0000ff00, TERTIARYORDERMASK = 0x000000ff, IGNORABLEMASK = 0x0000ffff, PRIMARYDIFFERENCEONLY = 0xffff0000,
  SECONDARYDIFFERENCEONLY = 0xffffff00, PRIMARYORDERSHIFT = 16, SECONDARYORDERSHIFT = 8, COLELEMENTSTART = 0x02020202,
  PRIMARYLOWZEROMASK = 0x00FF0000, RESETSECONDARYTERTIARY = 0x00000202, RESETTERTIARY = 0x00000002, PRIMIGNORABLE = 0x0202
}

Private Member Functions

void checkOwned (void)
void construct (const UnicodeString &rules, UColAttributeValue collationStrength, UColAttributeValue decompositionMode, UErrorCode &status)
Collator::ECollationStrength getECollationStrength (const UCollationStrength &strength) const
Collator::EComparisonResult getEComparisonResult (const UCollationResult &result) const
UCollationStrength getUCollationStrength (const Collator::ECollationStrength &strength) const
 RuleBasedCollator (const Locale &desiredLocale, UErrorCode &status)
 RuleBasedCollator ()
void setRuleStringFromCollator ()
void setUCollator (UCollator *collator)
void setUCollator (const char *locale, UErrorCode &status)
void setUCollator (const Locale &locale, UErrorCode &status)

Private Attributes

UBool dataIsOwned
UBool isWriteThroughAlias
UCollatorucollator
UnicodeString urulestring

Friends

class CollationElementIterator
class Collator
class StringSearch

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

Generated by  Doxygen 1.6.0   Back to index