OLD | NEW |
1 /* | 1 /* |
2 ********************************************************************** | 2 ********************************************************************** |
3 * Copyright (C) 1999-2013, International Business Machines | 3 * Copyright (C) 1999-2014, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ********************************************************************** | 5 ********************************************************************** |
6 * ucnv.h: | 6 * ucnv.h: |
7 * External APIs for the ICU's codeset conversion library | 7 * External APIs for the ICU's codeset conversion library |
8 * Bertrand A. Damiba | 8 * Bertrand A. Damiba |
9 * | 9 * |
10 * Modification History: | 10 * Modification History: |
11 * | 11 * |
12 * Date Name Description | 12 * Date Name Description |
13 * 04/04/99 helena Fixed internal header inclusion. | 13 * 04/04/99 helena Fixed internal header inclusion. |
14 * 05/11/00 helena Added setFallback and usesFallback APIs. | 14 * 05/11/00 helena Added setFallback and usesFallback APIs. |
15 * 06/29/2000 helena Major rewrite of the callback APIs. | 15 * 06/29/2000 helena Major rewrite of the callback APIs. |
16 * 12/07/2000 srl Update of documentation | 16 * 12/07/2000 srl Update of documentation |
17 */ | 17 */ |
18 | 18 |
19 /** | 19 /** |
20 * \file | 20 * \file |
21 * \brief C API: Character conversion | 21 * \brief C API: Character conversion |
22 * | 22 * |
23 * <h2>Character Conversion C API</h2> | 23 * <h2>Character Conversion C API</h2> |
24 * | 24 * |
25 * <p>This API is used to convert codepage or character encoded data to and | 25 * <p>This API is used to convert codepage or character encoded data to and |
26 * from UTF-16. You can open a converter with {@link ucnv_open() }. With that | 26 * from UTF-16. You can open a converter with {@link ucnv_open() }. With that |
27 * converter, you can get its properties, set options, convert your data and | 27 * converter, you can get its properties, set options, convert your data and |
28 * close the converter.</p> | 28 * close the converter.</p> |
29 * | 29 * |
30 * <p>Since many software programs recogize different converter names for | 30 * <p>Since many software programs recogize different converter names for |
31 * different types of converters, there are other functions in this API to | 31 * different types of converters, there are other functions in this API to |
32 * iterate over the converter aliases. The functions {@link ucnv_getAvailableNam
e() }, | 32 * iterate over the converter aliases. The functions {@link ucnv_getAvailableNam
e() }, |
33 * {@link ucnv_getAlias() } and {@link ucnv_getStandardName() } are some of the | 33 * {@link ucnv_getAlias() } and {@link ucnv_getStandardName() } are some of the |
34 * more frequently used alias functions to get this information.</p> | 34 * more frequently used alias functions to get this information.</p> |
35 * | 35 * |
36 * <p>When a converter encounters an illegal, irregular, invalid or unmappable c
haracter | 36 * <p>When a converter encounters an illegal, irregular, invalid or unmappable c
haracter |
37 * its default behavior is to use a substitution character to replace the | 37 * its default behavior is to use a substitution character to replace the |
38 * bad byte sequence. This behavior can be changed by using {@link ucnv_setFromU
CallBack() } | 38 * bad byte sequence. This behavior can be changed by using {@link ucnv_setFromU
CallBack() } |
39 * or {@link ucnv_setToUCallBack() } on the converter. The header ucnv_err.h def
ines | 39 * or {@link ucnv_setToUCallBack() } on the converter. The header ucnv_err.h def
ines |
40 * many other callback actions that can be used instead of a character substitut
ion.</p> | 40 * many other callback actions that can be used instead of a character substitut
ion.</p> |
41 * | 41 * |
42 * <p>More information about this API can be found in our | 42 * <p>More information about this API can be found in our |
43 * <a href="http://icu-project.org/userguide/conversion.html">User's | 43 * <a href="http://icu-project.org/userguide/conversion.html">User's |
44 * Guide</a>.</p> | 44 * Guide</a>.</p> |
45 */ | 45 */ |
46 | 46 |
47 #ifndef UCNV_H | 47 #ifndef UCNV_H |
48 #define UCNV_H | 48 #define UCNV_H |
49 | 49 |
50 #include "unicode/ucnv_err.h" | 50 #include "unicode/ucnv_err.h" |
51 #include "unicode/uenum.h" | 51 #include "unicode/uenum.h" |
52 #include "unicode/localpointer.h" | 52 #include "unicode/localpointer.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 /** @stable ICU 2.0 */ | 109 /** @stable ICU 2.0 */ |
110 UCNV_UTF32_LittleEndian = 8, | 110 UCNV_UTF32_LittleEndian = 8, |
111 /** @stable ICU 2.0 */ | 111 /** @stable ICU 2.0 */ |
112 UCNV_EBCDIC_STATEFUL = 9, | 112 UCNV_EBCDIC_STATEFUL = 9, |
113 /** @stable ICU 2.0 */ | 113 /** @stable ICU 2.0 */ |
114 UCNV_ISO_2022 = 10, | 114 UCNV_ISO_2022 = 10, |
115 | 115 |
116 /** @stable ICU 2.0 */ | 116 /** @stable ICU 2.0 */ |
117 UCNV_LMBCS_1 = 11, | 117 UCNV_LMBCS_1 = 11, |
118 /** @stable ICU 2.0 */ | 118 /** @stable ICU 2.0 */ |
119 UCNV_LMBCS_2, | 119 UCNV_LMBCS_2, |
120 /** @stable ICU 2.0 */ | 120 /** @stable ICU 2.0 */ |
121 UCNV_LMBCS_3, | 121 UCNV_LMBCS_3, |
122 /** @stable ICU 2.0 */ | 122 /** @stable ICU 2.0 */ |
123 UCNV_LMBCS_4, | 123 UCNV_LMBCS_4, |
124 /** @stable ICU 2.0 */ | 124 /** @stable ICU 2.0 */ |
125 UCNV_LMBCS_5, | 125 UCNV_LMBCS_5, |
126 /** @stable ICU 2.0 */ | 126 /** @stable ICU 2.0 */ |
127 UCNV_LMBCS_6, | 127 UCNV_LMBCS_6, |
128 /** @stable ICU 2.0 */ | 128 /** @stable ICU 2.0 */ |
129 UCNV_LMBCS_8, | 129 UCNV_LMBCS_8, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 U_CDECL_END | 230 U_CDECL_END |
231 | 231 |
232 /** | 232 /** |
233 * Character that separates converter names from options and options from each o
ther. | 233 * Character that separates converter names from options and options from each o
ther. |
234 * @see ucnv_open | 234 * @see ucnv_open |
235 * @stable ICU 2.0 | 235 * @stable ICU 2.0 |
236 */ | 236 */ |
237 #define UCNV_OPTION_SEP_CHAR ',' | 237 #define UCNV_OPTION_SEP_CHAR ',' |
238 | 238 |
239 /** | 239 /** |
240 * String version of UCNV_OPTION_SEP_CHAR. | 240 * String version of UCNV_OPTION_SEP_CHAR. |
241 * @see ucnv_open | 241 * @see ucnv_open |
242 * @stable ICU 2.0 | 242 * @stable ICU 2.0 |
243 */ | 243 */ |
244 #define UCNV_OPTION_SEP_STRING "," | 244 #define UCNV_OPTION_SEP_STRING "," |
245 | 245 |
246 /** | 246 /** |
247 * Character that separates a converter option from its value. | 247 * Character that separates a converter option from its value. |
248 * @see ucnv_open | 248 * @see ucnv_open |
249 * @stable ICU 2.0 | 249 * @stable ICU 2.0 |
250 */ | 250 */ |
251 #define UCNV_VALUE_SEP_CHAR '=' | 251 #define UCNV_VALUE_SEP_CHAR '=' |
252 | 252 |
253 /** | 253 /** |
254 * String version of UCNV_VALUE_SEP_CHAR. | 254 * String version of UCNV_VALUE_SEP_CHAR. |
255 * @see ucnv_open | 255 * @see ucnv_open |
256 * @stable ICU 2.0 | 256 * @stable ICU 2.0 |
257 */ | 257 */ |
258 #define UCNV_VALUE_SEP_STRING "=" | 258 #define UCNV_VALUE_SEP_STRING "=" |
259 | 259 |
260 /** | 260 /** |
261 * Converter option for specifying a locale. | 261 * Converter option for specifying a locale. |
262 * For example, ucnv_open("SCSU,locale=ja", &errorCode); | 262 * For example, ucnv_open("SCSU,locale=ja", &errorCode); |
263 * See convrtrs.txt. | 263 * See convrtrs.txt. |
264 * | 264 * |
265 * @see ucnv_open | 265 * @see ucnv_open |
266 * @stable ICU 2.0 | 266 * @stable ICU 2.0 |
267 */ | 267 */ |
268 #define UCNV_LOCALE_OPTION_STRING ",locale=" | 268 #define UCNV_LOCALE_OPTION_STRING ",locale=" |
269 | 269 |
270 /** | 270 /** |
271 * Converter option for specifying a version selector (0..9) for some converters
. | 271 * Converter option for specifying a version selector (0..9) for some converters
. |
272 * For example, | 272 * For example, |
273 * \code | 273 * \code |
274 * ucnv_open("UTF-7,version=1", &errorCode); | 274 * ucnv_open("UTF-7,version=1", &errorCode); |
275 * \endcode | 275 * \endcode |
276 * See convrtrs.txt. | 276 * See convrtrs.txt. |
277 * | 277 * |
278 * @see ucnv_open | 278 * @see ucnv_open |
279 * @stable ICU 2.4 | 279 * @stable ICU 2.4 |
280 */ | 280 */ |
281 #define UCNV_VERSION_OPTION_STRING ",version=" | 281 #define UCNV_VERSION_OPTION_STRING ",version=" |
282 | 282 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 * @return the created Unicode converter object, or <TT>NULL</TT> if an error oc
cured | 354 * @return the created Unicode converter object, or <TT>NULL</TT> if an error oc
cured |
355 * @see ucnv_openU | 355 * @see ucnv_openU |
356 * @see ucnv_openCCSID | 356 * @see ucnv_openCCSID |
357 * @see ucnv_getAvailableName | 357 * @see ucnv_getAvailableName |
358 * @see ucnv_getAlias | 358 * @see ucnv_getAlias |
359 * @see ucnv_getDefaultName | 359 * @see ucnv_getDefaultName |
360 * @see ucnv_close | 360 * @see ucnv_close |
361 * @see ucnv_compareNames | 361 * @see ucnv_compareNames |
362 * @stable ICU 2.0 | 362 * @stable ICU 2.0 |
363 */ | 363 */ |
364 U_STABLE UConverter* U_EXPORT2 | 364 U_STABLE UConverter* U_EXPORT2 |
365 ucnv_open(const char *converterName, UErrorCode *err); | 365 ucnv_open(const char *converterName, UErrorCode *err); |
366 | 366 |
367 | 367 |
368 /** | 368 /** |
369 * Creates a Unicode converter with the names specified as unicode string. | 369 * Creates a Unicode converter with the names specified as unicode string. |
370 * The name should be limited to the ASCII-7 alphanumerics range. | 370 * The name should be limited to the ASCII-7 alphanumerics range. |
371 * The actual name will be resolved with the alias file | 371 * The actual name will be resolved with the alias file |
372 * using a case-insensitive string comparison that ignores | 372 * using a case-insensitive string comparison that ignores |
373 * leading zeroes and all non-alphanumeric characters. | 373 * leading zeroes and all non-alphanumeric characters. |
374 * E.g., the names "UTF8", "utf-8", "u*T@f08" and "Utf 8" are all equivalent. | 374 * E.g., the names "UTF8", "utf-8", "u*T@f08" and "Utf 8" are all equivalent. |
375 * (See also ucnv_compareNames().) | 375 * (See also ucnv_compareNames().) |
376 * If <TT>NULL</TT> is passed for the converter name, it will create | 376 * If <TT>NULL</TT> is passed for the converter name, it will create |
377 * one with the ucnv_getDefaultName() return value. | 377 * one with the ucnv_getDefaultName() return value. |
378 * If the alias is ambiguous, then the preferred converter is used | 378 * If the alias is ambiguous, then the preferred converter is used |
379 * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. | 379 * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. |
380 * | 380 * |
381 * <p>See ucnv_open for the complete details</p> | 381 * <p>See ucnv_open for the complete details</p> |
382 * @param name Name of the UConverter table in a zero terminated | 382 * @param name Name of the UConverter table in a zero terminated |
383 * Unicode string | 383 * Unicode string |
384 * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, | 384 * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, |
385 * U_FILE_ACCESS_ERROR</TT> | 385 * U_FILE_ACCESS_ERROR</TT> |
386 * @return the created Unicode converter object, or <TT>NULL</TT> if an | 386 * @return the created Unicode converter object, or <TT>NULL</TT> if an |
387 * error occured | 387 * error occured |
388 * @see ucnv_open | 388 * @see ucnv_open |
389 * @see ucnv_openCCSID | 389 * @see ucnv_openCCSID |
390 * @see ucnv_close | 390 * @see ucnv_close |
391 * @see ucnv_compareNames | 391 * @see ucnv_compareNames |
392 * @stable ICU 2.0 | 392 * @stable ICU 2.0 |
393 */ | 393 */ |
394 U_STABLE UConverter* U_EXPORT2 | 394 U_STABLE UConverter* U_EXPORT2 |
395 ucnv_openU(const UChar *name, | 395 ucnv_openU(const UChar *name, |
396 UErrorCode *err); | 396 UErrorCode *err); |
397 | 397 |
398 /** | 398 /** |
399 * Creates a UConverter object from a CCSID number and platform pair. | 399 * Creates a UConverter object from a CCSID number and platform pair. |
400 * Note that the usefulness of this function is limited to platforms with numeri
c | 400 * Note that the usefulness of this function is limited to platforms with numeri
c |
401 * encoding IDs. Only IBM and Microsoft platforms use numeric (16-bit) identifie
rs for | 401 * encoding IDs. Only IBM and Microsoft platforms use numeric (16-bit) identifie
rs for |
402 * encodings. | 402 * encodings. |
403 * | 403 * |
404 * In addition, IBM CCSIDs and Unicode conversion tables are not 1:1 related. | 404 * In addition, IBM CCSIDs and Unicode conversion tables are not 1:1 related. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 * @see UConverterPlatform | 459 * @see UConverterPlatform |
460 * @stable ICU 2.0 | 460 * @stable ICU 2.0 |
461 */ | 461 */ |
462 U_STABLE UConverter* U_EXPORT2 | 462 U_STABLE UConverter* U_EXPORT2 |
463 ucnv_openCCSID(int32_t codepage, | 463 ucnv_openCCSID(int32_t codepage, |
464 UConverterPlatform platform, | 464 UConverterPlatform platform, |
465 UErrorCode * err); | 465 UErrorCode * err); |
466 | 466 |
467 /** | 467 /** |
468 * <p>Creates a UConverter object specified from a packageName and a converterNa
me.</p> | 468 * <p>Creates a UConverter object specified from a packageName and a converterNa
me.</p> |
469 * | 469 * |
470 * <p>The packageName and converterName must point to an ICU udata object, as de
fined by | 470 * <p>The packageName and converterName must point to an ICU udata object, as de
fined by |
471 * <code> udata_open( packageName, "cnv", converterName, err) </code> or equiv
alent. | 471 * <code> udata_open( packageName, "cnv", converterName, err) </code> or equiv
alent. |
472 * Typically, packageName will refer to a (.dat) file, or to a package registere
d with | 472 * Typically, packageName will refer to a (.dat) file, or to a package registere
d with |
473 * udata_setAppData(). Using a full file or directory pathname for packageName i
s deprecated.</p> | 473 * udata_setAppData(). Using a full file or directory pathname for packageName i
s deprecated.</p> |
474 * | 474 * |
475 * <p>The name will NOT be looked up in the alias mechanism, nor will the conver
ter be | 475 * <p>The name will NOT be looked up in the alias mechanism, nor will the conver
ter be |
476 * stored in the converter cache or the alias table. The only way to open furthe
r converters | 476 * stored in the converter cache or the alias table. The only way to open furthe
r converters |
477 * is call this function multiple times, or use the ucnv_safeClone() function to
clone a | 477 * is call this function multiple times, or use the ucnv_safeClone() function to
clone a |
478 * 'master' converter.</p> | 478 * 'master' converter.</p> |
479 * | 479 * |
480 * <p>A future version of ICU may add alias table lookups and/or caching | 480 * <p>A future version of ICU may add alias table lookups and/or caching |
481 * to this function.</p> | 481 * to this function.</p> |
482 * | 482 * |
483 * <p>Example Use: | 483 * <p>Example Use: |
484 * <code>cnv = ucnv_openPackage("myapp", "myconverter", &err);</code> | 484 * <code>cnv = ucnv_openPackage("myapp", "myconverter", &err);</code> |
485 * </p> | 485 * </p> |
486 * | 486 * |
487 * @param packageName name of the package (equivalent to 'path' in udata_open()
call) | 487 * @param packageName name of the package (equivalent to 'path' in udata_open()
call) |
488 * @param converterName name of the data item to be used, without suffix. | 488 * @param converterName name of the data item to be used, without suffix. |
489 * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS
_ERROR</TT> | 489 * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS
_ERROR</TT> |
490 * @return the created Unicode converter object, or <TT>NULL</TT> if an error oc
cured | 490 * @return the created Unicode converter object, or <TT>NULL</TT> if an error oc
cured |
491 * @see udata_open | 491 * @see udata_open |
492 * @see ucnv_open | 492 * @see ucnv_open |
493 * @see ucnv_safeClone | 493 * @see ucnv_safeClone |
494 * @see ucnv_close | 494 * @see ucnv_close |
495 * @stable ICU 2.2 | 495 * @stable ICU 2.2 |
496 */ | 496 */ |
497 U_STABLE UConverter* U_EXPORT2 | 497 U_STABLE UConverter* U_EXPORT2 |
498 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode
*err); | 498 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode
*err); |
499 | 499 |
500 /** | 500 /** |
501 * Thread safe converter cloning operation. | 501 * Thread safe converter cloning operation. |
502 * For most efficient operation, pass in a stackBuffer (and a *pBufferSize) | 502 * For most efficient operation, pass in a stackBuffer (and a *pBufferSize) |
503 * with at least U_CNV_SAFECLONE_BUFFERSIZE bytes of space. | 503 * with at least U_CNV_SAFECLONE_BUFFERSIZE bytes of space. |
504 * If the buffer size is sufficient, then the clone will use the stack buffer; | 504 * If the buffer size is sufficient, then the clone will use the stack buffer; |
505 * otherwise, it will be allocated, and *pBufferSize will indicate | 505 * otherwise, it will be allocated, and *pBufferSize will indicate |
506 * the actual size. (This should not occur with U_CNV_SAFECLONE_BUFFERSIZE.) | 506 * the actual size. (This should not occur with U_CNV_SAFECLONE_BUFFERSIZE.) |
507 * | 507 * |
508 * You must ucnv_close() the clone in any case. | 508 * You must ucnv_close() the clone in any case. |
509 * | 509 * |
510 * If *pBufferSize==0, (regardless of whether stackBuffer==NULL or not) | 510 * If *pBufferSize==0, (regardless of whether stackBuffer==NULL or not) |
511 * then *pBufferSize will be changed to a sufficient size | 511 * then *pBufferSize will be changed to a sufficient size |
512 * for cloning this converter, | 512 * for cloning this converter, |
513 * without actually cloning the converter ("pure pre-flighting"). | 513 * without actually cloning the converter ("pure pre-flighting"). |
514 * | 514 * |
515 * If *pBufferSize is greater than zero but not large enough for a stack-based | 515 * If *pBufferSize is greater than zero but not large enough for a stack-based |
516 * clone, then the converter is cloned using newly allocated memory | 516 * clone, then the converter is cloned using newly allocated memory |
517 * and *pBufferSize is changed to the necessary size. | 517 * and *pBufferSize is changed to the necessary size. |
518 * | 518 * |
519 * If the converter clone fits into the stack buffer but the stack buffer is not | 519 * If the converter clone fits into the stack buffer but the stack buffer is not |
520 * sufficiently aligned for the clone, then the clone will use an | 520 * sufficiently aligned for the clone, then the clone will use an |
521 * adjusted pointer and use an accordingly smaller buffer size. | 521 * adjusted pointer and use an accordingly smaller buffer size. |
522 * | 522 * |
523 * @param cnv converter to be cloned | 523 * @param cnv converter to be cloned |
524 * @param stackBuffer <em>Deprecated functionality as of ICU 52, use NULL.</em><
br> | 524 * @param stackBuffer <em>Deprecated functionality as of ICU 52, use NULL.</em><
br> |
525 * user allocated space for the new clone. If NULL new memory will be allocated
. | 525 * user allocated space for the new clone. If NULL new memory will be allocated
. |
526 * If buffer is not large enough, new memory will be allocated. | 526 * If buffer is not large enough, new memory will be allocated. |
527 * Clients can use the U_CNV_SAFECLONE_BUFFERSIZE. This will probably be enough
to avoid memory allocations. | 527 * Clients can use the U_CNV_SAFECLONE_BUFFERSIZE. This will probably be enough
to avoid memory allocations. |
528 * @param pBufferSize <em>Deprecated functionality as of ICU 52, use NULL or 1.<
/em><br> | 528 * @param pBufferSize <em>Deprecated functionality as of ICU 52, use NULL or 1.<
/em><br> |
529 * pointer to size of allocated space. | 529 * pointer to size of allocated space. |
530 * @param status to indicate whether the operation went on smoothly or there wer
e errors | 530 * @param status to indicate whether the operation went on smoothly or there wer
e errors |
531 * An informational status value, U_SAFECLONE_ALLOCATED_WARNING, | 531 * An informational status value, U_SAFECLONE_ALLOCATED_WARNING, |
532 * is used if any allocations were necessary. | 532 * is used if any allocations were necessary. |
533 * However, it is better to check if *pBufferSize grew for checking for | 533 * However, it is better to check if *pBufferSize grew for checking for |
534 * allocations because warning codes can be overridden by subsequent | 534 * allocations because warning codes can be overridden by subsequent |
535 * function calls. | 535 * function calls. |
536 * @return pointer to the new clone | 536 * @return pointer to the new clone |
537 * @stable ICU 2.0 | 537 * @stable ICU 2.0 |
538 */ | 538 */ |
539 U_STABLE UConverter * U_EXPORT2 | 539 U_STABLE UConverter * U_EXPORT2 |
540 ucnv_safeClone(const UConverter *cnv, | 540 ucnv_safeClone(const UConverter *cnv, |
541 void *stackBuffer, | 541 void *stackBuffer, |
542 int32_t *pBufferSize, | 542 int32_t *pBufferSize, |
543 UErrorCode *status); | 543 UErrorCode *status); |
544 | 544 |
545 #ifndef U_HIDE_DEPRECATED_API | 545 #ifndef U_HIDE_DEPRECATED_API |
546 | 546 |
547 /** | 547 /** |
548 * \def U_CNV_SAFECLONE_BUFFERSIZE | 548 * \def U_CNV_SAFECLONE_BUFFERSIZE |
549 * Definition of a buffer size that is designed to be large enough for | 549 * Definition of a buffer size that is designed to be large enough for |
550 * converters to be cloned with ucnv_safeClone(). | 550 * converters to be cloned with ucnv_safeClone(). |
551 * @deprecated ICU 52. Do not rely on ucnv_safeClone() cloning into any provided
buffer. | 551 * @deprecated ICU 52. Do not rely on ucnv_safeClone() cloning into any provided
buffer. |
552 */ | 552 */ |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 #endif | 588 #endif |
589 | 589 |
590 /** | 590 /** |
591 * Fills in the output parameter, subChars, with the substitution characters | 591 * Fills in the output parameter, subChars, with the substitution characters |
592 * as multiple bytes. | 592 * as multiple bytes. |
593 * If ucnv_setSubstString() set a Unicode string because the converter is | 593 * If ucnv_setSubstString() set a Unicode string because the converter is |
594 * stateful, then subChars will be an empty string. | 594 * stateful, then subChars will be an empty string. |
595 * | 595 * |
596 * @param converter the Unicode converter | 596 * @param converter the Unicode converter |
597 * @param subChars the subsitution characters | 597 * @param subChars the subsitution characters |
598 * @param len on input the capacity of subChars, on output the number | 598 * @param len on input the capacity of subChars, on output the number |
599 * of bytes copied to it | 599 * of bytes copied to it |
600 * @param err the outgoing error status code. | 600 * @param err the outgoing error status code. |
601 * If the substitution character array is too small, an | 601 * If the substitution character array is too small, an |
602 * <TT>U_INDEX_OUTOFBOUNDS_ERROR</TT> will be returned. | 602 * <TT>U_INDEX_OUTOFBOUNDS_ERROR</TT> will be returned. |
603 * @see ucnv_setSubstString | 603 * @see ucnv_setSubstString |
604 * @see ucnv_setSubstChars | 604 * @see ucnv_setSubstChars |
605 * @stable ICU 2.0 | 605 * @stable ICU 2.0 |
606 */ | 606 */ |
607 U_STABLE void U_EXPORT2 | 607 U_STABLE void U_EXPORT2 |
608 ucnv_getSubstChars(const UConverter *converter, | 608 ucnv_getSubstChars(const UConverter *converter, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 char *errBytes, | 686 char *errBytes, |
687 int8_t *len, | 687 int8_t *len, |
688 UErrorCode *err); | 688 UErrorCode *err); |
689 | 689 |
690 /** | 690 /** |
691 * Fills in the output parameter, errChars, with the error characters from the | 691 * Fills in the output parameter, errChars, with the error characters from the |
692 * last failing conversion. | 692 * last failing conversion. |
693 * | 693 * |
694 * @param converter the Unicode converter | 694 * @param converter the Unicode converter |
695 * @param errUChars the UChars which were in error | 695 * @param errUChars the UChars which were in error |
696 * @param len on input the capacity of errUChars, on output the number of | 696 * @param len on input the capacity of errUChars, on output the number of |
697 * UChars which were copied to it | 697 * UChars which were copied to it |
698 * @param err the error status code. | 698 * @param err the error status code. |
699 * If the substitution character array is too small, an | 699 * If the substitution character array is too small, an |
700 * <TT>U_INDEX_OUTOFBOUNDS_ERROR</TT> will be returned. | 700 * <TT>U_INDEX_OUTOFBOUNDS_ERROR</TT> will be returned. |
701 * @stable ICU 2.0 | 701 * @stable ICU 2.0 |
702 */ | 702 */ |
703 U_STABLE void U_EXPORT2 | 703 U_STABLE void U_EXPORT2 |
704 ucnv_getInvalidUChars(const UConverter *converter, | 704 ucnv_getInvalidUChars(const UConverter *converter, |
705 UChar *errUChars, | 705 UChar *errUChars, |
706 int8_t *len, | 706 int8_t *len, |
(...skipping 10 matching lines...) Expand all Loading... |
717 ucnv_reset(UConverter *converter); | 717 ucnv_reset(UConverter *converter); |
718 | 718 |
719 /** | 719 /** |
720 * Resets the to-Unicode part of a converter state to the default state. | 720 * Resets the to-Unicode part of a converter state to the default state. |
721 * This is used in the case of an error to restart a conversion to | 721 * This is used in the case of an error to restart a conversion to |
722 * Unicode to a known default state. It will also empty the internal | 722 * Unicode to a known default state. It will also empty the internal |
723 * output buffers used for the conversion to Unicode codepoints. | 723 * output buffers used for the conversion to Unicode codepoints. |
724 * @param converter the Unicode converter | 724 * @param converter the Unicode converter |
725 * @stable ICU 2.0 | 725 * @stable ICU 2.0 |
726 */ | 726 */ |
727 U_STABLE void U_EXPORT2 | 727 U_STABLE void U_EXPORT2 |
728 ucnv_resetToUnicode(UConverter *converter); | 728 ucnv_resetToUnicode(UConverter *converter); |
729 | 729 |
730 /** | 730 /** |
731 * Resets the from-Unicode part of a converter state to the default state. | 731 * Resets the from-Unicode part of a converter state to the default state. |
732 * This is used in the case of an error to restart a conversion from | 732 * This is used in the case of an error to restart a conversion from |
733 * Unicode to a known default state. It will also empty the internal output | 733 * Unicode to a known default state. It will also empty the internal output |
734 * buffers used for the conversion from Unicode codepoints. | 734 * buffers used for the conversion from Unicode codepoints. |
735 * @param converter the Unicode converter | 735 * @param converter the Unicode converter |
736 * @stable ICU 2.0 | 736 * @stable ICU 2.0 |
737 */ | 737 */ |
738 U_STABLE void U_EXPORT2 | 738 U_STABLE void U_EXPORT2 |
739 ucnv_resetFromUnicode(UConverter *converter); | 739 ucnv_resetFromUnicode(UConverter *converter); |
740 | 740 |
741 /** | 741 /** |
742 * Returns the maximum number of bytes that are output per UChar in conversion | 742 * Returns the maximum number of bytes that are output per UChar in conversion |
743 * from Unicode using this converter. | 743 * from Unicode using this converter. |
744 * The returned number can be used with UCNV_GET_MAX_BYTES_FOR_STRING | 744 * The returned number can be used with UCNV_GET_MAX_BYTES_FOR_STRING |
745 * to calculate the size of a target buffer for conversion from Unicode. | 745 * to calculate the size of a target buffer for conversion from Unicode. |
746 * | 746 * |
747 * Note: Before ICU 2.8, this function did not return reliable numbers for | 747 * Note: Before ICU 2.8, this function did not return reliable numbers for |
748 * some stateful converters (EBCDIC_STATEFUL, ISO-2022) and LMBCS. | 748 * some stateful converters (EBCDIC_STATEFUL, ISO-2022) and LMBCS. |
(...skipping 23 matching lines...) Expand all Loading... |
772 * - SBCS charsets: 1 | 772 * - SBCS charsets: 1 |
773 * - Shift-JIS: 2 | 773 * - Shift-JIS: 2 |
774 * - UTF-16: 2 (2 per BMP, 4 per surrogate _pair_, BOM not counted) | 774 * - UTF-16: 2 (2 per BMP, 4 per surrogate _pair_, BOM not counted) |
775 * - UTF-8: 3 (3 per BMP, 4 per surrogate _pair_) | 775 * - UTF-8: 3 (3 per BMP, 4 per surrogate _pair_) |
776 * - EBCDIC_STATEFUL (EBCDIC mixed SBCS/DBCS): 3 (SO + DBCS) | 776 * - EBCDIC_STATEFUL (EBCDIC mixed SBCS/DBCS): 3 (SO + DBCS) |
777 * - ISO-2022: 3 (always outputs UTF-8) | 777 * - ISO-2022: 3 (always outputs UTF-8) |
778 * - ISO-2022-JP: 6 (4-byte escape sequences + DBCS) | 778 * - ISO-2022-JP: 6 (4-byte escape sequences + DBCS) |
779 * - ISO-2022-CN: 8 (4-byte designator sequences + 2-byte SS2/SS3 + DBCS) | 779 * - ISO-2022-CN: 8 (4-byte designator sequences + 2-byte SS2/SS3 + DBCS) |
780 * | 780 * |
781 * @param converter The Unicode converter. | 781 * @param converter The Unicode converter. |
782 * @return The maximum number of bytes per UChar that are output by ucnv_fromUni
code(), | 782 * @return The maximum number of bytes per UChar (16 bit code unit) |
783 * to be used together with UCNV_GET_MAX_BYTES_FOR_STRING for buffer all
ocation. | 783 * that are output by ucnv_fromUnicode(), |
| 784 * to be used together with UCNV_GET_MAX_BYTES_FOR_STRING |
| 785 * for buffer allocation. |
784 * | 786 * |
785 * @see UCNV_GET_MAX_BYTES_FOR_STRING | 787 * @see UCNV_GET_MAX_BYTES_FOR_STRING |
786 * @see ucnv_getMinCharSize | 788 * @see ucnv_getMinCharSize |
787 * @stable ICU 2.0 | 789 * @stable ICU 2.0 |
788 */ | 790 */ |
789 U_STABLE int8_t U_EXPORT2 | 791 U_STABLE int8_t U_EXPORT2 |
790 ucnv_getMaxCharSize(const UConverter *converter); | 792 ucnv_getMaxCharSize(const UConverter *converter); |
791 | 793 |
792 /** | 794 /** |
793 * Calculates the size of a buffer for conversion from Unicode to a charset. | 795 * Calculates the size of a buffer for conversion from Unicode to a charset. |
(...skipping 11 matching lines...) Expand all Loading... |
805 * @return Size of a buffer that will be large enough to hold the output bytes o
f | 807 * @return Size of a buffer that will be large enough to hold the output bytes o
f |
806 * converting length UChars with the converter that returned the maxChar
Size. | 808 * converting length UChars with the converter that returned the maxChar
Size. |
807 * | 809 * |
808 * @see ucnv_getMaxCharSize | 810 * @see ucnv_getMaxCharSize |
809 * @stable ICU 2.8 | 811 * @stable ICU 2.8 |
810 */ | 812 */ |
811 #define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \ | 813 #define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \ |
812 (((int32_t)(length)+10)*(int32_t)(maxCharSize)) | 814 (((int32_t)(length)+10)*(int32_t)(maxCharSize)) |
813 | 815 |
814 /** | 816 /** |
815 * Returns the minimum byte length for characters in this codepage. | 817 * Returns the minimum byte length (per codepoint) for characters in this codepa
ge. |
816 * This is usually either 1 or 2. | 818 * This is usually either 1 or 2. |
817 * @param converter the Unicode converter | 819 * @param converter the Unicode converter |
818 * @return the minimum number of bytes allowed by this particular converter | 820 * @return the minimum number of bytes per codepoint allowed by this particular
converter |
819 * @see ucnv_getMaxCharSize | 821 * @see ucnv_getMaxCharSize |
820 * @stable ICU 2.0 | 822 * @stable ICU 2.0 |
821 */ | 823 */ |
822 U_STABLE int8_t U_EXPORT2 | 824 U_STABLE int8_t U_EXPORT2 |
823 ucnv_getMinCharSize(const UConverter *converter); | 825 ucnv_getMinCharSize(const UConverter *converter); |
824 | 826 |
825 /** | 827 /** |
826 * Returns the display name of the converter passed in based on the Locale | 828 * Returns the display name of the converter passed in based on the Locale |
827 * passed in. If the locale contains no display name, the internal ASCII | 829 * passed in. If the locale contains no display name, the internal ASCII |
828 * name will be filled in. | 830 * name will be filled in. |
829 * | 831 * |
830 * @param converter the Unicode converter. | 832 * @param converter the Unicode converter. |
831 * @param displayLocale is the specific Locale we want to localised for | 833 * @param displayLocale is the specific Locale we want to localised for |
832 * @param displayName user provided buffer to be filled in | 834 * @param displayName user provided buffer to be filled in |
833 * @param displayNameCapacity size of displayName Buffer | 835 * @param displayNameCapacity size of displayName Buffer |
834 * @param err error status code | 836 * @param err error status code |
835 * @return displayNameLength number of UChar needed in displayName | 837 * @return displayNameLength number of UChar needed in displayName |
836 * @see ucnv_getName | 838 * @see ucnv_getName |
837 * @stable ICU 2.0 | 839 * @stable ICU 2.0 |
838 */ | 840 */ |
839 U_STABLE int32_t U_EXPORT2 | 841 U_STABLE int32_t U_EXPORT2 |
840 ucnv_getDisplayName(const UConverter *converter, | 842 ucnv_getDisplayName(const UConverter *converter, |
841 const char *displayLocale, | 843 const char *displayLocale, |
842 UChar *displayName, | 844 UChar *displayName, |
843 int32_t displayNameCapacity, | 845 int32_t displayNameCapacity, |
844 UErrorCode *err); | 846 UErrorCode *err); |
845 | 847 |
846 /** | 848 /** |
847 * Gets the internal, canonical name of the converter (zero-terminated). | 849 * Gets the internal, canonical name of the converter (zero-terminated). |
848 * The lifetime of the returned string will be that of the converter | 850 * The lifetime of the returned string will be that of the converter |
849 * passed to this function. | 851 * passed to this function. |
850 * @param converter the Unicode converter | 852 * @param converter the Unicode converter |
851 * @param err UErrorCode status | 853 * @param err UErrorCode status |
852 * @return the internal name of the converter | 854 * @return the internal name of the converter |
853 * @see ucnv_getDisplayName | 855 * @see ucnv_getDisplayName |
854 * @stable ICU 2.0 | 856 * @stable ICU 2.0 |
855 */ | 857 */ |
856 U_STABLE const char * U_EXPORT2 | 858 U_STABLE const char * U_EXPORT2 |
857 ucnv_getName(const UConverter *converter, UErrorCode *err); | 859 ucnv_getName(const UConverter *converter, UErrorCode *err); |
858 | 860 |
859 /** | 861 /** |
860 * Gets a codepage number associated with the converter. This is not guaranteed | 862 * Gets a codepage number associated with the converter. This is not guaranteed |
861 * to be the one used to create the converter. Some converters do not represent | 863 * to be the one used to create the converter. Some converters do not represent |
862 * platform registered codepages and return zero for the codepage number. | 864 * platform registered codepages and return zero for the codepage number. |
863 * The error code fill-in parameter indicates if the codepage number | 865 * The error code fill-in parameter indicates if the codepage number |
864 * is available. | 866 * is available. |
865 * Does not check if the converter is <TT>NULL</TT> or if converter's data | 867 * Does not check if the converter is <TT>NULL</TT> or if converter's data |
866 * table is <TT>NULL</TT>. | 868 * table is <TT>NULL</TT>. |
(...skipping 10 matching lines...) Expand all Loading... |
877 * will be returned | 879 * will be returned |
878 * @see ucnv_openCCSID | 880 * @see ucnv_openCCSID |
879 * @see ucnv_getPlatform | 881 * @see ucnv_getPlatform |
880 * @stable ICU 2.0 | 882 * @stable ICU 2.0 |
881 */ | 883 */ |
882 U_STABLE int32_t U_EXPORT2 | 884 U_STABLE int32_t U_EXPORT2 |
883 ucnv_getCCSID(const UConverter *converter, | 885 ucnv_getCCSID(const UConverter *converter, |
884 UErrorCode *err); | 886 UErrorCode *err); |
885 | 887 |
886 /** | 888 /** |
887 * Gets a codepage platform associated with the converter. Currently, | 889 * Gets a codepage platform associated with the converter. Currently, |
888 * only <TT>UCNV_IBM</TT> will be returned. | 890 * only <TT>UCNV_IBM</TT> will be returned. |
889 * Does not test if the converter is <TT>NULL</TT> or if converter's data | 891 * Does not test if the converter is <TT>NULL</TT> or if converter's data |
890 * table is <TT>NULL</TT>. | 892 * table is <TT>NULL</TT>. |
891 * @param converter the Unicode converter | 893 * @param converter the Unicode converter |
892 * @param err the error status code. | 894 * @param err the error status code. |
893 * @return The codepage platform | 895 * @return The codepage platform |
894 * @stable ICU 2.0 | 896 * @stable ICU 2.0 |
895 */ | 897 */ |
896 U_STABLE UConverterPlatform U_EXPORT2 | 898 U_STABLE UConverterPlatform U_EXPORT2 |
897 ucnv_getPlatform(const UConverter *converter, | 899 ucnv_getPlatform(const UConverter *converter, |
898 UErrorCode *err); | 900 UErrorCode *err); |
899 | 901 |
900 /** | 902 /** |
901 * Gets the type of the converter | 903 * Gets the type of the converter |
902 * e.g. SBCS, MBCS, DBCS, UTF8, UTF16_BE, UTF16_LE, ISO_2022, | 904 * e.g. SBCS, MBCS, DBCS, UTF8, UTF16_BE, UTF16_LE, ISO_2022, |
903 * EBCDIC_STATEFUL, LATIN_1 | 905 * EBCDIC_STATEFUL, LATIN_1 |
904 * @param converter a valid, opened converter | 906 * @param converter a valid, opened converter |
905 * @return the type of the converter | 907 * @return the type of the converter |
906 * @stable ICU 2.0 | 908 * @stable ICU 2.0 |
907 */ | 909 */ |
908 U_STABLE UConverterType U_EXPORT2 | 910 U_STABLE UConverterType U_EXPORT2 |
909 ucnv_getType(const UConverter * converter); | 911 ucnv_getType(const UConverter * converter); |
910 | 912 |
911 /** | 913 /** |
912 * Gets the "starter" (lead) bytes for converters of type MBCS. | 914 * Gets the "starter" (lead) bytes for converters of type MBCS. |
913 * Will fill in an <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> if converter passed in | 915 * Will fill in an <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> if converter passed in |
914 * is not MBCS. Fills in an array of type UBool, with the value of the byte | 916 * is not MBCS. Fills in an array of type UBool, with the value of the byte |
915 * as offset to the array. For example, if (starters[0x20] == TRUE) at return, | 917 * as offset to the array. For example, if (starters[0x20] == TRUE) at return, |
916 * it means that the byte 0x20 is a starter byte in this converter. | 918 * it means that the byte 0x20 is a starter byte in this converter. |
917 * Context pointers are always owned by the caller. | 919 * Context pointers are always owned by the caller. |
918 * | 920 * |
919 * @param converter a valid, opened converter of type MBCS | 921 * @param converter a valid, opened converter of type MBCS |
920 * @param starters an array of size 256 to be filled in | 922 * @param starters an array of size 256 to be filled in |
921 * @param err error status, <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> if the | 923 * @param err error status, <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> if the |
922 * converter is not a type which can return starters. | 924 * converter is not a type which can return starters. |
923 * @see ucnv_getType | 925 * @see ucnv_getType |
924 * @stable ICU 2.0 | 926 * @stable ICU 2.0 |
925 */ | 927 */ |
926 U_STABLE void U_EXPORT2 | 928 U_STABLE void U_EXPORT2 |
927 ucnv_getStarters(const UConverter* converter, | 929 ucnv_getStarters(const UConverter* converter, |
928 UBool starters[256], | 930 UBool starters[256], |
929 UErrorCode* err); | 931 UErrorCode* err); |
930 | 932 |
931 | 933 |
932 /** | 934 /** |
933 * Selectors for Unicode sets that can be returned by ucnv_getUnicodeSet(). | 935 * Selectors for Unicode sets that can be returned by ucnv_getUnicodeSet(). |
934 * @see ucnv_getUnicodeSet | 936 * @see ucnv_getUnicodeSet |
935 * @stable ICU 2.6 | 937 * @stable ICU 2.6 |
936 */ | 938 */ |
937 typedef enum UConverterUnicodeSet { | 939 typedef enum UConverterUnicodeSet { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 * @stable ICU 2.6 | 992 * @stable ICU 2.6 |
991 */ | 993 */ |
992 U_STABLE void U_EXPORT2 | 994 U_STABLE void U_EXPORT2 |
993 ucnv_getUnicodeSet(const UConverter *cnv, | 995 ucnv_getUnicodeSet(const UConverter *cnv, |
994 USet *setFillIn, | 996 USet *setFillIn, |
995 UConverterUnicodeSet whichSet, | 997 UConverterUnicodeSet whichSet, |
996 UErrorCode *pErrorCode); | 998 UErrorCode *pErrorCode); |
997 | 999 |
998 /** | 1000 /** |
999 * Gets the current calback function used by the converter when an illegal | 1001 * Gets the current calback function used by the converter when an illegal |
1000 * or invalid codepage sequence is found. | 1002 * or invalid codepage sequence is found. |
1001 * Context pointers are always owned by the caller. | 1003 * Context pointers are always owned by the caller. |
1002 * | 1004 * |
1003 * @param converter the unicode converter | 1005 * @param converter the unicode converter |
1004 * @param action fillin: returns the callback function pointer | 1006 * @param action fillin: returns the callback function pointer |
1005 * @param context fillin: returns the callback's private void* context | 1007 * @param context fillin: returns the callback's private void* context |
1006 * @see ucnv_setToUCallBack | 1008 * @see ucnv_setToUCallBack |
1007 * @stable ICU 2.0 | 1009 * @stable ICU 2.0 |
1008 */ | 1010 */ |
1009 U_STABLE void U_EXPORT2 | 1011 U_STABLE void U_EXPORT2 |
1010 ucnv_getToUCallBack (const UConverter * converter, | 1012 ucnv_getToUCallBack (const UConverter * converter, |
1011 UConverterToUCallback *action, | 1013 UConverterToUCallback *action, |
1012 const void **context); | 1014 const void **context); |
1013 | 1015 |
1014 /** | 1016 /** |
1015 * Gets the current callback function used by the converter when illegal | 1017 * Gets the current callback function used by the converter when illegal |
1016 * or invalid Unicode sequence is found. | 1018 * or invalid Unicode sequence is found. |
1017 * Context pointers are always owned by the caller. | 1019 * Context pointers are always owned by the caller. |
1018 * | 1020 * |
1019 * @param converter the unicode converter | 1021 * @param converter the unicode converter |
1020 * @param action fillin: returns the callback function pointer | 1022 * @param action fillin: returns the callback function pointer |
1021 * @param context fillin: returns the callback's private void* context | 1023 * @param context fillin: returns the callback's private void* context |
1022 * @see ucnv_setFromUCallBack | 1024 * @see ucnv_setFromUCallBack |
1023 * @stable ICU 2.0 | 1025 * @stable ICU 2.0 |
1024 */ | 1026 */ |
1025 U_STABLE void U_EXPORT2 | 1027 U_STABLE void U_EXPORT2 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 const void *newContext, | 1073 const void *newContext, |
1072 UConverterFromUCallback *oldAction, | 1074 UConverterFromUCallback *oldAction, |
1073 const void **oldContext, | 1075 const void **oldContext, |
1074 UErrorCode * err); | 1076 UErrorCode * err); |
1075 | 1077 |
1076 /** | 1078 /** |
1077 * Converts an array of unicode characters to an array of codepage | 1079 * Converts an array of unicode characters to an array of codepage |
1078 * characters. This function is optimized for converting a continuous | 1080 * characters. This function is optimized for converting a continuous |
1079 * stream of data in buffer-sized chunks, where the entire source and | 1081 * stream of data in buffer-sized chunks, where the entire source and |
1080 * target does not fit in available buffers. | 1082 * target does not fit in available buffers. |
1081 * | 1083 * |
1082 * The source pointer is an in/out parameter. It starts out pointing where the | 1084 * The source pointer is an in/out parameter. It starts out pointing where the |
1083 * conversion is to begin, and ends up pointing after the last UChar consumed. | 1085 * conversion is to begin, and ends up pointing after the last UChar consumed. |
1084 * | 1086 * |
1085 * Target similarly starts out pointer at the first available byte in the output | 1087 * Target similarly starts out pointer at the first available byte in the output |
1086 * buffer, and ends up pointing after the last byte written to the output. | 1088 * buffer, and ends up pointing after the last byte written to the output. |
1087 * | 1089 * |
1088 * The converter always attempts to consume the entire source buffer, unless | 1090 * The converter always attempts to consume the entire source buffer, unless |
1089 * (1.) the target buffer is full, or (2.) a failing error is returned from the | 1091 * (1.) the target buffer is full, or (2.) a failing error is returned from the |
1090 * current callback function. When a successful error status has been | 1092 * current callback function. When a successful error status has been |
1091 * returned, it means that all of the source buffer has been | 1093 * returned, it means that all of the source buffer has been |
1092 * consumed. At that point, the caller should reset the source and | 1094 * consumed. At that point, the caller should reset the source and |
1093 * sourceLimit pointers to point to the next chunk. | 1095 * sourceLimit pointers to point to the next chunk. |
1094 * | 1096 * |
1095 * At the end of the stream (flush==TRUE), the input is completely consumed | 1097 * At the end of the stream (flush==TRUE), the input is completely consumed |
1096 * when *source==sourceLimit and no error code is set. | 1098 * when *source==sourceLimit and no error code is set. |
1097 * The converter object is then automatically reset by this function. | 1099 * The converter object is then automatically reset by this function. |
1098 * (This means that a converter need not be reset explicitly between data | 1100 * (This means that a converter need not be reset explicitly between data |
1099 * streams if it finishes the previous stream without errors.) | 1101 * streams if it finishes the previous stream without errors.) |
1100 * | 1102 * |
1101 * This is a <I>stateful</I> conversion. Additionally, even when all source data
has | 1103 * This is a <I>stateful</I> conversion. Additionally, even when all source data
has |
1102 * been consumed, some data may be in the converters' internal state. | 1104 * been consumed, some data may be in the converters' internal state. |
1103 * Call this function repeatedly, updating the target pointers with | 1105 * Call this function repeatedly, updating the target pointers with |
1104 * the next empty chunk of target in case of a | 1106 * the next empty chunk of target in case of a |
1105 * <TT>U_BUFFER_OVERFLOW_ERROR</TT>, and updating the source pointers | 1107 * <TT>U_BUFFER_OVERFLOW_ERROR</TT>, and updating the source pointers |
1106 * with the next chunk of source when a successful error status is | 1108 * with the next chunk of source when a successful error status is |
1107 * returned, until there are no more chunks of source data. | 1109 * returned, until there are no more chunks of source data. |
1108 * @param converter the Unicode converter | 1110 * @param converter the Unicode converter |
1109 * @param target I/O parameter. Input : Points to the beginning of the buffer to
copy | 1111 * @param target I/O parameter. Input : Points to the beginning of the buffer to
copy |
1110 * codepage characters to. Output : points to after the last codepage character
copied | 1112 * codepage characters to. Output : points to after the last codepage character
copied |
1111 * to <TT>target</TT>. | 1113 * to <TT>target</TT>. |
1112 * @param targetLimit the pointer just after last of the <TT>target</TT> buffer | 1114 * @param targetLimit the pointer just after last of the <TT>target</TT> buffer |
1113 * @param source I/O parameter, pointer to pointer to the source Unicode charact
er buffer. | 1115 * @param source I/O parameter, pointer to pointer to the source Unicode charact
er buffer. |
1114 * @param sourceLimit the pointer just after the last of the source buffer | 1116 * @param sourceLimit the pointer just after the last of the source buffer |
1115 * @param offsets if NULL is passed, nothing will happen to it, otherwise it nee
ds to have the same number | 1117 * @param offsets if NULL is passed, nothing will happen to it, otherwise it nee
ds to have the same number |
1116 * of allocated cells as <TT>target</TT>. Will fill in offsets from target to so
urce pointer | 1118 * of allocated cells as <TT>target</TT>. Will fill in offsets from target to so
urce pointer |
1117 * e.g: <TT>offsets[3]</TT> is equal to 6, it means that the <TT>target[3]</TT>
was a result of transcoding <TT>source[6]</TT> | 1119 * e.g: <TT>offsets[3]</TT> is equal to 6, it means that the <TT>target[3]</TT>
was a result of transcoding <TT>source[6]</TT> |
1118 * For output data carried across calls, and other data without a specific sourc
e character | 1120 * For output data carried across calls, and other data without a specific sourc
e character |
1119 * (such as from escape sequences or callbacks) -1 will be placed for offsets. | 1121 * (such as from escape sequences or callbacks) -1 will be placed for offsets. |
1120 * @param flush set to <TT>TRUE</TT> if the current source buffer is the last av
ailable | 1122 * @param flush set to <TT>TRUE</TT> if the current source buffer is the last av
ailable |
1121 * chunk of the source, <TT>FALSE</TT> otherwise. Note that if a failing status
is returned, | 1123 * chunk of the source, <TT>FALSE</TT> otherwise. Note that if a failing status
is returned, |
1122 * this function may have to be called multiple times with flush set to <TT>TRUE
</TT> until | 1124 * this function may have to be called multiple times with flush set to <TT>TRUE
</TT> until |
1123 * the source buffer is consumed. | 1125 * the source buffer is consumed. |
1124 * @param err the error status. <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> will be set i
f the | 1126 * @param err the error status. <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> will be set i
f the |
1125 * converter is <TT>NULL</TT>. | 1127 * converter is <TT>NULL</TT>. |
1126 * <code>U_BUFFER_OVERFLOW_ERROR</code> will be set if the target is full and th
ere is | 1128 * <code>U_BUFFER_OVERFLOW_ERROR</code> will be set if the target is full and th
ere is |
1127 * still data to be written to the target. | 1129 * still data to be written to the target. |
1128 * @see ucnv_fromUChars | 1130 * @see ucnv_fromUChars |
1129 * @see ucnv_convert | 1131 * @see ucnv_convert |
1130 * @see ucnv_getMinCharSize | 1132 * @see ucnv_getMinCharSize |
1131 * @see ucnv_setToUCallBack | 1133 * @see ucnv_setToUCallBack |
1132 * @stable ICU 2.0 | 1134 * @stable ICU 2.0 |
1133 */ | 1135 */ |
1134 U_STABLE void U_EXPORT2 | 1136 U_STABLE void U_EXPORT2 |
1135 ucnv_fromUnicode (UConverter * converter, | 1137 ucnv_fromUnicode (UConverter * converter, |
1136 char **target, | 1138 char **target, |
1137 const char *targetLimit, | 1139 const char *targetLimit, |
1138 const UChar ** source, | 1140 const UChar ** source, |
1139 const UChar * sourceLimit, | 1141 const UChar * sourceLimit, |
1140 int32_t* offsets, | 1142 int32_t* offsets, |
1141 UBool flush, | 1143 UBool flush, |
1142 UErrorCode * err); | 1144 UErrorCode * err); |
1143 | 1145 |
1144 /** | 1146 /** |
1145 * Converts a buffer of codepage bytes into an array of unicode UChars | 1147 * Converts a buffer of codepage bytes into an array of unicode UChars |
1146 * characters. This function is optimized for converting a continuous | 1148 * characters. This function is optimized for converting a continuous |
1147 * stream of data in buffer-sized chunks, where the entire source and | 1149 * stream of data in buffer-sized chunks, where the entire source and |
1148 * target does not fit in available buffers. | 1150 * target does not fit in available buffers. |
1149 * | 1151 * |
1150 * The source pointer is an in/out parameter. It starts out pointing where the | 1152 * The source pointer is an in/out parameter. It starts out pointing where the |
1151 * conversion is to begin, and ends up pointing after the last byte of source co
nsumed. | 1153 * conversion is to begin, and ends up pointing after the last byte of source co
nsumed. |
1152 * | 1154 * |
1153 * Target similarly starts out pointer at the first available UChar in the outpu
t | 1155 * Target similarly starts out pointer at the first available UChar in the outpu
t |
1154 * buffer, and ends up pointing after the last UChar written to the output. | 1156 * buffer, and ends up pointing after the last UChar written to the output. |
1155 * It does NOT necessarily keep UChar sequences together. | 1157 * It does NOT necessarily keep UChar sequences together. |
1156 * | 1158 * |
1157 * The converter always attempts to consume the entire source buffer, unless | 1159 * The converter always attempts to consume the entire source buffer, unless |
1158 * (1.) the target buffer is full, or (2.) a failing error is returned from the | 1160 * (1.) the target buffer is full, or (2.) a failing error is returned from the |
1159 * current callback function. When a successful error status has been | 1161 * current callback function. When a successful error status has been |
1160 * returned, it means that all of the source buffer has been | 1162 * returned, it means that all of the source buffer has been |
1161 * consumed. At that point, the caller should reset the source and | 1163 * consumed. At that point, the caller should reset the source and |
1162 * sourceLimit pointers to point to the next chunk. | 1164 * sourceLimit pointers to point to the next chunk. |
1163 * | 1165 * |
1164 * At the end of the stream (flush==TRUE), the input is completely consumed | 1166 * At the end of the stream (flush==TRUE), the input is completely consumed |
1165 * when *source==sourceLimit and no error code is set | 1167 * when *source==sourceLimit and no error code is set |
1166 * The converter object is then automatically reset by this function. | 1168 * The converter object is then automatically reset by this function. |
1167 * (This means that a converter need not be reset explicitly between data | 1169 * (This means that a converter need not be reset explicitly between data |
1168 * streams if it finishes the previous stream without errors.) | 1170 * streams if it finishes the previous stream without errors.) |
1169 * | 1171 * |
1170 * This is a <I>stateful</I> conversion. Additionally, even when all source data
has | 1172 * This is a <I>stateful</I> conversion. Additionally, even when all source data
has |
1171 * been consumed, some data may be in the converters' internal state. | 1173 * been consumed, some data may be in the converters' internal state. |
1172 * Call this function repeatedly, updating the target pointers with | 1174 * Call this function repeatedly, updating the target pointers with |
1173 * the next empty chunk of target in case of a | 1175 * the next empty chunk of target in case of a |
1174 * <TT>U_BUFFER_OVERFLOW_ERROR</TT>, and updating the source pointers | 1176 * <TT>U_BUFFER_OVERFLOW_ERROR</TT>, and updating the source pointers |
1175 * with the next chunk of source when a successful error status is | 1177 * with the next chunk of source when a successful error status is |
1176 * returned, until there are no more chunks of source data. | 1178 * returned, until there are no more chunks of source data. |
1177 * @param converter the Unicode converter | 1179 * @param converter the Unicode converter |
1178 * @param target I/O parameter. Input : Points to the beginning of the buffer to
copy | 1180 * @param target I/O parameter. Input : Points to the beginning of the buffer to
copy |
1179 * UChars into. Output : points to after the last UChar copied. | 1181 * UChars into. Output : points to after the last UChar copied. |
1180 * @param targetLimit the pointer just after the end of the <TT>target</TT> buff
er | 1182 * @param targetLimit the pointer just after the end of the <TT>target</TT> buff
er |
1181 * @param source I/O parameter, pointer to pointer to the source codepage buffer
. | 1183 * @param source I/O parameter, pointer to pointer to the source codepage buffer
. |
1182 * @param sourceLimit the pointer to the byte after the end of the source buffer | 1184 * @param sourceLimit the pointer to the byte after the end of the source buffer |
1183 * @param offsets if NULL is passed, nothing will happen to it, otherwise it nee
ds to have the same number | 1185 * @param offsets if NULL is passed, nothing will happen to it, otherwise it nee
ds to have the same number |
1184 * of allocated cells as <TT>target</TT>. Will fill in offsets from target to so
urce pointer | 1186 * of allocated cells as <TT>target</TT>. Will fill in offsets from target to so
urce pointer |
1185 * e.g: <TT>offsets[3]</TT> is equal to 6, it means that the <TT>target[3]</TT>
was a result of transcoding <TT>source[6]</TT> | 1187 * e.g: <TT>offsets[3]</TT> is equal to 6, it means that the <TT>target[3]</TT>
was a result of transcoding <TT>source[6]</TT> |
1186 * For output data carried across calls, and other data without a specific sourc
e character | 1188 * For output data carried across calls, and other data without a specific sourc
e character |
1187 * (such as from escape sequences or callbacks) -1 will be placed for offsets. | 1189 * (such as from escape sequences or callbacks) -1 will be placed for offsets. |
1188 * @param flush set to <TT>TRUE</TT> if the current source buffer is the last av
ailable | 1190 * @param flush set to <TT>TRUE</TT> if the current source buffer is the last av
ailable |
1189 * chunk of the source, <TT>FALSE</TT> otherwise. Note that if a failing status
is returned, | 1191 * chunk of the source, <TT>FALSE</TT> otherwise. Note that if a failing status
is returned, |
1190 * this function may have to be called multiple times with flush set to <TT>TRUE
</TT> until | 1192 * this function may have to be called multiple times with flush set to <TT>TRUE
</TT> until |
1191 * the source buffer is consumed. | 1193 * the source buffer is consumed. |
1192 * @param err the error status. <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> will be set i
f the | 1194 * @param err the error status. <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> will be set i
f the |
1193 * converter is <TT>NULL</TT>. | 1195 * converter is <TT>NULL</TT>. |
1194 * <code>U_BUFFER_OVERFLOW_ERROR</code> will be set if the target is full and th
ere is | 1196 * <code>U_BUFFER_OVERFLOW_ERROR</code> will be set if the target is full and th
ere is |
1195 * still data to be written to the target. | 1197 * still data to be written to the target. |
1196 * @see ucnv_fromUChars | 1198 * @see ucnv_fromUChars |
1197 * @see ucnv_convert | 1199 * @see ucnv_convert |
1198 * @see ucnv_getMinCharSize | 1200 * @see ucnv_getMinCharSize |
1199 * @see ucnv_setFromUCallBack | 1201 * @see ucnv_setFromUCallBack |
1200 * @see ucnv_getNextUChar | 1202 * @see ucnv_getNextUChar |
1201 * @stable ICU 2.0 | 1203 * @stable ICU 2.0 |
1202 */ | 1204 */ |
1203 U_STABLE void U_EXPORT2 | 1205 U_STABLE void U_EXPORT2 |
1204 ucnv_toUnicode(UConverter *converter, | 1206 ucnv_toUnicode(UConverter *converter, |
1205 UChar **target, | 1207 UChar **target, |
1206 const UChar *targetLimit, | 1208 const UChar *targetLimit, |
1207 const char **source, | 1209 const char **source, |
1208 const char *sourceLimit, | 1210 const char *sourceLimit, |
1209 int32_t *offsets, | 1211 int32_t *offsets, |
1210 UBool flush, | 1212 UBool flush, |
1211 UErrorCode *err); | 1213 UErrorCode *err); |
1212 | 1214 |
1213 /** | 1215 /** |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 * For these codepages, matching pairs of surrogates will be combined into
single | 1326 * For these codepages, matching pairs of surrogates will be combined into
single |
1325 * code points for returning from this function. | 1327 * code points for returning from this function. |
1326 * (Note that SCSU is actually a mix of these codepage types.)</li> | 1328 * (Note that SCSU is actually a mix of these codepage types.)</li> |
1327 * </ul></p> | 1329 * </ul></p> |
1328 * | 1330 * |
1329 * @param converter an open UConverter | 1331 * @param converter an open UConverter |
1330 * @param source the address of a pointer to the codepage buffer, will be | 1332 * @param source the address of a pointer to the codepage buffer, will be |
1331 * updated to point after the bytes consumed in the conversion call. | 1333 * updated to point after the bytes consumed in the conversion call. |
1332 * @param sourceLimit points to the end of the input buffer | 1334 * @param sourceLimit points to the end of the input buffer |
1333 * @param err fills in error status (see ucnv_toUnicode) | 1335 * @param err fills in error status (see ucnv_toUnicode) |
1334 * <code>U_INDEX_OUTOFBOUNDS_ERROR</code> will be set if the input | 1336 * <code>U_INDEX_OUTOFBOUNDS_ERROR</code> will be set if the input |
1335 * is empty or does not convert to any output (e.g.: pure state-change | 1337 * is empty or does not convert to any output (e.g.: pure state-change |
1336 * codes SI/SO, escape sequences for ISO 2022, | 1338 * codes SI/SO, escape sequences for ISO 2022, |
1337 * or if the callback did not output anything, ...). | 1339 * or if the callback did not output anything, ...). |
1338 * This function will not set a <code>U_BUFFER_OVERFLOW_ERROR</code> because | 1340 * This function will not set a <code>U_BUFFER_OVERFLOW_ERROR</code> because |
1339 * the "buffer" is the return code. However, there might be subsequent output | 1341 * the "buffer" is the return code. However, there might be subsequent output |
1340 * stored in the converter object | 1342 * stored in the converter object |
1341 * that will be returned in following calls to this function. | 1343 * that will be returned in following calls to this function. |
1342 * @return a UChar32 resulting from the partial conversion of source | 1344 * @return a UChar32 resulting from the partial conversion of source |
1343 * @see ucnv_toUnicode | 1345 * @see ucnv_toUnicode |
1344 * @see ucnv_toUChars | 1346 * @see ucnv_toUChars |
1345 * @see ucnv_convert | 1347 * @see ucnv_convert |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 * if(length<0) { | 1431 * if(length<0) { |
1430 * length=strlen(s); | 1432 * length=strlen(s); |
1431 * } | 1433 * } |
1432 * target=u8; | 1434 * target=u8; |
1433 * ucnv_convertEx(utf8Cnv, cnv, | 1435 * ucnv_convertEx(utf8Cnv, cnv, |
1434 * &target, u8+capacity, | 1436 * &target, u8+capacity, |
1435 * &s, s+length, | 1437 * &s, s+length, |
1436 * NULL, NULL, NULL, NULL, | 1438 * NULL, NULL, NULL, NULL, |
1437 * TRUE, TRUE, | 1439 * TRUE, TRUE, |
1438 * pErrorCode); | 1440 * pErrorCode); |
1439 * | 1441 * |
1440 * myReleaseCachedUTF8Converter(utf8Cnv); | 1442 * myReleaseCachedUTF8Converter(utf8Cnv); |
1441 * | 1443 * |
1442 * // return the output string length, but without preflighting | 1444 * // return the output string length, but without preflighting |
1443 * return (int32_t)(target-u8); | 1445 * return (int32_t)(target-u8); |
1444 * } | 1446 * } |
1445 * \endcode | 1447 * \endcode |
1446 * | 1448 * |
1447 * @param targetCnv Output converter, used to convert from the UTF-16 pivot | 1449 * @param targetCnv Output converter, used to convert from the UTF-16 pivot |
1448 * to the target using ucnv_fromUnicode(). | 1450 * to the target using ucnv_fromUnicode(). |
1449 * @param sourceCnv Input converter, used to convert from the source to | 1451 * @param sourceCnv Input converter, used to convert from the source to |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 /** | 1719 /** |
1718 * Gives the number of aliases for a given converter or alias name. | 1720 * Gives the number of aliases for a given converter or alias name. |
1719 * If the alias is ambiguous, then the preferred converter is used | 1721 * If the alias is ambiguous, then the preferred converter is used |
1720 * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. | 1722 * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. |
1721 * This method only enumerates the listed entries in the alias file. | 1723 * This method only enumerates the listed entries in the alias file. |
1722 * @param alias alias name | 1724 * @param alias alias name |
1723 * @param pErrorCode error status | 1725 * @param pErrorCode error status |
1724 * @return number of names on alias list for given alias | 1726 * @return number of names on alias list for given alias |
1725 * @stable ICU 2.0 | 1727 * @stable ICU 2.0 |
1726 */ | 1728 */ |
1727 U_STABLE uint16_t U_EXPORT2 | 1729 U_STABLE uint16_t U_EXPORT2 |
1728 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode); | 1730 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode); |
1729 | 1731 |
1730 /** | 1732 /** |
1731 * Gives the name of the alias at given index of alias list. | 1733 * Gives the name of the alias at given index of alias list. |
1732 * This method only enumerates the listed entries in the alias file. | 1734 * This method only enumerates the listed entries in the alias file. |
1733 * If the alias is ambiguous, then the preferred converter is used | 1735 * If the alias is ambiguous, then the preferred converter is used |
1734 * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. | 1736 * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. |
1735 * @param alias alias name | 1737 * @param alias alias name |
1736 * @param n index in alias list | 1738 * @param n index in alias list |
1737 * @param pErrorCode result of operation | 1739 * @param pErrorCode result of operation |
1738 * @return returns the name of the alias at given index | 1740 * @return returns the name of the alias at given index |
1739 * @see ucnv_countAliases | 1741 * @see ucnv_countAliases |
1740 * @stable ICU 2.0 | 1742 * @stable ICU 2.0 |
1741 */ | 1743 */ |
1742 U_STABLE const char * U_EXPORT2 | 1744 U_STABLE const char * U_EXPORT2 |
1743 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode); | 1745 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode); |
1744 | 1746 |
1745 /** | 1747 /** |
1746 * Fill-up the list of alias names for the given alias. | 1748 * Fill-up the list of alias names for the given alias. |
1747 * This method only enumerates the listed entries in the alias file. | 1749 * This method only enumerates the listed entries in the alias file. |
1748 * If the alias is ambiguous, then the preferred converter is used | 1750 * If the alias is ambiguous, then the preferred converter is used |
1749 * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. | 1751 * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. |
1750 * @param alias alias name | 1752 * @param alias alias name |
1751 * @param aliases fill-in list, aliases is a pointer to an array of | 1753 * @param aliases fill-in list, aliases is a pointer to an array of |
1752 * <code>ucnv_countAliases()</code> string-pointers | 1754 * <code>ucnv_countAliases()</code> string-pointers |
1753 * (<code>const char *</code>) that will be filled in. | 1755 * (<code>const char *</code>) that will be filled in. |
1754 * The strings themselves are owned by the library. | 1756 * The strings themselves are owned by the library. |
1755 * @param pErrorCode result of operation | 1757 * @param pErrorCode result of operation |
1756 * @stable ICU 2.0 | 1758 * @stable ICU 2.0 |
1757 */ | 1759 */ |
1758 U_STABLE void U_EXPORT2 | 1760 U_STABLE void U_EXPORT2 |
1759 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode)
; | 1761 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode)
; |
1760 | 1762 |
1761 /** | 1763 /** |
1762 * Return a new UEnumeration object for enumerating all the | 1764 * Return a new UEnumeration object for enumerating all the |
1763 * alias names for a given converter that are recognized by a standard. | 1765 * alias names for a given converter that are recognized by a standard. |
1764 * This method only enumerates the listed entries in the alias file. | 1766 * This method only enumerates the listed entries in the alias file. |
1765 * The convrtrs.txt file can be modified to change the results of | 1767 * The convrtrs.txt file can be modified to change the results of |
1766 * this function. | 1768 * this function. |
1767 * The first result in this list is the same result given by | 1769 * The first result in this list is the same result given by |
1768 * <code>ucnv_getStandardName</code>, which is the default alias for | 1770 * <code>ucnv_getStandardName</code>, which is the default alias for |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 * @param name the converter name to be the default (must be known by ICU). | 1882 * @param name the converter name to be the default (must be known by ICU). |
1881 * @see ucnv_getDefaultName | 1883 * @see ucnv_getDefaultName |
1882 * @system | 1884 * @system |
1883 * @stable ICU 2.0 | 1885 * @stable ICU 2.0 |
1884 */ | 1886 */ |
1885 U_STABLE void U_EXPORT2 | 1887 U_STABLE void U_EXPORT2 |
1886 ucnv_setDefaultName(const char *name); | 1888 ucnv_setDefaultName(const char *name); |
1887 #endif /* U_HIDE_SYSTEM_API */ | 1889 #endif /* U_HIDE_SYSTEM_API */ |
1888 | 1890 |
1889 /** | 1891 /** |
1890 * Fixes the backslash character mismapping. For example, in SJIS, the backslas
h | 1892 * Fixes the backslash character mismapping. For example, in SJIS, the backslas
h |
1891 * character in the ASCII portion is also used to represent the yen currency sig
n. | 1893 * character in the ASCII portion is also used to represent the yen currency sig
n. |
1892 * When mapping from Unicode character 0x005C, it's unclear whether to map the | 1894 * When mapping from Unicode character 0x005C, it's unclear whether to map the |
1893 * character back to yen or backslash in SJIS. This function will take the inpu
t | 1895 * character back to yen or backslash in SJIS. This function will take the inpu
t |
1894 * buffer and replace all the yen sign characters with backslash. This is neces
sary | 1896 * buffer and replace all the yen sign characters with backslash. This is neces
sary |
1895 * when the user tries to open a file with the input buffer on Windows. | 1897 * when the user tries to open a file with the input buffer on Windows. |
1896 * This function will test the converter to see whether such mapping is | 1898 * This function will test the converter to see whether such mapping is |
1897 * required. You can sometimes avoid using this function by using the correct v
ersion | 1899 * required. You can sometimes avoid using this function by using the correct v
ersion |
1898 * of Shift-JIS. | 1900 * of Shift-JIS. |
1899 * | 1901 * |
1900 * @param cnv The converter representing the target codepage. | 1902 * @param cnv The converter representing the target codepage. |
1901 * @param source the input buffer to be fixed | 1903 * @param source the input buffer to be fixed |
1902 * @param sourceLen the length of the input buffer | 1904 * @param sourceLen the length of the input buffer |
1903 * @see ucnv_isAmbiguous | 1905 * @see ucnv_isAmbiguous |
1904 * @stable ICU 2.0 | 1906 * @stable ICU 2.0 |
1905 */ | 1907 */ |
1906 U_STABLE void U_EXPORT2 | 1908 U_STABLE void U_EXPORT2 |
1907 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen); | 1909 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen); |
1908 | 1910 |
1909 /** | 1911 /** |
1910 * Determines if the converter contains ambiguous mappings of the same | 1912 * Determines if the converter contains ambiguous mappings of the same |
1911 * character or not. | 1913 * character or not. |
1912 * @param cnv the converter to be tested | 1914 * @param cnv the converter to be tested |
1913 * @return TRUE if the converter contains ambiguous mapping of the same | 1915 * @return TRUE if the converter contains ambiguous mapping of the same |
1914 * character, FALSE otherwise. | 1916 * character, FALSE otherwise. |
1915 * @stable ICU 2.0 | 1917 * @stable ICU 2.0 |
1916 */ | 1918 */ |
1917 U_STABLE UBool U_EXPORT2 | 1919 U_STABLE UBool U_EXPORT2 |
1918 ucnv_isAmbiguous(const UConverter *cnv); | 1920 ucnv_isAmbiguous(const UConverter *cnv); |
1919 | 1921 |
1920 /** | 1922 /** |
1921 * Sets the converter to use fallback mappings or not. | 1923 * Sets the converter to use fallback mappings or not. |
1922 * Regardless of this flag, the converter will always use | 1924 * Regardless of this flag, the converter will always use |
1923 * fallbacks from Unicode Private Use code points, as well as | 1925 * fallbacks from Unicode Private Use code points, as well as |
1924 * reverse fallbacks (to Unicode). | 1926 * reverse fallbacks (to Unicode). |
1925 * For details see ".ucm File Format" | 1927 * For details see ".ucm File Format" |
1926 * in the Conversion Data chapter of the ICU User Guide: | 1928 * in the Conversion Data chapter of the ICU User Guide: |
1927 * http://www.icu-project.org/userguide/conversion-data.html#ucmformat | 1929 * http://www.icu-project.org/userguide/conversion-data.html#ucmformat |
1928 * | 1930 * |
1929 * @param cnv The converter to set the fallback mapping usage on. | 1931 * @param cnv The converter to set the fallback mapping usage on. |
1930 * @param usesFallback TRUE if the user wants the converter to take advantage of
the fallback | 1932 * @param usesFallback TRUE if the user wants the converter to take advantage of
the fallback |
1931 * mapping, FALSE otherwise. | 1933 * mapping, FALSE otherwise. |
1932 * @stable ICU 2.0 | 1934 * @stable ICU 2.0 |
1933 * @see ucnv_usesFallback | 1935 * @see ucnv_usesFallback |
1934 */ | 1936 */ |
1935 U_STABLE void U_EXPORT2 | 1937 U_STABLE void U_EXPORT2 |
1936 ucnv_setFallback(UConverter *cnv, UBool usesFallback); | 1938 ucnv_setFallback(UConverter *cnv, UBool usesFallback); |
1937 | 1939 |
1938 /** | 1940 /** |
1939 * Determines if the converter uses fallback mappings or not. | 1941 * Determines if the converter uses fallback mappings or not. |
1940 * This flag has restrictions, see ucnv_setFallback(). | 1942 * This flag has restrictions, see ucnv_setFallback(). |
1941 * | 1943 * |
1942 * @param cnv The converter to be tested | 1944 * @param cnv The converter to be tested |
1943 * @return TRUE if the converter uses fallback, FALSE otherwise. | 1945 * @return TRUE if the converter uses fallback, FALSE otherwise. |
1944 * @stable ICU 2.0 | 1946 * @stable ICU 2.0 |
1945 * @see ucnv_setFallback | 1947 * @see ucnv_setFallback |
1946 */ | 1948 */ |
1947 U_STABLE UBool U_EXPORT2 | 1949 U_STABLE UBool U_EXPORT2 |
1948 ucnv_usesFallback(const UConverter *cnv); | 1950 ucnv_usesFallback(const UConverter *cnv); |
1949 | 1951 |
1950 /** | 1952 /** |
1951 * Detects Unicode signature byte sequences at the start of the byte stream | 1953 * Detects Unicode signature byte sequences at the start of the byte stream |
1952 * and returns the charset name of the indicated Unicode charset. | 1954 * and returns the charset name of the indicated Unicode charset. |
1953 * NULL is returned when no Unicode signature is recognized. | 1955 * NULL is returned when no Unicode signature is recognized. |
1954 * The number of bytes in the signature is output as well. | 1956 * The number of bytes in the signature is output as well. |
1955 * | 1957 * |
1956 * The caller can ucnv_open() a converter using the charset name. | 1958 * The caller can ucnv_open() a converter using the charset name. |
1957 * The first code unit (UChar) from the start of the stream will be U+FEFF | 1959 * The first code unit (UChar) from the start of the stream will be U+FEFF |
1958 * (the Unicode BOM/signature character) and can usually be ignored. | 1960 * (the Unicode BOM/signature character) and can usually be ignored. |
1959 * | 1961 * |
1960 * For most Unicode charsets it is also possible to ignore the indicated | 1962 * For most Unicode charsets it is also possible to ignore the indicated |
1961 * number of initial stream bytes and start converting after them. | 1963 * number of initial stream bytes and start converting after them. |
1962 * However, there are stateful Unicode charsets (UTF-7 and BOCU-1) for which | 1964 * However, there are stateful Unicode charsets (UTF-7 and BOCU-1) for which |
1963 * this will not work. Therefore, it is best to ignore the first output UChar | 1965 * this will not work. Therefore, it is best to ignore the first output UChar |
1964 * instead of the input signature bytes. | 1966 * instead of the input signature bytes. |
1965 * <p> | 1967 * <p> |
1966 * Usage: | 1968 * Usage: |
1967 * \snippet samples/ucnv/convsamp.cpp ucnv_detectUnicodeSignature | 1969 * \snippet samples/ucnv/convsamp.cpp ucnv_detectUnicodeSignature |
1968 * | 1970 * |
1969 * @param source The source string in which the signature should be d
etected. | 1971 * @param source The source string in which the signature should be d
etected. |
1970 * @param sourceLength Length of the input string, or -1 if terminated with
a NUL byte. | 1972 * @param sourceLength Length of the input string, or -1 if terminated with
a NUL byte. |
1971 * @param signatureLength A pointer to int32_t to receive the number of bytes
that make up the signature | 1973 * @param signatureLength A pointer to int32_t to receive the number of bytes
that make up the signature |
1972 * of the detected UTF. 0 if not detected. | 1974 * of the detected UTF. 0 if not detected. |
1973 * Can be a NULL pointer. | 1975 * Can be a NULL pointer. |
1974 * @param pErrorCode ICU error code in/out parameter. | 1976 * @param pErrorCode ICU error code in/out parameter. |
1975 * Must fulfill U_SUCCESS before the function call. | 1977 * Must fulfill U_SUCCESS before the function call. |
1976 * @return The name of the encoding detected. NULL if encoding is not detected. | 1978 * @return The name of the encoding detected. NULL if encoding is not detected. |
1977 * @stable ICU 2.4 | 1979 * @stable ICU 2.4 |
1978 */ | 1980 */ |
1979 U_STABLE const char* U_EXPORT2 | 1981 U_STABLE const char* U_EXPORT2 |
1980 ucnv_detectUnicodeSignature(const char* source, | 1982 ucnv_detectUnicodeSignature(const char* source, |
1981 int32_t sourceLength, | 1983 int32_t sourceLength, |
1982 int32_t *signatureLength, | 1984 int32_t *signatureLength, |
1983 UErrorCode *pErrorCode); | 1985 UErrorCode *pErrorCode); |
1984 | 1986 |
1985 /** | 1987 /** |
1986 * Returns the number of UChars held in the converter's internal state | 1988 * Returns the number of UChars held in the converter's internal state |
1987 * because more input is needed for completing the conversion. This function is | 1989 * because more input is needed for completing the conversion. This function is |
1988 * useful for mapping semantics of ICU's converter interface to those of iconv, | 1990 * useful for mapping semantics of ICU's converter interface to those of iconv, |
1989 * and this information is not needed for normal conversion. | 1991 * and this information is not needed for normal conversion. |
1990 * @param cnv The converter in which the input is held | 1992 * @param cnv The converter in which the input is held |
1991 * @param status ICU error code in/out parameter. | 1993 * @param status ICU error code in/out parameter. |
1992 * Must fulfill U_SUCCESS before the function call. | 1994 * Must fulfill U_SUCCESS before the function call. |
1993 * @return The number of UChars in the state. -1 if an error is encountered. | 1995 * @return The number of UChars in the state. -1 if an error is encountered. |
1994 * @stable ICU 3.4 | 1996 * @stable ICU 3.4 |
1995 */ | 1997 */ |
1996 U_STABLE int32_t U_EXPORT2 | 1998 U_STABLE int32_t U_EXPORT2 |
1997 ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status); | 1999 ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status); |
1998 | 2000 |
1999 /** | 2001 /** |
2000 * Returns the number of chars held in the converter's internal state | 2002 * Returns the number of chars held in the converter's internal state |
2001 * because more input is needed for completing the conversion. This function is | 2003 * because more input is needed for completing the conversion. This function is |
2002 * useful for mapping semantics of ICU's converter interface to those of iconv, | 2004 * useful for mapping semantics of ICU's converter interface to those of iconv, |
2003 * and this information is not needed for normal conversion. | 2005 * and this information is not needed for normal conversion. |
2004 * @param cnv The converter in which the input is held as internal state | 2006 * @param cnv The converter in which the input is held as internal state |
2005 * @param status ICU error code in/out parameter. | 2007 * @param status ICU error code in/out parameter. |
2006 * Must fulfill U_SUCCESS before the function call. | 2008 * Must fulfill U_SUCCESS before the function call. |
2007 * @return The number of chars in the state. -1 if an error is encountered. | 2009 * @return The number of chars in the state. -1 if an error is encountered. |
2008 * @stable ICU 3.4 | 2010 * @stable ICU 3.4 |
2009 */ | 2011 */ |
2010 U_STABLE int32_t U_EXPORT2 | 2012 U_STABLE int32_t U_EXPORT2 |
2011 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status); | 2013 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status); |
(...skipping 13 matching lines...) Expand all Loading... |
2025 * @return TRUE if the converter is fixed-width | 2027 * @return TRUE if the converter is fixed-width |
2026 * @stable ICU 4.8 | 2028 * @stable ICU 4.8 |
2027 */ | 2029 */ |
2028 U_STABLE UBool U_EXPORT2 | 2030 U_STABLE UBool U_EXPORT2 |
2029 ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status); | 2031 ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status); |
2030 | 2032 |
2031 #endif | 2033 #endif |
2032 | 2034 |
2033 #endif | 2035 #endif |
2034 /*_UCNV*/ | 2036 /*_UCNV*/ |
OLD | NEW |