67#if U_SHOW_CPLUSPLUS_API
69#if !UCONFIG_NO_COLLATION
78struct CollationCacheEntry;
80struct CollationSettings;
81struct CollationTailoring;
89class CollationElementIterator;
168#ifndef U_HIDE_INTERNAL_API
261 using Collator::compare;
394#ifndef U_FORCE_HIDE_DEPRECATED_API
422#ifndef U_HIDE_DEPRECATED_API
467#ifndef U_HIDE_DEPRECATED_API
552#ifndef U_FORCE_HIDE_DEPRECATED_API
742#ifndef U_HIDE_INTERNAL_API
837 void writeSortKey(
const char16_t *s,
int32_t length,
840 void writeIdenticalLevel(
const char16_t *s,
const char16_t *limit,
848 void setAttributeExplicitly(int32_t attribute) {
849 explicitlySetAttributes |=
static_cast<uint32_t
>(1) << attribute;
851 UBool attributeHasBeenSetExplicitly(int32_t attribute)
const {
853 return (explicitlySetAttributes & (
static_cast<uint32_t
>(1) << attribute)) != 0;
865 static void U_CALLCONV computeMaxExpansions(
const CollationTailoring *t,
UErrorCode &errorCode);
868 void setFastLatinOptions(CollationSettings &ownedSettings)
const;
870 const CollationData *data;
871 const CollationSettings *settings;
872 const CollationTailoring *tailoring;
873 const CollationCacheEntry *cacheEntry;
875 uint32_t explicitlySetAttributes;
877 UBool actualLocaleIsSameAsValid;
Abstract class that defines an API for iteration on text objects.
The CollationElementIterator class is used as an iterator to walk through each character of an inte...
Collation keys are generated by the Collator class.
The Collator class performs locale-sensitive string comparison.
static Collator * fromUCollator(UCollator *uc)
ECollationStrength
Base letter represents a primary difference.
"Smart pointer" base class; do not use directly: use LocalPointer etc.
A Locale object represents a specific geographical, political, or cultural region.
The RuleBasedCollator class provides the implementation of Collator, using data-driven tables.
virtual void setVariableTop(uint32_t varTop, UErrorCode &status) override
Sets the variable top to the specified primary weight.
RuleBasedCollator(const UnicodeString &rules, UColAttributeValue decompositionMode, UErrorCode &status)
RuleBasedCollator constructor.
virtual UCollationResult internalCompareUTF8(const char *left, int32_t leftLength, const char *right, int32_t rightLength, UErrorCode &errorCode) const override
Implements ucol_strcollUTF8().
virtual Collator & setMaxVariable(UColReorderCode group, UErrorCode &errorCode) override
Sets the variable top to the top of the specified reordering group.
virtual int32_t getSortKey(const char16_t *source, int32_t sourceLength, uint8_t *result, int32_t resultLength) const override
Get the sort key as an array of bytes from a char16_t buffer.
virtual CollationKey & getCollationKey(const char16_t *source, int32_t sourceLength, CollationKey &key, UErrorCode &status) const override
Transforms a specified region of the string into a series of characters that can be compared with Col...
RuleBasedCollator & operator=(const RuleBasedCollator &other)
Assignment operator.
virtual int32_t hashCode() const override
Generates the hash code for the rule-based collation object.
virtual uint32_t getVariableTop(UErrorCode &status) const override
Gets the variable top value of a Collator.
RuleBasedCollator(const UnicodeString &rules, ECollationStrength collationStrength, UColAttributeValue decompositionMode, UErrorCode &status)
RuleBasedCollator constructor.
virtual void setLocales(const Locale &requestedLocale, const Locale &validLocale, const Locale &actualLocale) override
Used internally by registration to define the requested and valid locales.
RuleBasedCollator(const uint8_t *bin, int32_t length, const RuleBasedCollator *base, UErrorCode &status)
Opens a collator from a collator binary image created using cloneBinary.
virtual int32_t getSortKey(const UnicodeString &source, uint8_t *result, int32_t resultLength) const override
Get the sort key as an array of bytes from a UnicodeString.
virtual UnicodeSet * getTailoredSet(UErrorCode &status) const override
Get a UnicodeSet that contains all the characters and sequences tailored in this collator.
static const RuleBasedCollator * rbcFromUCollator(const UCollator *uc)
RuleBasedCollator(const UnicodeString &rules, UParseError &parseError, UnicodeString &reason, UErrorCode &errorCode)
TODO: document & propose as public API.
virtual uint32_t setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &status) override
Sets the variable top to the primary weight of the specified string.
virtual uint32_t setVariableTop(const UnicodeString &varTop, UErrorCode &status) override
Sets the variable top to the primary weight of the specified string.
virtual int32_t getReorderCodes(int32_t *dest, int32_t destCapacity, UErrorCode &status) const override
Retrieves the reordering codes for this collator.
virtual UCollationResult compare(const UnicodeString &source, const UnicodeString &target, UErrorCode &status) const override
The comparison function compares the character data stored in two different strings.
void internalBuildTailoring(const UnicodeString &rules, int32_t strength, UColAttributeValue decompositionMode, UParseError *outParseError, UnicodeString *outReason, UErrorCode &errorCode)
Implements from-rule constructors, and ucol_openRules().
void internalAddContractions(UChar32 c, UnicodeSet &set, UErrorCode &errorCode) const
Adds the contractions that start with character c to the set.
virtual Locale getLocale(ULocDataLocaleType type, UErrorCode &status) const override
Gets the locale of the Collator.
virtual UCollationResult compare(const UnicodeString &source, const UnicodeString &target, int32_t length, UErrorCode &status) const override
Does the same thing as compare but limits the comparison to a specified length.
void internalGetContractionsAndExpansions(UnicodeSet *contractions, UnicodeSet *expansions, UBool addPrefixes, UErrorCode &errorCode) const
Implements ucol_getContractionsAndExpansions().
virtual bool operator==(const Collator &other) const override
Returns true if argument is the same as this object.
virtual ~RuleBasedCollator()
Destructor.
virtual void setReorderCodes(const int32_t *reorderCodes, int32_t reorderCodesLength, UErrorCode &status) override
Sets the ordering of scripts for this collator.
int32_t cloneBinary(uint8_t *buffer, int32_t capacity, UErrorCode &status) const
Creates a binary image of a collator.
virtual CollationElementIterator * createCollationElementIterator(const CharacterIterator &source) const
Creates a collation element iterator for the source.
virtual CollationElementIterator * createCollationElementIterator(const UnicodeString &source) const
Creates a collation element iterator for the source string.
virtual void getVersion(UVersionInfo info) const override
Gets the version information for a Collator.
virtual int32_t internalNextSortKeyPart(UCharIterator *iter, uint32_t state[2], uint8_t *dest, int32_t count, UErrorCode &errorCode) const override
Implements ucol_nextSortKeyPart().
void internalGetCEs(const UnicodeString &str, UVector64 &ces, UErrorCode &errorCode) const
Appends the CEs for the string to the vector.
int32_t getMaxExpansion(int32_t order) const
Returns the maximum length of any expansion sequences that end with the specified comparison order.
virtual UClassID getDynamicClassID() const override
Returns a unique class ID POLYMORPHICALLY.
uint8_t * cloneRuleData(int32_t &length, UErrorCode &status) const
Do not use this method: The caller and the ICU library might use different heaps.
virtual int32_t internalGetShortDefinitionString(const char *locale, char *buffer, int32_t capacity, UErrorCode &status) const override
Get the short definition string for a collator.
RuleBasedCollator(const UnicodeString &rules, ECollationStrength collationStrength, UErrorCode &status)
RuleBasedCollator constructor.
virtual UCollationResult compare(const char16_t *source, int32_t sourceLength, const char16_t *target, int32_t targetLength, UErrorCode &status) const override
The comparison function compares the character data stored in two different string arrays.
RuleBasedCollator(const UnicodeString &rules, UErrorCode &status)
RuleBasedCollator constructor.
virtual UColAttributeValue getAttribute(UColAttribute attr, UErrorCode &status) const override
Universal attribute getter.
virtual CollationKey & getCollationKey(const UnicodeString &source, CollationKey &key, UErrorCode &status) const override
Transforms the string into a series of characters that can be compared with CollationKey....
const char * internalGetLocaleID(ULocDataLocaleType type, UErrorCode &errorCode) const
Implements ucol_getLocaleByType().
RuleBasedCollator()
Only for use in ucol_openRules().
virtual RuleBasedCollator * clone() const override
Makes a copy of this object.
RuleBasedCollator(const RuleBasedCollator &other)
Copy constructor.
static UClassID getStaticClassID()
Returns the class ID for this class.
virtual UCollationResult compareUTF8(const StringPiece &source, const StringPiece &target, UErrorCode &status) const override
Compares two UTF-8 strings using the Collator.
static RuleBasedCollator * rbcFromUCollator(UCollator *uc)
const UnicodeString & getRules() const
Gets the tailoring rules for this collator.
virtual UColReorderCode getMaxVariable() const override
Returns the maximum reordering group whose characters are affected by UCOL_ALTERNATE_HANDLING.
virtual void setAttribute(UColAttribute attr, UColAttributeValue value, UErrorCode &status) override
Universal attribute setter.
virtual UCollationResult compare(UCharIterator &sIter, UCharIterator &tIter, UErrorCode &status) const override
Compares two strings using the Collator.
void getRules(UColRuleOption delta, UnicodeString &buffer) const
Returns current rules.
A string-like object that points to a sized piece of memory.
A mutable set of Unicode characters and multicharacter strings.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
C++ API: Collation Service.
C++ API: Locale ID object.
C API for code unit iteration.
A UParseError struct is used to returned detailed information about parsing errors.
struct UCollator UCollator
structure representing a collator object instance
UColRuleOption
Options for retrieving the rule string.
UColAttribute
Attributes that collation service understands.
@ UCOL_ATTRIBUTE_COUNT
One more than the highest normal UColAttribute value.
UCollationResult
UCOL_LESS is returned if source string is compared to be less than target string in the ucol_strcoll(...
UColAttributeValue
Enum containing attribute values for controlling collation behavior.
UColReorderCode
Enum containing the codes for reordering segments of the collation table that are not script codes.
C API: Unicode Character Iteration.
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
int8_t UBool
The ICU boolean type, a signed-byte integer.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]
The binary form of a version on ICU APIs is an array of 4 uint8_t.