]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/ustr_imp.h
2 **********************************************************************
3 * Copyright (C) 1999-2006, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 * file name: ustr_imp.h
8 * tab size: 8 (not used)
11 * created on: 2001jan30
12 * created by: Markus W. Scherer
15 #ifndef __USTR_IMP_H__
16 #define __USTR_IMP_H__
18 #include "unicode/utypes.h"
19 #include "unicode/uiter.h"
22 /** Simple declaration for u_strToTitle() to avoid including unicode/ubrk.h. */
23 #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
24 # define UBRK_TYPEDEF_UBREAK_ITERATOR
25 typedef void UBreakIterator
;
29 * Compare two strings in code point order or code unit order.
30 * Works in strcmp style (both lengths -1),
31 * strncmp style (lengths equal and >=0, flag TRUE),
32 * and memcmp/UnicodeString style (at least one length >=0).
35 U_CAPI
int32_t U_EXPORT2
36 uprv_strCompare(const UChar
*s1
, int32_t length1
,
37 const UChar
*s2
, int32_t length2
,
38 UBool strncmpStyle
, UBool codePointOrder
);
41 * Internal API, used by u_strcasecmp() etc.
42 * Compare strings case-insensitively,
43 * in code point order or code unit order.
47 u_strcmpFold(const UChar
*s1
, int32_t length1
,
48 const UChar
*s2
, int32_t length2
,
50 UErrorCode
*pErrorCode
);
53 * Are the Unicode properties loaded?
54 * This must be used before internal functions are called that do
55 * not perform this check.
56 * Generate a debug assertion failure if data is not loaded, to flag the fact
57 * that u_init() wasn't called first, before trying to access character properties.
61 uprv_haveProperties(UErrorCode
*pErrorCode
);
64 * Load the Unicode property data.
65 * Intended primarily for use from u_init().
66 * Has no effect if property data is already loaded.
71 uprv_loadPropsData(UErrorCode *errorCode);*/
74 * Type of a function that may be passed to the internal case mapping functions
75 * or similar for growing the destination buffer.
78 typedef UBool U_CALLCONV
79 UGrowBuffer(void *context
, /* opaque pointer for this function */
80 UChar
**pBuffer
, /* in/out destination buffer pointer */
81 int32_t *pCapacity
, /* in/out buffer capacity in numbers of UChars */
82 int32_t reqCapacity
,/* requested capacity */
83 int32_t length
); /* number of UChars to be copied to new buffer */
86 * Default implementation of UGrowBuffer.
87 * Takes a static buffer as context, allocates a new buffer,
88 * and releases the old one if it is not the same as the one passed as context.
91 U_CAPI UBool
/* U_CALLCONV U_EXPORT2 */
92 u_growBufferFromStatic(void *context
,
93 UChar
**pBuffer
, int32_t *pCapacity
, int32_t reqCapacity
,
97 * Internal string casing functions implementing
98 * ustring.h/ustrcase.c and UnicodeString case mapping functions.
105 ustr_toLower(const UCaseProps
*csp
,
106 UChar
*dest
, int32_t destCapacity
,
107 const UChar
*src
, int32_t srcLength
,
109 UErrorCode
*pErrorCode
);
115 ustr_toUpper(const UCaseProps
*csp
,
116 UChar
*dest
, int32_t destCapacity
,
117 const UChar
*src
, int32_t srcLength
,
119 UErrorCode
*pErrorCode
);
121 #if !UCONFIG_NO_BREAK_ITERATION
127 ustr_toTitle(const UCaseProps
*csp
,
128 UChar
*dest
, int32_t destCapacity
,
129 const UChar
*src
, int32_t srcLength
,
130 UBreakIterator
*titleIter
,
132 UErrorCode
*pErrorCode
);
137 * Internal case folding function.
141 ustr_foldCase(const UCaseProps
*csp
,
142 UChar
*dest
, int32_t destCapacity
,
143 const UChar
*src
, int32_t srcLength
,
145 UErrorCode
*pErrorCode
);
148 * NUL-terminate a UChar * string if possible.
149 * If length < destCapacity then NUL-terminate.
150 * If length == destCapacity then do not terminate but set U_STRING_NOT_TERMINATED_WARNING.
151 * If length > destCapacity then do not terminate but set U_BUFFER_OVERFLOW_ERROR.
153 * @param dest Destination buffer, can be NULL if destCapacity==0.
154 * @param destCapacity Number of UChars available at dest.
155 * @param length Number of UChars that were (to be) written to dest.
156 * @param pErrorCode ICU error code.
160 U_CAPI
int32_t U_EXPORT2
161 u_terminateUChars(UChar
*dest
, int32_t destCapacity
, int32_t length
, UErrorCode
*pErrorCode
);
164 * NUL-terminate a char * string if possible.
165 * Same as u_terminateUChars() but for a different string type.
167 U_CAPI
int32_t U_EXPORT2
168 u_terminateChars(char *dest
, int32_t destCapacity
, int32_t length
, UErrorCode
*pErrorCode
);
171 * NUL-terminate a UChar32 * string if possible.
172 * Same as u_terminateUChars() but for a different string type.
174 U_CAPI
int32_t U_EXPORT2
175 u_terminateUChar32s(UChar32
*dest
, int32_t destCapacity
, int32_t length
, UErrorCode
*pErrorCode
);
178 * NUL-terminate a wchar_t * string if possible.
179 * Same as u_terminateUChars() but for a different string type.
181 U_CAPI
int32_t U_EXPORT2
182 u_terminateWChars(wchar_t *dest
, int32_t destCapacity
, int32_t length
, UErrorCode
*pErrorCode
);