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
00130 UCOL_ON_WITHOUT_HANGUL = 28,
00131
00132 UCOL_ATTRIBUTE_VALUE_COUNT
00133
00134 } UColAttributeValue;
00135
00161 typedef UColAttributeValue UCollationStrength;
00162
00165 typedef enum {
00170 UCOL_FRENCH_COLLATION,
00179 UCOL_ALTERNATE_HANDLING,
00186 UCOL_CASE_FIRST,
00194 UCOL_CASE_LEVEL,
00202 UCOL_NORMALIZATION_MODE,
00204 UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
00215 UCOL_STRENGTH,
00221 UCOL_HIRAGANA_QUATERNARY_MODE,
00222 UCOL_ATTRIBUTE_COUNT
00223 } UColAttribute;
00224
00226 typedef enum {
00227 UCOL_TAILORING_ONLY,
00228 UCOL_FULL_RULES
00229 } UColRuleOption ;
00230
00246 U_CAPI UCollator* U_EXPORT2
00247 ucol_open(const char *loc, UErrorCode *status);
00248
00274 U_CAPI UCollator* U_EXPORT2
00275 ucol_openRules( const UChar *rules,
00276 int32_t rulesLength,
00277 UColAttributeValue normalizationMode,
00278 UCollationStrength strength,
00279 UParseError *parseError,
00280 UErrorCode *status);
00281
00292 U_CAPI void U_EXPORT2
00293 ucol_close(UCollator *coll);
00294
00310 U_CAPI UCollationResult U_EXPORT2
00311 ucol_strcoll( const UCollator *coll,
00312 const UChar *source,
00313 int32_t sourceLength,
00314 const UChar *target,
00315 int32_t targetLength);
00316
00331 U_CAPI UBool U_EXPORT2
00332 ucol_greater(const UCollator *coll,
00333 const UChar *source, int32_t sourceLength,
00334 const UChar *target, int32_t targetLength);
00335
00350 U_CAPI UBool U_EXPORT2
00351 ucol_greaterOrEqual(const UCollator *coll,
00352 const UChar *source, int32_t sourceLength,
00353 const UChar *target, int32_t targetLength);
00354
00369 U_CAPI UBool U_EXPORT2
00370 ucol_equal(const UCollator *coll,
00371 const UChar *source, int32_t sourceLength,
00372 const UChar *target, int32_t targetLength);
00373
00383 U_CAPI UCollationStrength U_EXPORT2
00384 ucol_getStrength(const UCollator *coll);
00385
00395 U_CAPI void U_EXPORT2
00396 ucol_setStrength(UCollator *coll,
00397 UCollationStrength strength);
00398
00411 U_CAPI int32_t U_EXPORT2
00412 ucol_getDisplayName( const char *objLoc,
00413 const char *dispLoc,
00414 UChar *result,
00415 int32_t resultLength,
00416 UErrorCode *status);
00417
00427 U_CAPI const char* U_EXPORT2
00428 ucol_getAvailable(int32_t index);
00429
00438 U_CAPI int32_t U_EXPORT2
00439 ucol_countAvailable(void);
00440
00449 U_CAPI const UChar* U_EXPORT2
00450 ucol_getRules( const UCollator *coll,
00451 int32_t *length);
00452
00465 U_CAPI int32_t U_EXPORT2
00466 ucol_getSortKey(const UCollator *coll,
00467 const UChar *source,
00468 int32_t sourceLength,
00469 uint8_t *result,
00470 int32_t resultLength);
00471
00473
00474
00475
00476
00477 typedef enum {
00479 UCOL_BOUND_LOWER = 0,
00481 UCOL_BOUND_UPPER = 1,
00483 UCOL_BOUND_UPPER_LONG = 2,
00484 UCOL_BOUND_VALUE_COUNT
00485 } UColBoundMode;
00486
00524 U_CAPI int32_t U_EXPORT2
00525 ucol_getBound(const uint8_t *source,
00526 int32_t sourceLength,
00527 UColBoundMode boundType,
00528 uint32_t noOfLevels,
00529 uint8_t *result,
00530 int32_t resultLength,
00531 UErrorCode *status);
00532
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
00629 U_CAPI uint32_t ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
00630
00642 U_CAPI void U_EXPORT2
00643 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
00644
00667 U_CAPI UCollator* U_EXPORT2
00668 ucol_safeClone(const UCollator *coll,
00669 void *stackBuffer,
00670 int32_t *pBufferSize,
00671 UErrorCode *status);
00672
00674 #define U_COL_SAFECLONE_BUFFERSIZE 384
00675
00686 U_CAPI int32_t U_EXPORT2
00687 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
00688
00689
00690
00691
00692
00693
00694 #include "unicode/ucoleitr.h"
00695
00717 U_CAPI UCollator * U_EXPORT2
00718 ucol_openVersion(const char *loc,
00719 UVersionInfo version,
00720 UErrorCode *status);
00721
00730 U_CAPI UNormalizationMode U_EXPORT2
00731 ucol_getNormalization(const UCollator* coll);
00732
00743 U_CAPI void U_EXPORT2
00744 ucol_setNormalization( UCollator *coll,
00745 UNormalizationMode mode);
00746
00760 U_CAPI const char * U_EXPORT2
00761 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
00762
00766 #ifdef U_USE_DEPRECATED_FORMAT_API
00767
00768 #if ((U_ICU_VERSION_MAJOR_NUM != 2) || (U_ICU_VERSION_MINOR_NUM !=1))
00769 # error "ICU version has changed. Please redefine the macros under U_USE_DEPRECATED_FORMAT_API pre-processor definition"
00770 #else
00771 # define ucol_openRules_2_1(rules,rulesLength,normalizationMode,strength,status) ucol_openRules(rules,rulesLength,(UColAttributeValue)normalizationMode,strength,NULL,status)
00772 #endif
00773
00774 #endif
00775
00776
00777 #endif