00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef UCOL_H
00011 #define UCOL_H
00012
00013 #include "unicode/utypes.h"
00014
00015 #if !UCONFIG_NO_COLLATION
00016
00017 #include "unicode/unorm.h"
00018 #include "unicode/localpointer.h"
00019 #include "unicode/parseerr.h"
00020 #include "unicode/uloc.h"
00021 #include "unicode/uset.h"
00022 #include "unicode/uscript.h"
00023
00054 struct UCollator;
00058 typedef struct UCollator UCollator;
00059
00060
00073 typedef enum {
00075 UCOL_EQUAL = 0,
00077 UCOL_GREATER = 1,
00079 UCOL_LESS = -1
00080 } UCollationResult ;
00081
00082
00089 typedef enum {
00091 UCOL_DEFAULT = -1,
00092
00094 UCOL_PRIMARY = 0,
00096 UCOL_SECONDARY = 1,
00098 UCOL_TERTIARY = 2,
00100 UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
00101 UCOL_CE_STRENGTH_LIMIT,
00103 UCOL_QUATERNARY=3,
00105 UCOL_IDENTICAL=15,
00106 UCOL_STRENGTH_LIMIT,
00107
00111 UCOL_OFF = 16,
00115 UCOL_ON = 17,
00116
00118 UCOL_SHIFTED = 20,
00120 UCOL_NON_IGNORABLE = 21,
00121
00124 UCOL_LOWER_FIRST = 24,
00126 UCOL_UPPER_FIRST = 25,
00127
00128 #ifndef U_HIDE_DEPRECATED_API
00129
00133 UCOL_ATTRIBUTE_VALUE_COUNT
00134 #endif
00135 } UColAttributeValue;
00136
00146 typedef enum {
00152 UCOL_REORDER_CODE_DEFAULT = -1,
00157 UCOL_REORDER_CODE_NONE = USCRIPT_UNKNOWN,
00164 UCOL_REORDER_CODE_OTHERS = USCRIPT_UNKNOWN,
00170 UCOL_REORDER_CODE_SPACE = 0x1000,
00176 UCOL_REORDER_CODE_FIRST = UCOL_REORDER_CODE_SPACE,
00182 UCOL_REORDER_CODE_PUNCTUATION = 0x1001,
00188 UCOL_REORDER_CODE_SYMBOL = 0x1002,
00194 UCOL_REORDER_CODE_CURRENCY = 0x1003,
00200 UCOL_REORDER_CODE_DIGIT = 0x1004,
00201 #ifndef U_HIDE_DEPRECATED_API
00202
00206 UCOL_REORDER_CODE_LIMIT = 0x1005
00207 #endif
00208 } UColReorderCode;
00209
00236 typedef UColAttributeValue UCollationStrength;
00237
00242 typedef enum {
00249 UCOL_FRENCH_COLLATION,
00260 UCOL_ALTERNATE_HANDLING,
00269 UCOL_CASE_FIRST,
00279 UCOL_CASE_LEVEL,
00289 UCOL_NORMALIZATION_MODE,
00293 UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
00310 UCOL_STRENGTH,
00311 #ifndef U_HIDE_DEPRECATED_API
00312
00323 UCOL_HIRAGANA_QUATERNARY_MODE = UCOL_STRENGTH + 1,
00324 #endif
00325
00343 UCOL_NUMERIC_COLLATION = UCOL_STRENGTH + 2,
00344
00345
00346
00351 UCOL_ATTRIBUTE_COUNT
00352 } UColAttribute;
00353
00357 typedef enum {
00363 UCOL_TAILORING_ONLY,
00371 UCOL_FULL_RULES
00372 } UColRuleOption ;
00373
00399 U_STABLE UCollator* U_EXPORT2
00400 ucol_open(const char *loc, UErrorCode *status);
00401
00427 U_STABLE UCollator* U_EXPORT2
00428 ucol_openRules( const UChar *rules,
00429 int32_t rulesLength,
00430 UColAttributeValue normalizationMode,
00431 UCollationStrength strength,
00432 UParseError *parseError,
00433 UErrorCode *status);
00434
00435 #ifndef U_HIDE_DEPRECATED_API
00436
00469 U_DEPRECATED UCollator* U_EXPORT2
00470 ucol_openFromShortString( const char *definition,
00471 UBool forceDefaults,
00472 UParseError *parseError,
00473 UErrorCode *status);
00474 #endif
00475
00476 #ifndef U_HIDE_DEPRECATED_API
00477
00490 U_DEPRECATED int32_t U_EXPORT2
00491 ucol_getContractions( const UCollator *coll,
00492 USet *conts,
00493 UErrorCode *status);
00494 #endif
00495
00507 U_STABLE void U_EXPORT2
00508 ucol_getContractionsAndExpansions( const UCollator *coll,
00509 USet *contractions, USet *expansions,
00510 UBool addPrefixes, UErrorCode *status);
00511
00522 U_STABLE void U_EXPORT2
00523 ucol_close(UCollator *coll);
00524
00525 #if U_SHOW_CPLUSPLUS_API
00526
00527 U_NAMESPACE_BEGIN
00528
00538 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
00539
00540 U_NAMESPACE_END
00541
00542 #endif
00543
00559 U_STABLE UCollationResult U_EXPORT2
00560 ucol_strcoll( const UCollator *coll,
00561 const UChar *source,
00562 int32_t sourceLength,
00563 const UChar *target,
00564 int32_t targetLength);
00565
00584 U_STABLE UCollationResult U_EXPORT2
00585 ucol_strcollUTF8(
00586 const UCollator *coll,
00587 const char *source,
00588 int32_t sourceLength,
00589 const char *target,
00590 int32_t targetLength,
00591 UErrorCode *status);
00592
00607 U_STABLE UBool U_EXPORT2
00608 ucol_greater(const UCollator *coll,
00609 const UChar *source, int32_t sourceLength,
00610 const UChar *target, int32_t targetLength);
00611
00626 U_STABLE UBool U_EXPORT2
00627 ucol_greaterOrEqual(const UCollator *coll,
00628 const UChar *source, int32_t sourceLength,
00629 const UChar *target, int32_t targetLength);
00630
00645 U_STABLE UBool U_EXPORT2
00646 ucol_equal(const UCollator *coll,
00647 const UChar *source, int32_t sourceLength,
00648 const UChar *target, int32_t targetLength);
00649
00662 U_STABLE UCollationResult U_EXPORT2
00663 ucol_strcollIter( const UCollator *coll,
00664 UCharIterator *sIter,
00665 UCharIterator *tIter,
00666 UErrorCode *status);
00667
00677 U_STABLE UCollationStrength U_EXPORT2
00678 ucol_getStrength(const UCollator *coll);
00679
00689 U_STABLE void U_EXPORT2
00690 ucol_setStrength(UCollator *coll,
00691 UCollationStrength strength);
00692
00709 U_STABLE int32_t U_EXPORT2
00710 ucol_getReorderCodes(const UCollator* coll,
00711 int32_t* dest,
00712 int32_t destCapacity,
00713 UErrorCode *pErrorCode);
00754 U_STABLE void U_EXPORT2
00755 ucol_setReorderCodes(UCollator* coll,
00756 const int32_t* reorderCodes,
00757 int32_t reorderCodesLength,
00758 UErrorCode *pErrorCode);
00759
00779 U_STABLE int32_t U_EXPORT2
00780 ucol_getEquivalentReorderCodes(int32_t reorderCode,
00781 int32_t* dest,
00782 int32_t destCapacity,
00783 UErrorCode *pErrorCode);
00784
00797 U_STABLE int32_t U_EXPORT2
00798 ucol_getDisplayName( const char *objLoc,
00799 const char *dispLoc,
00800 UChar *result,
00801 int32_t resultLength,
00802 UErrorCode *status);
00803
00813 U_STABLE const char* U_EXPORT2
00814 ucol_getAvailable(int32_t localeIndex);
00815
00824 U_STABLE int32_t U_EXPORT2
00825 ucol_countAvailable(void);
00826
00827 #if !UCONFIG_NO_SERVICE
00828
00836 U_STABLE UEnumeration* U_EXPORT2
00837 ucol_openAvailableLocales(UErrorCode *status);
00838 #endif
00839
00849 U_STABLE UEnumeration* U_EXPORT2
00850 ucol_getKeywords(UErrorCode *status);
00851
00863 U_STABLE UEnumeration* U_EXPORT2
00864 ucol_getKeywordValues(const char *keyword, UErrorCode *status);
00865
00882 U_STABLE UEnumeration* U_EXPORT2
00883 ucol_getKeywordValuesForLocale(const char* key,
00884 const char* locale,
00885 UBool commonlyUsed,
00886 UErrorCode* status);
00887
00919 U_STABLE int32_t U_EXPORT2
00920 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
00921 const char* keyword, const char* locale,
00922 UBool* isAvailable, UErrorCode* status);
00923
00932 U_STABLE const UChar* U_EXPORT2
00933 ucol_getRules( const UCollator *coll,
00934 int32_t *length);
00935
00936 #ifndef U_HIDE_DEPRECATED_API
00937
00957 U_DEPRECATED int32_t U_EXPORT2
00958 ucol_getShortDefinitionString(const UCollator *coll,
00959 const char *locale,
00960 char *buffer,
00961 int32_t capacity,
00962 UErrorCode *status);
00963
00984 U_DEPRECATED int32_t U_EXPORT2
00985 ucol_normalizeShortDefinitionString(const char *source,
00986 char *destination,
00987 int32_t capacity,
00988 UParseError *parseError,
00989 UErrorCode *status);
00990 #endif
00991
00992
01015 U_STABLE int32_t U_EXPORT2
01016 ucol_getSortKey(const UCollator *coll,
01017 const UChar *source,
01018 int32_t sourceLength,
01019 uint8_t *result,
01020 int32_t resultLength);
01021
01022
01043 U_STABLE int32_t U_EXPORT2
01044 ucol_nextSortKeyPart(const UCollator *coll,
01045 UCharIterator *iter,
01046 uint32_t state[2],
01047 uint8_t *dest, int32_t count,
01048 UErrorCode *status);
01049
01057 typedef enum {
01059 UCOL_BOUND_LOWER = 0,
01061 UCOL_BOUND_UPPER = 1,
01063 UCOL_BOUND_UPPER_LONG = 2,
01064 #ifndef U_HIDE_DEPRECATED_API
01065
01069 UCOL_BOUND_VALUE_COUNT
01070 #endif
01071 } UColBoundMode;
01072
01110 U_STABLE int32_t U_EXPORT2
01111 ucol_getBound(const uint8_t *source,
01112 int32_t sourceLength,
01113 UColBoundMode boundType,
01114 uint32_t noOfLevels,
01115 uint8_t *result,
01116 int32_t resultLength,
01117 UErrorCode *status);
01118
01127 U_STABLE void U_EXPORT2
01128 ucol_getVersion(const UCollator* coll, UVersionInfo info);
01129
01137 U_STABLE void U_EXPORT2
01138 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
01139
01187 U_STABLE int32_t U_EXPORT2
01188 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
01189 const uint8_t *src2, int32_t src2Length,
01190 uint8_t *dest, int32_t destCapacity);
01191
01203 U_STABLE void U_EXPORT2
01204 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
01205
01217 U_STABLE UColAttributeValue U_EXPORT2
01218 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
01219
01236 U_STABLE void U_EXPORT2
01237 ucol_setMaxVariable(UCollator *coll, UColReorderCode group, UErrorCode *pErrorCode);
01238
01246 U_STABLE UColReorderCode U_EXPORT2
01247 ucol_getMaxVariable(const UCollator *coll);
01248
01249 #ifndef U_HIDE_DEPRECATED_API
01250
01270 U_DEPRECATED uint32_t U_EXPORT2
01271 ucol_setVariableTop(UCollator *coll,
01272 const UChar *varTop, int32_t len,
01273 UErrorCode *status);
01274 #endif
01275
01287 U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
01288
01289 #ifndef U_HIDE_DEPRECATED_API
01290
01303 U_DEPRECATED void U_EXPORT2
01304 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
01305 #endif
01306
01330 U_STABLE UCollator* U_EXPORT2
01331 ucol_safeClone(const UCollator *coll,
01332 void *stackBuffer,
01333 int32_t *pBufferSize,
01334 UErrorCode *status);
01335
01336 #ifndef U_HIDE_DEPRECATED_API
01337
01341 #define U_COL_SAFECLONE_BUFFERSIZE 1
01342
01343 #endif
01344
01360 U_STABLE int32_t U_EXPORT2
01361 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
01362
01363 #ifndef U_HIDE_DEPRECATED_API
01364
01378 U_DEPRECATED const char * U_EXPORT2
01379 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01380 #endif
01381
01396 U_STABLE const char * U_EXPORT2
01397 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01398
01409 U_STABLE USet * U_EXPORT2
01410 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
01411
01412 #ifndef U_HIDE_INTERNAL_API
01413
01424 U_INTERNAL int32_t U_EXPORT2
01425 ucol_getUnsafeSet( const UCollator *coll,
01426 USet *unsafe,
01427 UErrorCode *status);
01428
01449 U_INTERNAL void U_EXPORT2
01450 ucol_prepareShortStringOpen( const char *definition,
01451 UBool forceDefaults,
01452 UParseError *parseError,
01453 UErrorCode *status);
01454 #endif
01455
01467 U_STABLE int32_t U_EXPORT2
01468 ucol_cloneBinary(const UCollator *coll,
01469 uint8_t *buffer, int32_t capacity,
01470 UErrorCode *status);
01471
01489 U_STABLE UCollator* U_EXPORT2
01490 ucol_openBinary(const uint8_t *bin, int32_t length,
01491 const UCollator *base,
01492 UErrorCode *status);
01493
01494
01495 #endif
01496
01497 #endif