]> git.saurik.com Git - apple/icu.git/blob - icuSources/common/icuuc40shim.cpp
ICU-59180.0.1.tar.gz
[apple/icu.git] / icuSources / common / icuuc40shim.cpp
1 /*
2 *****************************************************************************************
3 * Copyright (C) 2010 Apple Inc. All Rights Reserved.
4 *****************************************************************************************
5 */
6
7 #include <unicode/utypes.h>
8 #include <unicode/ubrk.h>
9 #include <unicode/uchar.h>
10 #include <unicode/uidna.h>
11 #include <unicode/uscript.h>
12 #include <unicode/ustring.h>
13 #include <unicode/utf8.h>
14 #include <unicode/brkiter.h>
15 #include <unicode/unistr.h>
16 #include <unicode/locid.h>
17
18 extern "C" {
19
20 /*
21 * imp: common/uchar.c
22 * hdr: common/unicode/uchar.h
23 * @stable ICU 2.0
24 */
25 U_CAPI int8_t U_EXPORT2
26 u_charType_4_0(UChar32 c)
27 {
28 return u_charType(c);
29 }
30
31 } // end extern "C"
32
33 /*
34 * imp: common/uchar.c
35 * hdr: common/unicode/uchar.h
36 * @stable ICU 2.0
37 */
38 U_CAPI UBool U_EXPORT2
39 u_isUWhiteSpace_4_0(UChar32 c)
40 {
41 return u_isUWhiteSpace(c);
42 }
43
44 /*
45 * imp: common/uchar.c
46 * hdr: common/unicode/uchar.h
47 * @stable ICU 2.0
48 */
49 U_CAPI UBool U_EXPORT2
50 u_isprint_4_0(UChar32 c)
51 {
52 return u_isprint(c);
53 }
54
55 /*
56 * imp: common/uchar.c
57 * hdr: common/unicode/uchar.h
58 * @stable ICU 2.0
59 */
60 U_CAPI UBool U_EXPORT2
61 u_isWhitespace_4_0(UChar32 c)
62 {
63 return u_isWhitespace(c);
64 }
65
66 /*
67 * imp: common/uchar.c
68 * hdr: common/unicode/uchar.h
69 * @stable ICU 2.0
70 */
71 U_CAPI UBool U_EXPORT2
72 u_isspace_4_0(UChar32 c)
73 {
74 return u_isspace(c);
75 }
76
77 /*
78 * imp: common/ucase.c
79 * hdr: common/unicode/uchar.h
80 * @stable ICU 2.0
81 */
82 U_CAPI UChar32 U_EXPORT2
83 u_foldCase_4_0(UChar32 c, uint32_t options) {
84 return u_foldCase(c, options);
85 }
86
87 /*
88 * imp: common/uprops.cpp
89 * hdr: common/unicode/uchar.h
90 * @stable ICU 2.1
91 */
92 U_CAPI UBool U_EXPORT2
93 u_hasBinaryProperty_4_0(UChar32 c, UProperty which)
94 {
95 return u_hasBinaryProperty(c, which);
96 }
97
98 /*
99 * imp: common/propname.cpp
100 * hdr: common/unicode/uchar.h
101 * @stable ICU 2.4
102 */
103 U_CAPI int32_t U_EXPORT2
104 u_getPropertyValueEnum_4_0(UProperty property,
105 const char* alias)
106 {
107 return u_getPropertyValueEnum(property, alias);
108 }
109
110 /*
111 * imp: common/uchar.c
112 * hdr: common/unicode/uscript.h
113 * @stable ICU 2.4
114 */
115 U_CAPI UScriptCode U_EXPORT2
116 uscript_getScript_4_0(UChar32 codepoint, UErrorCode *err)
117
118 {
119 return uscript_getScript(codepoint, err);
120 }
121
122 /*
123 * imp: common/ustrcase.c
124 * hdr: common/unicode/ustring.h
125 * @stable ICU 2.0
126 */
127 U_CAPI int32_t U_EXPORT2
128 u_memcasecmp_4_0(const UChar *s1, const UChar *s2, int32_t length, uint32_t options) {
129 return u_memcasecmp(s1, s2, length, options);
130 }
131
132 /*
133 * imp: common/utypes.c
134 * hdr: common/unicode/utypes.h
135 * @stable ICU 2.0
136 */
137 U_CAPI const char * U_EXPORT2
138 u_errorName_4_0(UErrorCode code)
139 {
140 return u_errorName(code);
141 }
142
143 /*
144 * imp: common/ubrk.cpp
145 * hdr: common/unicode/ubrk.h
146 * @stable ICU 2.0
147 * #if !UCONFIG_NO_BREAK_ITERATION
148 * (don't actually conditionalize this, if the underlying library is not
149 * built with break iteration, we want to fail at build time, not runtime)
150 */
151 U_CAPI UBreakIterator* U_EXPORT2
152 ubrk_open_4_0(UBreakIteratorType type,
153 const char *locale,
154 const UChar *text,
155 int32_t textLength,
156 UErrorCode *status)
157 {
158 return ubrk_open(type, locale, text, textLength, status);
159 }
160
161 /*
162 * imp: common/ubrk.cpp
163 * hdr: common/unicode/ubrk.h
164 * @stable ICU 2.0
165 * #if !UCONFIG_NO_BREAK_ITERATION
166 * (don't actually conditionalize this, if the underlying library is not
167 * built with break iteration, we want to fail at build time, not runtime)
168 */
169 U_CAPI void U_EXPORT2
170 ubrk_close_4_0(UBreakIterator *bi)
171 {
172 return ubrk_close(bi);
173 }
174
175 /*
176 * imp: common/ubrk.cpp
177 * hdr: common/unicode/ubrk.h
178 * @stable ICU 2.0
179 * #if !UCONFIG_NO_BREAK_ITERATION
180 * (don't actually conditionalize this, if the underlying library is not
181 * built with break iteration, we want to fail at build time, not runtime)
182 */
183 U_CAPI void U_EXPORT2
184 ubrk_setText_4_0(UBreakIterator* bi,
185 const UChar* text,
186 int32_t textLength,
187 UErrorCode* status)
188 {
189 return ubrk_setText(bi, text, textLength, status);
190 }
191
192 /*
193 * imp: common/ubrk.cpp
194 * hdr: common/unicode/ubrk.h
195 * @stable ICU 2.0
196 * #if !UCONFIG_NO_BREAK_ITERATION
197 * (don't actually conditionalize this, if the underlying library is not
198 * built with break iteration, we want to fail at build time, not runtime)
199 */
200 U_CAPI int32_t U_EXPORT2
201 ubrk_first_4_0(UBreakIterator *bi)
202 {
203 return ubrk_first(bi);
204 }
205
206 /*
207 * imp: common/ubrk.cpp
208 * hdr: common/unicode/ubrk.h
209 * @stable ICU 2.0
210 * #if !UCONFIG_NO_BREAK_ITERATION
211 * (don't actually conditionalize this, if the underlying library is not
212 * built with break iteration, we want to fail at build time, not runtime)
213 */
214 U_CAPI int32_t U_EXPORT2
215 ubrk_last_4_0(UBreakIterator *bi)
216 {
217 return ubrk_last(bi);
218 }
219
220 /*
221 * imp: common/ubrk.cpp
222 * hdr: common/unicode/ubrk.h
223 * @stable ICU 2.0
224 * #if !UCONFIG_NO_BREAK_ITERATION
225 * (don't actually conditionalize this, if the underlying library is not
226 * built with break iteration, we want to fail at build time, not runtime)
227 */
228 U_CAPI int32_t U_EXPORT2
229 ubrk_next_4_0(UBreakIterator *bi)
230 {
231 return ubrk_next(bi);
232 }
233
234 /*
235 * imp: common/ubrk.cpp
236 * hdr: common/unicode/ubrk.h
237 * @stable ICU 2.0
238 * #if !UCONFIG_NO_BREAK_ITERATION
239 * (don't actually conditionalize this, if the underlying library is not
240 * built with break iteration, we want to fail at build time, not runtime)
241 */
242 U_CAPI int32_t U_EXPORT2
243 ubrk_previous_4_0(UBreakIterator *bi)
244 {
245 return ubrk_previous(bi);
246 }
247
248 /*
249 * imp: common/ubrk.cpp
250 * hdr: common/unicode/ubrk.h
251 * @stable ICU 2.0
252 * #if !UCONFIG_NO_BREAK_ITERATION
253 * (don't actually conditionalize this, if the underlying library is not
254 * built with break iteration, we want to fail at build time, not runtime)
255 */
256 U_CAPI int32_t U_EXPORT2
257 ubrk_preceding_4_0(UBreakIterator *bi,
258 int32_t offset)
259 {
260 return ubrk_preceding(bi, offset);
261 }
262
263 /*
264 * imp: common/ubrk.cpp
265 * hdr: common/unicode/ubrk.h
266 * @stable ICU 2.0
267 * #if !UCONFIG_NO_BREAK_ITERATION
268 * (don't actually conditionalize this, if the underlying library is not
269 * built with break iteration, we want to fail at build time, not runtime)
270 */
271 U_CAPI int32_t U_EXPORT2
272 ubrk_following_4_0(UBreakIterator *bi,
273 int32_t offset)
274 {
275 return ubrk_following(bi, offset);
276 }
277
278
279 /*
280 * imp: common/uidna.cpp
281 * hdr: common/unicode/uidna.h
282 * @stable ICU 2.6
283 */
284 U_CAPI int32_t U_EXPORT2
285 uidna_IDNToUnicode_4_0( const UChar* src, int32_t srcLength,
286 UChar* dest, int32_t destCapacity,
287 int32_t options,
288 UParseError* parseError,
289 UErrorCode* status)
290 {
291 return uidna_IDNToUnicode(src, srcLength, dest, destCapacity, options, parseError, status);
292 }
293
294 /*
295 * imp: common/uidna.cpp
296 * hdr: common/unicode/uidna.h
297 * @stable ICU 2.6
298 */
299 U_CAPI int32_t U_EXPORT2
300 uidna_IDNToASCII_4_0( const UChar* src, int32_t srcLength,
301 UChar* dest, int32_t destCapacity,
302 int32_t options,
303 UParseError* parseError,
304 UErrorCode* status)
305 {
306 return uidna_IDNToASCII(src, srcLength, dest, destCapacity, options, parseError, status);
307 }
308
309
310 /*
311 * imp: common/utf_impl.c
312 * hdr: common/unicode/utf8.h
313 * @internal
314 */
315 U_CAPI int32_t U_EXPORT2
316 utf8_appendCharSafeBody_4_0(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError)
317 {
318 return utf8_appendCharSafeBody(s, i, length, c, pIsError);
319 }
320
321
322 namespace icu_4_0 {
323
324 /*
325 * imp: common/locid.cpp
326 * hdr: common/unicode/locid.h
327 */
328 class __declspec(dllexport) Locale : public icu::Locale {
329 public:
330 // @stable ICU 2.0
331 Locale(const char* language, const char* country = 0, const char* variant = 0, const char* keywordsAndValues = 0)
332 : icu::Locale(language, country, variant, keywordsAndValues)
333 {
334 }
335 };
336
337
338 /*
339 * imp: common/unistr.cpp
340 * hdr: common/unicode/unistr.h
341 */
342 class __declspec(dllexport) UnicodeString : public icu::UnicodeString {
343 public:
344 UnicodeString(UBool isTerminated, const UChar *text, int32_t textLength)
345 : icu::UnicodeString(isTerminated, text, textLength)
346 {
347 }
348
349 UnicodeString(int32_t capacity, UChar32 c, int32_t count)
350 : icu::UnicodeString(capacity, c, count)
351 {
352 }
353
354 UnicodeString()
355 : icu::UnicodeString()
356 {
357 }
358
359 UChar *getBuffer(int32_t minCapacity)
360 {
361 return icu::UnicodeString::getBuffer(minCapacity);
362 }
363
364 void releaseBuffer(int32_t newLength=-1)
365 {
366 return icu::UnicodeString::releaseBuffer(newLength);
367 }
368 };
369
370
371 /*
372 * imp: common/brkiter.cpp
373 * hdr: common/unicode/brkiter.h
374 */
375 class __declspec(dllexport) BreakIterator : public icu::BreakIterator {
376 public:
377 // @stable ICU 2.0
378 static BreakIterator* U_EXPORT2
379 createWordInstance(const icu_4_0::Locale& where, UErrorCode& status)
380 {
381 return static_cast<BreakIterator*>(icu::BreakIterator::createWordInstance(where, status));
382 }
383 };
384
385 }; // end namespace icu_4_0