sl@0
|
1 |
/*
|
sl@0
|
2 |
**********************************************************************
|
sl@0
|
3 |
* Copyright (C) 1999-2005, International Business Machines
|
sl@0
|
4 |
* Corporation and others. All Rights Reserved.
|
sl@0
|
5 |
**********************************************************************
|
sl@0
|
6 |
* file name: ustr_imp.h
|
sl@0
|
7 |
* encoding: US-ASCII
|
sl@0
|
8 |
* tab size: 8 (not used)
|
sl@0
|
9 |
* indentation:4
|
sl@0
|
10 |
*
|
sl@0
|
11 |
* created on: 2001jan30
|
sl@0
|
12 |
* created by: Markus W. Scherer
|
sl@0
|
13 |
*/
|
sl@0
|
14 |
|
sl@0
|
15 |
#ifndef __USTR_IMP_H__
|
sl@0
|
16 |
#define __USTR_IMP_H__
|
sl@0
|
17 |
|
sl@0
|
18 |
#include "unicode/utypes.h"
|
sl@0
|
19 |
#include "unicode/uiter.h"
|
sl@0
|
20 |
#include "ucase.h"
|
sl@0
|
21 |
|
sl@0
|
22 |
/** Simple declaration for u_strToTitle() to avoid including unicode/ubrk.h. */
|
sl@0
|
23 |
#ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
|
sl@0
|
24 |
# define UBRK_TYPEDEF_UBREAK_ITERATOR
|
sl@0
|
25 |
typedef void UBreakIterator;
|
sl@0
|
26 |
#endif
|
sl@0
|
27 |
|
sl@0
|
28 |
/**
|
sl@0
|
29 |
* Compare two strings in code point order or code unit order.
|
sl@0
|
30 |
* Works in strcmp style (both lengths -1),
|
sl@0
|
31 |
* strncmp style (lengths equal and >=0, flag TRUE),
|
sl@0
|
32 |
* and memcmp/UnicodeString style (at least one length >=0).
|
sl@0
|
33 |
* @internal
|
sl@0
|
34 |
*/
|
sl@0
|
35 |
U_CAPI int32_t U_EXPORT2
|
sl@0
|
36 |
uprv_strCompare(const UChar *s1, int32_t length1,
|
sl@0
|
37 |
const UChar *s2, int32_t length2,
|
sl@0
|
38 |
UBool strncmpStyle, UBool codePointOrder);
|
sl@0
|
39 |
|
sl@0
|
40 |
/**
|
sl@0
|
41 |
* Internal API, used by u_strcasecmp() etc.
|
sl@0
|
42 |
* Compare strings case-insensitively,
|
sl@0
|
43 |
* in code point order or code unit order.
|
sl@0
|
44 |
* @internal
|
sl@0
|
45 |
*/
|
sl@0
|
46 |
U_CFUNC int32_t
|
sl@0
|
47 |
u_strcmpFold(const UChar *s1, int32_t length1,
|
sl@0
|
48 |
const UChar *s2, int32_t length2,
|
sl@0
|
49 |
uint32_t options,
|
sl@0
|
50 |
UErrorCode *pErrorCode);
|
sl@0
|
51 |
|
sl@0
|
52 |
/**
|
sl@0
|
53 |
* Are the Unicode properties loaded?
|
sl@0
|
54 |
* This must be used before internal functions are called that do
|
sl@0
|
55 |
* not perform this check.
|
sl@0
|
56 |
* Generate a debug assertion failure if data is not loaded, to flag the fact
|
sl@0
|
57 |
* that u_init() wasn't called first, before trying to access character properties.
|
sl@0
|
58 |
* @internal
|
sl@0
|
59 |
*/
|
sl@0
|
60 |
U_CFUNC UBool
|
sl@0
|
61 |
uprv_haveProperties(UErrorCode *pErrorCode);
|
sl@0
|
62 |
|
sl@0
|
63 |
/**
|
sl@0
|
64 |
* Load the Unicode property data.
|
sl@0
|
65 |
* Intended primarily for use from u_init().
|
sl@0
|
66 |
* Has no effect if property data is already loaded.
|
sl@0
|
67 |
* NOT thread safe.
|
sl@0
|
68 |
* @internal
|
sl@0
|
69 |
*/
|
sl@0
|
70 |
U_CFUNC int8_t
|
sl@0
|
71 |
uprv_loadPropsData(UErrorCode *errorCode);
|
sl@0
|
72 |
|
sl@0
|
73 |
/**
|
sl@0
|
74 |
* Type of a function that may be passed to the internal case mapping functions
|
sl@0
|
75 |
* or similar for growing the destination buffer.
|
sl@0
|
76 |
* @internal
|
sl@0
|
77 |
*/
|
sl@0
|
78 |
typedef UBool U_CALLCONV
|
sl@0
|
79 |
UGrowBuffer(void *context, /* opaque pointer for this function */
|
sl@0
|
80 |
UChar **pBuffer, /* in/out destination buffer pointer */
|
sl@0
|
81 |
int32_t *pCapacity, /* in/out buffer capacity in numbers of UChars */
|
sl@0
|
82 |
int32_t reqCapacity,/* requested capacity */
|
sl@0
|
83 |
int32_t length); /* number of UChars to be copied to new buffer */
|
sl@0
|
84 |
|
sl@0
|
85 |
/**
|
sl@0
|
86 |
* Default implementation of UGrowBuffer.
|
sl@0
|
87 |
* Takes a static buffer as context, allocates a new buffer,
|
sl@0
|
88 |
* and releases the old one if it is not the same as the one passed as context.
|
sl@0
|
89 |
* @internal
|
sl@0
|
90 |
*/
|
sl@0
|
91 |
U_CAPI UBool /* U_CALLCONV U_EXPORT2 */
|
sl@0
|
92 |
u_growBufferFromStatic(void *context,
|
sl@0
|
93 |
UChar **pBuffer, int32_t *pCapacity, int32_t reqCapacity,
|
sl@0
|
94 |
int32_t length);
|
sl@0
|
95 |
|
sl@0
|
96 |
/*
|
sl@0
|
97 |
* Internal string casing functions implementing
|
sl@0
|
98 |
* ustring.h/ustrcase.c and UnicodeString case mapping functions.
|
sl@0
|
99 |
*/
|
sl@0
|
100 |
|
sl@0
|
101 |
/**
|
sl@0
|
102 |
* @internal
|
sl@0
|
103 |
*/
|
sl@0
|
104 |
U_CFUNC int32_t
|
sl@0
|
105 |
ustr_toLower(const UCaseProps *csp,
|
sl@0
|
106 |
UChar *dest, int32_t destCapacity,
|
sl@0
|
107 |
const UChar *src, int32_t srcLength,
|
sl@0
|
108 |
const char *locale,
|
sl@0
|
109 |
UErrorCode *pErrorCode);
|
sl@0
|
110 |
|
sl@0
|
111 |
/**
|
sl@0
|
112 |
* @internal
|
sl@0
|
113 |
*/
|
sl@0
|
114 |
U_CFUNC int32_t
|
sl@0
|
115 |
ustr_toUpper(const UCaseProps *csp,
|
sl@0
|
116 |
UChar *dest, int32_t destCapacity,
|
sl@0
|
117 |
const UChar *src, int32_t srcLength,
|
sl@0
|
118 |
const char *locale,
|
sl@0
|
119 |
UErrorCode *pErrorCode);
|
sl@0
|
120 |
|
sl@0
|
121 |
#if !UCONFIG_NO_BREAK_ITERATION
|
sl@0
|
122 |
|
sl@0
|
123 |
/**
|
sl@0
|
124 |
* @internal
|
sl@0
|
125 |
*/
|
sl@0
|
126 |
U_CFUNC int32_t
|
sl@0
|
127 |
ustr_toTitle(const UCaseProps *csp,
|
sl@0
|
128 |
UChar *dest, int32_t destCapacity,
|
sl@0
|
129 |
const UChar *src, int32_t srcLength,
|
sl@0
|
130 |
UBreakIterator *titleIter,
|
sl@0
|
131 |
const char *locale,
|
sl@0
|
132 |
UErrorCode *pErrorCode);
|
sl@0
|
133 |
|
sl@0
|
134 |
#endif
|
sl@0
|
135 |
|
sl@0
|
136 |
/**
|
sl@0
|
137 |
* Internal case folding function.
|
sl@0
|
138 |
* @internal
|
sl@0
|
139 |
*/
|
sl@0
|
140 |
U_CFUNC int32_t
|
sl@0
|
141 |
ustr_foldCase(const UCaseProps *csp,
|
sl@0
|
142 |
UChar *dest, int32_t destCapacity,
|
sl@0
|
143 |
const UChar *src, int32_t srcLength,
|
sl@0
|
144 |
uint32_t options,
|
sl@0
|
145 |
UErrorCode *pErrorCode);
|
sl@0
|
146 |
|
sl@0
|
147 |
/**
|
sl@0
|
148 |
* NUL-terminate a UChar * string if possible.
|
sl@0
|
149 |
* If length < destCapacity then NUL-terminate.
|
sl@0
|
150 |
* If length == destCapacity then do not terminate but set U_STRING_NOT_TERMINATED_WARNING.
|
sl@0
|
151 |
* If length > destCapacity then do not terminate but set U_BUFFER_OVERFLOW_ERROR.
|
sl@0
|
152 |
*
|
sl@0
|
153 |
* @param dest Destination buffer, can be NULL if destCapacity==0.
|
sl@0
|
154 |
* @param destCapacity Number of UChars available at dest.
|
sl@0
|
155 |
* @param length Number of UChars that were (to be) written to dest.
|
sl@0
|
156 |
* @param pErrorCode ICU error code.
|
sl@0
|
157 |
* @return length
|
sl@0
|
158 |
* @internal
|
sl@0
|
159 |
*/
|
sl@0
|
160 |
U_CAPI int32_t U_EXPORT2
|
sl@0
|
161 |
u_terminateUChars(UChar *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
|
sl@0
|
162 |
|
sl@0
|
163 |
/**
|
sl@0
|
164 |
* NUL-terminate a char * string if possible.
|
sl@0
|
165 |
* Same as u_terminateUChars() but for a different string type.
|
sl@0
|
166 |
*/
|
sl@0
|
167 |
U_CAPI int32_t U_EXPORT2
|
sl@0
|
168 |
u_terminateChars(char *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
|
sl@0
|
169 |
|
sl@0
|
170 |
/**
|
sl@0
|
171 |
* NUL-terminate a UChar32 * string if possible.
|
sl@0
|
172 |
* Same as u_terminateUChars() but for a different string type.
|
sl@0
|
173 |
*/
|
sl@0
|
174 |
U_CAPI int32_t U_EXPORT2
|
sl@0
|
175 |
u_terminateUChar32s(UChar32 *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
|
sl@0
|
176 |
|
sl@0
|
177 |
/**
|
sl@0
|
178 |
* NUL-terminate a wchar_t * string if possible.
|
sl@0
|
179 |
* Same as u_terminateUChars() but for a different string type.
|
sl@0
|
180 |
*/
|
sl@0
|
181 |
U_CAPI int32_t U_EXPORT2
|
sl@0
|
182 |
u_terminateWChars(wchar_t *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
|
sl@0
|
183 |
|
sl@0
|
184 |
#endif
|