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 UCollator;
00060 typedef struct UCollator UCollator;
00061
00062
00075 typedef enum {
00077 UCOL_EQUAL = 0,
00079 UCOL_GREATER = 1,
00081 UCOL_LESS = -1
00082 } UCollationResult ;
00083
00084
00091 typedef enum {
00093 UCOL_DEFAULT = -1,
00094
00096 UCOL_PRIMARY = 0,
00098 UCOL_SECONDARY = 1,
00100 UCOL_TERTIARY = 2,
00102 UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
00103 UCOL_CE_STRENGTH_LIMIT,
00105 UCOL_QUATERNARY=3,
00107 UCOL_IDENTICAL=15,
00108 UCOL_STRENGTH_LIMIT,
00109
00113 UCOL_OFF = 16,
00117 UCOL_ON = 17,
00118
00120 UCOL_SHIFTED = 20,
00122 UCOL_NON_IGNORABLE = 21,
00123
00126 UCOL_LOWER_FIRST = 24,
00128 UCOL_UPPER_FIRST = 25,
00129
00130 UCOL_ATTRIBUTE_VALUE_COUNT
00131
00132 } UColAttributeValue;
00133
00160 typedef UColAttributeValue UCollationStrength;
00161
00166 typedef enum {
00171 UCOL_FRENCH_COLLATION,
00180 UCOL_ALTERNATE_HANDLING,
00187 UCOL_CASE_FIRST,
00195 UCOL_CASE_LEVEL,
00203 UCOL_NORMALIZATION_MODE,
00205 UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
00216 UCOL_STRENGTH,
00220 UCOL_HIRAGANA_QUATERNARY_MODE,
00224 UCOL_NUMERIC_COLLATION,
00225 UCOL_ATTRIBUTE_COUNT
00226 } UColAttribute;
00227
00231 typedef enum {
00233 UCOL_TAILORING_ONLY,
00235 UCOL_FULL_RULES
00236 } UColRuleOption ;
00237
00255 U_STABLE UCollator* U_EXPORT2
00256 ucol_open(const char *loc, UErrorCode *status);
00257
00283 U_STABLE UCollator* U_EXPORT2
00284 ucol_openRules( const UChar *rules,
00285 int32_t rulesLength,
00286 UColAttributeValue normalizationMode,
00287 UCollationStrength strength,
00288 UParseError *parseError,
00289 UErrorCode *status);
00290
00325 U_STABLE UCollator* U_EXPORT2
00326 ucol_openFromShortString( const char *definition,
00327 UBool forceDefaults,
00328 UParseError *parseError,
00329 UErrorCode *status);
00330
00344 U_DEPRECATED int32_t U_EXPORT2
00345 ucol_getContractions( const UCollator *coll,
00346 USet *conts,
00347 UErrorCode *status);
00348
00360 U_STABLE void U_EXPORT2
00361 ucol_getContractionsAndExpansions( const UCollator *coll,
00362 USet *contractions, USet *expansions,
00363 UBool addPrefixes, UErrorCode *status);
00364
00375 U_STABLE void U_EXPORT2
00376 ucol_close(UCollator *coll);
00377
00393 U_STABLE UCollationResult U_EXPORT2
00394 ucol_strcoll( const UCollator *coll,
00395 const UChar *source,
00396 int32_t sourceLength,
00397 const UChar *target,
00398 int32_t targetLength);
00399
00414 U_STABLE UBool U_EXPORT2
00415 ucol_greater(const UCollator *coll,
00416 const UChar *source, int32_t sourceLength,
00417 const UChar *target, int32_t targetLength);
00418
00433 U_STABLE UBool U_EXPORT2
00434 ucol_greaterOrEqual(const UCollator *coll,
00435 const UChar *source, int32_t sourceLength,
00436 const UChar *target, int32_t targetLength);
00437
00452 U_STABLE UBool U_EXPORT2
00453 ucol_equal(const UCollator *coll,
00454 const UChar *source, int32_t sourceLength,
00455 const UChar *target, int32_t targetLength);
00456
00469 U_STABLE UCollationResult U_EXPORT2
00470 ucol_strcollIter( const UCollator *coll,
00471 UCharIterator *sIter,
00472 UCharIterator *tIter,
00473 UErrorCode *status);
00474
00484 U_STABLE UCollationStrength U_EXPORT2
00485 ucol_getStrength(const UCollator *coll);
00486
00496 U_STABLE void U_EXPORT2
00497 ucol_setStrength(UCollator *coll,
00498 UCollationStrength strength);
00499
00512 U_STABLE int32_t U_EXPORT2
00513 ucol_getDisplayName( const char *objLoc,
00514 const char *dispLoc,
00515 UChar *result,
00516 int32_t resultLength,
00517 UErrorCode *status);
00518
00528 U_STABLE const char* U_EXPORT2
00529 ucol_getAvailable(int32_t index);
00530
00539 U_STABLE int32_t U_EXPORT2
00540 ucol_countAvailable(void);
00541
00542 #if !UCONFIG_NO_SERVICE
00543
00551 U_STABLE UEnumeration* U_EXPORT2
00552 ucol_openAvailableLocales(UErrorCode *status);
00553 #endif
00554
00564 U_STABLE UEnumeration* U_EXPORT2
00565 ucol_getKeywords(UErrorCode *status);
00566
00578 U_STABLE UEnumeration* U_EXPORT2
00579 ucol_getKeywordValues(const char *keyword, UErrorCode *status);
00580
00611 U_STABLE int32_t U_EXPORT2
00612 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
00613 const char* keyword, const char* locale,
00614 UBool* isAvailable, UErrorCode* status);
00615
00624 U_STABLE const UChar* U_EXPORT2
00625 ucol_getRules( const UCollator *coll,
00626 int32_t *length);
00627
00648 U_STABLE int32_t U_EXPORT2
00649 ucol_getShortDefinitionString(const UCollator *coll,
00650 const char *locale,
00651 char *buffer,
00652 int32_t capacity,
00653 UErrorCode *status);
00654
00675 U_STABLE int32_t U_EXPORT2
00676 ucol_normalizeShortDefinitionString(const char *source,
00677 char *destination,
00678 int32_t capacity,
00679 UParseError *parseError,
00680 UErrorCode *status);
00681
00682
00697 U_STABLE int32_t U_EXPORT2
00698 ucol_getSortKey(const UCollator *coll,
00699 const UChar *source,
00700 int32_t sourceLength,
00701 uint8_t *result,
00702 int32_t resultLength);
00703
00704
00725 U_STABLE int32_t U_EXPORT2
00726 ucol_nextSortKeyPart(const UCollator *coll,
00727 UCharIterator *iter,
00728 uint32_t state[2],
00729 uint8_t *dest, int32_t count,
00730 UErrorCode *status);
00731
00739 typedef enum {
00741 UCOL_BOUND_LOWER = 0,
00743 UCOL_BOUND_UPPER = 1,
00745 UCOL_BOUND_UPPER_LONG = 2,
00746 UCOL_BOUND_VALUE_COUNT
00747 } UColBoundMode;
00748
00786 U_STABLE int32_t U_EXPORT2
00787 ucol_getBound(const uint8_t *source,
00788 int32_t sourceLength,
00789 UColBoundMode boundType,
00790 uint32_t noOfLevels,
00791 uint8_t *result,
00792 int32_t resultLength,
00793 UErrorCode *status);
00794
00803 U_STABLE void U_EXPORT2
00804 ucol_getVersion(const UCollator* coll, UVersionInfo info);
00805
00813 U_STABLE void U_EXPORT2
00814 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
00815
00838 U_STABLE int32_t U_EXPORT2
00839 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
00840 const uint8_t *src2, int32_t src2Length,
00841 uint8_t *dest, int32_t destCapacity);
00842
00854 U_STABLE void U_EXPORT2
00855 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
00856
00868 U_STABLE UColAttributeValue U_EXPORT2
00869 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
00870
00890 U_STABLE uint32_t U_EXPORT2
00891 ucol_setVariableTop(UCollator *coll,
00892 const UChar *varTop, int32_t len,
00893 UErrorCode *status);
00894
00906 U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
00907
00919 U_STABLE void U_EXPORT2
00920 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
00921
00944 U_STABLE UCollator* U_EXPORT2
00945 ucol_safeClone(const UCollator *coll,
00946 void *stackBuffer,
00947 int32_t *pBufferSize,
00948 UErrorCode *status);
00949
00953 #define U_COL_SAFECLONE_BUFFERSIZE 512
00954
00966 U_STABLE int32_t U_EXPORT2
00967 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
00968
00983 U_DEPRECATED const char * U_EXPORT2
00984 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
00985
00986
01001 U_STABLE const char * U_EXPORT2
01002 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01003
01014 U_STABLE USet * U_EXPORT2
01015 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
01016
01028 U_INTERNAL UColAttributeValue U_EXPORT2
01029 ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status);
01030
01039 U_INTERNAL UBool U_EXPORT2
01040 ucol_equals(const UCollator *source, const UCollator *target);
01041
01053 U_INTERNAL int32_t U_EXPORT2
01054 ucol_getUnsafeSet( const UCollator *coll,
01055 USet *unsafe,
01056 UErrorCode *status);
01057
01061 U_INTERNAL void U_EXPORT2
01062 ucol_forgetUCA(void);
01063
01084 U_INTERNAL void U_EXPORT2
01085 ucol_prepareShortStringOpen( const char *definition,
01086 UBool forceDefaults,
01087 UParseError *parseError,
01088 UErrorCode *status);
01089
01101 U_STABLE int32_t U_EXPORT2
01102 ucol_cloneBinary(const UCollator *coll,
01103 uint8_t *buffer, int32_t capacity,
01104 UErrorCode *status);
01105
01123 U_STABLE UCollator* U_EXPORT2
01124 ucol_openBinary(const uint8_t *bin, int32_t length,
01125 const UCollator *base,
01126 UErrorCode *status);
01127
01128
01129 #endif
01130
01131 #endif
01132