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,
00237 UCOL_NUMERIC_COLLATION,
00238 UCOL_ATTRIBUTE_COUNT
00239 } UColAttribute;
00240
00244 typedef enum {
00246 UCOL_TAILORING_ONLY,
00248 UCOL_FULL_RULES
00249 } UColRuleOption ;
00250
00268 U_CAPI UCollator* U_EXPORT2
00269 ucol_open(const char *loc, UErrorCode *status);
00270
00296 U_CAPI UCollator* U_EXPORT2
00297 ucol_openRules( const UChar *rules,
00298 int32_t rulesLength,
00299 UColAttributeValue normalizationMode,
00300 UCollationStrength strength,
00301 UParseError *parseError,
00302 UErrorCode *status);
00303
00314 U_CAPI void U_EXPORT2
00315 ucol_close(UCollator *coll);
00316
00332 U_CAPI UCollationResult U_EXPORT2
00333 ucol_strcoll( const UCollator *coll,
00334 const UChar *source,
00335 int32_t sourceLength,
00336 const UChar *target,
00337 int32_t targetLength);
00338
00353 U_CAPI UBool U_EXPORT2
00354 ucol_greater(const UCollator *coll,
00355 const UChar *source, int32_t sourceLength,
00356 const UChar *target, int32_t targetLength);
00357
00372 U_CAPI UBool U_EXPORT2
00373 ucol_greaterOrEqual(const UCollator *coll,
00374 const UChar *source, int32_t sourceLength,
00375 const UChar *target, int32_t targetLength);
00376
00391 U_CAPI UBool U_EXPORT2
00392 ucol_equal(const UCollator *coll,
00393 const UChar *source, int32_t sourceLength,
00394 const UChar *target, int32_t targetLength);
00395
00408 U_CAPI UCollationResult U_EXPORT2
00409 ucol_strcollIter( const UCollator *coll,
00410 UCharIterator *sIter,
00411 UCharIterator *tIter,
00412 UErrorCode *status);
00413
00423 U_CAPI UCollationStrength U_EXPORT2
00424 ucol_getStrength(const UCollator *coll);
00425
00435 U_CAPI void U_EXPORT2
00436 ucol_setStrength(UCollator *coll,
00437 UCollationStrength strength);
00438
00451 U_CAPI int32_t U_EXPORT2
00452 ucol_getDisplayName( const char *objLoc,
00453 const char *dispLoc,
00454 UChar *result,
00455 int32_t resultLength,
00456 UErrorCode *status);
00457
00467 U_CAPI const char* U_EXPORT2
00468 ucol_getAvailable(int32_t index);
00469
00478 U_CAPI int32_t U_EXPORT2
00479 ucol_countAvailable(void);
00480
00489 U_CAPI const UChar* U_EXPORT2
00490 ucol_getRules( const UCollator *coll,
00491 int32_t *length);
00492
00505 U_CAPI int32_t U_EXPORT2
00506 ucol_getSortKey(const UCollator *coll,
00507 const UChar *source,
00508 int32_t sourceLength,
00509 uint8_t *result,
00510 int32_t resultLength);
00511
00512
00533 U_CAPI int32_t U_EXPORT2
00534 ucol_nextSortKeyPart(const UCollator *coll,
00535 UCharIterator *iter,
00536 uint32_t state[2],
00537 uint8_t *dest, int32_t count,
00538 UErrorCode *status);
00539
00547 typedef enum {
00549 UCOL_BOUND_LOWER = 0,
00551 UCOL_BOUND_UPPER = 1,
00553 UCOL_BOUND_UPPER_LONG = 2,
00554 UCOL_BOUND_VALUE_COUNT
00555 } UColBoundMode;
00556
00594 U_CAPI int32_t U_EXPORT2
00595 ucol_getBound(const uint8_t *source,
00596 int32_t sourceLength,
00597 UColBoundMode boundType,
00598 uint32_t noOfLevels,
00599 uint8_t *result,
00600 int32_t resultLength,
00601 UErrorCode *status);
00602
00611 U_CAPI void U_EXPORT2
00612 ucol_getVersion(const UCollator* coll, UVersionInfo info);
00613
00621 U_CAPI void U_EXPORT2
00622 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
00623
00646 U_CAPI int32_t U_EXPORT2
00647 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
00648 const uint8_t *src2, int32_t src2Length,
00649 uint8_t *dest, int32_t destCapacity);
00650
00662 U_CAPI void U_EXPORT2
00663 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
00664
00676 U_CAPI UColAttributeValue U_EXPORT2
00677 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
00678
00698 U_CAPI uint32_t U_EXPORT2
00699 ucol_setVariableTop(UCollator *coll,
00700 const UChar *varTop, int32_t len,
00701 UErrorCode *status);
00702
00714 U_CAPI uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
00715
00727 U_CAPI void U_EXPORT2
00728 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
00729
00752 U_CAPI UCollator* U_EXPORT2
00753 ucol_safeClone(const UCollator *coll,
00754 void *stackBuffer,
00755 int32_t *pBufferSize,
00756 UErrorCode *status);
00757
00761 #define U_COL_SAFECLONE_BUFFERSIZE 512
00762
00774 U_CAPI int32_t U_EXPORT2
00775 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
00776
00791 U_CAPI const char * U_EXPORT2
00792 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
00793
00794
00809 U_CAPI const char * U_EXPORT2
00810 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
00811
00822 U_CAPI USet * U_EXPORT2
00823 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
00824
00825 #endif
00826
00827 #endif
00828