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
00399 U_CAPI UCollationStrength U_EXPORT2
00400 ucol_getStrength(const UCollator *coll);
00401
00411 U_CAPI void U_EXPORT2
00412 ucol_setStrength(UCollator *coll,
00413 UCollationStrength strength);
00414
00427 U_CAPI int32_t U_EXPORT2
00428 ucol_getDisplayName( const char *objLoc,
00429 const char *dispLoc,
00430 UChar *result,
00431 int32_t resultLength,
00432 UErrorCode *status);
00433
00443 U_CAPI const char* U_EXPORT2
00444 ucol_getAvailable(int32_t index);
00445
00454 U_CAPI int32_t U_EXPORT2
00455 ucol_countAvailable(void);
00456
00465 U_CAPI const UChar* U_EXPORT2
00466 ucol_getRules( const UCollator *coll,
00467 int32_t *length);
00468
00481 U_CAPI int32_t U_EXPORT2
00482 ucol_getSortKey(const UCollator *coll,
00483 const UChar *source,
00484 int32_t sourceLength,
00485 uint8_t *result,
00486 int32_t resultLength);
00487
00495 typedef enum {
00497 UCOL_BOUND_LOWER = 0,
00499 UCOL_BOUND_UPPER = 1,
00501 UCOL_BOUND_UPPER_LONG = 2,
00502 UCOL_BOUND_VALUE_COUNT
00503 } UColBoundMode;
00504
00542 U_CAPI int32_t U_EXPORT2
00543 ucol_getBound(const uint8_t *source,
00544 int32_t sourceLength,
00545 UColBoundMode boundType,
00546 uint32_t noOfLevels,
00547 uint8_t *result,
00548 int32_t resultLength,
00549 UErrorCode *status);
00550
00557 U_CAPI void U_EXPORT2
00558 ucol_getVersion(const UCollator* coll, UVersionInfo info);
00559
00560
00581 U_CAPI int32_t U_EXPORT2
00582 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
00583 const uint8_t *src2, int32_t src2Length,
00584 uint8_t *dest, int32_t destCapacity);
00585
00597 U_CAPI void U_EXPORT2
00598 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
00599
00611 U_CAPI UColAttributeValue U_EXPORT2
00612 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
00613
00633 U_CAPI uint32_t U_EXPORT2
00634 ucol_setVariableTop(UCollator *coll,
00635 const UChar *varTop, int32_t len,
00636 UErrorCode *status);
00637
00649 U_CAPI uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
00650
00662 U_CAPI void U_EXPORT2
00663 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
00664
00687 U_CAPI UCollator* U_EXPORT2
00688 ucol_safeClone(const UCollator *coll,
00689 void *stackBuffer,
00690 int32_t *pBufferSize,
00691 UErrorCode *status);
00692
00696 #define U_COL_SAFECLONE_BUFFERSIZE 512
00697
00709 U_CAPI int32_t U_EXPORT2
00710 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
00711
00726 U_CAPI const char * U_EXPORT2
00727 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
00728
00729
00740 U_CAPI USet * U_EXPORT2
00741 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
00742
00743 #ifdef U_USE_DEPRECATED_UCOL_API
00744
00745
00746
00747
00751 #include "unicode/ucoleitr.h"
00752
00774 U_CAPI UCollator * U_EXPORT2
00775 ucol_openVersion(const char *loc,
00776 UVersionInfo version,
00777 UErrorCode *status);
00778
00787 U_CAPI UNormalizationMode U_EXPORT2
00788 ucol_getNormalization(const UCollator* coll);
00789
00800 U_CAPI void U_EXPORT2
00801 ucol_setNormalization( UCollator *coll,
00802 UNormalizationMode mode);
00803
00807 #if ((U_ICU_VERSION_MAJOR_NUM != 2) || (U_ICU_VERSION_MINOR_NUM != 2))
00808 # error "ICU version has changed. Please redefine the macros under U_USE_DEPRECATED_FORMAT_API pre-processor definition"
00809 #else
00810 # define ucol_openRules_2_2(rules,rulesLength,normalizationMode,strength,status) ucol_openRules(rules,rulesLength,(UColAttributeValue)normalizationMode,strength,NULL,status)
00811 #endif
00812
00813 #endif
00814
00815
00816 #endif
00817
00818 #endif