ICU 4.8.1.1  4.8.1.1
ucol.h
Go to the documentation of this file.
00001 /*
00002 *******************************************************************************
00003 * Copyright (c) 1996-2011, 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/localpointer.h"
00017 #include "unicode/parseerr.h"
00018 #include "unicode/uloc.h"
00019 #include "unicode/uset.h"
00020 #include "unicode/uscript.h"
00021 
00058 struct UCollator;
00062 typedef struct UCollator UCollator;
00063 
00064 
00077 typedef enum {
00079   UCOL_EQUAL    = 0,
00081   UCOL_GREATER    = 1,
00083   UCOL_LESS    = -1
00084 } UCollationResult ;
00085 
00086 
00093 typedef enum {
00095   UCOL_DEFAULT = -1,
00096 
00098   UCOL_PRIMARY = 0,
00100   UCOL_SECONDARY = 1,
00102   UCOL_TERTIARY = 2,
00104   UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
00105   UCOL_CE_STRENGTH_LIMIT,
00107   UCOL_QUATERNARY=3,
00109   UCOL_IDENTICAL=15,
00110   UCOL_STRENGTH_LIMIT,
00111 
00115   UCOL_OFF = 16,
00119   UCOL_ON = 17,
00120   
00122   UCOL_SHIFTED = 20,
00124   UCOL_NON_IGNORABLE = 21,
00125 
00128   UCOL_LOWER_FIRST = 24,
00130   UCOL_UPPER_FIRST = 25,
00131 
00132   UCOL_ATTRIBUTE_VALUE_COUNT
00133 
00134 } UColAttributeValue;
00135 
00144  typedef enum {
00150     UCOL_REORDER_CODE_DEFAULT       = -1,
00155     UCOL_REORDER_CODE_NONE          = USCRIPT_UNKNOWN,
00162     UCOL_REORDER_CODE_OTHERS        = USCRIPT_UNKNOWN,
00167     UCOL_REORDER_CODE_SPACE         = 0x1000,
00172     UCOL_REORDER_CODE_FIRST         = UCOL_REORDER_CODE_SPACE,
00177     UCOL_REORDER_CODE_PUNCTUATION   = 0x1001,
00182     UCOL_REORDER_CODE_SYMBOL        = 0x1002,
00187     UCOL_REORDER_CODE_CURRENCY      = 0x1003,
00192     UCOL_REORDER_CODE_DIGIT         = 0x1004,
00197     UCOL_REORDER_CODE_LIMIT         = 0x1005
00198 } UColReorderCode;
00199 
00226 typedef UColAttributeValue UCollationStrength;
00227 
00232 typedef enum {
00237      UCOL_FRENCH_COLLATION, 
00246      UCOL_ALTERNATE_HANDLING, 
00253      UCOL_CASE_FIRST, 
00261      UCOL_CASE_LEVEL,
00269      UCOL_NORMALIZATION_MODE, 
00271      UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
00282      UCOL_STRENGTH,  
00286      UCOL_HIRAGANA_QUATERNARY_MODE,
00294      UCOL_NUMERIC_COLLATION, 
00295      UCOL_ATTRIBUTE_COUNT
00296 } UColAttribute;
00297 
00301 typedef enum {
00303   UCOL_TAILORING_ONLY, 
00305   UCOL_FULL_RULES 
00306 } UColRuleOption ;
00307 
00325 U_STABLE UCollator* U_EXPORT2 
00326 ucol_open(const char *loc, UErrorCode *status);
00327 
00353 U_STABLE UCollator* U_EXPORT2 
00354 ucol_openRules( const UChar        *rules,
00355                 int32_t            rulesLength,
00356                 UColAttributeValue normalizationMode,
00357                 UCollationStrength strength,
00358                 UParseError        *parseError,
00359                 UErrorCode         *status);
00360 
00395 U_STABLE UCollator* U_EXPORT2
00396 ucol_openFromShortString( const char *definition,
00397                           UBool forceDefaults,
00398                           UParseError *parseError,
00399                           UErrorCode *status);
00400 
00414 U_DEPRECATED int32_t U_EXPORT2
00415 ucol_getContractions( const UCollator *coll,
00416                   USet *conts,
00417                   UErrorCode *status);
00418 
00430 U_STABLE void U_EXPORT2
00431 ucol_getContractionsAndExpansions( const UCollator *coll,
00432                   USet *contractions, USet *expansions,
00433                   UBool addPrefixes, UErrorCode *status);
00434 
00445 U_STABLE void U_EXPORT2 
00446 ucol_close(UCollator *coll);
00447 
00448 #if U_SHOW_CPLUSPLUS_API
00449 
00450 U_NAMESPACE_BEGIN
00451 
00461 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
00462 
00463 U_NAMESPACE_END
00464 
00465 #endif
00466 
00482 U_STABLE UCollationResult U_EXPORT2 
00483 ucol_strcoll(    const    UCollator    *coll,
00484         const    UChar        *source,
00485         int32_t            sourceLength,
00486         const    UChar        *target,
00487         int32_t            targetLength);
00488 
00503 U_STABLE UBool U_EXPORT2 
00504 ucol_greater(const UCollator *coll,
00505              const UChar     *source, int32_t sourceLength,
00506              const UChar     *target, int32_t targetLength);
00507 
00522 U_STABLE UBool U_EXPORT2 
00523 ucol_greaterOrEqual(const UCollator *coll,
00524                     const UChar     *source, int32_t sourceLength,
00525                     const UChar     *target, int32_t targetLength);
00526 
00541 U_STABLE UBool U_EXPORT2 
00542 ucol_equal(const UCollator *coll,
00543            const UChar     *source, int32_t sourceLength,
00544            const UChar     *target, int32_t targetLength);
00545 
00558 U_STABLE UCollationResult U_EXPORT2 
00559 ucol_strcollIter(  const    UCollator    *coll,
00560                   UCharIterator *sIter,
00561                   UCharIterator *tIter,
00562                   UErrorCode *status);
00563 
00573 U_STABLE UCollationStrength U_EXPORT2 
00574 ucol_getStrength(const UCollator *coll);
00575 
00585 U_STABLE void U_EXPORT2 
00586 ucol_setStrength(UCollator *coll,
00587                  UCollationStrength strength);
00588 
00603 U_DRAFT int32_t U_EXPORT2 
00604 ucol_getReorderCodes(const UCollator* coll,
00605                     int32_t* dest,
00606                     int32_t destCapacity,
00607                     UErrorCode *pErrorCode);
00641 U_DRAFT void U_EXPORT2 
00642 ucol_setReorderCodes(UCollator* coll,
00643                     const int32_t* reorderCodes,
00644                     int32_t reorderCodesLength,
00645                     UErrorCode *pErrorCode);
00646 
00661 U_DRAFT int32_t U_EXPORT2 
00662 ucol_getEquivalentReorderCodes(int32_t reorderCode,
00663                     int32_t* dest,
00664                     int32_t destCapacity,
00665                     UErrorCode *pErrorCode);
00666 
00679 U_STABLE int32_t U_EXPORT2 
00680 ucol_getDisplayName(    const    char        *objLoc,
00681             const    char        *dispLoc,
00682             UChar             *result,
00683             int32_t         resultLength,
00684             UErrorCode        *status);
00685 
00695 U_STABLE const char* U_EXPORT2 
00696 ucol_getAvailable(int32_t localeIndex);
00697 
00706 U_STABLE int32_t U_EXPORT2 
00707 ucol_countAvailable(void);
00708 
00709 #if !UCONFIG_NO_SERVICE
00710 
00718 U_STABLE UEnumeration* U_EXPORT2
00719 ucol_openAvailableLocales(UErrorCode *status);
00720 #endif
00721 
00731 U_STABLE UEnumeration* U_EXPORT2
00732 ucol_getKeywords(UErrorCode *status);
00733 
00745 U_STABLE UEnumeration* U_EXPORT2
00746 ucol_getKeywordValues(const char *keyword, UErrorCode *status);
00747 
00764 U_STABLE UEnumeration* U_EXPORT2
00765 ucol_getKeywordValuesForLocale(const char* key,
00766                                const char* locale,
00767                                UBool commonlyUsed,
00768                                UErrorCode* status);
00769 
00800 U_STABLE int32_t U_EXPORT2
00801 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
00802                              const char* keyword, const char* locale,
00803                              UBool* isAvailable, UErrorCode* status);
00804 
00813 U_STABLE const UChar* U_EXPORT2 
00814 ucol_getRules(    const    UCollator    *coll, 
00815         int32_t            *length);
00816 
00837 U_STABLE int32_t U_EXPORT2
00838 ucol_getShortDefinitionString(const UCollator *coll,
00839                               const char *locale,
00840                               char *buffer,
00841                               int32_t capacity,
00842                               UErrorCode *status);
00843 
00864 U_STABLE int32_t U_EXPORT2
00865 ucol_normalizeShortDefinitionString(const char *source,
00866                                     char *destination,
00867                                     int32_t capacity,
00868                                     UParseError *parseError,
00869                                     UErrorCode *status);
00870 
00871 
00891 U_STABLE int32_t U_EXPORT2 
00892 ucol_getSortKey(const    UCollator    *coll,
00893         const    UChar        *source,
00894         int32_t        sourceLength,
00895         uint8_t        *result,
00896         int32_t        resultLength);
00897 
00898 
00919 U_STABLE int32_t U_EXPORT2 
00920 ucol_nextSortKeyPart(const UCollator *coll,
00921                      UCharIterator *iter,
00922                      uint32_t state[2],
00923                      uint8_t *dest, int32_t count,
00924                      UErrorCode *status);
00925 
00933 typedef enum {
00935   UCOL_BOUND_LOWER = 0,
00937   UCOL_BOUND_UPPER = 1,
00939   UCOL_BOUND_UPPER_LONG = 2,
00940   UCOL_BOUND_VALUE_COUNT
00941 } UColBoundMode;
00942 
00980 U_STABLE int32_t U_EXPORT2 
00981 ucol_getBound(const uint8_t       *source,
00982         int32_t             sourceLength,
00983         UColBoundMode       boundType,
00984         uint32_t            noOfLevels,
00985         uint8_t             *result,
00986         int32_t             resultLength,
00987         UErrorCode          *status);
00988         
00997 U_STABLE void U_EXPORT2
00998 ucol_getVersion(const UCollator* coll, UVersionInfo info);
00999 
01007 U_STABLE void U_EXPORT2
01008 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
01009 
01032 U_STABLE int32_t U_EXPORT2 
01033 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
01034                    const uint8_t *src2, int32_t src2Length,
01035                    uint8_t *dest, int32_t destCapacity);
01036 
01048 U_STABLE void U_EXPORT2 
01049 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
01050 
01062 U_STABLE UColAttributeValue  U_EXPORT2 
01063 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
01064 
01084 U_STABLE uint32_t U_EXPORT2 
01085 ucol_setVariableTop(UCollator *coll, 
01086                     const UChar *varTop, int32_t len, 
01087                     UErrorCode *status);
01088 
01100 U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
01101 
01113 U_STABLE void U_EXPORT2 
01114 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
01115 
01138 U_STABLE UCollator* U_EXPORT2 
01139 ucol_safeClone(const UCollator *coll,
01140                void            *stackBuffer,
01141                int32_t         *pBufferSize,
01142                UErrorCode      *status);
01143 
01147 #define U_COL_SAFECLONE_BUFFERSIZE 512
01148 
01160 U_STABLE int32_t U_EXPORT2 
01161 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
01162 
01177 U_DEPRECATED const char * U_EXPORT2
01178 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01179 
01180 
01195 U_STABLE const char * U_EXPORT2
01196 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
01197 
01208 U_STABLE USet * U_EXPORT2
01209 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
01210 
01222 U_INTERNAL UColAttributeValue  U_EXPORT2
01223 ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status);
01224 
01233 U_INTERNAL UBool U_EXPORT2
01234 ucol_equals(const UCollator *source, const UCollator *target);
01235 
01247 U_INTERNAL int32_t U_EXPORT2
01248 ucol_getUnsafeSet( const UCollator *coll,
01249                   USet *unsafe,
01250                   UErrorCode *status);
01251 
01255 U_INTERNAL void U_EXPORT2
01256 ucol_forgetUCA(void);
01257 
01278 U_INTERNAL void U_EXPORT2
01279 ucol_prepareShortStringOpen( const char *definition,
01280                           UBool forceDefaults,
01281                           UParseError *parseError,
01282                           UErrorCode *status);
01283 
01295 U_STABLE int32_t U_EXPORT2
01296 ucol_cloneBinary(const UCollator *coll,
01297                  uint8_t *buffer, int32_t capacity,
01298                  UErrorCode *status);
01299 
01317 U_STABLE UCollator* U_EXPORT2
01318 ucol_openBinary(const uint8_t *bin, int32_t length, 
01319                 const UCollator *base, 
01320                 UErrorCode *status);
01321 
01322 
01323 #endif /* #if !UCONFIG_NO_COLLATION */
01324 
01325 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines