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
00139 typedef enum {
00140 UCOL_REORDER_CODE_SPACE = 0x1000,
00141 UCOL_REORDER_CODE_FIRST = UCOL_REORDER_CODE_SPACE,
00142 UCOL_REORDER_CODE_PUNCTUATION = 0x1001,
00143 UCOL_REORDER_CODE_SYMBOL = 0x1002,
00144 UCOL_REORDER_CODE_CURRENCY = 0x1003,
00145 UCOL_REORDER_CODE_DIGIT = 0x1004,
00146 UCOL_REORDER_CODE_LIMIT = 0x1005
00147 } UColReorderCode;
00148
00175 typedef UColAttributeValue UCollationStrength;
00176
00181 typedef enum {
00186 UCOL_FRENCH_COLLATION,
00195 UCOL_ALTERNATE_HANDLING,
00202 UCOL_CASE_FIRST,
00210 UCOL_CASE_LEVEL,
00218 UCOL_NORMALIZATION_MODE,
00220 UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
00231 UCOL_STRENGTH,
00235 UCOL_HIRAGANA_QUATERNARY_MODE,
00243 UCOL_NUMERIC_COLLATION,
00244 UCOL_ATTRIBUTE_COUNT
00245 } UColAttribute;
00246
00250 typedef enum {
00252 UCOL_TAILORING_ONLY,
00254 UCOL_FULL_RULES
00255 } UColRuleOption ;
00256
00274 U_STABLE UCollator* U_EXPORT2
00275 ucol_open(const char *loc, UErrorCode *status);
00276
00302 U_STABLE UCollator* U_EXPORT2
00303 ucol_openRules( const UChar *rules,
00304 int32_t rulesLength,
00305 UColAttributeValue normalizationMode,
00306 UCollationStrength strength,
00307 UParseError *parseError,
00308 UErrorCode *status);
00309
00344 U_STABLE UCollator* U_EXPORT2
00345 ucol_openFromShortString( const char *definition,
00346 UBool forceDefaults,
00347 UParseError *parseError,
00348 UErrorCode *status);
00349
00363 U_DEPRECATED int32_t U_EXPORT2
00364 ucol_getContractions( const UCollator *coll,
00365 USet *conts,
00366 UErrorCode *status);
00367
00379 U_STABLE void U_EXPORT2
00380 ucol_getContractionsAndExpansions( const UCollator *coll,
00381 USet *contractions, USet *expansions,
00382 UBool addPrefixes, UErrorCode *status);
00383
00394 U_STABLE void U_EXPORT2
00395 ucol_close(UCollator *coll);
00396
00397 #if U_SHOW_CPLUSPLUS_API
00398
00399 U_NAMESPACE_BEGIN
00400
00410 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
00411
00412 U_NAMESPACE_END
00413
00414 #endif
00415
00431 U_STABLE UCollationResult U_EXPORT2
00432 ucol_strcoll( const UCollator *coll,
00433 const UChar *source,
00434 int32_t sourceLength,
00435 const UChar *target,
00436 int32_t targetLength);
00437
00452 U_STABLE UBool U_EXPORT2
00453 ucol_greater(const UCollator *coll,
00454 const UChar *source, int32_t sourceLength,
00455 const UChar *target, int32_t targetLength);
00456
00471 U_STABLE UBool U_EXPORT2
00472 ucol_greaterOrEqual(const UCollator *coll,
00473 const UChar *source, int32_t sourceLength,
00474 const UChar *target, int32_t targetLength);
00475
00490 U_STABLE UBool U_EXPORT2
00491 ucol_equal(const UCollator *coll,
00492 const UChar *source, int32_t sourceLength,
00493 const UChar *target, int32_t targetLength);
00494
00507 U_STABLE UCollationResult U_EXPORT2
00508 ucol_strcollIter( const UCollator *coll,
00509 UCharIterator *sIter,
00510 UCharIterator *tIter,
00511 UErrorCode *status);
00512
00522 U_STABLE UCollationStrength U_EXPORT2
00523 ucol_getStrength(const UCollator *coll);
00524
00534 U_STABLE void U_EXPORT2
00535 ucol_setStrength(UCollator *coll,
00536 UCollationStrength strength);
00537
00548 U_INTERNAL int32_t U_EXPORT2
00549 ucol_getReorderCodes(const UCollator* coll,
00550 int32_t* dest,
00551 int32_t destCapacity,
00552 UErrorCode *pErrorCode);
00553
00563 U_INTERNAL void U_EXPORT2
00564 ucol_setReorderCodes(UCollator* coll,
00565 const int32_t* reorderCodes,
00566 int32_t reorderCodesLength,
00567 UErrorCode *pErrorCode);
00568
00581 U_STABLE int32_t U_EXPORT2
00582 ucol_getDisplayName( const char *objLoc,
00583 const char *dispLoc,
00584 UChar *result,
00585 int32_t resultLength,
00586 UErrorCode *status);
00587
00597 U_STABLE const char* U_EXPORT2
00598 ucol_getAvailable(int32_t localeIndex);
00599
00608 U_STABLE int32_t U_EXPORT2
00609 ucol_countAvailable(void);
00610
00611 #if !UCONFIG_NO_SERVICE
00612
00620 U_STABLE UEnumeration* U_EXPORT2
00621 ucol_openAvailableLocales(UErrorCode *status);
00622 #endif
00623
00633 U_STABLE UEnumeration* U_EXPORT2
00634 ucol_getKeywords(UErrorCode *status);
00635
00647 U_STABLE UEnumeration* U_EXPORT2
00648 ucol_getKeywordValues(const char *keyword, UErrorCode *status);
00649
00666 U_STABLE UEnumeration* U_EXPORT2
00667 ucol_getKeywordValuesForLocale(const char* key,
00668 const char* locale,
00669 UBool commonlyUsed,
00670 UErrorCode* status);
00671
00702 U_STABLE int32_t U_EXPORT2
00703 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
00704 const char* keyword, const char* locale,
00705 UBool* isAvailable, UErrorCode* status);
00706
00715 U_STABLE const UChar* U_EXPORT2
00716 ucol_getRules( const UCollator *coll,
00717 int32_t *length);
00718
00739 U_STABLE int32_t U_EXPORT2
00740 ucol_getShortDefinitionString(const UCollator *coll,
00741 const char *locale,
00742 char *buffer,
00743 int32_t capacity,
00744 UErrorCode *status);
00745
00766 U_STABLE int32_t U_EXPORT2
00767 ucol_normalizeShortDefinitionString(const char *source,
00768 char *destination,
00769 int32_t capacity,
00770 UParseError *parseError,
00771 UErrorCode *status);
00772
00773
00793 U_STABLE int32_t U_EXPORT2
00794 ucol_getSortKey(const UCollator *coll,
00795 const UChar *source,
00796 int32_t sourceLength,
00797 uint8_t *result,
00798 int32_t resultLength);
00799
00800
00821 U_STABLE int32_t U_EXPORT2
00822 ucol_nextSortKeyPart(const UCollator *coll,
00823 UCharIterator *iter,
00824 uint32_t state[2],
00825 uint8_t *dest, int32_t count,
00826 UErrorCode *status);
00827
00835 typedef enum {
00837 UCOL_BOUND_LOWER = 0,
00839 UCOL_BOUND_UPPER = 1,
00841 UCOL_BOUND_UPPER_LONG = 2,
00842 UCOL_BOUND_VALUE_COUNT
00843 } UColBoundMode;
00844
00882 U_STABLE int32_t U_EXPORT2
00883 ucol_getBound(const uint8_t *source,
00884 int32_t sourceLength,
00885 UColBoundMode boundType,
00886 uint32_t noOfLevels,
00887 uint8_t *result,
00888 int32_t resultLength,
00889 UErrorCode *status);
00890
00899 U_STABLE void U_EXPORT2
00900 ucol_getVersion(const UCollator* coll, UVersionInfo info);
00901
00909 U_STABLE void U_EXPORT2
00910 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
00911
00934 U_STABLE int32_t U_EXPORT2
00935 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
00936 const uint8_t *src2, int32_t src2Length,
00937 uint8_t *dest, int32_t destCapacity);
00938
00950 U_STABLE void U_EXPORT2
00951 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
00952
00964 U_STABLE UColAttributeValue U_EXPORT2
00965 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
00966
00986 U_STABLE uint32_t U_EXPORT2
00987 ucol_setVariableTop(UCollator *coll,
00988 const UChar *varTop, int32_t len,
00989 UErrorCode *status);
00990
01002 U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
01003
01015 U_STABLE void U_EXPORT2
01016 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
01017
01040 U_STABLE UCollator* U_EXPORT2
01041 ucol_safeClone(const UCollator *coll,
01042 void *stackBuffer,
01043 int32_t *pBufferSize,
01044 UErrorCode *status);
01045
01049 #define U_COL_SAFECLONE_BUFFERSIZE 512
01050
01062 U_STABLE int32_t U_EXPORT2
01063 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
01064
01079 U_DEPRECATED const char * U_EXPORT2
01080 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01081
01082
01097 U_STABLE const char * U_EXPORT2
01098 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01099
01110 U_STABLE USet * U_EXPORT2
01111 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
01112
01124 U_INTERNAL UColAttributeValue U_EXPORT2
01125 ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status);
01126
01135 U_INTERNAL UBool U_EXPORT2
01136 ucol_equals(const UCollator *source, const UCollator *target);
01137
01149 U_INTERNAL int32_t U_EXPORT2
01150 ucol_getUnsafeSet( const UCollator *coll,
01151 USet *unsafe,
01152 UErrorCode *status);
01153
01157 U_INTERNAL void U_EXPORT2
01158 ucol_forgetUCA(void);
01159
01180 U_INTERNAL void U_EXPORT2
01181 ucol_prepareShortStringOpen( const char *definition,
01182 UBool forceDefaults,
01183 UParseError *parseError,
01184 UErrorCode *status);
01185
01197 U_STABLE int32_t U_EXPORT2
01198 ucol_cloneBinary(const UCollator *coll,
01199 uint8_t *buffer, int32_t capacity,
01200 UErrorCode *status);
01201
01219 U_STABLE UCollator* U_EXPORT2
01220 ucol_openBinary(const uint8_t *bin, int32_t length,
01221 const UCollator *base,
01222 UErrorCode *status);
01223
01224
01225 #endif
01226
01227 #endif