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
00471
00472
00478 U_CAPI void U_EXPORT2
00479 ucol_getVersion(const UCollator* coll, UVersionInfo info);
00480
00481
00502 U_CAPI int32_t U_EXPORT2
00503 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
00504 const uint8_t *src2, int32_t src2Length,
00505 uint8_t *dest, int32_t destCapacity);
00506
00518 U_CAPI void U_EXPORT2
00519 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
00520
00532 U_CAPI UColAttributeValue U_EXPORT2
00533 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
00534
00554 U_CAPI uint32_t U_EXPORT2
00555 ucol_setVariableTop(UCollator *coll,
00556 const UChar *varTop, int32_t len,
00557 UErrorCode *status);
00558
00569 U_CAPI uint32_t ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
00570
00582 U_CAPI void U_EXPORT2
00583 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
00584
00607 U_CAPI UCollator* U_EXPORT2
00608 ucol_safeClone(const UCollator *coll,
00609 void *stackBuffer,
00610 int32_t *pBufferSize,
00611 UErrorCode *status);
00612
00614 #define U_COL_SAFECLONE_BUFFERSIZE 384
00615
00626 U_CAPI int32_t U_EXPORT2
00627 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
00628
00629
00630
00631
00632
00633
00634 #include "unicode/ucoleitr.h"
00635
00657 U_CAPI UCollator * U_EXPORT2
00658 ucol_openVersion(const char *loc,
00659 UVersionInfo version,
00660 UErrorCode *status);
00661
00670 U_CAPI UNormalizationMode U_EXPORT2
00671 ucol_getNormalization(const UCollator* coll);
00672
00683 U_CAPI void U_EXPORT2
00684 ucol_setNormalization( UCollator *coll,
00685 UNormalizationMode mode);
00686
00690 #ifdef U_USE_DEPRECATED_FORMAT_API
00691
00692 #if ((U_ICU_VERSION_MAJOR_NUM != 2) || (U_ICU_VERSION_MINOR_NUM !=0))
00693 # error "ICU version has changed. Please redefine the macros under U_USE_DEPRECATED_FORMAT_API pre-processor definition"
00694 #else
00695 # define ucol_openRules_2_0(rules,rulesLength,normalizationMode,strength,status) ucol_openRules(rules,rulesLength,(UColAttributeValue)normalizationMode,strength,NULL,status)
00696 #endif
00697
00698 #endif
00699
00700
00701 #endif