ICU 78.1  78.1
ucol.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 * Copyright (c) 1996-2015, International Business Machines Corporation and others.
6 * All Rights Reserved.
7 *******************************************************************************
8 */
9 
10 #ifndef UCOL_H
11 #define UCOL_H
12 
13 #include "unicode/utypes.h"
14 
15 #if !UCONFIG_NO_COLLATION
16 
17 #include "unicode/unorm.h"
18 #include "unicode/parseerr.h"
19 #include "unicode/uloc.h"
20 #include "unicode/uset.h"
21 #include "unicode/uscript.h"
22 
23 #if U_SHOW_CPLUSPLUS_API
24 #include "unicode/localpointer.h"
25 #endif // U_SHOW_CPLUSPLUS_API
26 
57 struct UCollator;
61 typedef struct UCollator UCollator;
62 
63 
76 typedef enum {
82  UCOL_LESS = -1
84 
85 
92 typedef enum {
95 
104  UCOL_CE_STRENGTH_LIMIT,
109  UCOL_STRENGTH_LIMIT,
110 
114  UCOL_OFF = 16,
118  UCOL_ON = 17,
119 
124 
130 
131 #ifndef U_HIDE_DEPRECATED_API
137 #endif /* U_HIDE_DEPRECATED_API */
139 
149  typedef enum {
204 #ifndef U_HIDE_DEPRECATED_API
209  UCOL_REORDER_CODE_LIMIT = 0x1005
210 #endif /* U_HIDE_DEPRECATED_API */
212 
240 
245 typedef enum {
324 #ifndef U_HIDE_DEPRECATED_API
337 #endif /* U_HIDE_DEPRECATED_API */
357 
358  /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
359  * it is needed for layout of RuleBasedCollator object. */
360 #ifndef U_FORCE_HIDE_DEPRECATED_API
366 #endif // U_FORCE_HIDE_DEPRECATED_API
368 
372 typedef enum {
388 
414 U_CAPI UCollator* U_EXPORT2
415 ucol_open(const char *loc, UErrorCode *status);
416 
444 U_CAPI UCollator* U_EXPORT2
445 ucol_openRules( const UChar *rules,
446  int32_t rulesLength,
447  UColAttributeValue normalizationMode,
448  UCollationStrength strength,
449  UParseError *parseError,
450  UErrorCode *status);
451 
452 #ifndef U_HIDE_DEPRECATED_API
486 U_DEPRECATED UCollator* U_EXPORT2
487 ucol_openFromShortString( const char *definition,
488  UBool forceDefaults,
489  UParseError *parseError,
490  UErrorCode *status);
491 #endif /* U_HIDE_DEPRECATED_API */
492 
493 #ifndef U_HIDE_DEPRECATED_API
507 U_DEPRECATED int32_t U_EXPORT2
509  USet *conts,
510  UErrorCode *status);
511 #endif /* U_HIDE_DEPRECATED_API */
512 
524 U_CAPI void U_EXPORT2
526  USet *contractions, USet *expansions,
527  UBool addPrefixes, UErrorCode *status);
528 
539 U_CAPI void U_EXPORT2
541 
542 #if U_SHOW_CPLUSPLUS_API
543 
544 U_NAMESPACE_BEGIN
545 
556 
557 U_NAMESPACE_END
558 
559 #endif
560 
576 U_CAPI UCollationResult U_EXPORT2
577 ucol_strcoll( const UCollator *coll,
578  const UChar *source,
579  int32_t sourceLength,
580  const UChar *target,
581  int32_t targetLength);
582 
601 U_CAPI UCollationResult U_EXPORT2
603  const UCollator *coll,
604  const char *source,
605  int32_t sourceLength,
606  const char *target,
607  int32_t targetLength,
608  UErrorCode *status);
609 
624 U_CAPI UBool U_EXPORT2
626  const UChar *source, int32_t sourceLength,
627  const UChar *target, int32_t targetLength);
628 
643 U_CAPI UBool U_EXPORT2
645  const UChar *source, int32_t sourceLength,
646  const UChar *target, int32_t targetLength);
647 
662 U_CAPI UBool U_EXPORT2
663 ucol_equal(const UCollator *coll,
664  const UChar *source, int32_t sourceLength,
665  const UChar *target, int32_t targetLength);
666 
679 U_CAPI UCollationResult U_EXPORT2
681  UCharIterator *sIter,
682  UCharIterator *tIter,
683  UErrorCode *status);
684 
694 U_CAPI UCollationStrength U_EXPORT2
696 
706 U_CAPI void U_EXPORT2
708  UCollationStrength strength);
709 
726 U_CAPI int32_t U_EXPORT2
728  int32_t* dest,
729  int32_t destCapacity,
730  UErrorCode *pErrorCode);
771 U_CAPI void U_EXPORT2
773  const int32_t* reorderCodes,
774  int32_t reorderCodesLength,
775  UErrorCode *pErrorCode);
776 
796 U_CAPI int32_t U_EXPORT2
797 ucol_getEquivalentReorderCodes(int32_t reorderCode,
798  int32_t* dest,
799  int32_t destCapacity,
800  UErrorCode *pErrorCode);
801 
814 U_CAPI int32_t U_EXPORT2
815 ucol_getDisplayName( const char *objLoc,
816  const char *dispLoc,
817  UChar *result,
818  int32_t resultLength,
819  UErrorCode *status);
820 
830 U_CAPI const char* U_EXPORT2
831 ucol_getAvailable(int32_t localeIndex);
832 
841 U_CAPI int32_t U_EXPORT2
843 
844 #if !UCONFIG_NO_SERVICE
853 U_CAPI UEnumeration* U_EXPORT2
855 #endif
856 
866 U_CAPI UEnumeration* U_EXPORT2
868 
880 U_CAPI UEnumeration* U_EXPORT2
881 ucol_getKeywordValues(const char *keyword, UErrorCode *status);
882 
899 U_CAPI UEnumeration* U_EXPORT2
901  const char* locale,
902  UBool commonlyUsed,
903  UErrorCode* status);
904 
936 U_CAPI int32_t U_EXPORT2
937 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
938  const char* keyword, const char* locale,
939  UBool* isAvailable, UErrorCode* status);
940 
949 U_CAPI const UChar* U_EXPORT2
950 ucol_getRules( const UCollator *coll,
951  int32_t *length);
952 
953 #ifndef U_HIDE_DEPRECATED_API
974 U_DEPRECATED int32_t U_EXPORT2
976  const char *locale,
977  char *buffer,
978  int32_t capacity,
979  UErrorCode *status);
980 
1000 U_DEPRECATED int32_t U_EXPORT2
1002  char *destination,
1003  int32_t capacity,
1004  UParseError *parseError,
1005  UErrorCode *status);
1006 #endif /* U_HIDE_DEPRECATED_API */
1007 
1008 
1031 U_CAPI int32_t U_EXPORT2
1033  const UChar *source,
1034  int32_t sourceLength,
1035  uint8_t *result,
1036  int32_t resultLength);
1037 
1038 
1059 U_CAPI int32_t U_EXPORT2
1061  UCharIterator *iter,
1062  uint32_t state[2],
1063  uint8_t *dest, int32_t count,
1064  UErrorCode *status);
1065 
1073 typedef enum {
1080 #ifndef U_HIDE_DEPRECATED_API
1086 #endif /* U_HIDE_DEPRECATED_API */
1088 
1126 U_CAPI int32_t U_EXPORT2
1127 ucol_getBound(const uint8_t *source,
1128  int32_t sourceLength,
1129  UColBoundMode boundType,
1130  uint32_t noOfLevels,
1131  uint8_t *result,
1132  int32_t resultLength,
1133  UErrorCode *status);
1134 
1143 U_CAPI void U_EXPORT2
1145 
1153 U_CAPI void U_EXPORT2
1155 
1203 U_CAPI int32_t U_EXPORT2
1204 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
1205  const uint8_t *src2, int32_t src2Length,
1206  uint8_t *dest, int32_t destCapacity);
1207 
1219 U_CAPI void U_EXPORT2
1221 
1233 U_CAPI UColAttributeValue U_EXPORT2
1235 
1252 U_CAPI void U_EXPORT2
1254 
1262 U_CAPI UColReorderCode U_EXPORT2
1264 
1265 #ifndef U_HIDE_DEPRECATED_API
1286 U_DEPRECATED uint32_t U_EXPORT2
1288  const UChar *varTop, int32_t len,
1289  UErrorCode *status);
1290 #endif /* U_HIDE_DEPRECATED_API */
1291 
1303 U_CAPI uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
1304 
1305 #ifndef U_HIDE_DEPRECATED_API
1320 U_DEPRECATED void U_EXPORT2
1321 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
1322 #endif /* U_HIDE_DEPRECATED_API */
1323 
1334 U_CAPI UCollator* U_EXPORT2 ucol_clone(const UCollator *coll, UErrorCode *status);
1335 
1336 #ifndef U_HIDE_DEPRECATED_API
1337 
1361 U_DEPRECATED UCollator* U_EXPORT2
1363  void *stackBuffer,
1364  int32_t *pBufferSize,
1365  UErrorCode *status);
1366 
1367 
1371 #define U_COL_SAFECLONE_BUFFERSIZE 1
1372 
1373 #endif /* U_HIDE_DEPRECATED_API */
1374 
1390 U_CAPI int32_t U_EXPORT2
1391 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
1392 
1393 #ifndef U_HIDE_DEPRECATED_API
1408 U_DEPRECATED const char * U_EXPORT2
1410 #endif /* U_HIDE_DEPRECATED_API */
1411 
1426 U_CAPI const char * U_EXPORT2
1428 
1439 U_CAPI USet * U_EXPORT2
1441 
1442 #ifndef U_HIDE_INTERNAL_API
1454 U_CAPI int32_t U_EXPORT2
1456  USet *unsafe,
1457  UErrorCode *status);
1458 
1479 U_CAPI void U_EXPORT2
1480 ucol_prepareShortStringOpen( const char *definition,
1481  UBool forceDefaults,
1482  UParseError *parseError,
1483  UErrorCode *status);
1484 #endif /* U_HIDE_INTERNAL_API */
1485 
1497 U_CAPI int32_t U_EXPORT2
1499  uint8_t *buffer, int32_t capacity,
1500  UErrorCode *status);
1501 
1519 U_CAPI UCollator* U_EXPORT2
1520 ucol_openBinary(const uint8_t *bin, int32_t length,
1521  const UCollator *base,
1522  UErrorCode *status);
1523 
1524 #if U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
1525 
1526 #include <functional>
1527 #include <string_view>
1528 #include <type_traits>
1529 
1530 #include "unicode/char16ptr.h"
1531 #include "unicode/unistr.h"
1532 
1533 namespace U_HEADER_ONLY_NAMESPACE {
1534 
1535 namespace collator {
1536 
1537 namespace internal {
1538 
1543 template <template <typename...> typename Compare, UCollationResult result>
1544 class Predicate {
1545  public:
1547  explicit Predicate(const UCollator* ucol) : collator(ucol) {}
1548 
1549 #if U_SHOW_CPLUSPLUS_API
1551  template <
1552  typename T, typename U,
1553  typename = std::enable_if_t<ConvertibleToU16StringView<T> && ConvertibleToU16StringView<U>>>
1554  bool operator()(const T& lhs, const U& rhs) const {
1555  return match(UnicodeString::readOnlyAlias(lhs), UnicodeString::readOnlyAlias(rhs));
1556  }
1557 #else
1559  bool operator()(std::u16string_view lhs, std::u16string_view rhs) const {
1560  return match(lhs, rhs);
1561  }
1562 
1563 #if !U_CHAR16_IS_TYPEDEF && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION < 180000)
1565  bool operator()(std::basic_string_view<uint16_t> lhs, std::basic_string_view<uint16_t> rhs) const {
1566  return match({uprv_char16PtrFromUint16(lhs.data()), lhs.length()},
1567  {uprv_char16PtrFromUint16(rhs.data()), rhs.length()});
1568  }
1569 #endif
1570 
1571 #if U_SIZEOF_WCHAR_T==2
1573  bool operator()(std::wstring_view lhs, std::wstring_view rhs) const {
1574  return match({uprv_char16PtrFromWchar(lhs.data()), lhs.length()},
1575  {uprv_char16PtrFromWchar(rhs.data()), rhs.length()});
1576  }
1577 #endif
1578 #endif
1579 
1581  bool operator()(std::string_view lhs, std::string_view rhs) const {
1582  return match(lhs, rhs);
1583  }
1584 
1585 #if defined(__cpp_char8_t)
1587  bool operator()(std::u8string_view lhs, std::u8string_view rhs) const {
1588  return match({reinterpret_cast<const char*>(lhs.data()), lhs.length()},
1589  {reinterpret_cast<const char*>(rhs.data()), rhs.length()});
1590  }
1591 #endif
1592 
1593  private:
1594  bool match(std::u16string_view lhs, std::u16string_view rhs) const {
1595  return compare(
1596  ucol_strcoll(
1597  collator,
1598  toUCharPtr(lhs.data()), static_cast<int32_t>(lhs.length()),
1599  toUCharPtr(rhs.data()), static_cast<int32_t>(rhs.length())),
1600  result);
1601  }
1602 
1603  bool match(std::string_view lhs, std::string_view rhs) const {
1604  UErrorCode status = U_ZERO_ERROR;
1605  return compare(
1607  collator,
1608  lhs.data(), static_cast<int32_t>(lhs.length()),
1609  rhs.data(), static_cast<int32_t>(rhs.length()),
1610  &status),
1611  result);
1612  }
1613 
1614  const UCollator* const collator;
1615  static constexpr Compare<UCollationResult> compare{};
1616 };
1617 
1618 } // namespace internal
1619 
1626 
1633 
1640 
1647 
1654 
1661 
1662 } // namespace collator
1663 
1664 } // namespace U_HEADER_ONLY_NAMESPACE
1665 
1666 #endif // U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
1667 
1668 #endif /* #if !UCONFIG_NO_COLLATION */
1669 
1670 #endif
C++ API: char16_t pointer wrappers with implicit conversion from bit-compatible raw pointer types.
"Smart pointer" class, closes a UCollator via ucol_close().
Function object for performing comparisons using a UCollator.
Definition: ucol.h:1544
bool operator()(std::string_view lhs, std::string_view rhs) const
Definition: ucol.h:1581
bool operator()(const T &lhs, const U &rhs) const
Definition: ucol.h:1554
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:548
C API: Parse Error Information.
C API for code unit iteration.
Definition: uiter.h:341
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
U_CAPI void ucol_setMaxVariable(UCollator *coll, UColReorderCode group, UErrorCode *pErrorCode)
Sets the variable top to the top of the specified reordering group.
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.
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.
U_CAPI int32_t ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen)
Returns current rules.
U_CAPI void ucol_getVersion(const UCollator *coll, UVersionInfo info)
Gets the version information for a Collator.
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.
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.
U_CAPI uint32_t ucol_getVariableTop(const UCollator *coll, UErrorCode *status)
Gets the variable top value of a Collator.
U_CAPI UColAttributeValue ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status)
Universal attribute getter.
U_CAPI void ucol_setStrength(UCollator *coll, UCollationStrength strength)
Set the collation strength used in a UCollator.
U_CAPI int32_t ucol_getUnsafeSet(const UCollator *coll, USet *unsafe, UErrorCode *status)
Calculates the set of unsafe code points, given a collator.
UCollator * ucol_openFromShortString(const char *definition, UBool forceDefaults, UParseError *parseError, UErrorCode *status)
Open a collator defined by a short form string.
struct UCollator UCollator
structure representing a collator object instance
Definition: ucol.h:61
U_CAPI void ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status)
Universal attribute setter.
U_CAPI UColReorderCode ucol_getMaxVariable(const UCollator *coll)
Returns the maximum reordering group whose characters are affected by UCOL_ALTERNATE_HANDLING.
int32_t ucol_normalizeShortDefinitionString(const char *source, char *destination, int32_t capacity, UParseError *parseError, UErrorCode *status)
Verifies and normalizes short definition string.
UColRuleOption
Options for retrieving the rule string.
Definition: ucol.h:372
@ UCOL_FULL_RULES
Retrieves the "UCA rules" concatenated with the tailoring rules.
Definition: ucol.h:386
@ UCOL_TAILORING_ONLY
Retrieves the tailoring rules only.
Definition: ucol.h:378
U_CAPI const UChar * ucol_getRules(const UCollator *coll, int32_t *length)
Get the collation tailoring rules from a UCollator.
UColAttribute
Attributes that collation service understands.
Definition: ucol.h:245
@ UCOL_CASE_FIRST
Controls the ordering of upper and lower case letters.
Definition: ucol.h:278
@ UCOL_NUMERIC_COLLATION
When turned on, this attribute makes substrings of digits sort according to their numeric values.
Definition: ucol.h:356
@ UCOL_STRENGTH
The strength attribute.
Definition: ucol.h:323
@ 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
Attribute for direction of secondary weights - used in Canadian French.
Definition: ucol.h:252
@ 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
An alias for UCOL_NORMALIZATION_MODE attribute.
Definition: ucol.h:306
@ UCOL_ATTRIBUTE_COUNT
One more than the highest normal UColAttribute value.
Definition: ucol.h:365
@ UCOL_ALTERNATE_HANDLING
Attribute for handling variable elements.
Definition: ucol.h:266
@ UCOL_NORMALIZATION_MODE
Controls whether the normalization check and necessary normalizations are performed.
Definition: ucol.h:302
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.
int32_t ucol_getContractions(const UCollator *coll, USet *conts, UErrorCode *status)
Get a set containing the contractions defined by the collator.
U_CAPI UCollationResult ucol_strcoll(const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength)
Compare two strings.
UColAttributeValue UCollationStrength
Base letter represents a primary difference.
Definition: ucol.h:239
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.
U_CAPI UCollationResult ucol_strcollIter(const UCollator *coll, UCharIterator *sIter, UCharIterator *tIter, UErrorCode *status)
Compare two UTF-8 encoded strings.
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.
U_CAPI const char * ucol_getAvailable(int32_t localeIndex)
Get a locale for which collation rules are available.
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.
U_CAPI int32_t ucol_cloneBinary(const UCollator *coll, uint8_t *buffer, int32_t capacity, UErrorCode *status)
Creates a binary image of a collator.
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.
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,...
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
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
string a < string b
Definition: ucol.h:82
@ UCOL_GREATER
string a > string b
Definition: ucol.h:80
@ UCOL_EQUAL
string a == string b
Definition: ucol.h:78
U_CAPI UCollator * ucol_open(const char *loc, UErrorCode *status)
Open a UCollator for comparing strings.
U_CAPI const char * ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status)
gets the locale name of the collator.
UCollator * ucol_safeClone(const UCollator *coll, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status)
Thread safe cloning operation.
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.
const char * ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status)
gets the locale name of the collator.
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
lower bound
Definition: ucol.h:1075
@ UCOL_BOUND_UPPER
upper bound that will match strings of exact size
Definition: ucol.h:1077
@ UCOL_BOUND_VALUE_COUNT
One more than the highest normal UColBoundMode value.
Definition: ucol.h:1085
@ 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
U_CAPI int32_t ucol_countAvailable(void)
Determine how many locales have collation rules available.
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.
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.
U_CAPI void ucol_close(UCollator *coll)
Close a UCollator.
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_CAPI UEnumeration * ucol_getKeywords(UErrorCode *status)
Create a string enumerator of all possible keywords that are relevant to collation.
U_CAPI UCollator * ucol_clone(const UCollator *coll, UErrorCode *status)
Thread safe cloning operation.
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.
U_CAPI UEnumeration * ucol_openAvailableLocales(UErrorCode *status)
Create a string enumerator of all locales for which a valid collator may be opened.
U_CAPI void ucol_getUCAVersion(const UCollator *coll, UVersionInfo info)
Gets the UCA version information for a Collator.
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
Enum containing attribute values for controlling collation behavior.
Definition: ucol.h:92
@ UCOL_UPPER_FIRST
upper case sorts before lower case
Definition: ucol.h:129
@ UCOL_TERTIARY
Tertiary collation strength.
Definition: ucol.h:101
@ UCOL_DEFAULT
accepted by most attributes
Definition: ucol.h:94
@ UCOL_IDENTICAL
Identical collation strength.
Definition: ucol.h:108
@ UCOL_OFF
Turn the feature off - works for UCOL_FRENCH_COLLATION, UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MOD...
Definition: ucol.h:114
@ UCOL_QUATERNARY
Quaternary collation strength.
Definition: ucol.h:106
@ UCOL_SHIFTED
Valid for UCOL_ALTERNATE_HANDLING.
Definition: ucol.h:121
@ UCOL_PRIMARY
Primary collation strength.
Definition: ucol.h:97
@ UCOL_LOWER_FIRST
Valid for UCOL_CASE_FIRST - lower case sorts before upper case.
Definition: ucol.h:127
@ UCOL_ATTRIBUTE_VALUE_COUNT
One more than the highest normal UColAttributeValue value.
Definition: ucol.h:136
@ UCOL_SECONDARY
Secondary collation strength.
Definition: ucol.h:99
@ UCOL_NON_IGNORABLE
Valid for UCOL_ALTERNATE_HANDLING.
Definition: ucol.h:123
@ 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
Default collation strength.
Definition: ucol.h:103
void ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status)
Sets the variable top to the specified primary weight.
U_CAPI UCollationStrength ucol_getStrength(const UCollator *coll)
Get the collation strength used in a UCollator.
U_CAPI int32_t ucol_getReorderCodes(const UCollator *coll, int32_t *dest, int32_t destCapacity, UErrorCode *pErrorCode)
Retrieves the reordering codes for this collator.
U_CAPI void ucol_setReorderCodes(UCollator *coll, const int32_t *reorderCodes, int32_t reorderCodesLength, UErrorCode *pErrorCode)
Sets the reordering codes for this collator.
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
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
A special reordering code that is used to specify no reordering codes.
Definition: ucol.h:160
@ 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
One more than the highest normal UColReorderCode value.
Definition: ucol.h:209
@ UCOL_REORDER_CODE_SYMBOL
Characters with the symbol property.
Definition: ucol.h:191
@ UCOL_REORDER_CODE_DIGIT
Characters with the digit property.
Definition: ucol.h:203
@ UCOL_REORDER_CODE_PUNCTUATION
Characters with the punctuation property.
Definition: ucol.h:185
@ UCOL_REORDER_CODE_SPACE
Characters with the space property.
Definition: ucol.h:173
@ UCOL_REORDER_CODE_FIRST
The first entry in the enumeration of reordering groups.
Definition: ucol.h:179
@ UCOL_REORDER_CODE_CURRENCY
Characters with the currency property.
Definition: ucol.h:197
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...
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...
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.
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:44
C API: Locale ID functionality similar to C++ class Locale.
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
Definition: uloc.h:338
#define U_DEPRECATED
This is used to declare a function as a deprecated public ICU C API
Definition: umachine.h:116
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:400
C++ API: Unicode String.
C API: Unicode Normalization.
C API: Unicode Script Information.
@ USCRIPT_UNKNOWN
Definition: uscript.h:287
C API: Unicode Set.
struct USet USet
USet is the C API type corresponding to C++ class UnicodeSet.
Definition: uset.h:54
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:509
@ U_ZERO_ERROR
No error, no warning.
Definition: utypes.h:544
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