ICU 55.1 55.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ucol.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 * Copyright (c) 1996-2015, International Business Machines Corporation and others.
4 * All Rights Reserved.
5 *******************************************************************************
6 */
7
8 #ifndef UCOL_H
9 #define UCOL_H
10
11 #include "unicode/utypes.h"
12
13 #if !UCONFIG_NO_COLLATION
14
15 #include "unicode/unorm.h"
16 #include "unicode/localpointer.h"
17 #include "unicode/parseerr.h"
18 #include "unicode/uloc.h"
19 #include "unicode/uset.h"
20 #include "unicode/uscript.h"
21
52 struct UCollator;
56 typedef struct UCollator UCollator;
57
58
71 typedef enum {
73 UCOL_EQUAL = 0,
75 UCOL_GREATER = 1,
77 UCOL_LESS = -1
78 } UCollationResult ;
79
80
87 typedef enum {
89 UCOL_DEFAULT = -1,
90
92 UCOL_PRIMARY = 0,
94 UCOL_SECONDARY = 1,
96 UCOL_TERTIARY = 2,
98 UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
99 UCOL_CE_STRENGTH_LIMIT,
101 UCOL_QUATERNARY=3,
103 UCOL_IDENTICAL=15,
104 UCOL_STRENGTH_LIMIT,
105
109 UCOL_OFF = 16,
113 UCOL_ON = 17,
114
116 UCOL_SHIFTED = 20,
118 UCOL_NON_IGNORABLE = 21,
119
122 UCOL_LOWER_FIRST = 24,
124 UCOL_UPPER_FIRST = 25,
125
126 UCOL_ATTRIBUTE_VALUE_COUNT
127
128 } UColAttributeValue;
129
139 typedef enum {
145 UCOL_REORDER_CODE_DEFAULT = -1,
150 UCOL_REORDER_CODE_NONE = USCRIPT_UNKNOWN,
157 UCOL_REORDER_CODE_OTHERS = USCRIPT_UNKNOWN,
163 UCOL_REORDER_CODE_SPACE = 0x1000,
169 UCOL_REORDER_CODE_FIRST = UCOL_REORDER_CODE_SPACE,
175 UCOL_REORDER_CODE_PUNCTUATION = 0x1001,
181 UCOL_REORDER_CODE_SYMBOL = 0x1002,
187 UCOL_REORDER_CODE_CURRENCY = 0x1003,
193 UCOL_REORDER_CODE_DIGIT = 0x1004,
199 UCOL_REORDER_CODE_LIMIT = 0x1005
200 } UColReorderCode;
201
228 typedef UColAttributeValue UCollationStrength;
229
234 typedef enum {
241 UCOL_FRENCH_COLLATION,
252 UCOL_ALTERNATE_HANDLING,
261 UCOL_CASE_FIRST,
271 UCOL_CASE_LEVEL,
281 UCOL_NORMALIZATION_MODE,
285 UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
302 UCOL_STRENGTH,
303 #ifndef U_HIDE_DEPRECATED_API
304
315 UCOL_HIRAGANA_QUATERNARY_MODE = UCOL_STRENGTH + 1,
316 #endif /* U_HIDE_DEPRECATED_API */
317
335 UCOL_NUMERIC_COLLATION = UCOL_STRENGTH + 2,
340 UCOL_ATTRIBUTE_COUNT
341 } UColAttribute;
342
346 typedef enum {
352 UCOL_TAILORING_ONLY,
360 UCOL_FULL_RULES
361 } UColRuleOption ;
362
388 U_STABLE UCollator* U_EXPORT2
389 ucol_open(const char *loc, UErrorCode *status);
390
416 U_STABLE UCollator* U_EXPORT2
417 ucol_openRules( const UChar *rules,
418 int32_t rulesLength,
419 UColAttributeValue normalizationMode,
420 UCollationStrength strength,
421 UParseError *parseError,
422 UErrorCode *status);
423
424 #ifndef U_HIDE_DEPRECATED_API
425
458 U_DEPRECATED UCollator* U_EXPORT2
459 ucol_openFromShortString( const char *definition,
460 UBool forceDefaults,
461 UParseError *parseError,
462 UErrorCode *status);
463 #endif /* U_HIDE_DEPRECATED_API */
464
465 #ifndef U_HIDE_DEPRECATED_API
466
479 U_DEPRECATED int32_t U_EXPORT2
480 ucol_getContractions( const UCollator *coll,
481 USet *conts,
482 UErrorCode *status);
483 #endif /* U_HIDE_DEPRECATED_API */
484
496 U_STABLE void U_EXPORT2
497 ucol_getContractionsAndExpansions( const UCollator *coll,
498 USet *contractions, USet *expansions,
499 UBool addPrefixes, UErrorCode *status);
500
511 U_STABLE void U_EXPORT2
512 ucol_close(UCollator *coll);
513
514 #if U_SHOW_CPLUSPLUS_API
515
516 U_NAMESPACE_BEGIN
517
527 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
528
529 U_NAMESPACE_END
530
531 #endif
532
548 U_STABLE UCollationResult U_EXPORT2
549 ucol_strcoll( const UCollator *coll,
550 const UChar *source,
551 int32_t sourceLength,
552 const UChar *target,
553 int32_t targetLength);
554
573 U_STABLE UCollationResult U_EXPORT2
574 ucol_strcollUTF8(
575 const UCollator *coll,
576 const char *source,
577 int32_t sourceLength,
578 const char *target,
579 int32_t targetLength,
580 UErrorCode *status);
581
596 U_STABLE UBool U_EXPORT2
597 ucol_greater(const UCollator *coll,
598 const UChar *source, int32_t sourceLength,
599 const UChar *target, int32_t targetLength);
600
615 U_STABLE UBool U_EXPORT2
616 ucol_greaterOrEqual(const UCollator *coll,
617 const UChar *source, int32_t sourceLength,
618 const UChar *target, int32_t targetLength);
619
634 U_STABLE UBool U_EXPORT2
635 ucol_equal(const UCollator *coll,
636 const UChar *source, int32_t sourceLength,
637 const UChar *target, int32_t targetLength);
638
651 U_STABLE UCollationResult U_EXPORT2
652 ucol_strcollIter( const UCollator *coll,
653 UCharIterator *sIter,
654 UCharIterator *tIter,
655 UErrorCode *status);
656
666 U_STABLE UCollationStrength U_EXPORT2
667 ucol_getStrength(const UCollator *coll);
668
678 U_STABLE void U_EXPORT2
679 ucol_setStrength(UCollator *coll,
680 UCollationStrength strength);
681
698 U_STABLE int32_t U_EXPORT2
699 ucol_getReorderCodes(const UCollator* coll,
700 int32_t* dest,
701 int32_t destCapacity,
702 UErrorCode *pErrorCode);
743 U_STABLE void U_EXPORT2
744 ucol_setReorderCodes(UCollator* coll,
745 const int32_t* reorderCodes,
746 int32_t reorderCodesLength,
747 UErrorCode *pErrorCode);
748
768 U_STABLE int32_t U_EXPORT2
769 ucol_getEquivalentReorderCodes(int32_t reorderCode,
770 int32_t* dest,
771 int32_t destCapacity,
772 UErrorCode *pErrorCode);
773
786 U_STABLE int32_t U_EXPORT2
787 ucol_getDisplayName( const char *objLoc,
788 const char *dispLoc,
789 UChar *result,
790 int32_t resultLength,
791 UErrorCode *status);
792
802 U_STABLE const char* U_EXPORT2
803 ucol_getAvailable(int32_t localeIndex);
804
813 U_STABLE int32_t U_EXPORT2
814 ucol_countAvailable(void);
815
816 #if !UCONFIG_NO_SERVICE
817
825 U_STABLE UEnumeration* U_EXPORT2
826 ucol_openAvailableLocales(UErrorCode *status);
827 #endif
828
838 U_STABLE UEnumeration* U_EXPORT2
839 ucol_getKeywords(UErrorCode *status);
840
852 U_STABLE UEnumeration* U_EXPORT2
853 ucol_getKeywordValues(const char *keyword, UErrorCode *status);
854
871 U_STABLE UEnumeration* U_EXPORT2
872 ucol_getKeywordValuesForLocale(const char* key,
873 const char* locale,
874 UBool commonlyUsed,
875 UErrorCode* status);
876
908 U_STABLE int32_t U_EXPORT2
909 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
910 const char* keyword, const char* locale,
911 UBool* isAvailable, UErrorCode* status);
912
921 U_STABLE const UChar* U_EXPORT2
922 ucol_getRules( const UCollator *coll,
923 int32_t *length);
924
925 #ifndef U_HIDE_DEPRECATED_API
926
946 U_DEPRECATED int32_t U_EXPORT2
947 ucol_getShortDefinitionString(const UCollator *coll,
948 const char *locale,
949 char *buffer,
950 int32_t capacity,
951 UErrorCode *status);
952
973 U_DEPRECATED int32_t U_EXPORT2
974 ucol_normalizeShortDefinitionString(const char *source,
975 char *destination,
976 int32_t capacity,
977 UParseError *parseError,
978 UErrorCode *status);
979 #endif /* U_HIDE_DEPRECATED_API */
980
981
1004 U_STABLE int32_t U_EXPORT2
1005 ucol_getSortKey(const UCollator *coll,
1006 const UChar *source,
1007 int32_t sourceLength,
1008 uint8_t *result,
1009 int32_t resultLength);
1010
1011
1032 U_STABLE int32_t U_EXPORT2
1033 ucol_nextSortKeyPart(const UCollator *coll,
1034 UCharIterator *iter,
1035 uint32_t state[2],
1036 uint8_t *dest, int32_t count,
1037 UErrorCode *status);
1038
1046 typedef enum {
1048 UCOL_BOUND_LOWER = 0,
1050 UCOL_BOUND_UPPER = 1,
1052 UCOL_BOUND_UPPER_LONG = 2,
1053 UCOL_BOUND_VALUE_COUNT
1054 } UColBoundMode;
1055
1093 U_STABLE int32_t U_EXPORT2
1094 ucol_getBound(const uint8_t *source,
1095 int32_t sourceLength,
1096 UColBoundMode boundType,
1097 uint32_t noOfLevels,
1098 uint8_t *result,
1099 int32_t resultLength,
1100 UErrorCode *status);
1101
1110 U_STABLE void U_EXPORT2
1111 ucol_getVersion(const UCollator* coll, UVersionInfo info);
1112
1120 U_STABLE void U_EXPORT2
1121 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
1122
1170 U_STABLE int32_t U_EXPORT2
1171 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
1172 const uint8_t *src2, int32_t src2Length,
1173 uint8_t *dest, int32_t destCapacity);
1174
1186 U_STABLE void U_EXPORT2
1187 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
1188
1200 U_STABLE UColAttributeValue U_EXPORT2
1201 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
1202
1219 U_STABLE void U_EXPORT2
1220 ucol_setMaxVariable(UCollator *coll, UColReorderCode group, UErrorCode *pErrorCode);
1221
1229 U_STABLE UColReorderCode U_EXPORT2
1230 ucol_getMaxVariable(const UCollator *coll);
1231
1232 #ifndef U_HIDE_DEPRECATED_API
1233
1253 U_DEPRECATED uint32_t U_EXPORT2
1254 ucol_setVariableTop(UCollator *coll,
1255 const UChar *varTop, int32_t len,
1256 UErrorCode *status);
1257 #endif /* U_HIDE_DEPRECATED_API */
1258
1270 U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
1271
1285 U_DEPRECATED void U_EXPORT2
1286 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
1287
1311 U_STABLE UCollator* U_EXPORT2
1312 ucol_safeClone(const UCollator *coll,
1313 void *stackBuffer,
1314 int32_t *pBufferSize,
1315 UErrorCode *status);
1316
1317 #ifndef U_HIDE_DEPRECATED_API
1318
1322 #define U_COL_SAFECLONE_BUFFERSIZE 1
1323
1324 #endif /* U_HIDE_DEPRECATED_API */
1325
1341 U_STABLE int32_t U_EXPORT2
1342 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
1343
1344 #ifndef U_HIDE_DEPRECATED_API
1345
1359 U_DEPRECATED const char * U_EXPORT2
1360 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
1361 #endif /* U_HIDE_DEPRECATED_API */
1362
1377 U_STABLE const char * U_EXPORT2
1378 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
1379
1390 U_STABLE USet * U_EXPORT2
1391 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
1392
1393 #ifndef U_HIDE_INTERNAL_API
1394
1405 U_INTERNAL int32_t U_EXPORT2
1406 ucol_getUnsafeSet( const UCollator *coll,
1407 USet *unsafe,
1408 UErrorCode *status);
1409
1430 U_INTERNAL void U_EXPORT2
1431 ucol_prepareShortStringOpen( const char *definition,
1432 UBool forceDefaults,
1433 UParseError *parseError,
1434 UErrorCode *status);
1435 #endif /* U_HIDE_INTERNAL_API */
1436
1448 U_STABLE int32_t U_EXPORT2
1449 ucol_cloneBinary(const UCollator *coll,
1450 uint8_t *buffer, int32_t capacity,
1451 UErrorCode *status);
1452
1470 U_STABLE UCollator* U_EXPORT2
1471 ucol_openBinary(const uint8_t *bin, int32_t length,
1472 const UCollator *base,
1473 UErrorCode *status);
1474
1475
1476 #endif /* #if !UCONFIG_NO_COLLATION */
1477
1478 #endif