X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/374ca955a76ecab1204ca8bfa63ff9238d998416..729e4ab9bc6618bc3d8a898e575df7f4019e29ca:/icuSources/common/ustr_imp.h diff --git a/icuSources/common/ustr_imp.h b/icuSources/common/ustr_imp.h index 3b162e8a..01c7901d 100644 --- a/icuSources/common/ustr_imp.h +++ b/icuSources/common/ustr_imp.h @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 1999-2004, International Business Machines +* Copyright (C) 1999-2010, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * file name: ustr_imp.h @@ -22,9 +22,26 @@ /** Simple declaration for u_strToTitle() to avoid including unicode/ubrk.h. */ #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR # define UBRK_TYPEDEF_UBREAK_ITERATOR - typedef void UBreakIterator; + typedef struct UBreakIterator UBreakIterator; #endif +#ifndef U_COMPARE_IGNORE_CASE +/* see also unorm.h */ +/** + * Option bit for unorm_compare: + * Perform case-insensitive comparison. + * @draft ICU 2.2 + */ +#define U_COMPARE_IGNORE_CASE 0x10000 +#endif + +/** + * Internal option for unorm_cmpEquivFold() for strncmp style. + * If set, checks for both string length and terminating NUL. + * @internal + */ +#define _STRNCMP_STYLE 0x1000 + /** * Compare two strings in code point order or code unit order. * Works in strcmp style (both lengths -1), @@ -32,7 +49,7 @@ * and memcmp/UnicodeString style (at least one length >=0). * @internal */ -U_CAPI int32_t U_EXPORT2 +U_CFUNC int32_t U_EXPORT2 uprv_strCompare(const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, UBool strncmpStyle, UBool codePointOrder); @@ -53,8 +70,7 @@ u_strcmpFold(const UChar *s1, int32_t length1, * Are the Unicode properties loaded? * This must be used before internal functions are called that do * not perform this check. - * Generate a debug assertion failure if data is not loaded, to flag the fact - * that u_init() wasn't called first, before trying to access character properties. + * Generate a debug assertion failure if data is not loaded. * @internal */ U_CFUNC UBool @@ -67,42 +83,46 @@ uprv_haveProperties(UErrorCode *pErrorCode); * NOT thread safe. * @internal */ -U_CFUNC int8_t -uprv_loadPropsData(UErrorCode *errorCode); +/*U_CFUNC int8_t +uprv_loadPropsData(UErrorCode *errorCode);*/ -/** - * Type of a function that may be passed to the internal case mapping functions - * or similar for growing the destination buffer. - * @internal +/* + * Internal string casing functions implementing + * ustring.h/ustrcase.c and UnicodeString case mapping functions. */ -typedef UBool U_CALLCONV -UGrowBuffer(void *context, /* opaque pointer for this function */ - UChar **pBuffer, /* in/out destination buffer pointer */ - int32_t *pCapacity, /* in/out buffer capacity in numbers of UChars */ - int32_t reqCapacity,/* requested capacity */ - int32_t length); /* number of UChars to be copied to new buffer */ /** - * Default implementation of UGrowBuffer. - * Takes a static buffer as context, allocates a new buffer, - * and releases the old one if it is not the same as the one passed as context. * @internal */ -U_CAPI UBool /* U_CALLCONV U_EXPORT2 */ -u_growBufferFromStatic(void *context, - UChar **pBuffer, int32_t *pCapacity, int32_t reqCapacity, - int32_t length); +struct UCaseMap { + const UCaseProps *csp; +#if !UCONFIG_NO_BREAK_ITERATION + UBreakIterator *iter; /* We adopt the iterator, so we own it. */ +#endif + char locale[32]; + int32_t locCache; + uint32_t options; +}; -/* - * Internal string casing functions implementing - * ustring.h/ustrcase.c and UnicodeString case mapping functions. +#ifndef __UCASEMAP_H__ +typedef struct UCaseMap UCaseMap; +#endif + +/** + * @internal */ +enum { + TO_LOWER, + TO_UPPER, + TO_TITLE, + FOLD_CASE +}; /** * @internal */ U_CFUNC int32_t -ustr_toLower(UCaseProps *csp, +ustr_toLower(const UCaseProps *csp, UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, const char *locale, @@ -112,7 +132,7 @@ ustr_toLower(UCaseProps *csp, * @internal */ U_CFUNC int32_t -ustr_toUpper(UCaseProps *csp, +ustr_toUpper(const UCaseProps *csp, UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, const char *locale, @@ -124,11 +144,11 @@ ustr_toUpper(UCaseProps *csp, * @internal */ U_CFUNC int32_t -ustr_toTitle(UCaseProps *csp, +ustr_toTitle(const UCaseProps *csp, UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, UBreakIterator *titleIter, - const char *locale, + const char *locale, uint32_t options, UErrorCode *pErrorCode); #endif @@ -138,7 +158,7 @@ ustr_toTitle(UCaseProps *csp, * @internal */ U_CFUNC int32_t -ustr_foldCase(UCaseProps *csp, +ustr_foldCase(const UCaseProps *csp, UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, uint32_t options,