Loading...
Searching...
No Matches
ucol.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (c) 1996-2015, International Business Machines Corporation and others.
* All Rights Reserved.
*******************************************************************************
*/
#ifndef UCOL_H
#define UCOL_H
#include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#include "unicode/unorm.h"
#include "unicode/parseerr.h"
#include "unicode/uloc.h"
#include "unicode/uset.h"
#include "unicode/uscript.h"
#if U_SHOW_CPLUSPLUS_API
#include "unicode/localpointer.h"
#endif // U_SHOW_CPLUSPLUS_API
struct UCollator;
typedef struct UCollator UCollator;
typedef enum {
UCOL_EQUAL = 0,
UCOL_GREATER = 1,
UCOL_LESS = -1
} UCollationResult ;
typedef enum {
UCOL_DEFAULT = -1,
UCOL_PRIMARY = 0,
UCOL_SECONDARY = 1,
UCOL_TERTIARY = 2,
UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
UCOL_CE_STRENGTH_LIMIT,
UCOL_QUATERNARY=3,
UCOL_IDENTICAL=15,
UCOL_STRENGTH_LIMIT,
UCOL_OFF = 16,
UCOL_ON = 17,
UCOL_SHIFTED = 20,
UCOL_NON_IGNORABLE = 21,
UCOL_LOWER_FIRST = 24,
UCOL_UPPER_FIRST = 25,
#ifndef U_HIDE_DEPRECATED_API
UCOL_ATTRIBUTE_VALUE_COUNT
#endif /* U_HIDE_DEPRECATED_API */
} UColAttributeValue;
typedef enum {
UCOL_REORDER_CODE_DEFAULT = -1,
UCOL_REORDER_CODE_NONE = USCRIPT_UNKNOWN,
UCOL_REORDER_CODE_OTHERS = USCRIPT_UNKNOWN,
UCOL_REORDER_CODE_SPACE = 0x1000,
UCOL_REORDER_CODE_FIRST = UCOL_REORDER_CODE_SPACE,
UCOL_REORDER_CODE_PUNCTUATION = 0x1001,
UCOL_REORDER_CODE_SYMBOL = 0x1002,
UCOL_REORDER_CODE_CURRENCY = 0x1003,
UCOL_REORDER_CODE_DIGIT = 0x1004,
#ifndef U_HIDE_DEPRECATED_API
UCOL_REORDER_CODE_LIMIT = 0x1005
#endif /* U_HIDE_DEPRECATED_API */
} UColReorderCode;
typedef UColAttributeValue UCollationStrength;
typedef enum {
UCOL_FRENCH_COLLATION,
UCOL_ALTERNATE_HANDLING,
UCOL_CASE_FIRST,
UCOL_CASE_LEVEL,
UCOL_NORMALIZATION_MODE,
UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
UCOL_STRENGTH,
#ifndef U_HIDE_DEPRECATED_API
UCOL_HIRAGANA_QUATERNARY_MODE = UCOL_STRENGTH + 1,
#endif /* U_HIDE_DEPRECATED_API */
UCOL_NUMERIC_COLLATION = UCOL_STRENGTH + 2,
/* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
* it is needed for layout of RuleBasedCollator object. */
#ifndef U_FORCE_HIDE_DEPRECATED_API
UCOL_ATTRIBUTE_COUNT
#endif // U_FORCE_HIDE_DEPRECATED_API
} UColAttribute;
typedef enum {
UCOL_TAILORING_ONLY,
UCOL_FULL_RULES
} UColRuleOption ;
U_CAPI UCollator* U_EXPORT2
ucol_open(const char *loc, UErrorCode *status);
U_CAPI UCollator* U_EXPORT2
ucol_openRules( const UChar *rules,
int32_t rulesLength,
UColAttributeValue normalizationMode,
UCollationStrength strength,
UParseError *parseError,
UErrorCode *status);
#ifndef U_HIDE_DEPRECATED_API
U_DEPRECATED UCollator* U_EXPORT2
ucol_openFromShortString( const char *definition,
UBool forceDefaults,
UParseError *parseError,
UErrorCode *status);
#endif /* U_HIDE_DEPRECATED_API */
#ifndef U_HIDE_DEPRECATED_API
U_DEPRECATED int32_t U_EXPORT2
ucol_getContractions( const UCollator *coll,
USet *conts,
UErrorCode *status);
#endif /* U_HIDE_DEPRECATED_API */
U_CAPI void U_EXPORT2
ucol_getContractionsAndExpansions( const UCollator *coll,
USet *contractions, USet *expansions,
UBool addPrefixes, UErrorCode *status);
U_CAPI void U_EXPORT2
ucol_close(UCollator *coll);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
U_NAMESPACE_END
#endif
U_CAPI UCollationResult U_EXPORT2
ucol_strcoll( const UCollator *coll,
const UChar *source,
int32_t sourceLength,
const UChar *target,
int32_t targetLength);
U_CAPI UCollationResult U_EXPORT2
ucol_strcollUTF8(
const UCollator *coll,
const char *source,
int32_t sourceLength,
const char *target,
int32_t targetLength,
UErrorCode *status);
U_CAPI UBool U_EXPORT2
ucol_greater(const UCollator *coll,
const UChar *source, int32_t sourceLength,
const UChar *target, int32_t targetLength);
U_CAPI UBool U_EXPORT2
ucol_greaterOrEqual(const UCollator *coll,
const UChar *source, int32_t sourceLength,
const UChar *target, int32_t targetLength);
U_CAPI UBool U_EXPORT2
ucol_equal(const UCollator *coll,
const UChar *source, int32_t sourceLength,
const UChar *target, int32_t targetLength);
U_CAPI UCollationResult U_EXPORT2
ucol_strcollIter( const UCollator *coll,
UCharIterator *sIter,
UCharIterator *tIter,
UErrorCode *status);
U_CAPI UCollationStrength U_EXPORT2
ucol_getStrength(const UCollator *coll);
U_CAPI void U_EXPORT2
ucol_setStrength(UCollator *coll,
UCollationStrength strength);
U_CAPI int32_t U_EXPORT2
ucol_getReorderCodes(const UCollator* coll,
int32_t* dest,
int32_t destCapacity,
UErrorCode *pErrorCode);
U_CAPI void U_EXPORT2
ucol_setReorderCodes(UCollator* coll,
const int32_t* reorderCodes,
int32_t reorderCodesLength,
UErrorCode *pErrorCode);
U_CAPI int32_t U_EXPORT2
ucol_getEquivalentReorderCodes(int32_t reorderCode,
int32_t* dest,
int32_t destCapacity,
UErrorCode *pErrorCode);
U_CAPI int32_t U_EXPORT2
ucol_getDisplayName( const char *objLoc,
const char *dispLoc,
UChar *result,
int32_t resultLength,
UErrorCode *status);
U_CAPI const char* U_EXPORT2
ucol_getAvailable(int32_t localeIndex);
U_CAPI int32_t U_EXPORT2
ucol_countAvailable(void);
#if !UCONFIG_NO_SERVICE
U_CAPI UEnumeration* U_EXPORT2
ucol_openAvailableLocales(UErrorCode *status);
#endif
U_CAPI UEnumeration* U_EXPORT2
ucol_getKeywords(UErrorCode *status);
U_CAPI UEnumeration* U_EXPORT2
ucol_getKeywordValues(const char *keyword, UErrorCode *status);
U_CAPI UEnumeration* U_EXPORT2
ucol_getKeywordValuesForLocale(const char* key,
const char* locale,
UBool commonlyUsed,
UErrorCode* status);
U_CAPI int32_t U_EXPORT2
ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
const char* keyword, const char* locale,
UBool* isAvailable, UErrorCode* status);
U_CAPI const UChar* U_EXPORT2
ucol_getRules( const UCollator *coll,
int32_t *length);
#ifndef U_HIDE_DEPRECATED_API
U_DEPRECATED int32_t U_EXPORT2
ucol_getShortDefinitionString(const UCollator *coll,
const char *locale,
char *buffer,
int32_t capacity,
UErrorCode *status);
U_DEPRECATED int32_t U_EXPORT2
ucol_normalizeShortDefinitionString(const char *source,
char *destination,
int32_t capacity,
UParseError *parseError,
UErrorCode *status);
#endif /* U_HIDE_DEPRECATED_API */
U_CAPI int32_t U_EXPORT2
ucol_getSortKey(const UCollator *coll,
const UChar *source,
int32_t sourceLength,
uint8_t *result,
int32_t resultLength);
U_CAPI int32_t U_EXPORT2
ucol_nextSortKeyPart(const UCollator *coll,
UCharIterator *iter,
uint32_t state[2],
uint8_t *dest, int32_t count,
UErrorCode *status);
typedef enum {
UCOL_BOUND_LOWER = 0,
UCOL_BOUND_UPPER = 1,
UCOL_BOUND_UPPER_LONG = 2,
#ifndef U_HIDE_DEPRECATED_API
UCOL_BOUND_VALUE_COUNT
#endif /* U_HIDE_DEPRECATED_API */
} UColBoundMode;
U_CAPI int32_t U_EXPORT2
ucol_getBound(const uint8_t *source,
int32_t sourceLength,
UColBoundMode boundType,
uint32_t noOfLevels,
uint8_t *result,
int32_t resultLength,
UErrorCode *status);
U_CAPI void U_EXPORT2
ucol_getVersion(const UCollator* coll, UVersionInfo info);
U_CAPI void U_EXPORT2
ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
U_CAPI int32_t U_EXPORT2
ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
const uint8_t *src2, int32_t src2Length,
uint8_t *dest, int32_t destCapacity);
U_CAPI void U_EXPORT2
ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
U_CAPI UColAttributeValue U_EXPORT2
ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
U_CAPI void U_EXPORT2
ucol_setMaxVariable(UCollator *coll, UColReorderCode group, UErrorCode *pErrorCode);
U_CAPI UColReorderCode U_EXPORT2
ucol_getMaxVariable(const UCollator *coll);
#ifndef U_HIDE_DEPRECATED_API
U_DEPRECATED uint32_t U_EXPORT2
ucol_setVariableTop(UCollator *coll,
const UChar *varTop, int32_t len,
UErrorCode *status);
#endif /* U_HIDE_DEPRECATED_API */
U_CAPI uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
#ifndef U_HIDE_DEPRECATED_API
U_DEPRECATED void U_EXPORT2
ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
#endif /* U_HIDE_DEPRECATED_API */
U_CAPI UCollator* U_EXPORT2 ucol_clone(const UCollator *coll, UErrorCode *status);
#ifndef U_HIDE_DEPRECATED_API
U_DEPRECATED UCollator* U_EXPORT2
ucol_safeClone(const UCollator *coll,
void *stackBuffer,
int32_t *pBufferSize,
UErrorCode *status);
#define U_COL_SAFECLONE_BUFFERSIZE 1
#endif /* U_HIDE_DEPRECATED_API */
U_CAPI int32_t U_EXPORT2
ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
#ifndef U_HIDE_DEPRECATED_API
U_DEPRECATED const char * U_EXPORT2
ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
#endif /* U_HIDE_DEPRECATED_API */
U_CAPI const char * U_EXPORT2
ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
U_CAPI USet * U_EXPORT2
ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
#ifndef U_HIDE_INTERNAL_API
U_CAPI int32_t U_EXPORT2
ucol_getUnsafeSet( const UCollator *coll,
USet *unsafe,
UErrorCode *status);
U_CAPI void U_EXPORT2
ucol_prepareShortStringOpen( const char *definition,
UBool forceDefaults,
UParseError *parseError,
UErrorCode *status);
#endif /* U_HIDE_INTERNAL_API */
U_CAPI int32_t U_EXPORT2
ucol_cloneBinary(const UCollator *coll,
uint8_t *buffer, int32_t capacity,
UErrorCode *status);
U_CAPI UCollator* U_EXPORT2
ucol_openBinary(const uint8_t *bin, int32_t length,
const UCollator *base,
UErrorCode *status);
#if U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
#include <functional>
#include <string_view>
#include <type_traits>
#include "unicode/char16ptr.h"
#include "unicode/unistr.h"
namespace U_HEADER_ONLY_NAMESPACE {
namespace collator {
namespace internal {
template <template <typename...> typename Compare, UCollationResult result>
class Predicate {
public:
explicit Predicate(const UCollator* ucol) : collator(ucol) {}
#if U_SHOW_CPLUSPLUS_API
template <
typename T, typename U,
typename = std::enable_if_t<ConvertibleToU16StringView<T> && ConvertibleToU16StringView<U>>>
bool operator()(const T& lhs, const U& rhs) const {
return match(UnicodeString::readOnlyAlias(lhs), UnicodeString::readOnlyAlias(rhs));
}
#else
bool operator()(std::u16string_view lhs, std::u16string_view rhs) const {
return match(lhs, rhs);
}
#if !U_CHAR16_IS_TYPEDEF && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION < 180000)
bool operator()(std::basic_string_view<uint16_t> lhs, std::basic_string_view<uint16_t> rhs) const {
return match({uprv_char16PtrFromUint16(lhs.data()), lhs.length()},
{uprv_char16PtrFromUint16(rhs.data()), rhs.length()});
}
#endif
#if U_SIZEOF_WCHAR_T==2
bool operator()(std::wstring_view lhs, std::wstring_view rhs) const {
return match({uprv_char16PtrFromWchar(lhs.data()), lhs.length()},
{uprv_char16PtrFromWchar(rhs.data()), rhs.length()});
}
#endif
#endif
bool operator()(std::string_view lhs, std::string_view rhs) const {
return match(lhs, rhs);
}
#if defined(__cpp_char8_t)
bool operator()(std::u8string_view lhs, std::u8string_view rhs) const {
return match({reinterpret_cast<const char*>(lhs.data()), lhs.length()},
{reinterpret_cast<const char*>(rhs.data()), rhs.length()});
}
#endif
private:
bool match(std::u16string_view lhs, std::u16string_view rhs) const {
return compare(
ucol_strcoll(
collator,
toUCharPtr(lhs.data()), static_cast<int32_t>(lhs.length()),
toUCharPtr(rhs.data()), static_cast<int32_t>(rhs.length())),
result);
}
bool match(std::string_view lhs, std::string_view rhs) const {
UErrorCode status = U_ZERO_ERROR;
return compare(
ucol_strcollUTF8(
collator,
lhs.data(), static_cast<int32_t>(lhs.length()),
rhs.data(), static_cast<int32_t>(rhs.length()),
&status),
result);
}
const UCollator* const collator;
static constexpr Compare<UCollationResult> compare{};
};
} // namespace internal
using equal_to = internal::Predicate<std::equal_to, UCOL_EQUAL>;
using greater = internal::Predicate<std::equal_to, UCOL_GREATER>;
using less = internal::Predicate<std::equal_to, UCOL_LESS>;
using not_equal_to = internal::Predicate<std::not_equal_to, UCOL_EQUAL>;
using greater_equal = internal::Predicate<std::not_equal_to, UCOL_LESS>;
using less_equal = internal::Predicate<std::not_equal_to, UCOL_GREATER>;
} // namespace collator
} // namespace U_HEADER_ONLY_NAMESPACE
#endif // U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
#endif /* #if !UCONFIG_NO_COLLATION */
#endif
char16ptr.h
C++ API: char16_t pointer wrappers with implicit conversion from bit-compatible raw pointer types.
LocalUCollatorPointer
"Smart pointer" class, closes a UCollator via ucol_close().
U_HEADER_ONLY_NAMESPACE::collator::internal::Predicate
Function object for performing comparisons using a UCollator.
Definition ucol.h:1544
U_HEADER_ONLY_NAMESPACE::collator::internal::Predicate::operator()
bool operator()(std::string_view lhs, std::string_view rhs) const
Definition ucol.h:1581
U_HEADER_ONLY_NAMESPACE::collator::internal::Predicate::operator()
bool operator()(const T &lhs, const U &rhs) const
Definition ucol.h:1554
U_HEADER_ONLY_NAMESPACE::collator::internal::Predicate::Predicate
Predicate(const UCollator *ucol)
Definition ucol.h:1547
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition localpointer.h:548
parseerr.h
C API: Parse Error Information.
UCharIterator
C API for code unit iteration.
Definition uiter.h:341
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition parseerr.h:58
ucol_setMaxVariable
U_CAPI void ucol_setMaxVariable(UCollator *coll, UColReorderCode group, UErrorCode *pErrorCode)
Sets the variable top to the top of the specified reordering group.
U_HEADER_ONLY_NAMESPACE::collator::less
internal::Predicate< std::equal_to, UCOL_LESS > less
Function object for performing comparisons using this collator.
Definition ucol.h:1639
ucol_setVariableTop
uint32_t ucol_setVariableTop(UCollator *coll, const UChar *varTop, int32_t len, UErrorCode *status)
Sets the variable top to the primary weight of the specified string.
ucol_getRulesEx
U_CAPI int32_t ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen)
Returns current rules.
ucol_getVersion
U_CAPI void ucol_getVersion(const UCollator *coll, UVersionInfo info)
Gets the version information for a Collator.
ucol_getContractionsAndExpansions
U_CAPI void ucol_getContractionsAndExpansions(const UCollator *coll, USet *contractions, USet *expansions, UBool addPrefixes, UErrorCode *status)
Get a set containing the expansions defined by the collator.
ucol_getVariableTop
U_CAPI uint32_t ucol_getVariableTop(const UCollator *coll, UErrorCode *status)
Gets the variable top value of a Collator.
ucol_getAttribute
U_CAPI UColAttributeValue ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status)
Universal attribute getter.
ucol_getLocaleByType
U_CAPI const char * ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status)
gets the locale name of the collator.
ucol_setStrength
U_CAPI void ucol_setStrength(UCollator *coll, UCollationStrength strength)
Set the collation strength used in a UCollator.
ucol_getUnsafeSet
U_CAPI int32_t ucol_getUnsafeSet(const UCollator *coll, USet *unsafe, UErrorCode *status)
Calculates the set of unsafe code points, given a collator.
ucol_openBinary
U_CAPI UCollator * ucol_openBinary(const uint8_t *bin, int32_t length, const UCollator *base, UErrorCode *status)
Opens a collator from a collator binary image created using ucol_cloneBinary.
ucol_open
U_CAPI UCollator * ucol_open(const char *loc, UErrorCode *status)
Open a UCollator for comparing strings.
UCollator
struct UCollator UCollator
structure representing a collator object instance
Definition ucol.h:61
ucol_setAttribute
U_CAPI void ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status)
Universal attribute setter.
U_HEADER_ONLY_NAMESPACE::collator::greater
internal::Predicate< std::equal_to, UCOL_GREATER > greater
Function object for performing comparisons using this collator.
Definition ucol.h:1632
ucol_openAvailableLocales
U_CAPI UEnumeration * ucol_openAvailableLocales(UErrorCode *status)
Create a string enumerator of all locales for which a valid collator may be opened.
ucol_getMaxVariable
U_CAPI UColReorderCode ucol_getMaxVariable(const UCollator *coll)
Returns the maximum reordering group whose characters are affected by UCOL_ALTERNATE_HANDLING.
ucol_normalizeShortDefinitionString
int32_t ucol_normalizeShortDefinitionString(const char *source, char *destination, int32_t capacity, UParseError *parseError, UErrorCode *status)
Verifies and normalizes short definition string.
UColRuleOption
UColRuleOption
Options for retrieving the rule string.
Definition ucol.h:372
UCOL_FULL_RULES
@ UCOL_FULL_RULES
Retrieves the "UCA rules" concatenated with the tailoring rules.
Definition ucol.h:386
UCOL_TAILORING_ONLY
@ UCOL_TAILORING_ONLY
Retrieves the tailoring rules only.
Definition ucol.h:378
U_HEADER_ONLY_NAMESPACE::collator::less_equal
internal::Predicate< std::not_equal_to, UCOL_GREATER > less_equal
Function object for performing comparisons using this collator.
Definition ucol.h:1660
UColAttribute
UColAttribute
Attributes that collation service understands.
Definition ucol.h:245
UCOL_CASE_FIRST
@ UCOL_CASE_FIRST
Controls the ordering of upper and lower case letters.
Definition ucol.h:278
UCOL_NUMERIC_COLLATION
@ UCOL_NUMERIC_COLLATION
When turned on, this attribute makes substrings of digits sort according to their numeric values.
Definition ucol.h:356
UCOL_STRENGTH
@ UCOL_STRENGTH
The strength attribute.
Definition ucol.h:323
UCOL_CASE_LEVEL
@ UCOL_CASE_LEVEL
Controls whether an extra case level (positioned before the third level) is generated or not.
Definition ucol.h:289
UCOL_FRENCH_COLLATION
@ UCOL_FRENCH_COLLATION
Attribute for direction of secondary weights - used in Canadian French.
Definition ucol.h:252
UCOL_HIRAGANA_QUATERNARY_MODE
@ UCOL_HIRAGANA_QUATERNARY_MODE
When turned on, this attribute positions Hiragana before all non-ignorables on quaternary level Thi...
Definition ucol.h:336
UCOL_DECOMPOSITION_MODE
@ UCOL_DECOMPOSITION_MODE
An alias for UCOL_NORMALIZATION_MODE attribute.
Definition ucol.h:306
UCOL_ATTRIBUTE_COUNT
@ UCOL_ATTRIBUTE_COUNT
One more than the highest normal UColAttribute value.
Definition ucol.h:365
UCOL_ALTERNATE_HANDLING
@ UCOL_ALTERNATE_HANDLING
Attribute for handling variable elements.
Definition ucol.h:266
UCOL_NORMALIZATION_MODE
@ UCOL_NORMALIZATION_MODE
Controls whether the normalization check and necessary normalizations are performed.
Definition ucol.h:302
ucol_getSortKey
U_CAPI int32_t ucol_getSortKey(const UCollator *coll, const UChar *source, int32_t sourceLength, uint8_t *result, int32_t resultLength)
Get a sort key for a string from a UCollator.
ucol_getContractions
int32_t ucol_getContractions(const UCollator *coll, USet *conts, UErrorCode *status)
Get a set containing the contractions defined by the collator.
ucol_getTailoredSet
U_CAPI USet * ucol_getTailoredSet(const UCollator *coll, UErrorCode *status)
Get a Unicode set that contains all the characters and sequences tailored in this collator.
ucol_strcoll
U_CAPI UCollationResult ucol_strcoll(const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength)
Compare two strings.
UCollationStrength
UColAttributeValue UCollationStrength
Base letter represents a primary difference.
Definition ucol.h:239
ucol_getBound
U_CAPI int32_t ucol_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.
ucol_strcollIter
U_CAPI UCollationResult ucol_strcollIter(const UCollator *coll, UCharIterator *sIter, UCharIterator *tIter, UErrorCode *status)
Compare two UTF-8 encoded strings.
ucol_getRules
U_CAPI const UChar * ucol_getRules(const UCollator *coll, int32_t *length)
Get the collation tailoring rules from a UCollator.
ucol_getShortDefinitionString
int32_t ucol_getShortDefinitionString(const UCollator *coll, const char *locale, char *buffer, int32_t capacity, UErrorCode *status)
Get the short definition string for a collator.
ucol_equal
U_CAPI UBool ucol_equal(const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength)
Compare two strings for equality.
ucol_getAvailable
U_CAPI const char * ucol_getAvailable(int32_t localeIndex)
Get a locale for which collation rules are available.
ucol_getKeywords
U_CAPI UEnumeration * ucol_getKeywords(UErrorCode *status)
Create a string enumerator of all possible keywords that are relevant to collation.
ucol_openFromShortString
UCollator * ucol_openFromShortString(const char *definition, UBool forceDefaults, UParseError *parseError, UErrorCode *status)
Open a collator defined by a short form string.
ucol_getLocale
const char * ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status)
gets the locale name of the collator.
ucol_cloneBinary
U_CAPI int32_t ucol_cloneBinary(const UCollator *coll, uint8_t *buffer, int32_t capacity, UErrorCode *status)
Creates a binary image of a collator.
ucol_strcollUTF8
U_CAPI UCollationResult ucol_strcollUTF8(const UCollator *coll, const char *source, int32_t sourceLength, const char *target, int32_t targetLength, UErrorCode *status)
Compare two strings in UTF-8.
ucol_prepareShortStringOpen
U_CAPI void ucol_prepareShortStringOpen(const char *definition, UBool forceDefaults, UParseError *parseError, UErrorCode *status)
Touches all resources needed for instantiating a collator from a short string definition,...
ucol_greater
U_CAPI UBool ucol_greater(const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength)
Determine if one string is greater than another.
UCollationResult
UCollationResult
UCOL_LESS is returned if source string is compared to be less than target string in the ucol_strcoll(...
Definition ucol.h:76
UCOL_LESS
@ UCOL_LESS
string a < string b
Definition ucol.h:82
UCOL_GREATER
@ UCOL_GREATER
string a > string b
Definition ucol.h:80
UCOL_EQUAL
@ UCOL_EQUAL
string a == string b
Definition ucol.h:78
U_HEADER_ONLY_NAMESPACE::collator::equal_to
internal::Predicate< std::equal_to, UCOL_EQUAL > equal_to
Function object for performing comparisons using this collator.
Definition ucol.h:1625
ucol_safeClone
UCollator * ucol_safeClone(const UCollator *coll, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status)
Thread safe cloning operation.
ucol_nextSortKeyPart
U_CAPI int32_t ucol_nextSortKeyPart(const UCollator *coll, UCharIterator *iter, uint32_t state[2], uint8_t *dest, int32_t count, UErrorCode *status)
Gets the next count bytes of a sort key.
U_HEADER_ONLY_NAMESPACE::collator::greater_equal
internal::Predicate< std::not_equal_to, UCOL_LESS > greater_equal
Function object for performing comparisons using this collator.
Definition ucol.h:1653
UColBoundMode
UColBoundMode
enum that is taken by ucol_getBound API See below for explanation do not change the values assigned...
Definition ucol.h:1073
UCOL_BOUND_LOWER
@ UCOL_BOUND_LOWER
lower bound
Definition ucol.h:1075
UCOL_BOUND_UPPER
@ UCOL_BOUND_UPPER
upper bound that will match strings of exact size
Definition ucol.h:1077
UCOL_BOUND_VALUE_COUNT
@ UCOL_BOUND_VALUE_COUNT
One more than the highest normal UColBoundMode value.
Definition ucol.h:1085
UCOL_BOUND_UPPER_LONG
@ UCOL_BOUND_UPPER_LONG
upper bound that will match all the strings that have the same initial substring as the given string
Definition ucol.h:1079
ucol_countAvailable
U_CAPI int32_t ucol_countAvailable(void)
Determine how many locales have collation rules available.
ucol_clone
U_CAPI UCollator * ucol_clone(const UCollator *coll, UErrorCode *status)
Thread safe cloning operation.
ucol_greaterOrEqual
U_CAPI UBool ucol_greaterOrEqual(const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength)
Determine if one string is greater than or equal to another.
ucol_getEquivalentReorderCodes
U_CAPI int32_t ucol_getEquivalentReorderCodes(int32_t reorderCode, int32_t *dest, int32_t destCapacity, UErrorCode *pErrorCode)
Retrieves the reorder codes that are grouped with the given reorder code.
ucol_close
U_CAPI void ucol_close(UCollator *coll)
Close a UCollator.
ucol_getFunctionalEquivalent
U_CAPI int32_t ucol_getFunctionalEquivalent(char *result, int32_t resultCapacity, const char *keyword, const char *locale, UBool *isAvailable, UErrorCode *status)
Return the functionally equivalent locale for the specified input locale, with respect to given keywo...
U_HEADER_ONLY_NAMESPACE::collator::not_equal_to
internal::Predicate< std::not_equal_to, UCOL_EQUAL > not_equal_to
Function object for performing comparisons using this collator.
Definition ucol.h:1646
ucol_openRules
U_CAPI UCollator * ucol_openRules(const UChar *rules, int32_t rulesLength, UColAttributeValue normalizationMode, UCollationStrength strength, UParseError *parseError, UErrorCode *status)
Produce a UCollator instance according to the rules supplied.
ucol_getUCAVersion
U_CAPI void ucol_getUCAVersion(const UCollator *coll, UVersionInfo info)
Gets the UCA version information for a Collator.
ucol_getDisplayName
U_CAPI int32_t ucol_getDisplayName(const char *objLoc, const char *dispLoc, UChar *result, int32_t resultLength, UErrorCode *status)
Get the display name for a UCollator.
UColAttributeValue
UColAttributeValue
Enum containing attribute values for controlling collation behavior.
Definition ucol.h:92
UCOL_UPPER_FIRST
@ UCOL_UPPER_FIRST
upper case sorts before lower case
Definition ucol.h:129
UCOL_TERTIARY
@ UCOL_TERTIARY
Tertiary collation strength.
Definition ucol.h:101
UCOL_DEFAULT
@ UCOL_DEFAULT
accepted by most attributes
Definition ucol.h:94
UCOL_IDENTICAL
@ UCOL_IDENTICAL
Identical collation strength.
Definition ucol.h:108
UCOL_OFF
@ UCOL_OFF
Turn the feature off - works for UCOL_FRENCH_COLLATION, UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MOD...
Definition ucol.h:114
UCOL_QUATERNARY
@ UCOL_QUATERNARY
Quaternary collation strength.
Definition ucol.h:106
UCOL_SHIFTED
@ UCOL_SHIFTED
Valid for UCOL_ALTERNATE_HANDLING.
Definition ucol.h:121
UCOL_PRIMARY
@ UCOL_PRIMARY
Primary collation strength.
Definition ucol.h:97
UCOL_LOWER_FIRST
@ UCOL_LOWER_FIRST
Valid for UCOL_CASE_FIRST - lower case sorts before upper case.
Definition ucol.h:127
UCOL_ATTRIBUTE_VALUE_COUNT
@ UCOL_ATTRIBUTE_VALUE_COUNT
One more than the highest normal UColAttributeValue value.
Definition ucol.h:136
UCOL_SECONDARY
@ UCOL_SECONDARY
Secondary collation strength.
Definition ucol.h:99
UCOL_NON_IGNORABLE
@ UCOL_NON_IGNORABLE
Valid for UCOL_ALTERNATE_HANDLING.
Definition ucol.h:123
UCOL_ON
@ UCOL_ON
Turn the feature on - works for UCOL_FRENCH_COLLATION, UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE...
Definition ucol.h:118
UCOL_DEFAULT_STRENGTH
@ UCOL_DEFAULT_STRENGTH
Default collation strength.
Definition ucol.h:103
ucol_restoreVariableTop
void ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status)
Sets the variable top to the specified primary weight.
ucol_getStrength
U_CAPI UCollationStrength ucol_getStrength(const UCollator *coll)
Get the collation strength used in a UCollator.
ucol_getReorderCodes
U_CAPI int32_t ucol_getReorderCodes(const UCollator *coll, int32_t *dest, int32_t destCapacity, UErrorCode *pErrorCode)
Retrieves the reordering codes for this collator.
ucol_setReorderCodes
U_CAPI void ucol_setReorderCodes(UCollator *coll, const int32_t *reorderCodes, int32_t reorderCodesLength, UErrorCode *pErrorCode)
Sets the reordering codes for this collator.
UColReorderCode
UColReorderCode
Enum containing the codes for reordering segments of the collation table that are not script codes.
Definition ucol.h:149
UCOL_REORDER_CODE_OTHERS
@ UCOL_REORDER_CODE_OTHERS
A special reordering code that is used to specify all other codes used for reordering except for the ...
Definition ucol.h:167
UCOL_REORDER_CODE_NONE
@ UCOL_REORDER_CODE_NONE
A special reordering code that is used to specify no reordering codes.
Definition ucol.h:160
UCOL_REORDER_CODE_DEFAULT
@ UCOL_REORDER_CODE_DEFAULT
A special reordering code that is used to specify the default reordering codes for a locale.
Definition ucol.h:155
UCOL_REORDER_CODE_LIMIT
@ UCOL_REORDER_CODE_LIMIT
One more than the highest normal UColReorderCode value.
Definition ucol.h:209
UCOL_REORDER_CODE_SYMBOL
@ UCOL_REORDER_CODE_SYMBOL
Characters with the symbol property.
Definition ucol.h:191
UCOL_REORDER_CODE_DIGIT
@ UCOL_REORDER_CODE_DIGIT
Characters with the digit property.
Definition ucol.h:203
UCOL_REORDER_CODE_PUNCTUATION
@ UCOL_REORDER_CODE_PUNCTUATION
Characters with the punctuation property.
Definition ucol.h:185
UCOL_REORDER_CODE_SPACE
@ UCOL_REORDER_CODE_SPACE
Characters with the space property.
Definition ucol.h:173
UCOL_REORDER_CODE_FIRST
@ UCOL_REORDER_CODE_FIRST
The first entry in the enumeration of reordering groups.
Definition ucol.h:179
UCOL_REORDER_CODE_CURRENCY
@ UCOL_REORDER_CODE_CURRENCY
Characters with the currency property.
Definition ucol.h:197
ucol_getKeywordValues
U_CAPI UEnumeration * ucol_getKeywordValues(const char *keyword, UErrorCode *status)
Given a keyword, create a string enumeration of all values for that keyword that are currently in use...
ucol_getKeywordValuesForLocale
U_CAPI UEnumeration * ucol_getKeywordValuesForLocale(const char *key, const char *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...
ucol_mergeSortkeys
U_CAPI int32_t ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length, const uint8_t *src2, int32_t src2Length, uint8_t *dest, int32_t destCapacity)
Merges two sort keys.
UEnumeration
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition uenum.h:44
uloc.h
C API: Locale ID functionality similar to C++ class Locale.
ULocDataLocaleType
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
Definition uloc.h:338
UChar
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition umachine.h:400
U_DEPRECATED
#define U_DEPRECATED
This is used to declare a function as a deprecated public ICU C API.
Definition umachine.h:116
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition umachine.h:269
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition umachine.h:110
unistr.h
C++ API: Unicode String.
unorm.h
C API: Unicode Normalization.
uscript.h
C API: Unicode Script Information.
USCRIPT_UNKNOWN
@ USCRIPT_UNKNOWN
Definition uscript.h:287
uset.h
C API: Unicode Set.
USet
struct USet USet
USet is the C API type corresponding to C++ class UnicodeSet.
Definition uset.h:54
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition utypes.h:509
U_ZERO_ERROR
@ U_ZERO_ERROR
No error, no warning.
Definition utypes.h:544
UVersionInfo
uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]
The binary form of a version on ICU APIs is an array of 4 uint8_t.
Definition uversion.h:59