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/parseerr.h"
00019 #include "unicode/uloc.h"
00020 #include "unicode/uset.h"
00021 #include "unicode/uscript.h"
00022
00023 #if U_SHOW_CPLUSPLUS_API
00024 #include "unicode/localpointer.h"
00025 #endif // U_SHOW_CPLUSPLUS_API
00026
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 #ifndef U_HIDE_DEPRECATED_API
00132
00136 UCOL_ATTRIBUTE_VALUE_COUNT
00137 #endif
00138 } UColAttributeValue;
00139
00149 typedef enum {
00155 UCOL_REORDER_CODE_DEFAULT = -1,
00160 UCOL_REORDER_CODE_NONE = USCRIPT_UNKNOWN,
00167 UCOL_REORDER_CODE_OTHERS = USCRIPT_UNKNOWN,
00173 UCOL_REORDER_CODE_SPACE = 0x1000,
00179 UCOL_REORDER_CODE_FIRST = UCOL_REORDER_CODE_SPACE,
00185 UCOL_REORDER_CODE_PUNCTUATION = 0x1001,
00191 UCOL_REORDER_CODE_SYMBOL = 0x1002,
00197 UCOL_REORDER_CODE_CURRENCY = 0x1003,
00203 UCOL_REORDER_CODE_DIGIT = 0x1004,
00204 #ifndef U_HIDE_DEPRECATED_API
00205
00209 UCOL_REORDER_CODE_LIMIT = 0x1005
00210 #endif
00211 } UColReorderCode;
00212
00239 typedef UColAttributeValue UCollationStrength;
00240
00245 typedef enum {
00252 UCOL_FRENCH_COLLATION,
00263 UCOL_ALTERNATE_HANDLING,
00272 UCOL_CASE_FIRST,
00282 UCOL_CASE_LEVEL,
00292 UCOL_NORMALIZATION_MODE,
00296 UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
00313 UCOL_STRENGTH,
00314 #ifndef U_HIDE_DEPRECATED_API
00315
00326 UCOL_HIRAGANA_QUATERNARY_MODE = UCOL_STRENGTH + 1,
00327 #endif
00328
00346 UCOL_NUMERIC_COLLATION = UCOL_STRENGTH + 2,
00347
00348
00349
00350 #ifndef U_FORCE_HIDE_DEPRECATED_API
00351
00355 UCOL_ATTRIBUTE_COUNT
00356 #endif // U_FORCE_HIDE_DEPRECATED_API
00357 } UColAttribute;
00358
00362 typedef enum {
00368 UCOL_TAILORING_ONLY,
00376 UCOL_FULL_RULES
00377 } UColRuleOption ;
00378
00404 U_CAPI UCollator* U_EXPORT2
00405 ucol_open(const char *loc, UErrorCode *status);
00406
00432 U_CAPI UCollator* U_EXPORT2
00433 ucol_openRules( const UChar *rules,
00434 int32_t rulesLength,
00435 UColAttributeValue normalizationMode,
00436 UCollationStrength strength,
00437 UParseError *parseError,
00438 UErrorCode *status);
00439
00440 #ifndef U_HIDE_DEPRECATED_API
00441
00474 U_DEPRECATED UCollator* U_EXPORT2
00475 ucol_openFromShortString( const char *definition,
00476 UBool forceDefaults,
00477 UParseError *parseError,
00478 UErrorCode *status);
00479 #endif
00480
00481 #ifndef U_HIDE_DEPRECATED_API
00482
00495 U_DEPRECATED int32_t U_EXPORT2
00496 ucol_getContractions( const UCollator *coll,
00497 USet *conts,
00498 UErrorCode *status);
00499 #endif
00500
00512 U_CAPI void U_EXPORT2
00513 ucol_getContractionsAndExpansions( const UCollator *coll,
00514 USet *contractions, USet *expansions,
00515 UBool addPrefixes, UErrorCode *status);
00516
00527 U_CAPI void U_EXPORT2
00528 ucol_close(UCollator *coll);
00529
00530 #if U_SHOW_CPLUSPLUS_API
00531
00532 U_NAMESPACE_BEGIN
00533
00543 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
00544
00545 U_NAMESPACE_END
00546
00547 #endif
00548
00564 U_CAPI UCollationResult U_EXPORT2
00565 ucol_strcoll( const UCollator *coll,
00566 const UChar *source,
00567 int32_t sourceLength,
00568 const UChar *target,
00569 int32_t targetLength);
00570
00589 U_CAPI UCollationResult U_EXPORT2
00590 ucol_strcollUTF8(
00591 const UCollator *coll,
00592 const char *source,
00593 int32_t sourceLength,
00594 const char *target,
00595 int32_t targetLength,
00596 UErrorCode *status);
00597
00612 U_CAPI UBool U_EXPORT2
00613 ucol_greater(const UCollator *coll,
00614 const UChar *source, int32_t sourceLength,
00615 const UChar *target, int32_t targetLength);
00616
00631 U_CAPI UBool U_EXPORT2
00632 ucol_greaterOrEqual(const UCollator *coll,
00633 const UChar *source, int32_t sourceLength,
00634 const UChar *target, int32_t targetLength);
00635
00650 U_CAPI UBool U_EXPORT2
00651 ucol_equal(const UCollator *coll,
00652 const UChar *source, int32_t sourceLength,
00653 const UChar *target, int32_t targetLength);
00654
00667 U_CAPI UCollationResult U_EXPORT2
00668 ucol_strcollIter( const UCollator *coll,
00669 UCharIterator *sIter,
00670 UCharIterator *tIter,
00671 UErrorCode *status);
00672
00682 U_CAPI UCollationStrength U_EXPORT2
00683 ucol_getStrength(const UCollator *coll);
00684
00694 U_CAPI void U_EXPORT2
00695 ucol_setStrength(UCollator *coll,
00696 UCollationStrength strength);
00697
00714 U_CAPI int32_t U_EXPORT2
00715 ucol_getReorderCodes(const UCollator* coll,
00716 int32_t* dest,
00717 int32_t destCapacity,
00718 UErrorCode *pErrorCode);
00759 U_CAPI void U_EXPORT2
00760 ucol_setReorderCodes(UCollator* coll,
00761 const int32_t* reorderCodes,
00762 int32_t reorderCodesLength,
00763 UErrorCode *pErrorCode);
00764
00784 U_CAPI int32_t U_EXPORT2
00785 ucol_getEquivalentReorderCodes(int32_t reorderCode,
00786 int32_t* dest,
00787 int32_t destCapacity,
00788 UErrorCode *pErrorCode);
00789
00802 U_CAPI int32_t U_EXPORT2
00803 ucol_getDisplayName( const char *objLoc,
00804 const char *dispLoc,
00805 UChar *result,
00806 int32_t resultLength,
00807 UErrorCode *status);
00808
00818 U_CAPI const char* U_EXPORT2
00819 ucol_getAvailable(int32_t localeIndex);
00820
00829 U_CAPI int32_t U_EXPORT2
00830 ucol_countAvailable(void);
00831
00832 #if !UCONFIG_NO_SERVICE
00833
00841 U_CAPI UEnumeration* U_EXPORT2
00842 ucol_openAvailableLocales(UErrorCode *status);
00843 #endif
00844
00854 U_CAPI UEnumeration* U_EXPORT2
00855 ucol_getKeywords(UErrorCode *status);
00856
00868 U_CAPI UEnumeration* U_EXPORT2
00869 ucol_getKeywordValues(const char *keyword, UErrorCode *status);
00870
00887 U_CAPI UEnumeration* U_EXPORT2
00888 ucol_getKeywordValuesForLocale(const char* key,
00889 const char* locale,
00890 UBool commonlyUsed,
00891 UErrorCode* status);
00892
00924 U_CAPI int32_t U_EXPORT2
00925 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
00926 const char* keyword, const char* locale,
00927 UBool* isAvailable, UErrorCode* status);
00928
00937 U_CAPI const UChar* U_EXPORT2
00938 ucol_getRules( const UCollator *coll,
00939 int32_t *length);
00940
00941 #ifndef U_HIDE_DEPRECATED_API
00942
00962 U_DEPRECATED int32_t U_EXPORT2
00963 ucol_getShortDefinitionString(const UCollator *coll,
00964 const char *locale,
00965 char *buffer,
00966 int32_t capacity,
00967 UErrorCode *status);
00968
00988 U_DEPRECATED int32_t U_EXPORT2
00989 ucol_normalizeShortDefinitionString(const char *source,
00990 char *destination,
00991 int32_t capacity,
00992 UParseError *parseError,
00993 UErrorCode *status);
00994 #endif
00995
00996
01019 U_CAPI int32_t U_EXPORT2
01020 ucol_getSortKey(const UCollator *coll,
01021 const UChar *source,
01022 int32_t sourceLength,
01023 uint8_t *result,
01024 int32_t resultLength);
01025
01026
01047 U_CAPI int32_t U_EXPORT2
01048 ucol_nextSortKeyPart(const UCollator *coll,
01049 UCharIterator *iter,
01050 uint32_t state[2],
01051 uint8_t *dest, int32_t count,
01052 UErrorCode *status);
01053
01061 typedef enum {
01063 UCOL_BOUND_LOWER = 0,
01065 UCOL_BOUND_UPPER = 1,
01067 UCOL_BOUND_UPPER_LONG = 2,
01068 #ifndef U_HIDE_DEPRECATED_API
01069
01073 UCOL_BOUND_VALUE_COUNT
01074 #endif
01075 } UColBoundMode;
01076
01114 U_CAPI int32_t U_EXPORT2
01115 ucol_getBound(const uint8_t *source,
01116 int32_t sourceLength,
01117 UColBoundMode boundType,
01118 uint32_t noOfLevels,
01119 uint8_t *result,
01120 int32_t resultLength,
01121 UErrorCode *status);
01122
01131 U_CAPI void U_EXPORT2
01132 ucol_getVersion(const UCollator* coll, UVersionInfo info);
01133
01141 U_CAPI void U_EXPORT2
01142 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
01143
01191 U_CAPI int32_t U_EXPORT2
01192 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
01193 const uint8_t *src2, int32_t src2Length,
01194 uint8_t *dest, int32_t destCapacity);
01195
01207 U_CAPI void U_EXPORT2
01208 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
01209
01221 U_CAPI UColAttributeValue U_EXPORT2
01222 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
01223
01240 U_CAPI void U_EXPORT2
01241 ucol_setMaxVariable(UCollator *coll, UColReorderCode group, UErrorCode *pErrorCode);
01242
01250 U_CAPI UColReorderCode U_EXPORT2
01251 ucol_getMaxVariable(const UCollator *coll);
01252
01253 #ifndef U_HIDE_DEPRECATED_API
01254
01274 U_DEPRECATED uint32_t U_EXPORT2
01275 ucol_setVariableTop(UCollator *coll,
01276 const UChar *varTop, int32_t len,
01277 UErrorCode *status);
01278 #endif
01279
01291 U_CAPI uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
01292
01293 #ifndef U_HIDE_DEPRECATED_API
01294
01308 U_DEPRECATED void U_EXPORT2
01309 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
01310 #endif
01311
01322 U_CAPI UCollator* U_EXPORT2 ucol_clone(const UCollator *coll, UErrorCode *status);
01323
01324 #ifndef U_HIDE_DEPRECATED_API
01325
01349 U_DEPRECATED UCollator* U_EXPORT2
01350 ucol_safeClone(const UCollator *coll,
01351 void *stackBuffer,
01352 int32_t *pBufferSize,
01353 UErrorCode *status);
01354
01355
01359 #define U_COL_SAFECLONE_BUFFERSIZE 1
01360
01361 #endif
01362
01378 U_CAPI int32_t U_EXPORT2
01379 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
01380
01381 #ifndef U_HIDE_DEPRECATED_API
01382
01396 U_DEPRECATED const char * U_EXPORT2
01397 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01398 #endif
01399
01414 U_CAPI const char * U_EXPORT2
01415 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01416
01427 U_CAPI USet * U_EXPORT2
01428 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
01429
01430 #ifndef U_HIDE_INTERNAL_API
01431
01442 U_CAPI int32_t U_EXPORT2
01443 ucol_getUnsafeSet( const UCollator *coll,
01444 USet *unsafe,
01445 UErrorCode *status);
01446
01467 U_CAPI void U_EXPORT2
01468 ucol_prepareShortStringOpen( const char *definition,
01469 UBool forceDefaults,
01470 UParseError *parseError,
01471 UErrorCode *status);
01472 #endif
01473
01485 U_CAPI int32_t U_EXPORT2
01486 ucol_cloneBinary(const UCollator *coll,
01487 uint8_t *buffer, int32_t capacity,
01488 UErrorCode *status);
01489
01507 U_CAPI UCollator* U_EXPORT2
01508 ucol_openBinary(const uint8_t *bin, int32_t length,
01509 const UCollator *base,
01510 UErrorCode *status);
01511
01512
01513 #endif
01514
01515 #endif