ucol.h

Go to the documentation of this file.
00001 /*
00002 *******************************************************************************
00003 * Copyright (c) 1996-2004, International Business Machines Corporation and others.
00004 * All Rights Reserved.
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/parseerr.h"
00017 #include "unicode/uloc.h"
00018 #include "unicode/uset.h"
00019 
00056 struct collIterate;
00060 typedef struct collIterate collIterate;
00061 
00065 struct UCollator;
00069 typedef struct UCollator UCollator;
00070 
00071 
00084 typedef enum {
00086   UCOL_EQUAL    = 0,
00088   UCOL_GREATER    = 1,
00090   UCOL_LESS    = -1
00091 } UCollationResult ;
00092 
00093 
00100 typedef enum {
00102   UCOL_DEFAULT = -1,
00103 
00105   UCOL_PRIMARY = 0,
00107   UCOL_SECONDARY = 1,
00109   UCOL_TERTIARY = 2,
00111   UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
00112   UCOL_CE_STRENGTH_LIMIT,
00114   UCOL_QUATERNARY=3,
00116   UCOL_IDENTICAL=15,
00117   UCOL_STRENGTH_LIMIT,
00118 
00122   UCOL_OFF = 16,
00126   UCOL_ON = 17,
00127   
00129   UCOL_SHIFTED = 20,
00131   UCOL_NON_IGNORABLE = 21,
00132 
00135   UCOL_LOWER_FIRST = 24,
00137   UCOL_UPPER_FIRST = 25,
00138 
00139   UCOL_ATTRIBUTE_VALUE_COUNT
00140 
00141 } UColAttributeValue;
00142 
00169 typedef UColAttributeValue UCollationStrength;
00170 
00175 typedef enum {
00180      UCOL_FRENCH_COLLATION, 
00189      UCOL_ALTERNATE_HANDLING, 
00196      UCOL_CASE_FIRST, 
00204      UCOL_CASE_LEVEL,
00212      UCOL_NORMALIZATION_MODE, 
00214      UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
00225      UCOL_STRENGTH,  
00231      UCOL_HIRAGANA_QUATERNARY_MODE,
00237      UCOL_NUMERIC_COLLATION, 
00238      UCOL_ATTRIBUTE_COUNT
00239 } UColAttribute;
00240 
00244 typedef enum {
00246   UCOL_TAILORING_ONLY, 
00248   UCOL_FULL_RULES 
00249 } UColRuleOption ;
00250 
00268 U_STABLE UCollator* U_EXPORT2 
00269 ucol_open(const char *loc, UErrorCode *status);
00270 
00296 U_STABLE UCollator* U_EXPORT2 
00297 ucol_openRules( const UChar        *rules,
00298                 int32_t            rulesLength,
00299                 UColAttributeValue normalizationMode,
00300                 UCollationStrength strength,
00301                 UParseError        *parseError,
00302                 UErrorCode         *status);
00303 
00338 U_CAPI UCollator* U_EXPORT2
00339 ucol_openFromShortString( const char *definition,
00340                           UBool forceDefaults,
00341                           UParseError *parseError,
00342                           UErrorCode *status);
00343 
00357 U_CAPI int32_t U_EXPORT2
00358 ucol_getContractions( const UCollator *coll,
00359                   USet *conts,
00360                   UErrorCode *status);
00361 
00362 
00373 U_STABLE void U_EXPORT2 
00374 ucol_close(UCollator *coll);
00375 
00391 U_STABLE UCollationResult U_EXPORT2 
00392 ucol_strcoll(    const    UCollator    *coll,
00393         const    UChar        *source,
00394         int32_t            sourceLength,
00395         const    UChar        *target,
00396         int32_t            targetLength);
00397 
00412 U_STABLE UBool U_EXPORT2 
00413 ucol_greater(const UCollator *coll,
00414              const UChar     *source, int32_t sourceLength,
00415              const UChar     *target, int32_t targetLength);
00416 
00431 U_STABLE UBool U_EXPORT2 
00432 ucol_greaterOrEqual(const UCollator *coll,
00433                     const UChar     *source, int32_t sourceLength,
00434                     const UChar     *target, int32_t targetLength);
00435 
00450 U_STABLE UBool U_EXPORT2 
00451 ucol_equal(const UCollator *coll,
00452            const UChar     *source, int32_t sourceLength,
00453            const UChar     *target, int32_t targetLength);
00454 
00467 U_STABLE UCollationResult U_EXPORT2 
00468 ucol_strcollIter(  const    UCollator    *coll,
00469                   UCharIterator *sIter,
00470                   UCharIterator *tIter,
00471                   UErrorCode *status);
00472 
00482 U_STABLE UCollationStrength U_EXPORT2 
00483 ucol_getStrength(const UCollator *coll);
00484 
00494 U_STABLE void U_EXPORT2 
00495 ucol_setStrength(UCollator *coll,
00496                  UCollationStrength strength);
00497 
00510 U_STABLE int32_t U_EXPORT2 
00511 ucol_getDisplayName(    const    char        *objLoc,
00512             const    char        *dispLoc,
00513             UChar             *result,
00514             int32_t         resultLength,
00515             UErrorCode        *status);
00516 
00526 U_STABLE const char* U_EXPORT2 
00527 ucol_getAvailable(int32_t index);
00528 
00537 U_STABLE int32_t U_EXPORT2 
00538 ucol_countAvailable(void);
00539 
00540 #if !UCONFIG_NO_SERVICE
00541 
00549 U_DRAFT UEnumeration* U_EXPORT2
00550 ucol_openAvailableLocales(UErrorCode *status);
00551 #endif
00552 
00562 U_DRAFT UEnumeration* U_EXPORT2
00563 ucol_getKeywords(UErrorCode *status);
00564 
00576 U_DRAFT UEnumeration* U_EXPORT2
00577 ucol_getKeywordValues(const char *keyword, UErrorCode *status);
00578 
00609 U_DRAFT int32_t U_EXPORT2
00610 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
00611                              const char* keyword, const char* locale,
00612                              UBool* isAvailable, UErrorCode* status);
00613 
00622 U_STABLE const UChar* U_EXPORT2 
00623 ucol_getRules(    const    UCollator    *coll, 
00624         int32_t            *length);
00625 
00646 U_CAPI int32_t U_EXPORT2
00647 ucol_getShortDefinitionString(const UCollator *coll,
00648                               const char *locale,
00649                               char *buffer,
00650                               int32_t capacity,
00651                               UErrorCode *status);
00652 
00673 U_CAPI int32_t U_EXPORT2
00674 ucol_normalizeShortDefinitionString(const char *source,
00675                                     char *destination,
00676                                     int32_t capacity,
00677                                     UParseError *parseError,
00678                                     UErrorCode *status);
00679         
00680 
00693 U_STABLE int32_t U_EXPORT2 
00694 ucol_getSortKey(const    UCollator    *coll,
00695         const    UChar        *source,
00696         int32_t        sourceLength,
00697         uint8_t        *result,
00698         int32_t        resultLength);
00699 
00700 
00721 U_STABLE int32_t U_EXPORT2 
00722 ucol_nextSortKeyPart(const UCollator *coll,
00723                      UCharIterator *iter,
00724                      uint32_t state[2],
00725                      uint8_t *dest, int32_t count,
00726                      UErrorCode *status);
00727 
00735 typedef enum {
00737   UCOL_BOUND_LOWER = 0,
00739   UCOL_BOUND_UPPER = 1,
00741   UCOL_BOUND_UPPER_LONG = 2,
00742   UCOL_BOUND_VALUE_COUNT
00743 } UColBoundMode;
00744 
00782 U_STABLE int32_t U_EXPORT2 
00783 ucol_getBound(const uint8_t       *source,
00784         int32_t             sourceLength,
00785         UColBoundMode       boundType,
00786         uint32_t            noOfLevels,
00787         uint8_t             *result,
00788         int32_t             resultLength,
00789         UErrorCode          *status);
00790         
00799 U_STABLE void U_EXPORT2
00800 ucol_getVersion(const UCollator* coll, UVersionInfo info);
00801 
00809 U_DRAFT void U_EXPORT2
00810 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
00811 
00834 U_STABLE int32_t U_EXPORT2 
00835 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
00836                    const uint8_t *src2, int32_t src2Length,
00837                    uint8_t *dest, int32_t destCapacity);
00838 
00850 U_STABLE void U_EXPORT2 
00851 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
00852 
00864 U_STABLE UColAttributeValue  U_EXPORT2 
00865 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
00866 
00886 U_STABLE uint32_t U_EXPORT2 
00887 ucol_setVariableTop(UCollator *coll, 
00888                     const UChar *varTop, int32_t len, 
00889                     UErrorCode *status);
00890 
00902 U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
00903 
00915 U_STABLE void U_EXPORT2 
00916 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
00917 
00940 U_STABLE UCollator* U_EXPORT2 
00941 ucol_safeClone(const UCollator *coll,
00942                void            *stackBuffer,
00943                int32_t         *pBufferSize,
00944                UErrorCode      *status);
00945 
00949 #define U_COL_SAFECLONE_BUFFERSIZE 512
00950 
00962 U_STABLE int32_t U_EXPORT2 
00963 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
00964 
00979 U_DEPRECATED const char * U_EXPORT2
00980 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
00981 
00982 
00997 U_DRAFT const char * U_EXPORT2
00998 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
00999 
01010 U_STABLE USet * U_EXPORT2
01011 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
01012 
01018 #define UCOL_SIT_COLLATOR_NOT_ENCODABLE 0x80000000
01019 
01033 U_INTERNAL uint32_t U_EXPORT2
01034 ucol_collatorToIdentifier(const UCollator *coll,
01035                           const char *locale,
01036                           UErrorCode *status);
01037 
01054 U_INTERNAL UCollator* U_EXPORT2
01055 ucol_openFromIdentifier(uint32_t identifier,
01056                         UBool forceDefaults,
01057                         UErrorCode *status);
01058 
01059 
01076 U_INTERNAL int32_t U_EXPORT2
01077 ucol_identifierToShortString(uint32_t identifier,
01078                              char *buffer,
01079                              int32_t capacity,
01080                              UBool forceDefaults,
01081                              UErrorCode *status);
01082 
01097 U_INTERNAL uint32_t U_EXPORT2
01098 ucol_shortStringToIdentifier(const char *definition,
01099                              UBool forceDefaults,
01100                              UErrorCode *status);
01101 
01102 
01103 
01115 U_INTERNAL UColAttributeValue  U_EXPORT2
01116 ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status);
01117 
01126 U_INTERNAL UBool U_EXPORT2
01127 ucol_equals(const UCollator *source, const UCollator *target);
01128 
01136 U_INTERNAL int32_t U_EXPORT2
01137 ucol_getUnsafeSet( const UCollator *coll,
01138                   USet *unsafe,
01139                   UErrorCode *status);
01140 
01152 U_DRAFT int32_t U_EXPORT2
01153 ucol_cloneBinary(const UCollator *coll,
01154                  uint8_t *buffer, int32_t capacity,
01155                  UErrorCode *status);
01156 
01174 U_DRAFT UCollator* U_EXPORT2
01175 ucol_openBinary(const uint8_t *bin, int32_t length, 
01176                 const UCollator *base, 
01177                 UErrorCode *status);
01178 
01179 
01180 #endif /* #if !UCONFIG_NO_COLLATION */
01181 
01182 #endif
01183 

Generated on Tue Nov 16 10:03:06 2004 for ICU 3.2 by  doxygen 1.3.9.1