ICU 51.2  51.2
ucol.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 * Copyright (c) 1996-2013, 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 
58 struct UCollator;
62 typedef struct UCollator UCollator;
63 
64 
77 typedef enum {
83  UCOL_LESS = -1
85 
86 
93 typedef enum {
96 
105  UCOL_CE_STRENGTH_LIMIT,
110  UCOL_STRENGTH_LIMIT,
111 
115  UCOL_OFF = 16,
119  UCOL_ON = 17,
120 
125 
131 
132  UCOL_ATTRIBUTE_VALUE_COUNT
133 
135 
145  typedef enum {
207 
235 
240 typedef enum {
331 } UColAttribute;
332 
336 typedef enum {
351 } UColRuleOption ;
352 
370 U_STABLE UCollator* U_EXPORT2
371 ucol_open(const char *loc, UErrorCode *status);
372 
398 U_STABLE UCollator* U_EXPORT2
399 ucol_openRules( const UChar *rules,
400  int32_t rulesLength,
401  UColAttributeValue normalizationMode,
402  UCollationStrength strength,
403  UParseError *parseError,
404  UErrorCode *status);
405 
440 U_STABLE UCollator* U_EXPORT2
441 ucol_openFromShortString( const char *definition,
442  UBool forceDefaults,
443  UParseError *parseError,
444  UErrorCode *status);
445 
446 #ifndef U_HIDE_DEPRECATED_API
447 
460 U_DEPRECATED int32_t U_EXPORT2
461 ucol_getContractions( const UCollator *coll,
462  USet *conts,
463  UErrorCode *status);
464 #endif /* U_HIDE_DEPRECATED_API */
465 
477 U_STABLE void U_EXPORT2
479  USet *contractions, USet *expansions,
480  UBool addPrefixes, UErrorCode *status);
481 
492 U_STABLE void U_EXPORT2
493 ucol_close(UCollator *coll);
494 
495 #if U_SHOW_CPLUSPLUS_API
496 
498 
509 
511 
512 #endif
513 
529 U_STABLE UCollationResult U_EXPORT2
530 ucol_strcoll( const UCollator *coll,
531  const UChar *source,
532  int32_t sourceLength,
533  const UChar *target,
534  int32_t targetLength);
535 
536 #ifndef U_HIDE_DRAFT_API
537 
555 U_DRAFT UCollationResult U_EXPORT2
557  const UCollator *coll,
558  const char *source,
559  int32_t sourceLength,
560  const char *target,
561  int32_t targetLength,
562  UErrorCode *status);
563 #endif /* U_HIDE_DRAFT_API */
564 
579 U_STABLE UBool U_EXPORT2
580 ucol_greater(const UCollator *coll,
581  const UChar *source, int32_t sourceLength,
582  const UChar *target, int32_t targetLength);
583 
598 U_STABLE UBool U_EXPORT2
599 ucol_greaterOrEqual(const UCollator *coll,
600  const UChar *source, int32_t sourceLength,
601  const UChar *target, int32_t targetLength);
602 
617 U_STABLE UBool U_EXPORT2
618 ucol_equal(const UCollator *coll,
619  const UChar *source, int32_t sourceLength,
620  const UChar *target, int32_t targetLength);
621 
634 U_STABLE UCollationResult U_EXPORT2
635 ucol_strcollIter( const UCollator *coll,
636  UCharIterator *sIter,
637  UCharIterator *tIter,
638  UErrorCode *status);
639 
649 U_STABLE UCollationStrength U_EXPORT2
650 ucol_getStrength(const UCollator *coll);
651 
661 U_STABLE void U_EXPORT2
663  UCollationStrength strength);
664 
681 U_STABLE int32_t U_EXPORT2
682 ucol_getReorderCodes(const UCollator* coll,
683  int32_t* dest,
684  int32_t destCapacity,
685  UErrorCode *pErrorCode);
721 U_STABLE void U_EXPORT2
723  const int32_t* reorderCodes,
724  int32_t reorderCodesLength,
725  UErrorCode *pErrorCode);
726 
743 U_STABLE int32_t U_EXPORT2
744 ucol_getEquivalentReorderCodes(int32_t reorderCode,
745  int32_t* dest,
746  int32_t destCapacity,
747  UErrorCode *pErrorCode);
748 
761 U_STABLE int32_t U_EXPORT2
762 ucol_getDisplayName( const char *objLoc,
763  const char *dispLoc,
764  UChar *result,
765  int32_t resultLength,
766  UErrorCode *status);
767 
777 U_STABLE const char* U_EXPORT2
778 ucol_getAvailable(int32_t localeIndex);
779 
788 U_STABLE int32_t U_EXPORT2
789 ucol_countAvailable(void);
790 
791 #if !UCONFIG_NO_SERVICE
792 
800 U_STABLE UEnumeration* U_EXPORT2
802 #endif
803 
813 U_STABLE UEnumeration* U_EXPORT2
815 
827 U_STABLE UEnumeration* U_EXPORT2
828 ucol_getKeywordValues(const char *keyword, UErrorCode *status);
829 
846 U_STABLE UEnumeration* U_EXPORT2
847 ucol_getKeywordValuesForLocale(const char* key,
848  const char* locale,
849  UBool commonlyUsed,
850  UErrorCode* status);
851 
882 U_STABLE int32_t U_EXPORT2
883 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
884  const char* keyword, const char* locale,
885  UBool* isAvailable, UErrorCode* status);
886 
895 U_STABLE const UChar* U_EXPORT2
896 ucol_getRules( const UCollator *coll,
897  int32_t *length);
898 
919 U_STABLE int32_t U_EXPORT2
921  const char *locale,
922  char *buffer,
923  int32_t capacity,
924  UErrorCode *status);
925 
946 U_STABLE int32_t U_EXPORT2
947 ucol_normalizeShortDefinitionString(const char *source,
948  char *destination,
949  int32_t capacity,
950  UParseError *parseError,
951  UErrorCode *status);
952 
953 
973 U_STABLE int32_t U_EXPORT2
974 ucol_getSortKey(const UCollator *coll,
975  const UChar *source,
976  int32_t sourceLength,
977  uint8_t *result,
978  int32_t resultLength);
979 
980 
1001 U_STABLE int32_t U_EXPORT2
1002 ucol_nextSortKeyPart(const UCollator *coll,
1003  UCharIterator *iter,
1004  uint32_t state[2],
1005  uint8_t *dest, int32_t count,
1006  UErrorCode *status);
1007 
1015 typedef enum {
1022  UCOL_BOUND_VALUE_COUNT
1023 } UColBoundMode;
1024 
1062 U_STABLE int32_t U_EXPORT2
1063 ucol_getBound(const uint8_t *source,
1064  int32_t sourceLength,
1065  UColBoundMode boundType,
1066  uint32_t noOfLevels,
1067  uint8_t *result,
1068  int32_t resultLength,
1069  UErrorCode *status);
1070 
1079 U_STABLE void U_EXPORT2
1080 ucol_getVersion(const UCollator* coll, UVersionInfo info);
1081 
1089 U_STABLE void U_EXPORT2
1090 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
1091 
1128 U_STABLE int32_t U_EXPORT2
1129 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
1130  const uint8_t *src2, int32_t src2Length,
1131  uint8_t *dest, int32_t destCapacity);
1132 
1144 U_STABLE void U_EXPORT2
1146 
1158 U_STABLE UColAttributeValue U_EXPORT2
1159 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
1160 
1180 U_STABLE uint32_t U_EXPORT2
1182  const UChar *varTop, int32_t len,
1183  UErrorCode *status);
1184 
1196 U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
1197 
1209 U_STABLE void U_EXPORT2
1210 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
1211 
1234 U_STABLE UCollator* U_EXPORT2
1235 ucol_safeClone(const UCollator *coll,
1236  void *stackBuffer,
1237  int32_t *pBufferSize,
1238  UErrorCode *status);
1239 
1243 #define U_COL_SAFECLONE_BUFFERSIZE 528
1244 
1260 U_STABLE int32_t U_EXPORT2
1261 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
1262 
1263 #ifndef U_HIDE_DEPRECATED_API
1264 
1278 U_DEPRECATED const char * U_EXPORT2
1279 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
1280 #endif /* U_HIDE_DEPRECATED_API */
1281 
1296 U_STABLE const char * U_EXPORT2
1297 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
1298 
1309 U_STABLE USet * U_EXPORT2
1310 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
1311 
1312 #ifndef U_HIDE_INTERNAL_API
1313 
1325 ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status);
1326 
1335 U_INTERNAL UBool U_EXPORT2
1336 ucol_equals(const UCollator *source, const UCollator *target);
1337 
1349 U_INTERNAL int32_t U_EXPORT2
1350 ucol_getUnsafeSet( const UCollator *coll,
1351  USet *unsafe,
1352  UErrorCode *status);
1353 
1357 U_INTERNAL void U_EXPORT2
1358 ucol_forgetUCA(void);
1359 
1380 U_INTERNAL void U_EXPORT2
1381 ucol_prepareShortStringOpen( const char *definition,
1382  UBool forceDefaults,
1383  UParseError *parseError,
1384  UErrorCode *status);
1385 #endif /* U_HIDE_INTERNAL_API */
1386 
1398 U_STABLE int32_t U_EXPORT2
1399 ucol_cloneBinary(const UCollator *coll,
1400  uint8_t *buffer, int32_t capacity,
1401  UErrorCode *status);
1402 
1420 U_STABLE UCollator* U_EXPORT2
1421 ucol_openBinary(const uint8_t *bin, int32_t length,
1422  const UCollator *base,
1423  UErrorCode *status);
1424 
1425 
1426 #endif /* #if !UCONFIG_NO_COLLATION */
1427 
1428 #endif