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_DRAFT 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
00695 U_STABLE int32_t U_EXPORT2
00696 ucol_getSortKey(const UCollator *coll,
00697 const UChar *source,
00698 int32_t sourceLength,
00699 uint8_t *result,
00700 int32_t resultLength);
00701
00702
00723 U_STABLE int32_t U_EXPORT2
00724 ucol_nextSortKeyPart(const UCollator *coll,
00725 UCharIterator *iter,
00726 uint32_t state[2],
00727 uint8_t *dest, int32_t count,
00728 UErrorCode *status);
00729
00737 typedef enum {
00739 UCOL_BOUND_LOWER = 0,
00741 UCOL_BOUND_UPPER = 1,
00743 UCOL_BOUND_UPPER_LONG = 2,
00744 UCOL_BOUND_VALUE_COUNT
00745 } UColBoundMode;
00746
00784 U_STABLE int32_t U_EXPORT2
00785 ucol_getBound(const uint8_t *source,
00786 int32_t sourceLength,
00787 UColBoundMode boundType,
00788 uint32_t noOfLevels,
00789 uint8_t *result,
00790 int32_t resultLength,
00791 UErrorCode *status);
00792
00801 U_STABLE void U_EXPORT2
00802 ucol_getVersion(const UCollator* coll, UVersionInfo info);
00803
00811 U_STABLE void U_EXPORT2
00812 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
00813
00836 U_STABLE int32_t U_EXPORT2
00837 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
00838 const uint8_t *src2, int32_t src2Length,
00839 uint8_t *dest, int32_t destCapacity);
00840
00852 U_STABLE void U_EXPORT2
00853 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
00854
00866 U_STABLE UColAttributeValue U_EXPORT2
00867 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
00868
00888 U_STABLE uint32_t U_EXPORT2
00889 ucol_setVariableTop(UCollator *coll,
00890 const UChar *varTop, int32_t len,
00891 UErrorCode *status);
00892
00904 U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
00905
00917 U_STABLE void U_EXPORT2
00918 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
00919
00942 U_STABLE UCollator* U_EXPORT2
00943 ucol_safeClone(const UCollator *coll,
00944 void *stackBuffer,
00945 int32_t *pBufferSize,
00946 UErrorCode *status);
00947
00951 #define U_COL_SAFECLONE_BUFFERSIZE 512
00952
00964 U_STABLE int32_t U_EXPORT2
00965 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
00966
00981 U_DEPRECATED const char * U_EXPORT2
00982 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
00983
00984
00999 U_STABLE const char * U_EXPORT2
01000 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01001
01012 U_STABLE USet * U_EXPORT2
01013 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
01014
01015 #ifndef U_HIDE_INTERNAL_API
01016
01021 #define UCOL_SIT_COLLATOR_NOT_ENCODABLE 0x80000000
01022 #endif
01023
01037 U_INTERNAL uint32_t U_EXPORT2
01038 ucol_collatorToIdentifier(const UCollator *coll,
01039 const char *locale,
01040 UErrorCode *status);
01041
01058 U_INTERNAL UCollator* U_EXPORT2
01059 ucol_openFromIdentifier(uint32_t identifier,
01060 UBool forceDefaults,
01061 UErrorCode *status);
01062
01063
01080 U_INTERNAL int32_t U_EXPORT2
01081 ucol_identifierToShortString(uint32_t identifier,
01082 char *buffer,
01083 int32_t capacity,
01084 UBool forceDefaults,
01085 UErrorCode *status);
01086
01101 U_INTERNAL uint32_t U_EXPORT2
01102 ucol_shortStringToIdentifier(const char *definition,
01103 UBool forceDefaults,
01104 UErrorCode *status);
01105
01106
01107
01119 U_INTERNAL UColAttributeValue U_EXPORT2
01120 ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status);
01121
01130 U_INTERNAL UBool U_EXPORT2
01131 ucol_equals(const UCollator *source, const UCollator *target);
01132
01144 U_INTERNAL int32_t U_EXPORT2
01145 ucol_getUnsafeSet( const UCollator *coll,
01146 USet *unsafe,
01147 UErrorCode *status);
01148
01152 U_INTERNAL void U_EXPORT2
01153 ucol_forgetUCA(void);
01154
01175 U_INTERNAL void U_EXPORT2
01176 ucol_prepareShortStringOpen( const char *definition,
01177 UBool forceDefaults,
01178 UParseError *parseError,
01179 UErrorCode *status);
01180
01192 U_STABLE int32_t U_EXPORT2
01193 ucol_cloneBinary(const UCollator *coll,
01194 uint8_t *buffer, int32_t capacity,
01195 UErrorCode *status);
01196
01214 U_STABLE UCollator* U_EXPORT2
01215 ucol_openBinary(const uint8_t *bin, int32_t length,
01216 const UCollator *base,
01217 UErrorCode *status);
01218
01219
01220 #endif
01221
01222 #endif
01223