| OLD | NEW |
| 1 /* | 1 /* |
| 2 ******************************************************************************* | 2 ******************************************************************************* |
| 3 * Copyright (C) 1997-2009, International Business Machines | 3 * Copyright (C) 1997-2009,2014 International Business Machines |
| 4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
| 5 ******************************************************************************* | 5 ******************************************************************************* |
| 6 * Date Name Description | 6 * Date Name Description |
| 7 * 06/21/00 aliu Creation. | 7 * 06/21/00 aliu Creation. |
| 8 ******************************************************************************* | 8 ******************************************************************************* |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "unicode/utypes.h" | 11 #include "unicode/utypes.h" |
| 12 | 12 |
| 13 #if !UCONFIG_NO_TRANSLITERATION | 13 #if !UCONFIG_NO_TRANSLITERATION |
| 14 | 14 |
| 15 #include "unicode/utrans.h" | 15 #include "unicode/utrans.h" |
| 16 #include "unicode/putil.h" | 16 #include "unicode/putil.h" |
| 17 #include "unicode/rep.h" | 17 #include "unicode/rep.h" |
| 18 #include "unicode/translit.h" | 18 #include "unicode/translit.h" |
| 19 #include "unicode/unifilt.h" | 19 #include "unicode/unifilt.h" |
| 20 #include "unicode/uniset.h" | 20 #include "unicode/uniset.h" |
| 21 #include "unicode/ustring.h" | 21 #include "unicode/ustring.h" |
| 22 #include "unicode/uenum.h" | 22 #include "unicode/uenum.h" |
| 23 #include "unicode/uset.h" |
| 23 #include "uenumimp.h" | 24 #include "uenumimp.h" |
| 24 #include "cpputils.h" | 25 #include "cpputils.h" |
| 25 #include "rbt.h" | 26 #include "rbt.h" |
| 26 | 27 |
| 27 // Following macro is to be followed by <return value>';' or just ';' | 28 // Following macro is to be followed by <return value>';' or just ';' |
| 28 #define utrans_ENTRY(s) if ((s)==NULL || U_FAILURE(*(s))) return | 29 #define utrans_ENTRY(s) if ((s)==NULL || U_FAILURE(*(s))) return |
| 29 | 30 |
| 30 /******************************************************************** | 31 /******************************************************************** |
| 31 * Replaceable-UReplaceableCallbacks glue | 32 * Replaceable-UReplaceableCallbacks glue |
| 32 ********************************************************************/ | 33 ********************************************************************/ |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 ((Transliterator*) trans)->transliterate(str, *pos, *status); | 486 ((Transliterator*) trans)->transliterate(str, *pos, *status); |
| 486 | 487 |
| 487 // Copy the string buffer back to text (only if necessary) | 488 // Copy the string buffer back to text (only if necessary) |
| 488 // and fill in *neededCapacity (if neededCapacity != NULL). | 489 // and fill in *neededCapacity (if neededCapacity != NULL). |
| 489 textLen = str.extract(text, textCapacity, *status); | 490 textLen = str.extract(text, textCapacity, *status); |
| 490 if(textLength != NULL) { | 491 if(textLength != NULL) { |
| 491 *textLength = textLen; | 492 *textLength = textLen; |
| 492 } | 493 } |
| 493 } | 494 } |
| 494 | 495 |
| 496 U_CAPI int32_t U_EXPORT2 |
| 497 utrans_toRules( const UTransliterator* trans, |
| 498 UBool escapeUnprintable, |
| 499 UChar* result, int32_t resultLength, |
| 500 UErrorCode* status) { |
| 501 utrans_ENTRY(status) 0; |
| 502 if ( (result==NULL)? resultLength!=0: resultLength<0 ) { |
| 503 *status = U_ILLEGAL_ARGUMENT_ERROR; |
| 504 return 0; |
| 505 } |
| 506 |
| 507 UnicodeString res; |
| 508 res.setTo(result, 0, resultLength); |
| 509 ((Transliterator*) trans)->toRules(res, escapeUnprintable); |
| 510 return res.extract(result, resultLength, *status); |
| 511 } |
| 512 |
| 513 U_CAPI USet* U_EXPORT2 |
| 514 utrans_getSourceSet(const UTransliterator* trans, |
| 515 UBool ignoreFilter, |
| 516 USet* fillIn, |
| 517 UErrorCode* status) { |
| 518 utrans_ENTRY(status) fillIn; |
| 519 |
| 520 if (fillIn == NULL) { |
| 521 fillIn = uset_openEmpty(); |
| 522 } |
| 523 if (ignoreFilter) { |
| 524 ((Transliterator*) trans)->handleGetSourceSet(*((UnicodeSet*)fillIn)); |
| 525 } else { |
| 526 ((Transliterator*) trans)->getSourceSet(*((UnicodeSet*)fillIn)); |
| 527 } |
| 528 return fillIn; |
| 529 } |
| 530 |
| 495 #endif /* #if !UCONFIG_NO_TRANSLITERATION */ | 531 #endif /* #if !UCONFIG_NO_TRANSLITERATION */ |
| OLD | NEW |