00001
00002
00003
00004
00005
00006
00007
00008 #ifndef UCOL_H
00009 #define UCOL_H
00010
00011 #include "unicode/utypes.h"
00012 #include "unicode/unorm.h"
00013 #include "unicode/parseerr.h"
00014
00051 struct collIterate;
00053 typedef struct collIterate collIterate;
00054
00058 struct UCollator;
00060 typedef struct UCollator UCollator;
00061
00062
00073 typedef enum {
00075 UCOL_EQUAL = 0,
00077 UCOL_GREATER = 1,
00079 UCOL_LESS = -1
00080 } UCollationResult ;
00081
00082
00084
00085
00086
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
00129 UCOL_ON_WITHOUT_HANGUL = 28,
00130
00131 UCOL_ATTRIBUTE_VALUE_COUNT
00132
00133 } UColAttributeValue;
00134
00160 typedef UColAttributeValue UCollationStrength;
00161
00164 typedef enum {
00169 UCOL_FRENCH_COLLATION,
00178 UCOL_ALTERNATE_HANDLING,
00185 UCOL_CASE_FIRST,
00193 UCOL_CASE_LEVEL,
00201 UCOL_NORMALIZATION_MODE,
00203 UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
00214 UCOL_STRENGTH,
00220 UCOL_HIRAGANA_QUATERNARY_MODE,
00221 UCOL_ATTRIBUTE_COUNT
00222 } UColAttribute;
00223
00225 typedef enum {
00226 UCOL_TAILORING_ONLY,
00227 UCOL_FULL_RULES
00228 } UColRuleOption ;
00229
00245 U_CAPI UCollator* U_EXPORT2
00246 ucol_open(const char *loc, UErrorCode *status);
00247
00273 U_CAPI UCollator* U_EXPORT2
00274 ucol_openRules( const UChar *rules,
00275 int32_t rulesLength,
00276 UColAttributeValue normalizationMode,
00277 UCollationStrength strength,
00278 UParseError *parseError,
00279 UErrorCode *status);
00280
00291 U_CAPI void U_EXPORT2
00292 ucol_close(UCollator *coll);
00293
00309 U_CAPI UCollationResult U_EXPORT2
00310 ucol_strcoll( const UCollator *coll,
00311 const UChar *source,
00312 int32_t sourceLength,
00313 const UChar *target,
00314 int32_t targetLength);
00315
00330 U_CAPI UBool U_EXPORT2
00331 ucol_greater(const UCollator *coll,
00332 const UChar *source, int32_t sourceLength,
00333 const UChar *target, int32_t targetLength);
00334
00349 U_CAPI UBool U_EXPORT2
00350 ucol_greaterOrEqual(const UCollator *coll,
00351 const UChar *source, int32_t sourceLength,
00352 const UChar *target, int32_t targetLength);
00353
00368 U_CAPI UBool U_EXPORT2
00369 ucol_equal(const UCollator *coll,
00370 const UChar *source, int32_t sourceLength,
00371 const UChar *target, int32_t targetLength);
00372
00382 U_CAPI UCollationStrength U_EXPORT2
00383 ucol_getStrength(const UCollator *coll);
00384
00394 U_CAPI void U_EXPORT2
00395 ucol_setStrength(UCollator *coll,
00396 UCollationStrength strength);
00397
00410 U_CAPI int32_t U_EXPORT2
00411 ucol_getDisplayName( const char *objLoc,
00412 const char *dispLoc,
00413 UChar *result,
00414 int32_t resultLength,
00415 UErrorCode *status);
00416
00426 U_CAPI const char* U_EXPORT2
00427 ucol_getAvailable(int32_t index);
00428
00437 U_CAPI int32_t U_EXPORT2
00438 ucol_countAvailable(void);
00439
00448 U_CAPI const UChar* U_EXPORT2
00449 ucol_getRules( const UCollator *coll,
00450 int32_t *length);
00451
00464 U_CAPI int32_t U_EXPORT2
00465 ucol_getSortKey(const UCollator *coll,
00466 const UChar *source,
00467 int32_t sourceLength,
00468 uint8_t *result,
00469 int32_t resultLength);
00470
00472
00473
00474
00475
00476 typedef enum {
00478 UCOL_BOUND_LOWER = 0,
00480 UCOL_BOUND_UPPER = 1,
00482 UCOL_BOUND_UPPER_LONG = 2,
00483 UCOL_BOUND_VALUE_COUNT
00484 } UColBoundMode;
00485
00523 U_CAPI int32_t U_EXPORT2
00524 ucol_getBound(const uint8_t *source,
00525 int32_t sourceLength,
00526 UColBoundMode boundType,
00527 uint32_t noOfLevels,
00528 uint8_t *result,
00529 int32_t resultLength,
00530 UErrorCode *status);
00531
00537 U_CAPI void U_EXPORT2
00538 ucol_getVersion(const UCollator* coll, UVersionInfo info);
00539
00540
00561 U_CAPI int32_t U_EXPORT2
00562 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
00563 const uint8_t *src2, int32_t src2Length,
00564 uint8_t *dest, int32_t destCapacity);
00565
00577 U_CAPI void U_EXPORT2
00578 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
00579
00591 U_CAPI UColAttributeValue U_EXPORT2
00592 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
00593
00613 U_CAPI uint32_t U_EXPORT2
00614 ucol_setVariableTop(UCollator *coll,
00615 const UChar *varTop, int32_t len,
00616 UErrorCode *status);
00617
00628 U_CAPI uint32_t ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
00629
00641 U_CAPI void U_EXPORT2
00642 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
00643
00666 U_CAPI UCollator* U_EXPORT2
00667 ucol_safeClone(const UCollator *coll,
00668 void *stackBuffer,
00669 int32_t *pBufferSize,
00670 UErrorCode *status);
00671
00673 #define U_COL_SAFECLONE_BUFFERSIZE 384
00674
00685 U_CAPI int32_t U_EXPORT2
00686 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
00687
00688
00689
00690
00691
00692
00693 #include "unicode/ucoleitr.h"
00694
00716 U_CAPI UCollator * U_EXPORT2
00717 ucol_openVersion(const char *loc,
00718 UVersionInfo version,
00719 UErrorCode *status);
00720
00729 U_CAPI UNormalizationMode U_EXPORT2
00730 ucol_getNormalization(const UCollator* coll);
00731
00742 U_CAPI void U_EXPORT2
00743 ucol_setNormalization( UCollator *coll,
00744 UNormalizationMode mode);
00745
00756 U_CAPI const char * U_EXPORT2
00757 ucol_getLocale(const UCollator *coll, UErrorCode *status);
00758
00762 #ifdef U_USE_DEPRECATED_FORMAT_API
00763
00764 #if ((U_ICU_VERSION_MAJOR_NUM != 2) || (U_ICU_VERSION_MINOR_NUM !=0))
00765 # error "ICU version has changed. Please redefine the macros under U_USE_DEPRECATED_FORMAT_API pre-processor definition"
00766 #else
00767 # define ucol_openRules_2_0(rules,rulesLength,normalizationMode,strength,status) ucol_openRules(rules,rulesLength,(UColAttributeValue)normalizationMode,strength,NULL,status)
00768 #endif
00769
00770 #endif
00771
00772
00773 #endif