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 localeIndex);
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
00597 U_DRAFT UEnumeration* U_EXPORT2
00598 ucol_getKeywordValuesForLocale(const char* key,
00599 const char* locale,
00600 UBool commonlyUsed,
00601 UErrorCode* status);
00602
00633 U_STABLE int32_t U_EXPORT2
00634 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
00635 const char* keyword, const char* locale,
00636 UBool* isAvailable, UErrorCode* status);
00637
00646 U_STABLE const UChar* U_EXPORT2
00647 ucol_getRules( const UCollator *coll,
00648 int32_t *length);
00649
00670 U_STABLE int32_t U_EXPORT2
00671 ucol_getShortDefinitionString(const UCollator *coll,
00672 const char *locale,
00673 char *buffer,
00674 int32_t capacity,
00675 UErrorCode *status);
00676
00697 U_STABLE int32_t U_EXPORT2
00698 ucol_normalizeShortDefinitionString(const char *source,
00699 char *destination,
00700 int32_t capacity,
00701 UParseError *parseError,
00702 UErrorCode *status);
00703
00704
00719 U_STABLE int32_t U_EXPORT2
00720 ucol_getSortKey(const UCollator *coll,
00721 const UChar *source,
00722 int32_t sourceLength,
00723 uint8_t *result,
00724 int32_t resultLength);
00725
00726
00747 U_STABLE int32_t U_EXPORT2
00748 ucol_nextSortKeyPart(const UCollator *coll,
00749 UCharIterator *iter,
00750 uint32_t state[2],
00751 uint8_t *dest, int32_t count,
00752 UErrorCode *status);
00753
00761 typedef enum {
00763 UCOL_BOUND_LOWER = 0,
00765 UCOL_BOUND_UPPER = 1,
00767 UCOL_BOUND_UPPER_LONG = 2,
00768 UCOL_BOUND_VALUE_COUNT
00769 } UColBoundMode;
00770
00808 U_STABLE int32_t U_EXPORT2
00809 ucol_getBound(const uint8_t *source,
00810 int32_t sourceLength,
00811 UColBoundMode boundType,
00812 uint32_t noOfLevels,
00813 uint8_t *result,
00814 int32_t resultLength,
00815 UErrorCode *status);
00816
00825 U_STABLE void U_EXPORT2
00826 ucol_getVersion(const UCollator* coll, UVersionInfo info);
00827
00835 U_STABLE void U_EXPORT2
00836 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
00837
00860 U_STABLE int32_t U_EXPORT2
00861 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
00862 const uint8_t *src2, int32_t src2Length,
00863 uint8_t *dest, int32_t destCapacity);
00864
00876 U_STABLE void U_EXPORT2
00877 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
00878
00890 U_STABLE UColAttributeValue U_EXPORT2
00891 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
00892
00912 U_STABLE uint32_t U_EXPORT2
00913 ucol_setVariableTop(UCollator *coll,
00914 const UChar *varTop, int32_t len,
00915 UErrorCode *status);
00916
00928 U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
00929
00941 U_STABLE void U_EXPORT2
00942 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
00943
00966 U_STABLE UCollator* U_EXPORT2
00967 ucol_safeClone(const UCollator *coll,
00968 void *stackBuffer,
00969 int32_t *pBufferSize,
00970 UErrorCode *status);
00971
00975 #define U_COL_SAFECLONE_BUFFERSIZE 512
00976
00988 U_STABLE int32_t U_EXPORT2
00989 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
00990
01005 U_DEPRECATED const char * U_EXPORT2
01006 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01007
01008
01023 U_STABLE const char * U_EXPORT2
01024 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01025
01036 U_STABLE USet * U_EXPORT2
01037 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
01038
01050 U_INTERNAL UColAttributeValue U_EXPORT2
01051 ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status);
01052
01061 U_INTERNAL UBool U_EXPORT2
01062 ucol_equals(const UCollator *source, const UCollator *target);
01063
01075 U_INTERNAL int32_t U_EXPORT2
01076 ucol_getUnsafeSet( const UCollator *coll,
01077 USet *unsafe,
01078 UErrorCode *status);
01079
01083 U_INTERNAL void U_EXPORT2
01084 ucol_forgetUCA(void);
01085
01106 U_INTERNAL void U_EXPORT2
01107 ucol_prepareShortStringOpen( const char *definition,
01108 UBool forceDefaults,
01109 UParseError *parseError,
01110 UErrorCode *status);
01111
01123 U_STABLE int32_t U_EXPORT2
01124 ucol_cloneBinary(const UCollator *coll,
01125 uint8_t *buffer, int32_t capacity,
01126 UErrorCode *status);
01127
01145 U_STABLE UCollator* U_EXPORT2
01146 ucol_openBinary(const uint8_t *bin, int32_t length,
01147 const UCollator *base,
01148 UErrorCode *status);
01149
01150
01151 #endif
01152
01153 #endif
01154