Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ucol.h

Go to the documentation of this file.
00001 /*
00002 *******************************************************************************
00003 * Copyright © {1996-1999}, International Business Machines Corporation and others. All Rights Reserved.
00004 *******************************************************************************
00005 */
00006 
00007 #ifndef UCOL_H
00008 #define UCOL_H
00009 
00010 #include "unicode/utypes.h"
00011 #include "unicode/unorm.h"
00109 struct collIterate;
00110 typedef struct collIterate collIterate;
00111 
00112 struct incrementalContext;
00113 typedef struct incrementalContext incrementalContext;
00114 
00118 typedef void* UCollator;
00119 
00130 typedef enum {
00132   UCOL_EQUAL    = 0,
00134   UCOL_GREATER    = 1,
00136   UCOL_LESS    = -1
00137 } UCollationResult ;
00138 
00139 
00140 typedef enum {
00141   /* accepted by most attributes */
00142   UCOL_DEFAULT = -1,
00143 
00144   /* for UCOL_STRENGTH */
00146   UCOL_PRIMARY = 0,
00148   UCOL_SECONDARY = 1,
00150   UCOL_TERTIARY = 2,
00152   UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
00154   UCOL_QUATERNARY=3,
00156   UCOL_IDENTICAL=15,
00157 
00158   /* for UCOL_FRENCH_COLLATION, UCOL_CASE_LEVEL & UCOL_DECOMPOSITION_MODE*/
00159   UCOL_OFF = 16,
00160   UCOL_ON = 17,
00161   
00162   /* for UCOL_ALTERNATE_HANDLING */
00163   UCOL_SHIFTED = 20,
00164   UCOL_NON_IGNORABLE = 21,
00165 
00166   /* for UCOL_CASE_FIRST */
00167   UCOL_LOWER_FIRST = 24,
00168   UCOL_UPPER_FIRST = 25,
00169 
00170   /* for UCOL_NORMALIZATION_MODE */
00171   UCOL_ON_WITHOUT_HANGUL = 28,
00172 
00174   UCOL_ATTRIBUTE_VALUE_COUNT
00175 
00176 } UColAttributeValue;
00177 
00203 typedef UColAttributeValue UCollationStrength;
00204 
00205 typedef enum {
00206      UCOL_FRENCH_COLLATION, /* attribute for direction of secondary weights*/
00207      UCOL_ALTERNATE_HANDLING, /* attribute for handling variable elements*/
00208      UCOL_CASE_FIRST, /* who goes first, lower case or uppercase */
00209      UCOL_CASE_LEVEL, /* do we have an extra case level */
00210      UCOL_NORMALIZATION_MODE, /* attribute for normalization */
00211      UCOL_STRENGTH,         /* attribute for strength */
00212      UCOL_ATTRIBUTE_COUNT
00213 } UColAttribute;
00214 
00215 typedef enum {
00216         UCOL_TAILORING_ONLY,
00217         UCOL_FULL_RULES
00218 }  UColRuleOption ;
00219 
00229 U_CAPI UCollator*
00230 ucol_open(    const    char         *loc,
00231         UErrorCode      *status);
00232 
00248 U_CAPI UCollator*
00249 ucol_openRules(    const    UChar        *rules,
00250         int32_t                 rulesLength,
00251         UNormalizationMode      mode,
00252         UCollationStrength      strength,
00253         UErrorCode              *status);
00254 
00261 U_CAPI void
00262 ucol_close(UCollator *coll);
00263 
00280 U_CAPI UCollationResult
00281 ucol_strcoll(    const    UCollator    *coll,
00282         const    UChar        *source,
00283         int32_t            sourceLength,
00284         const    UChar        *target,
00285         int32_t            targetLength);
00286 
00292 U_CAPI UCollationResult
00293 ucol_strcollEx(    const    UCollator    *coll,
00294         const    UChar        *source,
00295         int32_t            sourceLength,
00296         const    UChar        *target,
00297         int32_t            targetLength);
00298 
00313 U_CAPI UBool
00314 ucol_greater(    const    UCollator    *coll,
00315         const    UChar        *source,
00316         int32_t            sourceLength,
00317         const    UChar        *target,
00318         int32_t            targetLength);
00319 
00334 U_CAPI UBool
00335 ucol_greaterOrEqual(    const    UCollator    *coll,
00336             const    UChar        *source,
00337             int32_t            sourceLength,
00338             const    UChar        *target,
00339             int32_t            targetLength);
00340 
00355 U_CAPI UBool
00356 ucol_equal(    const    UCollator    *coll,
00357         const    UChar        *source,
00358         int32_t            sourceLength,
00359         const    UChar        *target,
00360         int32_t            targetLength);
00361 
00371 U_CAPI UCollationStrength
00372 ucol_getStrength(const UCollator *coll);
00373 
00397 U_CAPI void
00398 ucol_setStrength(    UCollator            *coll,
00399             UCollationStrength        strength);
00400 
00411 U_CAPI UNormalizationMode
00412 ucol_getNormalization(const UCollator* coll);
00413 
00424 U_CAPI void
00425 ucol_setNormalization(  UCollator        *coll,
00426             UNormalizationMode    mode);
00427 
00440 U_CAPI int32_t
00441 ucol_getDisplayName(    const    char        *objLoc,
00442             const    char        *dispLoc,
00443             UChar             *result,
00444             int32_t         resultLength,
00445             UErrorCode        *status);
00446 
00456 U_CAPI const char*
00457 ucol_getAvailable(int32_t index);
00458 
00467 U_CAPI int32_t
00468 ucol_countAvailable(void);
00469 
00478 U_CAPI const UChar*
00479 ucol_getRules(    const    UCollator    *coll, 
00480         int32_t            *length);
00481 
00494 U_CAPI int32_t
00495 ucol_getSortKey(const    UCollator    *coll,
00496         const    UChar        *source,
00497         int32_t            sourceLength,
00498         uint8_t            *result,
00499         int32_t            resultLength);
00500 
00506 U_CAPI int32_t
00507 ucol_getSortKeyEx(const    UCollator    *coll,
00508         const    UChar        *source,
00509         int32_t        sourceLength,
00510         uint8_t        *result,
00511         int32_t        resultLength);
00512 
00522 U_CAPI int32_t
00523 ucol_keyHashCode(    const    uint8_t*    key, 
00524             int32_t        length);
00525 
00526 
00530 struct UCollationElements;
00531 typedef struct UCollationElements UCollationElements;
00532 
00591 U_CAPI UCollationElements*
00592 ucol_openElements(    const    UCollator       *coll,
00593             const    UChar           *text,
00594             int32_t                  textLength,
00595             UErrorCode         *status);
00596 
00597 /* Bit mask for primary collation strength. */
00598 #define UCOL_PRIMARYMASK    0xFFFF0000
00599 
00600 /* Bit mask for secondary collation strength. */
00601 #define UCOL_SECONDARYMASK  0x0000FF00
00602 
00603 /* Bit mask for tertiary collation strength. */
00604 #define UCOL_TERTIARYMASK   0x000000FF
00605 
00609 #define UCOL_NULLORDER        0xFFFFFFFF
00610 
00617 U_CAPI void
00618 ucol_closeElements(UCollationElements *elems);
00619 
00628 U_CAPI void
00629 ucol_reset(UCollationElements *elems);
00630 
00640 U_CAPI int32_t
00641 ucol_next(    UCollationElements    *elems,
00642         UErrorCode        *status);
00643 
00653 U_CAPI int32_t
00654 ucol_previous(    UCollationElements    *elems,
00655         UErrorCode        *status);
00656 
00667 U_CAPI int32_t
00668 ucol_getMaxExpansion(    const    UCollationElements    *elems,
00669             int32_t                order);
00670 
00681 U_CAPI void
00682 ucol_setText(    UCollationElements    *elems,
00683         const    UChar        *text,
00684         int32_t            textLength,
00685         UErrorCode        *status);
00686 
00696 U_CAPI UTextOffset
00697 ucol_getOffset(const UCollationElements *elems);
00698 
00708 U_CAPI void
00709 ucol_setOffset(    UCollationElements    *elems,
00710         UTextOffset        offset,
00711         UErrorCode        *status);
00712 
00718 U_CAPI void U_EXPORT2
00719 ucol_getVersion(const UCollator* coll, UVersionInfo info);
00720 
00721 
00722 /* Following are the new APIs for 1.7. They are all draft and most are not even implemented */
00723 
00732 U_CAPI void ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
00733 
00742 U_CAPI UColAttributeValue ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
00743 
00753 U_CAPI UCollator *ucol_safeClone(const UCollator *coll, void *stackBuffer, uint32_t bufferSize, UErrorCode *status);
00754 
00755 /* declaration for forward iterating function */
00756 typedef UChar UCharForwardIterator(void *context);
00757 
00770 U_CAPI UCollationResult ucol_strcollinc(const UCollator *coll, 
00771                                                                  UCharForwardIterator *source, void *sourceContext,
00772                                                                  UCharForwardIterator *target, void *targetContext);
00773 
00783 U_CAPI int32_t ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
00784 
00785 
00786 #endif

Generated at Fri Dec 15 12:12:36 2000 for ICU 1.7 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000