ICU 49.1.1  49.1.1
ucol.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 * Copyright (c) 1996-2012, 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 {
303  UCOL_ATTRIBUTE_COUNT
304 } UColAttribute;
305 
309 typedef enum {
314 } UColRuleOption ;
315 
333 U_STABLE UCollator* U_EXPORT2
334 ucol_open(const char *loc, UErrorCode *status);
335 
361 U_STABLE UCollator* U_EXPORT2
362 ucol_openRules( const UChar *rules,
363  int32_t rulesLength,
364  UColAttributeValue normalizationMode,
365  UCollationStrength strength,
366  UParseError *parseError,
367  UErrorCode *status);
368 
403 U_STABLE UCollator* U_EXPORT2
404 ucol_openFromShortString( const char *definition,
405  UBool forceDefaults,
406  UParseError *parseError,
407  UErrorCode *status);
408 
409 #ifndef U_HIDE_DEPRECATED_API
410 
423 U_DEPRECATED int32_t U_EXPORT2
424 ucol_getContractions( const UCollator *coll,
425  USet *conts,
426  UErrorCode *status);
427 #endif /* U_HIDE_DEPRECATED_API */
428 
440 U_STABLE void U_EXPORT2
442  USet *contractions, USet *expansions,
443  UBool addPrefixes, UErrorCode *status);
444 
455 U_STABLE void U_EXPORT2
456 ucol_close(UCollator *coll);
457 
458 #if U_SHOW_CPLUSPLUS_API
459 
461 
471 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
472 
474 
475 #endif
476 
492 U_STABLE UCollationResult U_EXPORT2
493 ucol_strcoll( const UCollator *coll,
494  const UChar *source,
495  int32_t sourceLength,
496  const UChar *target,
497  int32_t targetLength);
498 
513 U_STABLE UBool U_EXPORT2
514 ucol_greater(const UCollator *coll,
515  const UChar *source, int32_t sourceLength,
516  const UChar *target, int32_t targetLength);
517 
532 U_STABLE UBool U_EXPORT2
533 ucol_greaterOrEqual(const UCollator *coll,
534  const UChar *source, int32_t sourceLength,
535  const UChar *target, int32_t targetLength);
536 
551 U_STABLE UBool U_EXPORT2
552 ucol_equal(const UCollator *coll,
553  const UChar *source, int32_t sourceLength,
554  const UChar *target, int32_t targetLength);
555 
568 U_STABLE UCollationResult U_EXPORT2
569 ucol_strcollIter( const UCollator *coll,
570  UCharIterator *sIter,
571  UCharIterator *tIter,
572  UErrorCode *status);
573 
583 U_STABLE UCollationStrength U_EXPORT2
584 ucol_getStrength(const UCollator *coll);
585 
595 U_STABLE void U_EXPORT2
597  UCollationStrength strength);
598 
615 U_DRAFT int32_t U_EXPORT2
616 ucol_getReorderCodes(const UCollator* coll,
617  int32_t* dest,
618  int32_t destCapacity,
619  UErrorCode *pErrorCode);
655 U_DRAFT void U_EXPORT2
657  const int32_t* reorderCodes,
658  int32_t reorderCodesLength,
659  UErrorCode *pErrorCode);
660 
677 U_DRAFT int32_t U_EXPORT2
678 ucol_getEquivalentReorderCodes(int32_t reorderCode,
679  int32_t* dest,
680  int32_t destCapacity,
681  UErrorCode *pErrorCode);
682 
695 U_STABLE int32_t U_EXPORT2
696 ucol_getDisplayName( const char *objLoc,
697  const char *dispLoc,
698  UChar *result,
699  int32_t resultLength,
700  UErrorCode *status);
701 
711 U_STABLE const char* U_EXPORT2
712 ucol_getAvailable(int32_t localeIndex);
713 
722 U_STABLE int32_t U_EXPORT2
723 ucol_countAvailable(void);
724 
725 #if !UCONFIG_NO_SERVICE
726 
734 U_STABLE UEnumeration* U_EXPORT2
736 #endif
737 
747 U_STABLE UEnumeration* U_EXPORT2
749 
761 U_STABLE UEnumeration* U_EXPORT2
762 ucol_getKeywordValues(const char *keyword, UErrorCode *status);
763 
780 U_STABLE UEnumeration* U_EXPORT2
781 ucol_getKeywordValuesForLocale(const char* key,
782  const char* locale,
783  UBool commonlyUsed,
784  UErrorCode* status);
785 
816 U_STABLE int32_t U_EXPORT2
817 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
818  const char* keyword, const char* locale,
819  UBool* isAvailable, UErrorCode* status);
820 
829 U_STABLE const UChar* U_EXPORT2
830 ucol_getRules( const UCollator *coll,
831  int32_t *length);
832 
853 U_STABLE int32_t U_EXPORT2
855  const char *locale,
856  char *buffer,
857  int32_t capacity,
858  UErrorCode *status);
859 
880 U_STABLE int32_t U_EXPORT2
881 ucol_normalizeShortDefinitionString(const char *source,
882  char *destination,
883  int32_t capacity,
884  UParseError *parseError,
885  UErrorCode *status);
886 
887 
907 U_STABLE int32_t U_EXPORT2
908 ucol_getSortKey(const UCollator *coll,
909  const UChar *source,
910  int32_t sourceLength,
911  uint8_t *result,
912  int32_t resultLength);
913 
914 
935 U_STABLE int32_t U_EXPORT2
936 ucol_nextSortKeyPart(const UCollator *coll,
937  UCharIterator *iter,
938  uint32_t state[2],
939  uint8_t *dest, int32_t count,
940  UErrorCode *status);
941 
949 typedef enum {
956  UCOL_BOUND_VALUE_COUNT
957 } UColBoundMode;
958 
996 U_STABLE int32_t U_EXPORT2
997 ucol_getBound(const uint8_t *source,
998  int32_t sourceLength,
999  UColBoundMode boundType,
1000  uint32_t noOfLevels,
1001  uint8_t *result,
1002  int32_t resultLength,
1003  UErrorCode *status);
1004 
1013 U_STABLE void U_EXPORT2
1014 ucol_getVersion(const UCollator* coll, UVersionInfo info);
1015 
1023 U_STABLE void U_EXPORT2
1024 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
1025 
1048 U_STABLE int32_t U_EXPORT2
1049 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
1050  const uint8_t *src2, int32_t src2Length,
1051  uint8_t *dest, int32_t destCapacity);
1052 
1064 U_STABLE void U_EXPORT2
1066 
1078 U_STABLE UColAttributeValue U_EXPORT2
1079 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
1080 
1100 U_STABLE uint32_t U_EXPORT2
1102  const UChar *varTop, int32_t len,
1103  UErrorCode *status);
1104 
1116 U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
1117 
1129 U_STABLE void U_EXPORT2
1130 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
1131 
1154 U_STABLE UCollator* U_EXPORT2
1155 ucol_safeClone(const UCollator *coll,
1156  void *stackBuffer,
1157  int32_t *pBufferSize,
1158  UErrorCode *status);
1159 
1163 #define U_COL_SAFECLONE_BUFFERSIZE 528
1164 
1176 U_STABLE int32_t U_EXPORT2
1177 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
1178 
1179 #ifndef U_HIDE_DEPRECATED_API
1180 
1194 U_DEPRECATED const char * U_EXPORT2
1195 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
1196 #endif /* U_HIDE_DEPRECATED_API */
1197 
1212 U_STABLE const char * U_EXPORT2
1213 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
1214 
1225 U_STABLE USet * U_EXPORT2
1226 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
1227 
1228 #ifndef U_HIDE_INTERNAL_API
1229 
1241 ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status);
1242 
1251 U_INTERNAL UBool U_EXPORT2
1252 ucol_equals(const UCollator *source, const UCollator *target);
1253 
1265 U_INTERNAL int32_t U_EXPORT2
1266 ucol_getUnsafeSet( const UCollator *coll,
1267  USet *unsafe,
1268  UErrorCode *status);
1269 
1273 U_INTERNAL void U_EXPORT2
1274 ucol_forgetUCA(void);
1275 
1296 U_INTERNAL void U_EXPORT2
1297 ucol_prepareShortStringOpen( const char *definition,
1298  UBool forceDefaults,
1299  UParseError *parseError,
1300  UErrorCode *status);
1301 #endif /* U_HIDE_INTERNAL_API */
1302 
1314 U_STABLE int32_t U_EXPORT2
1315 ucol_cloneBinary(const UCollator *coll,
1316  uint8_t *buffer, int32_t capacity,
1317  UErrorCode *status);
1318 
1336 U_STABLE UCollator* U_EXPORT2
1337 ucol_openBinary(const uint8_t *bin, int32_t length,
1338  const UCollator *base,
1339  UErrorCode *status);
1340 
1341 
1342 #endif /* #if !UCONFIG_NO_COLLATION */
1343 
1344 #endif