00001
00002
00003
00004
00005
00006
00007 #ifndef UCOL_H
00008 #define UCOL_H
00009
00010 #include "unicode/utypes.h"
00011 #include "unicode/unorm.h"
00012
00110 struct collIterate;
00111 typedef struct collIterate collIterate;
00112
00113 struct incrementalContext;
00114 typedef struct incrementalContext incrementalContext;
00115
00119 struct UCollator;
00120 typedef struct UCollator UCollator;
00121
00122
00133 typedef enum {
00135 UCOL_EQUAL = 0,
00137 UCOL_GREATER = 1,
00139 UCOL_LESS = -1
00140 } UCollationResult ;
00141
00142
00143 typedef enum {
00144
00145 UCOL_DEFAULT = -1,
00146
00147
00149 UCOL_PRIMARY = 0,
00151 UCOL_SECONDARY = 1,
00153 UCOL_TERTIARY = 2,
00155 UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
00156 UCOL_CE_STRENGTH_LIMIT,
00158 UCOL_QUATERNARY=3,
00160 UCOL_IDENTICAL=15,
00161 UCOL_STRENGTH_LIMIT,
00162
00163
00164 UCOL_OFF = 16,
00165 UCOL_ON = 17,
00166
00167
00168 UCOL_SHIFTED = 20,
00169 UCOL_NON_IGNORABLE = 21,
00170
00171
00172 UCOL_LOWER_FIRST = 24,
00173 UCOL_UPPER_FIRST = 25,
00174
00175
00176 UCOL_ON_WITHOUT_HANGUL = 28,
00177
00179 UCOL_ATTRIBUTE_VALUE_COUNT
00180
00181 } UColAttributeValue;
00182
00208 typedef UColAttributeValue UCollationStrength;
00209
00210 typedef enum {
00211 UCOL_FRENCH_COLLATION,
00212 UCOL_ALTERNATE_HANDLING,
00213 UCOL_CASE_FIRST,
00214 UCOL_CASE_LEVEL,
00215 UCOL_NORMALIZATION_MODE,
00216 UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
00217 UCOL_STRENGTH,
00218 UCOL_ATTRIBUTE_COUNT
00219 } UColAttribute;
00220
00221 typedef enum {
00222 UCOL_TAILORING_ONLY,
00223 UCOL_FULL_RULES
00224 } UColRuleOption ;
00225
00236 U_CAPI UCollator*
00237 ucol_open( const char *loc,
00238 UErrorCode *status);
00239
00261 U_CAPI UCollator * U_EXPORT2
00262 ucol_openVersion(const char *loc,
00263 UVersionInfo version,
00264 UErrorCode *status);
00265
00281 U_CAPI UCollator*
00282 ucol_openRules( const UChar *rules,
00283 int32_t rulesLength,
00284 UNormalizationMode mode,
00285 UCollationStrength strength,
00286 UErrorCode *status);
00287
00294 U_CAPI void
00295 ucol_close(UCollator *coll);
00296
00314 U_CAPI UCollationResult
00315 ucol_strcoll( const UCollator *coll,
00316 const UChar *source,
00317 int32_t sourceLength,
00318 const UChar *target,
00319 int32_t targetLength);
00320
00335 U_CAPI UBool
00336 ucol_greater( const UCollator *coll,
00337 const UChar *source,
00338 int32_t sourceLength,
00339 const UChar *target,
00340 int32_t targetLength);
00341
00356 U_CAPI UBool
00357 ucol_greaterOrEqual( const UCollator *coll,
00358 const UChar *source,
00359 int32_t sourceLength,
00360 const UChar *target,
00361 int32_t targetLength);
00362
00377 U_CAPI UBool
00378 ucol_equal( const UCollator *coll,
00379 const UChar *source,
00380 int32_t sourceLength,
00381 const UChar *target,
00382 int32_t targetLength);
00383
00393 U_CAPI UCollationStrength
00394 ucol_getStrength(const UCollator *coll);
00395
00419 U_CAPI void
00420 ucol_setStrength( UCollator *coll,
00421 UCollationStrength strength);
00422
00433 U_CAPI UNormalizationMode
00434 ucol_getNormalization(const UCollator* coll);
00435
00446 U_CAPI void
00447 ucol_setNormalization( UCollator *coll,
00448 UNormalizationMode mode);
00449
00462 U_CAPI int32_t
00463 ucol_getDisplayName( const char *objLoc,
00464 const char *dispLoc,
00465 UChar *result,
00466 int32_t resultLength,
00467 UErrorCode *status);
00468
00478 U_CAPI const char*
00479 ucol_getAvailable(int32_t index);
00480
00489 U_CAPI int32_t
00490 ucol_countAvailable(void);
00491
00500 U_CAPI const UChar*
00501 ucol_getRules( const UCollator *coll,
00502 int32_t *length);
00503
00516 U_CAPI int32_t
00517 ucol_getSortKey(const UCollator *coll,
00518 const UChar *source,
00519 int32_t sourceLength,
00520 uint8_t *result,
00521 int32_t resultLength);
00522
00523
00524
00530 U_CAPI void U_EXPORT2
00531 ucol_getVersion(const UCollator* coll, UVersionInfo info);
00532
00533
00534
00535
00544 U_CAPI void ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
00545
00554 U_CAPI UColAttributeValue ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
00555
00575 U_CAPI UCollator * ucol_safeClone(
00576 const UCollator *coll,
00577 void *stackBuffer,
00578 int32_t *pBufferSize,
00579 UErrorCode *status);
00580
00581 #define U_COL_SAFECLONE_BUFFERSIZE 384
00582
00583
00584 U_CDECL_BEGIN
00585 typedef UChar UCharForwardIterator(void *context);
00586 U_CDECL_END
00587
00601 U_CAPI UCollationResult ucol_strcollinc(const UCollator *coll,
00602 UCharForwardIterator *source, void *sourceContext,
00603 UCharForwardIterator *target, void *targetContext);
00604
00614 U_CAPI int32_t ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
00615
00616
00617
00618 #include "unicode/ucoleitr.h"
00619
00620 #endif