Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

unorm.h

Go to the documentation of this file.
00001 /*
00002 *******************************************************************************
00003 * Copyright (c) 1996-2001, International Business Machines Corporation
00004 *               and others. All Rights Reserved.
00005 *******************************************************************************
00006 * File unorm.h
00007 *
00008 * Created by: Vladimir Weinstein 12052000
00009 *
00010 * Modification history :
00011 *
00012 * Date        Name        Description
00013 * 02/01/01    synwee      Added normalization quickcheck enum and method.
00014 */
00015 #ifndef UNORM_H
00016 #define UNORM_H
00017 
00018 #include "unicode/utypes.h"
00019 #include "unicode/uiter.h"
00020 
00124 typedef enum {
00126   UNORM_NONE = 1, 
00128   UNORM_NFD = 2,
00130   UNORM_NFKD = 3,
00132   UNORM_NFC = 4,
00134   UNORM_DEFAULT = UNORM_NFC, 
00136   UNORM_NFKC =5,
00138   UNORM_FCD = 6,
00139 
00141   UNORM_MODE_COUNT,
00142 
00143   /* *** The rest of this enum is entirely deprecated. *** */
00144 
00149   UCOL_NO_NORMALIZATION = 1,
00154   UCOL_DECOMP_CAN = 2,
00159   UCOL_DECOMP_COMPAT = 3,
00164   UCOL_DEFAULT_NORMALIZATION = UCOL_DECOMP_COMPAT, 
00169   UCOL_DECOMP_CAN_COMP_COMPAT = 4,
00174   UCOL_DECOMP_COMPAT_COMP_CAN =5,
00175 
00180   UCOL_IGNORE_HANGUL    = 16,
00185   UNORM_IGNORE_HANGUL    = 16
00186 } UNormalizationMode;
00187 
00207 U_CAPI int32_t U_EXPORT2 
00208 unorm_normalize(const UChar *source, int32_t sourceLength,
00209                 UNormalizationMode mode, int32_t options,
00210                 UChar *result, int32_t resultLength,
00211                 UErrorCode *status);
00212 
00218 #define u_normalize unorm_normalize
00219 
00225 typedef enum UNormalizationCheckResult {
00229   UNORM_NO,
00233   UNORM_YES,
00238   UNORM_MAYBE
00239 } UNormalizationCheckResult;
00240 
00259 U_CAPI UNormalizationCheckResult U_EXPORT2
00260 unorm_quickCheck(const UChar *source, int32_t sourcelength,
00261                  UNormalizationMode mode,
00262                  UErrorCode *status);
00263 
00337 U_CAPI int32_t U_EXPORT2
00338 unorm_next(UCharIterator *src,
00339            UChar *dest, int32_t destCapacity,
00340            UNormalizationMode mode, int32_t options,
00341            UBool doNormalize, UBool *pNeededToNormalize,
00342            UErrorCode *pErrorCode);
00343 
00370 U_CAPI int32_t U_EXPORT2
00371 unorm_previous(UCharIterator *src,
00372                UChar *dest, int32_t destCapacity,
00373                UNormalizationMode mode, int32_t options,
00374                UBool doNormalize, UBool *pNeededToNormalize,
00375                UErrorCode *pErrorCode);
00376 
00377 /*
00378  * Concatenate normalized strings, making sure that the result is normalized as well.
00379  *
00380  * If both the left and the right strings are in
00381  * the normalization form according to "mode",
00382  * then the result will be
00383  *
00384  * \code
00385  *     dest=normalize(left+right, mode)
00386  * \endcode
00387  *
00388  * With the input strings already being normalized,
00389  * this function will use unorm_next() and unorm_previous()
00390  * to find the adjacent end pieces of the input strings.
00391  * Only the concatenation of these end pieces will be normalized and
00392  * then concatenated with the remaining parts of the input strings.
00393  *
00394  * It is allowed to have dest==left to avoid copying the entire left string.
00395  *
00396  * @param left Left source string, may be same as dest.
00397  * @param leftLength Length of left source string, or -1 if NUL-terminated.
00398  * @param right Right source string.
00399  * @param rightLength Length of right source string, or -1 if NUL-terminated.
00400  * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting.
00401  * @param destCapacity The number of UChars that fit into dest.
00402  * @param mode The normalization mode.
00403  * @param options A bit set of normalization options.
00404  * @param pErrorCode ICU error code in/out parameter.
00405  *                   Must fulfill U_SUCCESS before the function call.
00406  * @return Length of output (number of UChars) when successful or buffer overflow.
00407  *
00408  * @see unorm_normalize
00409  * @see unorm_next
00410  * @see unorm_previous
00411  *
00412  * @draft ICU 2.1
00413  */
00414 U_CAPI int32_t U_EXPORT2
00415 unorm_concatenate(const UChar *left, int32_t leftLength,
00416                   const UChar *right, int32_t rightLength,
00417                   UChar *dest, int32_t destCapacity,
00418                   UNormalizationMode mode, int32_t options,
00419                   UErrorCode *pErrorCode);
00420 
00421 #endif

Generated on Mon Mar 4 22:08:43 2002 for ICU 2.0 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002