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 #include "unicode/uloc.h"
00015
00052 struct collIterate;
00054 typedef struct collIterate collIterate;
00055
00059 struct UCollator;
00061 typedef struct UCollator UCollator;
00062
00063
00074 typedef enum {
00076 UCOL_EQUAL = 0,
00078 UCOL_GREATER = 1,
00080 UCOL_LESS = -1
00081 } UCollationResult ;
00082
00083
00085
00086
00087
00088 typedef enum {
00090 UCOL_DEFAULT = -1,
00091
00093 UCOL_PRIMARY = 0,
00095 UCOL_SECONDARY = 1,
00097 UCOL_TERTIARY = 2,
00099 UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
00100 UCOL_CE_STRENGTH_LIMIT,
00102 UCOL_QUATERNARY=3,
00104 UCOL_IDENTICAL=15,
00105 UCOL_STRENGTH_LIMIT,
00106
00110 UCOL_OFF = 16,
00114 UCOL_ON = 17,
00115
00117 UCOL_SHIFTED = 20,
00119 UCOL_NON_IGNORABLE = 21,
00120
00123 UCOL_LOWER_FIRST = 24,
00125 UCOL_UPPER_FIRST = 25,
00126
00127 UCOL_ATTRIBUTE_VALUE_COUNT
00128
00129 } UColAttributeValue;
00130
00156 typedef UColAttributeValue UCollationStrength;
00157
00160 typedef enum {
00165 UCOL_FRENCH_COLLATION,
00174 UCOL_ALTERNATE_HANDLING,
00181 UCOL_CASE_FIRST,
00189 UCOL_CASE_LEVEL,
00197 UCOL_NORMALIZATION_MODE,
00199 UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
00210 UCOL_STRENGTH,
00216 UCOL_HIRAGANA_QUATERNARY_MODE,
00217 UCOL_ATTRIBUTE_COUNT
00218 } UColAttribute;
00219
00221 typedef enum {
00223 UCOL_TAILORING_ONLY,
00225 UCOL_FULL_RULES
00226 } UColRuleOption ;
00227
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
00538 U_CAPI void U_EXPORT2
00539 ucol_getVersion(const UCollator* coll, UVersionInfo info);
00540
00541
00562 U_CAPI int32_t U_EXPORT2
00563 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
00564 const uint8_t *src2, int32_t src2Length,
00565 uint8_t *dest, int32_t destCapacity);
00566
00578 U_CAPI void U_EXPORT2
00579 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
00580
00592 U_CAPI UColAttributeValue U_EXPORT2
00593 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
00594
00614 U_CAPI uint32_t U_EXPORT2
00615 ucol_setVariableTop(UCollator *coll,
00616 const UChar *varTop, int32_t len,
00617 UErrorCode *status);
00618
00630 U_CAPI uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
00631
00643 U_CAPI void U_EXPORT2
00644 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
00645
00668 U_CAPI UCollator* U_EXPORT2
00669 ucol_safeClone(const UCollator *coll,
00670 void *stackBuffer,
00671 int32_t *pBufferSize,
00672 UErrorCode *status);
00673
00675 #define U_COL_SAFECLONE_BUFFERSIZE 512
00676
00688 U_CAPI int32_t U_EXPORT2
00689 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
00690
00691
00692
00693
00694
00695
00696 #include "unicode/ucoleitr.h"
00697
00719 U_CAPI UCollator * U_EXPORT2
00720 ucol_openVersion(const char *loc,
00721 UVersionInfo version,
00722 UErrorCode *status);
00723
00732 U_CAPI UNormalizationMode U_EXPORT2
00733 ucol_getNormalization(const UCollator* coll);
00734
00745 U_CAPI void U_EXPORT2
00746 ucol_setNormalization( UCollator *coll,
00747 UNormalizationMode mode);
00748
00763 U_CAPI const char * U_EXPORT2
00764 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
00765
00769 #ifdef U_USE_DEPRECATED_FORMAT_API
00770
00771 #if ((U_ICU_VERSION_MAJOR_NUM != 2) || (U_ICU_VERSION_MINOR_NUM != 2))
00772 # error "ICU version has changed. Please redefine the macros under U_USE_DEPRECATED_FORMAT_API pre-processor definition"
00773 #else
00774 # define ucol_openRules_2_2(rules,rulesLength,normalizationMode,strength,status) ucol_openRules(rules,rulesLength,(UColAttributeValue)normalizationMode,strength,NULL,status)
00775 #endif
00776
00777 #endif
00778
00779
00780 #endif