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/parseerr.h"
00017 #include "unicode/uloc.h"
00018 #include "unicode/uset.h"
00019
00056 struct collIterate;
00060 typedef struct collIterate collIterate;
00061
00065 struct UCollator;
00069 typedef struct UCollator UCollator;
00070
00071
00084 typedef enum {
00086 UCOL_EQUAL = 0,
00088 UCOL_GREATER = 1,
00090 UCOL_LESS = -1
00091 } UCollationResult ;
00092
00093
00100 typedef enum {
00102 UCOL_DEFAULT = -1,
00103
00105 UCOL_PRIMARY = 0,
00107 UCOL_SECONDARY = 1,
00109 UCOL_TERTIARY = 2,
00111 UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
00112 UCOL_CE_STRENGTH_LIMIT,
00114 UCOL_QUATERNARY=3,
00116 UCOL_IDENTICAL=15,
00117 UCOL_STRENGTH_LIMIT,
00118
00122 UCOL_OFF = 16,
00126 UCOL_ON = 17,
00127
00129 UCOL_SHIFTED = 20,
00131 UCOL_NON_IGNORABLE = 21,
00132
00135 UCOL_LOWER_FIRST = 24,
00137 UCOL_UPPER_FIRST = 25,
00138
00139 UCOL_ATTRIBUTE_VALUE_COUNT
00140
00141 } UColAttributeValue;
00142
00169 typedef UColAttributeValue UCollationStrength;
00170
00175 typedef enum {
00180 UCOL_FRENCH_COLLATION,
00189 UCOL_ALTERNATE_HANDLING,
00196 UCOL_CASE_FIRST,
00204 UCOL_CASE_LEVEL,
00212 UCOL_NORMALIZATION_MODE,
00214 UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
00225 UCOL_STRENGTH,
00231 UCOL_HIRAGANA_QUATERNARY_MODE,
00232 UCOL_ATTRIBUTE_COUNT
00233 } UColAttribute;
00234
00238 typedef enum {
00240 UCOL_TAILORING_ONLY,
00242 UCOL_FULL_RULES
00243 } UColRuleOption ;
00244
00262 U_CAPI UCollator* U_EXPORT2
00263 ucol_open(const char *loc, UErrorCode *status);
00264
00290 U_CAPI UCollator* U_EXPORT2
00291 ucol_openRules( const UChar *rules,
00292 int32_t rulesLength,
00293 UColAttributeValue normalizationMode,
00294 UCollationStrength strength,
00295 UParseError *parseError,
00296 UErrorCode *status);
00297
00308 U_CAPI void U_EXPORT2
00309 ucol_close(UCollator *coll);
00310
00326 U_CAPI UCollationResult U_EXPORT2
00327 ucol_strcoll( const UCollator *coll,
00328 const UChar *source,
00329 int32_t sourceLength,
00330 const UChar *target,
00331 int32_t targetLength);
00332
00347 U_CAPI UBool U_EXPORT2
00348 ucol_greater(const UCollator *coll,
00349 const UChar *source, int32_t sourceLength,
00350 const UChar *target, int32_t targetLength);
00351
00366 U_CAPI UBool U_EXPORT2
00367 ucol_greaterOrEqual(const UCollator *coll,
00368 const UChar *source, int32_t sourceLength,
00369 const UChar *target, int32_t targetLength);
00370
00385 U_CAPI UBool U_EXPORT2
00386 ucol_equal(const UCollator *coll,
00387 const UChar *source, int32_t sourceLength,
00388 const UChar *target, int32_t targetLength);
00389
00402 U_CAPI UCollationResult U_EXPORT2
00403 ucol_strcollIter( const UCollator *coll,
00404 UCharIterator *sIter,
00405 UCharIterator *tIter,
00406 UErrorCode *status);
00407
00417 U_CAPI UCollationStrength U_EXPORT2
00418 ucol_getStrength(const UCollator *coll);
00419
00429 U_CAPI void U_EXPORT2
00430 ucol_setStrength(UCollator *coll,
00431 UCollationStrength strength);
00432
00445 U_CAPI int32_t U_EXPORT2
00446 ucol_getDisplayName( const char *objLoc,
00447 const char *dispLoc,
00448 UChar *result,
00449 int32_t resultLength,
00450 UErrorCode *status);
00451
00461 U_CAPI const char* U_EXPORT2
00462 ucol_getAvailable(int32_t index);
00463
00472 U_CAPI int32_t U_EXPORT2
00473 ucol_countAvailable(void);
00474
00483 U_CAPI const UChar* U_EXPORT2
00484 ucol_getRules( const UCollator *coll,
00485 int32_t *length);
00486
00499 U_CAPI int32_t U_EXPORT2
00500 ucol_getSortKey(const UCollator *coll,
00501 const UChar *source,
00502 int32_t sourceLength,
00503 uint8_t *result,
00504 int32_t resultLength);
00505
00506
00527 U_CAPI int32_t U_EXPORT2
00528 ucol_nextSortKeyPart(const UCollator *coll,
00529 UCharIterator *iter,
00530 uint32_t state[2],
00531 uint8_t *dest, int32_t count,
00532 UErrorCode *status);
00533
00541 typedef enum {
00543 UCOL_BOUND_LOWER = 0,
00545 UCOL_BOUND_UPPER = 1,
00547 UCOL_BOUND_UPPER_LONG = 2,
00548 UCOL_BOUND_VALUE_COUNT
00549 } UColBoundMode;
00550
00588 U_CAPI int32_t U_EXPORT2
00589 ucol_getBound(const uint8_t *source,
00590 int32_t sourceLength,
00591 UColBoundMode boundType,
00592 uint32_t noOfLevels,
00593 uint8_t *result,
00594 int32_t resultLength,
00595 UErrorCode *status);
00596
00605 U_CAPI void U_EXPORT2
00606 ucol_getVersion(const UCollator* coll, UVersionInfo info);
00607
00608
00631 U_CAPI int32_t U_EXPORT2
00632 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
00633 const uint8_t *src2, int32_t src2Length,
00634 uint8_t *dest, int32_t destCapacity);
00635
00647 U_CAPI void U_EXPORT2
00648 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
00649
00661 U_CAPI UColAttributeValue U_EXPORT2
00662 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
00663
00683 U_CAPI uint32_t U_EXPORT2
00684 ucol_setVariableTop(UCollator *coll,
00685 const UChar *varTop, int32_t len,
00686 UErrorCode *status);
00687
00699 U_CAPI uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
00700
00712 U_CAPI void U_EXPORT2
00713 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
00714
00737 U_CAPI UCollator* U_EXPORT2
00738 ucol_safeClone(const UCollator *coll,
00739 void *stackBuffer,
00740 int32_t *pBufferSize,
00741 UErrorCode *status);
00742
00746 #define U_COL_SAFECLONE_BUFFERSIZE 512
00747
00759 U_CAPI int32_t U_EXPORT2
00760 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
00761
00776 U_CAPI const char * U_EXPORT2
00777 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
00778
00779
00790 U_CAPI USet * U_EXPORT2
00791 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
00792
00793 #endif
00794
00795 #endif