00001
00002
00003
00004
00005
00006
00007
00008 #ifndef UCOL_H
00009 #define UCOL_H
00010
00011 #include "unicode/utypes.h"
00012
00013 #if !UCONFIG_NO_COLLATION
00014
00015 #include "unicode/unorm.h"
00016 #include "unicode/localpointer.h"
00017 #include "unicode/parseerr.h"
00018 #include "unicode/uloc.h"
00019 #include "unicode/uset.h"
00020 #include "unicode/uscript.h"
00021
00052 struct UCollator;
00056 typedef struct UCollator UCollator;
00057
00058
00071 typedef enum {
00073 UCOL_EQUAL = 0,
00075 UCOL_GREATER = 1,
00077 UCOL_LESS = -1
00078 } UCollationResult ;
00079
00080
00087 typedef enum {
00089 UCOL_DEFAULT = -1,
00090
00092 UCOL_PRIMARY = 0,
00094 UCOL_SECONDARY = 1,
00096 UCOL_TERTIARY = 2,
00098 UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
00099 UCOL_CE_STRENGTH_LIMIT,
00101 UCOL_QUATERNARY=3,
00103 UCOL_IDENTICAL=15,
00104 UCOL_STRENGTH_LIMIT,
00105
00109 UCOL_OFF = 16,
00113 UCOL_ON = 17,
00114
00116 UCOL_SHIFTED = 20,
00118 UCOL_NON_IGNORABLE = 21,
00119
00122 UCOL_LOWER_FIRST = 24,
00124 UCOL_UPPER_FIRST = 25,
00125
00126 UCOL_ATTRIBUTE_VALUE_COUNT
00127
00128 } UColAttributeValue;
00129
00139 typedef enum {
00145 UCOL_REORDER_CODE_DEFAULT = -1,
00150 UCOL_REORDER_CODE_NONE = USCRIPT_UNKNOWN,
00157 UCOL_REORDER_CODE_OTHERS = USCRIPT_UNKNOWN,
00163 UCOL_REORDER_CODE_SPACE = 0x1000,
00169 UCOL_REORDER_CODE_FIRST = UCOL_REORDER_CODE_SPACE,
00175 UCOL_REORDER_CODE_PUNCTUATION = 0x1001,
00181 UCOL_REORDER_CODE_SYMBOL = 0x1002,
00187 UCOL_REORDER_CODE_CURRENCY = 0x1003,
00193 UCOL_REORDER_CODE_DIGIT = 0x1004,
00199 UCOL_REORDER_CODE_LIMIT = 0x1005
00200 } UColReorderCode;
00201
00228 typedef UColAttributeValue UCollationStrength;
00229
00234 typedef enum {
00241 UCOL_FRENCH_COLLATION,
00252 UCOL_ALTERNATE_HANDLING,
00261 UCOL_CASE_FIRST,
00271 UCOL_CASE_LEVEL,
00281 UCOL_NORMALIZATION_MODE,
00285 UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
00302 UCOL_STRENGTH,
00303 #ifndef U_HIDE_DEPRECATED_API
00304
00315 UCOL_HIRAGANA_QUATERNARY_MODE = UCOL_STRENGTH + 1,
00316 #endif
00317
00335 UCOL_NUMERIC_COLLATION = UCOL_STRENGTH + 2,
00340 UCOL_ATTRIBUTE_COUNT
00341 } UColAttribute;
00342
00346 typedef enum {
00352 UCOL_TAILORING_ONLY,
00360 UCOL_FULL_RULES
00361 } UColRuleOption ;
00362
00388 U_STABLE UCollator* U_EXPORT2
00389 ucol_open(const char *loc, UErrorCode *status);
00390
00416 U_STABLE UCollator* U_EXPORT2
00417 ucol_openRules( const UChar *rules,
00418 int32_t rulesLength,
00419 UColAttributeValue normalizationMode,
00420 UCollationStrength strength,
00421 UParseError *parseError,
00422 UErrorCode *status);
00423
00424 #ifndef U_HIDE_DEPRECATED_API
00425
00458 U_DEPRECATED UCollator* U_EXPORT2
00459 ucol_openFromShortString( const char *definition,
00460 UBool forceDefaults,
00461 UParseError *parseError,
00462 UErrorCode *status);
00463 #endif
00464
00465 #ifndef U_HIDE_DEPRECATED_API
00466
00479 U_DEPRECATED int32_t U_EXPORT2
00480 ucol_getContractions( const UCollator *coll,
00481 USet *conts,
00482 UErrorCode *status);
00483 #endif
00484
00496 U_STABLE void U_EXPORT2
00497 ucol_getContractionsAndExpansions( const UCollator *coll,
00498 USet *contractions, USet *expansions,
00499 UBool addPrefixes, UErrorCode *status);
00500
00511 U_STABLE void U_EXPORT2
00512 ucol_close(UCollator *coll);
00513
00514 #if U_SHOW_CPLUSPLUS_API
00515
00516 U_NAMESPACE_BEGIN
00517
00527 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
00528
00529 U_NAMESPACE_END
00530
00531 #endif
00532
00548 U_STABLE UCollationResult U_EXPORT2
00549 ucol_strcoll( const UCollator *coll,
00550 const UChar *source,
00551 int32_t sourceLength,
00552 const UChar *target,
00553 int32_t targetLength);
00554
00573 U_STABLE UCollationResult U_EXPORT2
00574 ucol_strcollUTF8(
00575 const UCollator *coll,
00576 const char *source,
00577 int32_t sourceLength,
00578 const char *target,
00579 int32_t targetLength,
00580 UErrorCode *status);
00581
00596 U_STABLE UBool U_EXPORT2
00597 ucol_greater(const UCollator *coll,
00598 const UChar *source, int32_t sourceLength,
00599 const UChar *target, int32_t targetLength);
00600
00615 U_STABLE UBool U_EXPORT2
00616 ucol_greaterOrEqual(const UCollator *coll,
00617 const UChar *source, int32_t sourceLength,
00618 const UChar *target, int32_t targetLength);
00619
00634 U_STABLE UBool U_EXPORT2
00635 ucol_equal(const UCollator *coll,
00636 const UChar *source, int32_t sourceLength,
00637 const UChar *target, int32_t targetLength);
00638
00651 U_STABLE UCollationResult U_EXPORT2
00652 ucol_strcollIter( const UCollator *coll,
00653 UCharIterator *sIter,
00654 UCharIterator *tIter,
00655 UErrorCode *status);
00656
00666 U_STABLE UCollationStrength U_EXPORT2
00667 ucol_getStrength(const UCollator *coll);
00668
00678 U_STABLE void U_EXPORT2
00679 ucol_setStrength(UCollator *coll,
00680 UCollationStrength strength);
00681
00698 U_STABLE int32_t U_EXPORT2
00699 ucol_getReorderCodes(const UCollator* coll,
00700 int32_t* dest,
00701 int32_t destCapacity,
00702 UErrorCode *pErrorCode);
00743 U_STABLE void U_EXPORT2
00744 ucol_setReorderCodes(UCollator* coll,
00745 const int32_t* reorderCodes,
00746 int32_t reorderCodesLength,
00747 UErrorCode *pErrorCode);
00748
00768 U_STABLE int32_t U_EXPORT2
00769 ucol_getEquivalentReorderCodes(int32_t reorderCode,
00770 int32_t* dest,
00771 int32_t destCapacity,
00772 UErrorCode *pErrorCode);
00773
00786 U_STABLE int32_t U_EXPORT2
00787 ucol_getDisplayName( const char *objLoc,
00788 const char *dispLoc,
00789 UChar *result,
00790 int32_t resultLength,
00791 UErrorCode *status);
00792
00802 U_STABLE const char* U_EXPORT2
00803 ucol_getAvailable(int32_t localeIndex);
00804
00813 U_STABLE int32_t U_EXPORT2
00814 ucol_countAvailable(void);
00815
00816 #if !UCONFIG_NO_SERVICE
00817
00825 U_STABLE UEnumeration* U_EXPORT2
00826 ucol_openAvailableLocales(UErrorCode *status);
00827 #endif
00828
00838 U_STABLE UEnumeration* U_EXPORT2
00839 ucol_getKeywords(UErrorCode *status);
00840
00852 U_STABLE UEnumeration* U_EXPORT2
00853 ucol_getKeywordValues(const char *keyword, UErrorCode *status);
00854
00871 U_STABLE UEnumeration* U_EXPORT2
00872 ucol_getKeywordValuesForLocale(const char* key,
00873 const char* locale,
00874 UBool commonlyUsed,
00875 UErrorCode* status);
00876
00908 U_STABLE int32_t U_EXPORT2
00909 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
00910 const char* keyword, const char* locale,
00911 UBool* isAvailable, UErrorCode* status);
00912
00921 U_STABLE const UChar* U_EXPORT2
00922 ucol_getRules( const UCollator *coll,
00923 int32_t *length);
00924
00925 #ifndef U_HIDE_DEPRECATED_API
00926
00946 U_DEPRECATED int32_t U_EXPORT2
00947 ucol_getShortDefinitionString(const UCollator *coll,
00948 const char *locale,
00949 char *buffer,
00950 int32_t capacity,
00951 UErrorCode *status);
00952
00973 U_DEPRECATED int32_t U_EXPORT2
00974 ucol_normalizeShortDefinitionString(const char *source,
00975 char *destination,
00976 int32_t capacity,
00977 UParseError *parseError,
00978 UErrorCode *status);
00979 #endif
00980
00981
01004 U_STABLE int32_t U_EXPORT2
01005 ucol_getSortKey(const UCollator *coll,
01006 const UChar *source,
01007 int32_t sourceLength,
01008 uint8_t *result,
01009 int32_t resultLength);
01010
01011
01032 U_STABLE int32_t U_EXPORT2
01033 ucol_nextSortKeyPart(const UCollator *coll,
01034 UCharIterator *iter,
01035 uint32_t state[2],
01036 uint8_t *dest, int32_t count,
01037 UErrorCode *status);
01038
01046 typedef enum {
01048 UCOL_BOUND_LOWER = 0,
01050 UCOL_BOUND_UPPER = 1,
01052 UCOL_BOUND_UPPER_LONG = 2,
01053 UCOL_BOUND_VALUE_COUNT
01054 } UColBoundMode;
01055
01093 U_STABLE int32_t U_EXPORT2
01094 ucol_getBound(const uint8_t *source,
01095 int32_t sourceLength,
01096 UColBoundMode boundType,
01097 uint32_t noOfLevels,
01098 uint8_t *result,
01099 int32_t resultLength,
01100 UErrorCode *status);
01101
01110 U_STABLE void U_EXPORT2
01111 ucol_getVersion(const UCollator* coll, UVersionInfo info);
01112
01120 U_STABLE void U_EXPORT2
01121 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
01122
01170 U_STABLE int32_t U_EXPORT2
01171 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
01172 const uint8_t *src2, int32_t src2Length,
01173 uint8_t *dest, int32_t destCapacity);
01174
01186 U_STABLE void U_EXPORT2
01187 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
01188
01200 U_STABLE UColAttributeValue U_EXPORT2
01201 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
01202
01219 U_STABLE void U_EXPORT2
01220 ucol_setMaxVariable(UCollator *coll, UColReorderCode group, UErrorCode *pErrorCode);
01221
01229 U_STABLE UColReorderCode U_EXPORT2
01230 ucol_getMaxVariable(const UCollator *coll);
01231
01232 #ifndef U_HIDE_DEPRECATED_API
01233
01253 U_DEPRECATED uint32_t U_EXPORT2
01254 ucol_setVariableTop(UCollator *coll,
01255 const UChar *varTop, int32_t len,
01256 UErrorCode *status);
01257 #endif
01258
01270 U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
01271
01272 #ifndef U_HIDE_DEPRECATED_API
01273
01286 U_DEPRECATED void U_EXPORT2
01287 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
01288 #endif
01289
01313 U_STABLE UCollator* U_EXPORT2
01314 ucol_safeClone(const UCollator *coll,
01315 void *stackBuffer,
01316 int32_t *pBufferSize,
01317 UErrorCode *status);
01318
01319 #ifndef U_HIDE_DEPRECATED_API
01320
01324 #define U_COL_SAFECLONE_BUFFERSIZE 1
01325
01326 #endif
01327
01343 U_STABLE int32_t U_EXPORT2
01344 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
01345
01346 #ifndef U_HIDE_DEPRECATED_API
01347
01361 U_DEPRECATED const char * U_EXPORT2
01362 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01363 #endif
01364
01379 U_STABLE const char * U_EXPORT2
01380 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01381
01392 U_STABLE USet * U_EXPORT2
01393 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
01394
01395 #ifndef U_HIDE_INTERNAL_API
01396
01407 U_INTERNAL int32_t U_EXPORT2
01408 ucol_getUnsafeSet( const UCollator *coll,
01409 USet *unsafe,
01410 UErrorCode *status);
01411
01432 U_INTERNAL void U_EXPORT2
01433 ucol_prepareShortStringOpen( const char *definition,
01434 UBool forceDefaults,
01435 UParseError *parseError,
01436 UErrorCode *status);
01437 #endif
01438
01450 U_STABLE int32_t U_EXPORT2
01451 ucol_cloneBinary(const UCollator *coll,
01452 uint8_t *buffer, int32_t capacity,
01453 UErrorCode *status);
01454
01472 U_STABLE UCollator* U_EXPORT2
01473 ucol_openBinary(const uint8_t *bin, int32_t length,
01474 const UCollator *base,
01475 UErrorCode *status);
01476
01477
01478 #endif
01479
01480 #endif