00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef UCOL_H
00011 #define UCOL_H
00012
00013 #include "unicode/utypes.h"
00014
00015 #if !UCONFIG_NO_COLLATION
00016
00017 #include "unicode/unorm.h"
00018 #include "unicode/localpointer.h"
00019 #include "unicode/parseerr.h"
00020 #include "unicode/uloc.h"
00021 #include "unicode/uset.h"
00022 #include "unicode/uscript.h"
00023
00054 struct UCollator;
00058 typedef struct UCollator UCollator;
00059
00060
00073 typedef enum {
00075 UCOL_EQUAL = 0,
00077 UCOL_GREATER = 1,
00079 UCOL_LESS = -1
00080 } UCollationResult ;
00081
00082
00089 typedef enum {
00091 UCOL_DEFAULT = -1,
00092
00094 UCOL_PRIMARY = 0,
00096 UCOL_SECONDARY = 1,
00098 UCOL_TERTIARY = 2,
00100 UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
00101 UCOL_CE_STRENGTH_LIMIT,
00103 UCOL_QUATERNARY=3,
00105 UCOL_IDENTICAL=15,
00106 UCOL_STRENGTH_LIMIT,
00107
00111 UCOL_OFF = 16,
00115 UCOL_ON = 17,
00116
00118 UCOL_SHIFTED = 20,
00120 UCOL_NON_IGNORABLE = 21,
00121
00124 UCOL_LOWER_FIRST = 24,
00126 UCOL_UPPER_FIRST = 25,
00127
00128 #ifndef U_HIDE_DEPRECATED_API
00129
00133 UCOL_ATTRIBUTE_VALUE_COUNT
00134 #endif
00135 } UColAttributeValue;
00136
00146 typedef enum {
00152 UCOL_REORDER_CODE_DEFAULT = -1,
00157 UCOL_REORDER_CODE_NONE = USCRIPT_UNKNOWN,
00164 UCOL_REORDER_CODE_OTHERS = USCRIPT_UNKNOWN,
00170 UCOL_REORDER_CODE_SPACE = 0x1000,
00176 UCOL_REORDER_CODE_FIRST = UCOL_REORDER_CODE_SPACE,
00182 UCOL_REORDER_CODE_PUNCTUATION = 0x1001,
00188 UCOL_REORDER_CODE_SYMBOL = 0x1002,
00194 UCOL_REORDER_CODE_CURRENCY = 0x1003,
00200 UCOL_REORDER_CODE_DIGIT = 0x1004,
00201 #ifndef U_HIDE_DEPRECATED_API
00202
00206 UCOL_REORDER_CODE_LIMIT = 0x1005
00207 #endif
00208 } UColReorderCode;
00209
00236 typedef UColAttributeValue UCollationStrength;
00237
00242 typedef enum {
00249 UCOL_FRENCH_COLLATION,
00260 UCOL_ALTERNATE_HANDLING,
00269 UCOL_CASE_FIRST,
00279 UCOL_CASE_LEVEL,
00289 UCOL_NORMALIZATION_MODE,
00293 UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
00310 UCOL_STRENGTH,
00311 #ifndef U_HIDE_DEPRECATED_API
00312
00323 UCOL_HIRAGANA_QUATERNARY_MODE = UCOL_STRENGTH + 1,
00324 #endif
00325
00343 UCOL_NUMERIC_COLLATION = UCOL_STRENGTH + 2,
00344
00345
00346
00347 #ifndef U_FORCE_HIDE_DEPRECATED_API
00348
00352 UCOL_ATTRIBUTE_COUNT
00353 #endif // U_FORCE_HIDE_DEPRECATED_API
00354 } UColAttribute;
00355
00359 typedef enum {
00365 UCOL_TAILORING_ONLY,
00373 UCOL_FULL_RULES
00374 } UColRuleOption ;
00375
00401 U_STABLE UCollator* U_EXPORT2
00402 ucol_open(const char *loc, UErrorCode *status);
00403
00429 U_STABLE UCollator* U_EXPORT2
00430 ucol_openRules( const UChar *rules,
00431 int32_t rulesLength,
00432 UColAttributeValue normalizationMode,
00433 UCollationStrength strength,
00434 UParseError *parseError,
00435 UErrorCode *status);
00436
00437 #ifndef U_HIDE_DEPRECATED_API
00438
00471 U_DEPRECATED UCollator* U_EXPORT2
00472 ucol_openFromShortString( const char *definition,
00473 UBool forceDefaults,
00474 UParseError *parseError,
00475 UErrorCode *status);
00476 #endif
00477
00478 #ifndef U_HIDE_DEPRECATED_API
00479
00492 U_DEPRECATED int32_t U_EXPORT2
00493 ucol_getContractions( const UCollator *coll,
00494 USet *conts,
00495 UErrorCode *status);
00496 #endif
00497
00509 U_STABLE void U_EXPORT2
00510 ucol_getContractionsAndExpansions( const UCollator *coll,
00511 USet *contractions, USet *expansions,
00512 UBool addPrefixes, UErrorCode *status);
00513
00524 U_STABLE void U_EXPORT2
00525 ucol_close(UCollator *coll);
00526
00527 #if U_SHOW_CPLUSPLUS_API
00528
00529 U_NAMESPACE_BEGIN
00530
00540 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
00541
00542 U_NAMESPACE_END
00543
00544 #endif
00545
00561 U_STABLE UCollationResult U_EXPORT2
00562 ucol_strcoll( const UCollator *coll,
00563 const UChar *source,
00564 int32_t sourceLength,
00565 const UChar *target,
00566 int32_t targetLength);
00567
00586 U_STABLE UCollationResult U_EXPORT2
00587 ucol_strcollUTF8(
00588 const UCollator *coll,
00589 const char *source,
00590 int32_t sourceLength,
00591 const char *target,
00592 int32_t targetLength,
00593 UErrorCode *status);
00594
00609 U_STABLE UBool U_EXPORT2
00610 ucol_greater(const UCollator *coll,
00611 const UChar *source, int32_t sourceLength,
00612 const UChar *target, int32_t targetLength);
00613
00628 U_STABLE UBool U_EXPORT2
00629 ucol_greaterOrEqual(const UCollator *coll,
00630 const UChar *source, int32_t sourceLength,
00631 const UChar *target, int32_t targetLength);
00632
00647 U_STABLE UBool U_EXPORT2
00648 ucol_equal(const UCollator *coll,
00649 const UChar *source, int32_t sourceLength,
00650 const UChar *target, int32_t targetLength);
00651
00664 U_STABLE UCollationResult U_EXPORT2
00665 ucol_strcollIter( const UCollator *coll,
00666 UCharIterator *sIter,
00667 UCharIterator *tIter,
00668 UErrorCode *status);
00669
00679 U_STABLE UCollationStrength U_EXPORT2
00680 ucol_getStrength(const UCollator *coll);
00681
00691 U_STABLE void U_EXPORT2
00692 ucol_setStrength(UCollator *coll,
00693 UCollationStrength strength);
00694
00711 U_STABLE int32_t U_EXPORT2
00712 ucol_getReorderCodes(const UCollator* coll,
00713 int32_t* dest,
00714 int32_t destCapacity,
00715 UErrorCode *pErrorCode);
00756 U_STABLE void U_EXPORT2
00757 ucol_setReorderCodes(UCollator* coll,
00758 const int32_t* reorderCodes,
00759 int32_t reorderCodesLength,
00760 UErrorCode *pErrorCode);
00761
00781 U_STABLE int32_t U_EXPORT2
00782 ucol_getEquivalentReorderCodes(int32_t reorderCode,
00783 int32_t* dest,
00784 int32_t destCapacity,
00785 UErrorCode *pErrorCode);
00786
00799 U_STABLE int32_t U_EXPORT2
00800 ucol_getDisplayName( const char *objLoc,
00801 const char *dispLoc,
00802 UChar *result,
00803 int32_t resultLength,
00804 UErrorCode *status);
00805
00815 U_STABLE const char* U_EXPORT2
00816 ucol_getAvailable(int32_t localeIndex);
00817
00826 U_STABLE int32_t U_EXPORT2
00827 ucol_countAvailable(void);
00828
00829 #if !UCONFIG_NO_SERVICE
00830
00838 U_STABLE UEnumeration* U_EXPORT2
00839 ucol_openAvailableLocales(UErrorCode *status);
00840 #endif
00841
00851 U_STABLE UEnumeration* U_EXPORT2
00852 ucol_getKeywords(UErrorCode *status);
00853
00865 U_STABLE UEnumeration* U_EXPORT2
00866 ucol_getKeywordValues(const char *keyword, UErrorCode *status);
00867
00884 U_STABLE UEnumeration* U_EXPORT2
00885 ucol_getKeywordValuesForLocale(const char* key,
00886 const char* locale,
00887 UBool commonlyUsed,
00888 UErrorCode* status);
00889
00921 U_STABLE int32_t U_EXPORT2
00922 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
00923 const char* keyword, const char* locale,
00924 UBool* isAvailable, UErrorCode* status);
00925
00934 U_STABLE const UChar* U_EXPORT2
00935 ucol_getRules( const UCollator *coll,
00936 int32_t *length);
00937
00938 #ifndef U_HIDE_DEPRECATED_API
00939
00959 U_DEPRECATED int32_t U_EXPORT2
00960 ucol_getShortDefinitionString(const UCollator *coll,
00961 const char *locale,
00962 char *buffer,
00963 int32_t capacity,
00964 UErrorCode *status);
00965
00986 U_DEPRECATED int32_t U_EXPORT2
00987 ucol_normalizeShortDefinitionString(const char *source,
00988 char *destination,
00989 int32_t capacity,
00990 UParseError *parseError,
00991 UErrorCode *status);
00992 #endif
00993
00994
01017 U_STABLE int32_t U_EXPORT2
01018 ucol_getSortKey(const UCollator *coll,
01019 const UChar *source,
01020 int32_t sourceLength,
01021 uint8_t *result,
01022 int32_t resultLength);
01023
01024
01045 U_STABLE int32_t U_EXPORT2
01046 ucol_nextSortKeyPart(const UCollator *coll,
01047 UCharIterator *iter,
01048 uint32_t state[2],
01049 uint8_t *dest, int32_t count,
01050 UErrorCode *status);
01051
01059 typedef enum {
01061 UCOL_BOUND_LOWER = 0,
01063 UCOL_BOUND_UPPER = 1,
01065 UCOL_BOUND_UPPER_LONG = 2,
01066 #ifndef U_HIDE_DEPRECATED_API
01067
01071 UCOL_BOUND_VALUE_COUNT
01072 #endif
01073 } UColBoundMode;
01074
01112 U_STABLE int32_t U_EXPORT2
01113 ucol_getBound(const uint8_t *source,
01114 int32_t sourceLength,
01115 UColBoundMode boundType,
01116 uint32_t noOfLevels,
01117 uint8_t *result,
01118 int32_t resultLength,
01119 UErrorCode *status);
01120
01129 U_STABLE void U_EXPORT2
01130 ucol_getVersion(const UCollator* coll, UVersionInfo info);
01131
01139 U_STABLE void U_EXPORT2
01140 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
01141
01189 U_STABLE int32_t U_EXPORT2
01190 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
01191 const uint8_t *src2, int32_t src2Length,
01192 uint8_t *dest, int32_t destCapacity);
01193
01205 U_STABLE void U_EXPORT2
01206 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
01207
01219 U_STABLE UColAttributeValue U_EXPORT2
01220 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
01221
01238 U_STABLE void U_EXPORT2
01239 ucol_setMaxVariable(UCollator *coll, UColReorderCode group, UErrorCode *pErrorCode);
01240
01248 U_STABLE UColReorderCode U_EXPORT2
01249 ucol_getMaxVariable(const UCollator *coll);
01250
01251 #ifndef U_HIDE_DEPRECATED_API
01252
01272 U_DEPRECATED uint32_t U_EXPORT2
01273 ucol_setVariableTop(UCollator *coll,
01274 const UChar *varTop, int32_t len,
01275 UErrorCode *status);
01276 #endif
01277
01289 U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
01290
01291 #ifndef U_HIDE_DEPRECATED_API
01292
01306 U_DEPRECATED void U_EXPORT2
01307 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
01308 #endif
01309
01333 U_STABLE UCollator* U_EXPORT2
01334 ucol_safeClone(const UCollator *coll,
01335 void *stackBuffer,
01336 int32_t *pBufferSize,
01337 UErrorCode *status);
01338
01339 #ifndef U_HIDE_DEPRECATED_API
01340
01344 #define U_COL_SAFECLONE_BUFFERSIZE 1
01345
01346 #endif
01347
01363 U_STABLE int32_t U_EXPORT2
01364 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
01365
01366 #ifndef U_HIDE_DEPRECATED_API
01367
01381 U_DEPRECATED const char * U_EXPORT2
01382 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01383 #endif
01384
01399 U_STABLE const char * U_EXPORT2
01400 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01401
01412 U_STABLE USet * U_EXPORT2
01413 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
01414
01415 #ifndef U_HIDE_INTERNAL_API
01416
01427 U_INTERNAL int32_t U_EXPORT2
01428 ucol_getUnsafeSet( const UCollator *coll,
01429 USet *unsafe,
01430 UErrorCode *status);
01431
01452 U_INTERNAL void U_EXPORT2
01453 ucol_prepareShortStringOpen( const char *definition,
01454 UBool forceDefaults,
01455 UParseError *parseError,
01456 UErrorCode *status);
01457 #endif
01458
01470 U_STABLE int32_t U_EXPORT2
01471 ucol_cloneBinary(const UCollator *coll,
01472 uint8_t *buffer, int32_t capacity,
01473 UErrorCode *status);
01474
01492 U_STABLE UCollator* U_EXPORT2
01493 ucol_openBinary(const uint8_t *bin, int32_t length,
01494 const UCollator *base,
01495 UErrorCode *status);
01496
01497
01498 #endif
01499
01500 #endif