Go to the documentation of this file.
67 #if U_SHOW_CPLUSPLUS_API
69 #if !UCONFIG_NO_COLLATION
78 struct CollationCacheEntry;
80 struct CollationSettings;
81 struct CollationTailoring;
89 class CollationElementIterator;
91 class SortKeyByteSink;
168 #ifndef U_HIDE_INTERNAL_API
247 createCollationElementIterator(
const UnicodeString& source)
const;
315 const char16_t* target, int32_t targetLength,
384 int32_t sourceLength,
395 #ifndef U_FORCE_HIDE_DEPRECATED_API
407 #endif // U_FORCE_HIDE_DEPRECATED_API
423 #ifndef U_HIDE_DEPRECATED_API
440 U_I18N_API int32_t getMaxExpansion(int32_t order)
const;
468 #ifndef U_HIDE_DEPRECATED_API
554 #ifndef U_FORCE_HIDE_DEPRECATED_API
604 #endif // U_FORCE_HIDE_DEPRECATED_API
642 int32_t resultLength)
const override;
661 int32_t sourceLength,
663 int32_t resultLength)
const override;
679 int32_t destCapacity,
694 int32_t reorderCodesLength,
702 const char* right, int32_t rightLength,
750 #ifndef U_HIDE_INTERNAL_API
810 #endif // U_HIDE_INTERNAL_API
838 void adoptTailoring(CollationTailoring *t,
UErrorCode &errorCode);
842 const char16_t *right, int32_t rightLength,
845 const uint8_t *right, int32_t rightLength,
848 void writeSortKey(
const char16_t *s, int32_t length,
849 SortKeyByteSink &sink,
UErrorCode &errorCode)
const;
851 void writeIdenticalLevel(
const char16_t *s,
const char16_t *limit,
852 SortKeyByteSink &sink,
UErrorCode &errorCode)
const;
854 const CollationSettings &getDefaultSettings()
const;
856 void setAttributeDefault(int32_t attribute) {
857 explicitlySetAttributes &= ~(
static_cast<uint32_t
>(1) << attribute);
859 void setAttributeExplicitly(int32_t attribute) {
860 explicitlySetAttributes |=
static_cast<uint32_t
>(1) << attribute;
862 UBool attributeHasBeenSetExplicitly(int32_t attribute)
const {
864 return (explicitlySetAttributes & (
static_cast<uint32_t
>(1) << attribute)) != 0;
876 static void U_CALLCONV computeMaxExpansions(
const CollationTailoring *t,
UErrorCode &errorCode);
879 void setFastLatinOptions(CollationSettings &ownedSettings)
const;
881 const CollationData *data;
882 const CollationSettings *settings;
883 const CollationTailoring *tailoring;
884 const CollationCacheEntry *cacheEntry;
886 uint32_t explicitlySetAttributes;
888 UBool actualLocaleIsSameAsValid;
893 #endif // !UCONFIG_NO_COLLATION
C++ API: Collation Service.
static RuleBasedCollator * rbcFromUCollator(UCollator *uc)
Collation keys are generated by the Collator class.
UColAttribute
Attributes that collation service understands.
virtual UClassID getDynamicClassID() const override=0
Returns a unique class ID POLYMORPHICALLY.
Basic definitions for ICU, for both C and C++ APIs.
A mutable set of Unicode characters and multicharacter strings.
ECollationStrength
Base letter represents a primary difference.
int8_t UBool
The ICU boolean type, a signed-byte integer.
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
virtual uint32_t getVariableTop(UErrorCode &status) const =0
Gets the variable top value of a Collator.
@ UCOL_ATTRIBUTE_COUNT
One more than the highest normal UColAttribute value.
UColRuleOption
Options for retrieving the rule string.
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.
The Collator class performs locale-sensitive string comparison.
virtual void setAttribute(UColAttribute attr, UColAttributeValue value, UErrorCode &status)=0
Universal attribute setter.
UColAttributeValue
Enum containing attribute values for controlling 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(...
A UParseError struct is used to returned detailed information about parsing errors.
virtual UCollationResult internalCompareUTF8(const char *left, int32_t leftLength, const char *right, int32_t rightLength, UErrorCode &errorCode) const
Implements ucol_strcollUTF8().
virtual bool operator==(const Collator &other) const
Returns true if "other" is the same as "this".
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
virtual UColAttributeValue getAttribute(UColAttribute attr, UErrorCode &status) const =0
Universal attribute getter.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
virtual uint32_t setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &status)=0
Sets the variable top to the primary weight of the specified string.
virtual int32_t hashCode() const =0
Generates the hash code for the collation object.
virtual void setReorderCodes(const int32_t *reorderCodes, int32_t reorderCodesLength, UErrorCode &status)
Sets the ordering of scripts for this collator.
The RuleBasedCollator class provides the implementation of Collator, using data-driven tables.
virtual int32_t getReorderCodes(int32_t *dest, int32_t destCapacity, UErrorCode &status) const
Retrieves the reordering codes for this collator.
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 Collator * clone() const =0
Makes a copy of this object.
virtual void getVersion(UVersionInfo info) const =0
Gets the version information for a Collator.
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.
Abstract class that defines an API for iteration on text objects.
C API for code unit iteration.
C API: Unicode Character Iteration.
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.
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.
C++ API: Locale ID object.
virtual EComparisonResult compare(const UnicodeString &source, const UnicodeString &target) const
The comparison function compares the character data stored in two different strings.
The CollationElementIterator class is used as an iterator to walk through each character of an inte...
virtual Collator & setMaxVariable(UColReorderCode group, UErrorCode &errorCode)
Sets the variable top to the top of the specified reordering group.
A string-like object that points to a sized piece of memory.
virtual void setLocales(const Locale &requestedLocale, const Locale &validLocale, const Locale &actualLocale)
Used internally by registration to define the requested and valid locales.
A Locale object represents a specific geographical, political, or cultural region.
static const RuleBasedCollator * rbcFromUCollator(const UCollator *uc)
UColReorderCode
Enum containing the codes for reordering segments of the collation table that are not script codes.