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
00057 struct UCollator;
00061 typedef struct UCollator UCollator;
00062
00063
00076 typedef enum {
00078 UCOL_EQUAL = 0,
00080 UCOL_GREATER = 1,
00082 UCOL_LESS = -1
00083 } UCollationResult ;
00084
00085
00092 typedef enum {
00094 UCOL_DEFAULT = -1,
00095
00097 UCOL_PRIMARY = 0,
00099 UCOL_SECONDARY = 1,
00101 UCOL_TERTIARY = 2,
00103 UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
00104 UCOL_CE_STRENGTH_LIMIT,
00106 UCOL_QUATERNARY=3,
00108 UCOL_IDENTICAL=15,
00109 UCOL_STRENGTH_LIMIT,
00110
00114 UCOL_OFF = 16,
00118 UCOL_ON = 17,
00119
00121 UCOL_SHIFTED = 20,
00123 UCOL_NON_IGNORABLE = 21,
00124
00127 UCOL_LOWER_FIRST = 24,
00129 UCOL_UPPER_FIRST = 25,
00130
00131 UCOL_ATTRIBUTE_VALUE_COUNT
00132
00133 } UColAttributeValue;
00134
00161 typedef UColAttributeValue UCollationStrength;
00162
00167 typedef enum {
00172 UCOL_FRENCH_COLLATION,
00181 UCOL_ALTERNATE_HANDLING,
00188 UCOL_CASE_FIRST,
00196 UCOL_CASE_LEVEL,
00204 UCOL_NORMALIZATION_MODE,
00206 UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
00217 UCOL_STRENGTH,
00221 UCOL_HIRAGANA_QUATERNARY_MODE,
00229 UCOL_NUMERIC_COLLATION,
00230 UCOL_ATTRIBUTE_COUNT
00231 } UColAttribute;
00232
00236 typedef enum {
00238 UCOL_TAILORING_ONLY,
00240 UCOL_FULL_RULES
00241 } UColRuleOption ;
00242
00260 U_STABLE UCollator* U_EXPORT2
00261 ucol_open(const char *loc, UErrorCode *status);
00262
00288 U_STABLE UCollator* U_EXPORT2
00289 ucol_openRules( const UChar *rules,
00290 int32_t rulesLength,
00291 UColAttributeValue normalizationMode,
00292 UCollationStrength strength,
00293 UParseError *parseError,
00294 UErrorCode *status);
00295
00330 U_STABLE UCollator* U_EXPORT2
00331 ucol_openFromShortString( const char *definition,
00332 UBool forceDefaults,
00333 UParseError *parseError,
00334 UErrorCode *status);
00335
00349 U_DEPRECATED int32_t U_EXPORT2
00350 ucol_getContractions( const UCollator *coll,
00351 USet *conts,
00352 UErrorCode *status);
00353
00365 U_STABLE void U_EXPORT2
00366 ucol_getContractionsAndExpansions( const UCollator *coll,
00367 USet *contractions, USet *expansions,
00368 UBool addPrefixes, UErrorCode *status);
00369
00380 U_STABLE void U_EXPORT2
00381 ucol_close(UCollator *coll);
00382
00383 #if U_SHOW_CPLUSPLUS_API
00384
00385 U_NAMESPACE_BEGIN
00386
00396 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
00397
00398 U_NAMESPACE_END
00399
00400 #endif
00401
00417 U_STABLE UCollationResult U_EXPORT2
00418 ucol_strcoll( const UCollator *coll,
00419 const UChar *source,
00420 int32_t sourceLength,
00421 const UChar *target,
00422 int32_t targetLength);
00423
00438 U_STABLE UBool U_EXPORT2
00439 ucol_greater(const UCollator *coll,
00440 const UChar *source, int32_t sourceLength,
00441 const UChar *target, int32_t targetLength);
00442
00457 U_STABLE UBool U_EXPORT2
00458 ucol_greaterOrEqual(const UCollator *coll,
00459 const UChar *source, int32_t sourceLength,
00460 const UChar *target, int32_t targetLength);
00461
00476 U_STABLE UBool U_EXPORT2
00477 ucol_equal(const UCollator *coll,
00478 const UChar *source, int32_t sourceLength,
00479 const UChar *target, int32_t targetLength);
00480
00493 U_STABLE UCollationResult U_EXPORT2
00494 ucol_strcollIter( const UCollator *coll,
00495 UCharIterator *sIter,
00496 UCharIterator *tIter,
00497 UErrorCode *status);
00498
00508 U_STABLE UCollationStrength U_EXPORT2
00509 ucol_getStrength(const UCollator *coll);
00510
00520 U_STABLE void U_EXPORT2
00521 ucol_setStrength(UCollator *coll,
00522 UCollationStrength strength);
00523
00536 U_STABLE int32_t U_EXPORT2
00537 ucol_getDisplayName( const char *objLoc,
00538 const char *dispLoc,
00539 UChar *result,
00540 int32_t resultLength,
00541 UErrorCode *status);
00542
00552 U_STABLE const char* U_EXPORT2
00553 ucol_getAvailable(int32_t localeIndex);
00554
00563 U_STABLE int32_t U_EXPORT2
00564 ucol_countAvailable(void);
00565
00566 #if !UCONFIG_NO_SERVICE
00567
00575 U_STABLE UEnumeration* U_EXPORT2
00576 ucol_openAvailableLocales(UErrorCode *status);
00577 #endif
00578
00588 U_STABLE UEnumeration* U_EXPORT2
00589 ucol_getKeywords(UErrorCode *status);
00590
00602 U_STABLE UEnumeration* U_EXPORT2
00603 ucol_getKeywordValues(const char *keyword, UErrorCode *status);
00604
00621 U_STABLE UEnumeration* U_EXPORT2
00622 ucol_getKeywordValuesForLocale(const char* key,
00623 const char* locale,
00624 UBool commonlyUsed,
00625 UErrorCode* status);
00626
00657 U_STABLE int32_t U_EXPORT2
00658 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
00659 const char* keyword, const char* locale,
00660 UBool* isAvailable, UErrorCode* status);
00661
00670 U_STABLE const UChar* U_EXPORT2
00671 ucol_getRules( const UCollator *coll,
00672 int32_t *length);
00673
00694 U_STABLE int32_t U_EXPORT2
00695 ucol_getShortDefinitionString(const UCollator *coll,
00696 const char *locale,
00697 char *buffer,
00698 int32_t capacity,
00699 UErrorCode *status);
00700
00721 U_STABLE int32_t U_EXPORT2
00722 ucol_normalizeShortDefinitionString(const char *source,
00723 char *destination,
00724 int32_t capacity,
00725 UParseError *parseError,
00726 UErrorCode *status);
00727
00728
00743 U_STABLE int32_t U_EXPORT2
00744 ucol_getSortKey(const UCollator *coll,
00745 const UChar *source,
00746 int32_t sourceLength,
00747 uint8_t *result,
00748 int32_t resultLength);
00749
00750
00771 U_STABLE int32_t U_EXPORT2
00772 ucol_nextSortKeyPart(const UCollator *coll,
00773 UCharIterator *iter,
00774 uint32_t state[2],
00775 uint8_t *dest, int32_t count,
00776 UErrorCode *status);
00777
00785 typedef enum {
00787 UCOL_BOUND_LOWER = 0,
00789 UCOL_BOUND_UPPER = 1,
00791 UCOL_BOUND_UPPER_LONG = 2,
00792 UCOL_BOUND_VALUE_COUNT
00793 } UColBoundMode;
00794
00832 U_STABLE int32_t U_EXPORT2
00833 ucol_getBound(const uint8_t *source,
00834 int32_t sourceLength,
00835 UColBoundMode boundType,
00836 uint32_t noOfLevels,
00837 uint8_t *result,
00838 int32_t resultLength,
00839 UErrorCode *status);
00840
00849 U_STABLE void U_EXPORT2
00850 ucol_getVersion(const UCollator* coll, UVersionInfo info);
00851
00859 U_STABLE void U_EXPORT2
00860 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
00861
00884 U_STABLE int32_t U_EXPORT2
00885 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
00886 const uint8_t *src2, int32_t src2Length,
00887 uint8_t *dest, int32_t destCapacity);
00888
00900 U_STABLE void U_EXPORT2
00901 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
00902
00914 U_STABLE UColAttributeValue U_EXPORT2
00915 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
00916
00936 U_STABLE uint32_t U_EXPORT2
00937 ucol_setVariableTop(UCollator *coll,
00938 const UChar *varTop, int32_t len,
00939 UErrorCode *status);
00940
00952 U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
00953
00965 U_STABLE void U_EXPORT2
00966 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
00967
00990 U_STABLE UCollator* U_EXPORT2
00991 ucol_safeClone(const UCollator *coll,
00992 void *stackBuffer,
00993 int32_t *pBufferSize,
00994 UErrorCode *status);
00995
00999 #define U_COL_SAFECLONE_BUFFERSIZE 512
01000
01012 U_STABLE int32_t U_EXPORT2
01013 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
01014
01029 U_DEPRECATED const char * U_EXPORT2
01030 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01031
01032
01047 U_STABLE const char * U_EXPORT2
01048 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01049
01060 U_STABLE USet * U_EXPORT2
01061 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
01062
01074 U_INTERNAL UColAttributeValue U_EXPORT2
01075 ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status);
01076
01085 U_INTERNAL UBool U_EXPORT2
01086 ucol_equals(const UCollator *source, const UCollator *target);
01087
01099 U_INTERNAL int32_t U_EXPORT2
01100 ucol_getUnsafeSet( const UCollator *coll,
01101 USet *unsafe,
01102 UErrorCode *status);
01103
01107 U_INTERNAL void U_EXPORT2
01108 ucol_forgetUCA(void);
01109
01130 U_INTERNAL void U_EXPORT2
01131 ucol_prepareShortStringOpen( const char *definition,
01132 UBool forceDefaults,
01133 UParseError *parseError,
01134 UErrorCode *status);
01135
01147 U_STABLE int32_t U_EXPORT2
01148 ucol_cloneBinary(const UCollator *coll,
01149 uint8_t *buffer, int32_t capacity,
01150 UErrorCode *status);
01151
01169 U_STABLE UCollator* U_EXPORT2
01170 ucol_openBinary(const uint8_t *bin, int32_t length,
01171 const UCollator *base,
01172 UErrorCode *status);
01173
01174
01175 #endif
01176
01177 #endif
01178