Go to the documentation of this file.
55 #if !UCONFIG_NO_COLLATION
68 class StringEnumeration;
70 #if !UCONFIG_NO_SERVICE
74 class CollatorFactory;
365 int32_t length)
const;
419 const UChar* target, int32_t targetLength)
439 const UChar* target, int32_t targetLength,
516 int32_t sourceLength,
622 int32_t destCapacity,
641 int32_t reorderCodesLength,
666 int32_t destCapacity,
679 const Locale& displayLocale,
789 #if !UCONFIG_NO_SERVICE
997 int32_t resultLength)
const = 0;
1019 uint8_t*result, int32_t resultLength)
const = 0;
1058 static int32_t U_EXPORT2
getBound(
const uint8_t *source,
1059 int32_t sourceLength,
1061 uint32_t noOfLevels,
1063 int32_t resultLength,
1080 #ifndef U_HIDE_DEPRECATED_API
1146 const char *left, int32_t leftLength,
1147 const char *right, int32_t rightLength,
1157 uint8_t *dest, int32_t count,
UErrorCode &errorCode)
const;
1159 #ifndef U_HIDE_INTERNAL_API
1162 return reinterpret_cast<Collator *
>(uc);
1166 return reinterpret_cast<const Collator *
>(uc);
1170 return reinterpret_cast<UCollator *
>(
this);
1174 return reinterpret_cast<const UCollator *
>(
this);
1176 #endif // U_HIDE_INTERNAL_API
1184 friend class CFactory;
1185 friend class SimpleCFactory;
1186 friend class ICUCollatorFactory;
1187 friend class ICUCollatorService;
1192 #if !UCONFIG_NO_SERVICE
1247 const Locale& displayLocale,
@ UCOL_IDENTICAL
Identical collation strength.
@ UCOL_QUATERNARY
Quaternary collation strength.
@ UCOL_EQUAL
string a == string b
C++ API: Unicode Normalization.
virtual ~Collator()
Destructor.
virtual ~CollatorFactory()
Destructor.
virtual UnicodeString & getDisplayName(const Locale &objectLocale, const Locale &displayLocale, UnicodeString &result)
Return the name of the collator for the objectLocale, localized for the displayLocale.
UBool greaterOrEqual(const UnicodeString &source, const UnicodeString &target) const
Convenience method for comparing two strings based on the collation rules.
Collation keys are generated by the Collator class.
UColAttribute
Attributes that collation service understands.
static Collator * createInstance(const Locale &loc, UErrorCode &err)
Gets the collation object for the desired locale.
Basic definitions for ICU, for both C and C++ APIs.
static const Collator * fromUCollator(const UCollator *uc)
A mutable set of Unicode characters and multicharacter strings.
ECollationStrength
Base letter represents a primary difference.
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
int8_t UBool
The ICU boolean type.
Collator()
Default constructor.
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
virtual uint32_t setVariableTop(const UChar *varTop, int32_t len, UErrorCode &status)=0
Sets the variable top to the primary weight of the specified string.
@ UCOL_LESS
string a < string b
virtual uint32_t getVariableTop(UErrorCode &status) const =0
Gets the variable top value of a Collator.
virtual UClassID getDynamicClassID(void) const =0
Returns a unique class ID POLYMORPHICALLY.
virtual int32_t internalNextSortKeyPart(UCharIterator *iter, uint32_t state[2], uint8_t *dest, int32_t count, UErrorCode &errorCode) const
Implements ucol_nextSortKeyPart().
virtual UnicodeSet * getTailoredSet(UErrorCode &status) const
Get a UnicodeSet that contains all the characters and sequences tailored in this collator.
virtual UCollationResult compareUTF8(const StringPiece &source, const StringPiece &target, UErrorCode &status) const
Compares two UTF-8 strings using the Collator.
@ UCOL_PRIMARY
Primary collation strength.
The Collator class performs locale-sensitive string comparison.
virtual UBool operator==(const Collator &other) const
Returns TRUE if "other" is the same as "this".
virtual int32_t hashCode(void) const =0
Generates the hash code for the collation object.
static URegistryKey registerInstance(Collator *toAdopt, const Locale &locale, UErrorCode &status)
Register a new Collator.
static URegistryKey registerFactory(CollatorFactory *toAdopt, UErrorCode &status)
Register a new CollatorFactory.
virtual void setAttribute(UColAttribute attr, UColAttributeValue value, UErrorCode &status)=0
Universal attribute setter.
UColAttributeValue
Enum containing attribute values for controling collation behavior.
virtual int32_t internalGetShortDefinitionString(const char *locale, char *buffer, int32_t capacity, UErrorCode &status) const
Get the short definition string for a collator.
UCollationResult
UCOL_LESS is returned if source string is compared to be less than target string in the ucol_strcoll(...
virtual uint32_t setVariableTop(const UnicodeString &varTop, UErrorCode &status)=0
Sets the variable top to the primary weight of the specified string.
@ UCOL_SECONDARY
Secondary collation strength.
virtual void setStrength(ECollationStrength newStrength)
Sets the minimum strength to be used in comparison or transformation.
virtual UCollationResult internalCompareUTF8(const char *left, int32_t leftLength, const char *right, int32_t rightLength, UErrorCode &errorCode) const
Implements ucol_strcollUTF8().
C++ API: StringPiece: Read-only byte string wrapper class.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
static StringEnumeration * getKeywordValues(const char *keyword, UErrorCode &status)
Given a keyword, create a string enumeration of all values for that keyword that are currently in use...
virtual Collator * createCollator(const Locale &loc)=0
Return a collator for the provided locale.
UCollator * toUCollator()
const void * URegistryKey
Opaque type returned by registerInstance, registerFactory and unregister for service registration.
virtual UColAttributeValue getAttribute(UColAttribute attr, UErrorCode &status) const =0
Universal attribute getter.
UObject is the common ICU "boilerplate" class.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Base class for 'pure' C++ implementations of uenum api.
virtual const UnicodeString * getSupportedIDs(int32_t &count, UErrorCode &status)=0
Return an array of all the locale names directly supported by this factory.
virtual void setReorderCodes(const int32_t *reorderCodes, int32_t reorderCodesLength, UErrorCode &status)
Sets the ordering of scripts for this collator.
virtual int32_t getReorderCodes(int32_t *dest, int32_t destCapacity, UErrorCode &status) const
Retrieves the reordering codes for this collator.
static UnicodeString & getDisplayName(const Locale &objectLocale, UnicodeString &name)
Get name of the object for the desired Locale, in the langauge of the default locale.
UColBoundMode
enum that is taken by ucol_getBound API See below for explanation do not change the values assigned...
UNormalizationMode
Constants for normalization modes.
const UCollator * toUCollator() const
virtual UColReorderCode getMaxVariable() const
Returns the maximum reordering group whose characters are affected by UCOL_ALTERNATE_HANDLING.
struct UCollator UCollator
structure representing a collator object instance
virtual void getVersion(UVersionInfo info) const =0
Gets the version information for a Collator.
static StringEnumeration * getKeywords(UErrorCode &status)
Create a string enumerator of all possible keywords that are relevant to collation.
virtual int32_t getSortKey(const UnicodeString &source, uint8_t *result, int32_t resultLength) const =0
Get the sort key as an array of bytes from a UnicodeString.
virtual ECollationStrength getStrength(void) const
Determines the minimum strength that will be used in comparison or transformation.
UBool greater(const UnicodeString &source, const UnicodeString &target) const
Convenience method for comparing two strings based on the collation rules.
static Collator * createInstance(UErrorCode &err)
Creates the Collator object for the current default locale.
Collator(UCollationStrength collationStrength, UNormalizationMode decompositionMode)
Constructor.
C API for code unit iteration.
virtual int32_t getSortKey(const UChar *source, int32_t sourceLength, uint8_t *result, int32_t resultLength) const =0
Get the sort key as an array of bytes from a UChar buffer.
Collator(const Collator &other)
Copy constructor.
static const Locale * getAvailableLocales(int32_t &count)
Get the set of Locales for which Collations are installed.
virtual Collator * clone(void) const =0
Makes a copy of this object.
virtual Collator * safeClone(void) const
Same as clone().
@ UCOL_TERTIARY
Tertiary collation strength.
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.
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 keywo...
virtual UBool operator!=(const Collator &other) const
Returns true if "other" is not the same as "this".
virtual UBool visible(void) const
Return true if this factory is visible.
C API: Unicode Character Iteration.
static StringEnumeration * getKeywordValuesForLocale(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 di...
virtual CollationKey & getCollationKey(const UnicodeString &source, CollationKey &key, UErrorCode &status) const =0
Transforms the string into a series of characters that can be compared with CollationKey::compareTo.
virtual void setVariableTop(uint32_t varTop, UErrorCode &status)=0
Sets the variable top to the specified primary weight.
static StringEnumeration * getAvailableLocales(void)
Return a StringEnumeration over the locales available at the time of the call, including registered l...
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
static Collator * fromUCollator(UCollator *uc)
uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]
The binary form of a version on ICU APIs is an array of 4 uint8_t.
virtual Locale getLocale(ULocDataLocaleType type, UErrorCode &status) const =0
Gets the locale of the Collator.
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.
C++ API: Locale ID object.
C++ API: Common ICU base class UObject.
UBool equals(const UnicodeString &source, const UnicodeString &target) const
Convenience method for comparing two strings based on the collation rules.
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
virtual Collator & setMaxVariable(UColReorderCode group, UErrorCode &errorCode)
Sets the variable top to the top of the specified reordering group.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
A string-like object that points to a sized piece of memory.
A factory, used with registerFactory, the creates multiple collators and provides display names for t...
static UnicodeString & getDisplayName(const Locale &objectLocale, const Locale &displayLocale, UnicodeString &name)
Get name of the object for the desired Locale, in the desired langauge.
virtual void setLocales(const Locale &requestedLocale, const Locale &validLocale, const Locale &actualLocale)
Used internally by registration to define the requested and valid locales.
EComparisonResult
LESS is returned if source string is compared to be less than target string in the compare() method.
virtual CollationKey & getCollationKey(const UChar *source, int32_t sourceLength, CollationKey &key, UErrorCode &status) const =0
Transforms the string into a series of characters that can be compared with CollationKey::compareTo.
A Locale object represents a specific geographical, political, or cultural region.
static UBool unregister(URegistryKey key, UErrorCode &status)
Unregister a previously-registered Collator or CollatorFactory using the key returned from the regist...
@ UCOL_GREATER
string a > string b
UColReorderCode
Enum containing the codes for reordering segments of the collation table that are not script codes.