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/localpointer.h"
00017 #include "unicode/parseerr.h"
00018 #include "unicode/uloc.h"
00019 #include "unicode/uset.h"
00020 #include "unicode/uscript.h"
00021
00058 struct UCollator;
00062 typedef struct UCollator UCollator;
00063
00064
00077 typedef enum {
00079 UCOL_EQUAL = 0,
00081 UCOL_GREATER = 1,
00083 UCOL_LESS = -1
00084 } UCollationResult ;
00085
00086
00093 typedef enum {
00095 UCOL_DEFAULT = -1,
00096
00098 UCOL_PRIMARY = 0,
00100 UCOL_SECONDARY = 1,
00102 UCOL_TERTIARY = 2,
00104 UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
00105 UCOL_CE_STRENGTH_LIMIT,
00107 UCOL_QUATERNARY=3,
00109 UCOL_IDENTICAL=15,
00110 UCOL_STRENGTH_LIMIT,
00111
00115 UCOL_OFF = 16,
00119 UCOL_ON = 17,
00120
00122 UCOL_SHIFTED = 20,
00124 UCOL_NON_IGNORABLE = 21,
00125
00128 UCOL_LOWER_FIRST = 24,
00130 UCOL_UPPER_FIRST = 25,
00131
00132 UCOL_ATTRIBUTE_VALUE_COUNT
00133
00134 } UColAttributeValue;
00135
00145 typedef enum {
00151 UCOL_REORDER_CODE_DEFAULT = -1,
00156 UCOL_REORDER_CODE_NONE = USCRIPT_UNKNOWN,
00163 UCOL_REORDER_CODE_OTHERS = USCRIPT_UNKNOWN,
00169 UCOL_REORDER_CODE_SPACE = 0x1000,
00175 UCOL_REORDER_CODE_FIRST = UCOL_REORDER_CODE_SPACE,
00181 UCOL_REORDER_CODE_PUNCTUATION = 0x1001,
00187 UCOL_REORDER_CODE_SYMBOL = 0x1002,
00193 UCOL_REORDER_CODE_CURRENCY = 0x1003,
00199 UCOL_REORDER_CODE_DIGIT = 0x1004,
00205 UCOL_REORDER_CODE_LIMIT = 0x1005
00206 } UColReorderCode;
00207
00234 typedef UColAttributeValue UCollationStrength;
00235
00240 typedef enum {
00247 UCOL_FRENCH_COLLATION,
00258 UCOL_ALTERNATE_HANDLING,
00267 UCOL_CASE_FIRST,
00277 UCOL_CASE_LEVEL,
00287 UCOL_NORMALIZATION_MODE,
00291 UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
00304 UCOL_STRENGTH,
00315 UCOL_HIRAGANA_QUATERNARY_MODE,
00325 UCOL_NUMERIC_COLLATION,
00330 UCOL_ATTRIBUTE_COUNT
00331 } UColAttribute;
00332
00336 typedef enum {
00342 UCOL_TAILORING_ONLY,
00350 UCOL_FULL_RULES
00351 } UColRuleOption ;
00352
00370 U_STABLE UCollator* U_EXPORT2
00371 ucol_open(const char *loc, UErrorCode *status);
00372
00398 U_STABLE UCollator* U_EXPORT2
00399 ucol_openRules( const UChar *rules,
00400 int32_t rulesLength,
00401 UColAttributeValue normalizationMode,
00402 UCollationStrength strength,
00403 UParseError *parseError,
00404 UErrorCode *status);
00405
00440 U_STABLE UCollator* U_EXPORT2
00441 ucol_openFromShortString( const char *definition,
00442 UBool forceDefaults,
00443 UParseError *parseError,
00444 UErrorCode *status);
00445
00446 #ifndef U_HIDE_DEPRECATED_API
00447
00460 U_DEPRECATED int32_t U_EXPORT2
00461 ucol_getContractions( const UCollator *coll,
00462 USet *conts,
00463 UErrorCode *status);
00464 #endif
00465
00477 U_STABLE void U_EXPORT2
00478 ucol_getContractionsAndExpansions( const UCollator *coll,
00479 USet *contractions, USet *expansions,
00480 UBool addPrefixes, UErrorCode *status);
00481
00492 U_STABLE void U_EXPORT2
00493 ucol_close(UCollator *coll);
00494
00495 #if U_SHOW_CPLUSPLUS_API
00496
00497 U_NAMESPACE_BEGIN
00498
00508 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
00509
00510 U_NAMESPACE_END
00511
00512 #endif
00513
00529 U_STABLE UCollationResult U_EXPORT2
00530 ucol_strcoll( const UCollator *coll,
00531 const UChar *source,
00532 int32_t sourceLength,
00533 const UChar *target,
00534 int32_t targetLength);
00535
00554 U_DRAFT UCollationResult U_EXPORT2
00555 ucol_strcollUTF8(
00556 const UCollator *coll,
00557 const char *source,
00558 int32_t sourceLength,
00559 const char *target,
00560 int32_t targetLength,
00561 UErrorCode *status);
00562
00577 U_STABLE UBool U_EXPORT2
00578 ucol_greater(const UCollator *coll,
00579 const UChar *source, int32_t sourceLength,
00580 const UChar *target, int32_t targetLength);
00581
00596 U_STABLE UBool U_EXPORT2
00597 ucol_greaterOrEqual(const UCollator *coll,
00598 const UChar *source, int32_t sourceLength,
00599 const UChar *target, int32_t targetLength);
00600
00615 U_STABLE UBool U_EXPORT2
00616 ucol_equal(const UCollator *coll,
00617 const UChar *source, int32_t sourceLength,
00618 const UChar *target, int32_t targetLength);
00619
00632 U_STABLE UCollationResult U_EXPORT2
00633 ucol_strcollIter( const UCollator *coll,
00634 UCharIterator *sIter,
00635 UCharIterator *tIter,
00636 UErrorCode *status);
00637
00647 U_STABLE UCollationStrength U_EXPORT2
00648 ucol_getStrength(const UCollator *coll);
00649
00659 U_STABLE void U_EXPORT2
00660 ucol_setStrength(UCollator *coll,
00661 UCollationStrength strength);
00662
00679 U_STABLE int32_t U_EXPORT2
00680 ucol_getReorderCodes(const UCollator* coll,
00681 int32_t* dest,
00682 int32_t destCapacity,
00683 UErrorCode *pErrorCode);
00719 U_STABLE void U_EXPORT2
00720 ucol_setReorderCodes(UCollator* coll,
00721 const int32_t* reorderCodes,
00722 int32_t reorderCodesLength,
00723 UErrorCode *pErrorCode);
00724
00741 U_STABLE int32_t U_EXPORT2
00742 ucol_getEquivalentReorderCodes(int32_t reorderCode,
00743 int32_t* dest,
00744 int32_t destCapacity,
00745 UErrorCode *pErrorCode);
00746
00759 U_STABLE int32_t U_EXPORT2
00760 ucol_getDisplayName( const char *objLoc,
00761 const char *dispLoc,
00762 UChar *result,
00763 int32_t resultLength,
00764 UErrorCode *status);
00765
00775 U_STABLE const char* U_EXPORT2
00776 ucol_getAvailable(int32_t localeIndex);
00777
00786 U_STABLE int32_t U_EXPORT2
00787 ucol_countAvailable(void);
00788
00789 #if !UCONFIG_NO_SERVICE
00790
00798 U_STABLE UEnumeration* U_EXPORT2
00799 ucol_openAvailableLocales(UErrorCode *status);
00800 #endif
00801
00811 U_STABLE UEnumeration* U_EXPORT2
00812 ucol_getKeywords(UErrorCode *status);
00813
00825 U_STABLE UEnumeration* U_EXPORT2
00826 ucol_getKeywordValues(const char *keyword, UErrorCode *status);
00827
00844 U_STABLE UEnumeration* U_EXPORT2
00845 ucol_getKeywordValuesForLocale(const char* key,
00846 const char* locale,
00847 UBool commonlyUsed,
00848 UErrorCode* status);
00849
00880 U_STABLE int32_t U_EXPORT2
00881 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
00882 const char* keyword, const char* locale,
00883 UBool* isAvailable, UErrorCode* status);
00884
00893 U_STABLE const UChar* U_EXPORT2
00894 ucol_getRules( const UCollator *coll,
00895 int32_t *length);
00896
00917 U_STABLE int32_t U_EXPORT2
00918 ucol_getShortDefinitionString(const UCollator *coll,
00919 const char *locale,
00920 char *buffer,
00921 int32_t capacity,
00922 UErrorCode *status);
00923
00944 U_STABLE int32_t U_EXPORT2
00945 ucol_normalizeShortDefinitionString(const char *source,
00946 char *destination,
00947 int32_t capacity,
00948 UParseError *parseError,
00949 UErrorCode *status);
00950
00951
00971 U_STABLE int32_t U_EXPORT2
00972 ucol_getSortKey(const UCollator *coll,
00973 const UChar *source,
00974 int32_t sourceLength,
00975 uint8_t *result,
00976 int32_t resultLength);
00977
00978
00999 U_STABLE int32_t U_EXPORT2
01000 ucol_nextSortKeyPart(const UCollator *coll,
01001 UCharIterator *iter,
01002 uint32_t state[2],
01003 uint8_t *dest, int32_t count,
01004 UErrorCode *status);
01005
01013 typedef enum {
01015 UCOL_BOUND_LOWER = 0,
01017 UCOL_BOUND_UPPER = 1,
01019 UCOL_BOUND_UPPER_LONG = 2,
01020 UCOL_BOUND_VALUE_COUNT
01021 } UColBoundMode;
01022
01060 U_STABLE int32_t U_EXPORT2
01061 ucol_getBound(const uint8_t *source,
01062 int32_t sourceLength,
01063 UColBoundMode boundType,
01064 uint32_t noOfLevels,
01065 uint8_t *result,
01066 int32_t resultLength,
01067 UErrorCode *status);
01068
01077 U_STABLE void U_EXPORT2
01078 ucol_getVersion(const UCollator* coll, UVersionInfo info);
01079
01087 U_STABLE void U_EXPORT2
01088 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
01089
01112 U_STABLE int32_t U_EXPORT2
01113 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
01114 const uint8_t *src2, int32_t src2Length,
01115 uint8_t *dest, int32_t destCapacity);
01116
01128 U_STABLE void U_EXPORT2
01129 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
01130
01142 U_STABLE UColAttributeValue U_EXPORT2
01143 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
01144
01164 U_STABLE uint32_t U_EXPORT2
01165 ucol_setVariableTop(UCollator *coll,
01166 const UChar *varTop, int32_t len,
01167 UErrorCode *status);
01168
01180 U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
01181
01193 U_STABLE void U_EXPORT2
01194 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
01195
01218 U_STABLE UCollator* U_EXPORT2
01219 ucol_safeClone(const UCollator *coll,
01220 void *stackBuffer,
01221 int32_t *pBufferSize,
01222 UErrorCode *status);
01223
01227 #define U_COL_SAFECLONE_BUFFERSIZE 528
01228
01244 U_STABLE int32_t U_EXPORT2
01245 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
01246
01247 #ifndef U_HIDE_DEPRECATED_API
01248
01262 U_DEPRECATED const char * U_EXPORT2
01263 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01264 #endif
01265
01280 U_STABLE const char * U_EXPORT2
01281 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01282
01293 U_STABLE USet * U_EXPORT2
01294 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
01295
01296 #ifndef U_HIDE_INTERNAL_API
01297
01308 U_INTERNAL UColAttributeValue U_EXPORT2
01309 ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status);
01310
01319 U_INTERNAL UBool U_EXPORT2
01320 ucol_equals(const UCollator *source, const UCollator *target);
01321
01333 U_INTERNAL int32_t U_EXPORT2
01334 ucol_getUnsafeSet( const UCollator *coll,
01335 USet *unsafe,
01336 UErrorCode *status);
01337
01341 U_INTERNAL void U_EXPORT2
01342 ucol_forgetUCA(void);
01343
01364 U_INTERNAL void U_EXPORT2
01365 ucol_prepareShortStringOpen( const char *definition,
01366 UBool forceDefaults,
01367 UParseError *parseError,
01368 UErrorCode *status);
01369 #endif
01370
01382 U_STABLE int32_t U_EXPORT2
01383 ucol_cloneBinary(const UCollator *coll,
01384 uint8_t *buffer, int32_t capacity,
01385 UErrorCode *status);
01386
01404 U_STABLE UCollator* U_EXPORT2
01405 ucol_openBinary(const uint8_t *bin, int32_t length,
01406 const UCollator *base,
01407 UErrorCode *status);
01408
01409
01410 #endif
01411
01412 #endif