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