| OLD | NEW |
| 1 /* | 1 /* |
| 2 ******************************************************************************* | 2 ******************************************************************************* |
| 3 * | 3 * |
| 4 * Copyright (C) 2001-2011, International Business Machines | 4 * Copyright (C) 2001-2014, International Business Machines |
| 5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
| 6 * | 6 * |
| 7 ******************************************************************************* | 7 ******************************************************************************* |
| 8 * file name: unormcmp.cpp | 8 * file name: unormcmp.cpp |
| 9 * encoding: US-ASCII | 9 * encoding: US-ASCII |
| 10 * tab size: 8 (not used) | 10 * tab size: 8 (not used) |
| 11 * indentation:4 | 11 * indentation:4 |
| 12 * | 12 * |
| 13 * created on: 2004sep13 | 13 * created on: 2004sep13 |
| 14 * created by: Markus W. Scherer | 14 * created by: Markus W. Scherer |
| (...skipping 10 matching lines...) Expand all Loading... |
| 25 #include "unicode/unorm.h" | 25 #include "unicode/unorm.h" |
| 26 #include "unicode/ustring.h" | 26 #include "unicode/ustring.h" |
| 27 #include "cmemory.h" | 27 #include "cmemory.h" |
| 28 #include "normalizer2impl.h" | 28 #include "normalizer2impl.h" |
| 29 #include "ucase.h" | 29 #include "ucase.h" |
| 30 #include "uprops.h" | 30 #include "uprops.h" |
| 31 #include "ustr_imp.h" | 31 #include "ustr_imp.h" |
| 32 | 32 |
| 33 U_NAMESPACE_USE | 33 U_NAMESPACE_USE |
| 34 | 34 |
| 35 #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) | |
| 36 | |
| 37 /* compare canonically equivalent ------------------------------------------- */ | 35 /* compare canonically equivalent ------------------------------------------- */ |
| 38 | 36 |
| 39 /* | 37 /* |
| 40 * Compare two strings for canonical equivalence. | 38 * Compare two strings for canonical equivalence. |
| 41 * Further options include case-insensitive comparison and | 39 * Further options include case-insensitive comparison and |
| 42 * code point order (as opposed to code unit order). | 40 * code point order (as opposed to code unit order). |
| 43 * | 41 * |
| 44 * In this function, canonical equivalence is optional as well. | 42 * In this function, canonical equivalence is optional as well. |
| 45 * If canonical equivalence is tested, then both strings must fulfill | 43 * If canonical equivalence is tested, then both strings must fulfill |
| 46 * the FCD check. | 44 * the FCD check. |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 * | 596 * |
| 599 * Exception: When using the Turkic case-folding option, we do perform | 597 * Exception: When using the Turkic case-folding option, we do perform |
| 600 * full NFD first. This is because in the Turkic case precomposed characters | 598 * full NFD first. This is because in the Turkic case precomposed characters |
| 601 * with 0049 capital I or 0069 small i fold differently whether they | 599 * with 0049 capital I or 0069 small i fold differently whether they |
| 602 * are first decomposed or not, so an FCD check - a check only for | 600 * are first decomposed or not, so an FCD check - a check only for |
| 603 * canonical order - is not sufficient. | 601 * canonical order - is not sufficient. |
| 604 */ | 602 */ |
| 605 if(!(options&UNORM_INPUT_IS_FCD) || (options&U_FOLD_CASE_EXCLUDE_SPECIAL_I))
{ | 603 if(!(options&UNORM_INPUT_IS_FCD) || (options&U_FOLD_CASE_EXCLUDE_SPECIAL_I))
{ |
| 606 const Normalizer2 *n2; | 604 const Normalizer2 *n2; |
| 607 if(options&U_FOLD_CASE_EXCLUDE_SPECIAL_I) { | 605 if(options&U_FOLD_CASE_EXCLUDE_SPECIAL_I) { |
| 608 n2=Normalizer2Factory::getNFDInstance(*pErrorCode); | 606 n2=Normalizer2::getNFDInstance(*pErrorCode); |
| 609 } else { | 607 } else { |
| 610 n2=Normalizer2Factory::getFCDInstance(*pErrorCode); | 608 n2=Normalizer2Factory::getFCDInstance(*pErrorCode); |
| 611 } | 609 } |
| 612 if (U_FAILURE(*pErrorCode)) { | 610 if (U_FAILURE(*pErrorCode)) { |
| 613 return 0; | 611 return 0; |
| 614 } | 612 } |
| 615 | 613 |
| 616 if(normOptions&UNORM_UNICODE_3_2) { | 614 if(normOptions&UNORM_UNICODE_3_2) { |
| 617 const UnicodeSet *uni32=uniset_getUnicode32Instance(*pErrorCode); | 615 const UnicodeSet *uni32=uniset_getUnicode32Instance(*pErrorCode); |
| 618 FilteredNormalizer2 fn2(*n2, *uni32); | 616 FilteredNormalizer2 fn2(*n2, *uni32); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 637 } | 635 } |
| 638 | 636 |
| 639 if(U_SUCCESS(*pErrorCode)) { | 637 if(U_SUCCESS(*pErrorCode)) { |
| 640 return unorm_cmpEquivFold(s1, length1, s2, length2, options, pErrorCode)
; | 638 return unorm_cmpEquivFold(s1, length1, s2, length2, options, pErrorCode)
; |
| 641 } else { | 639 } else { |
| 642 return 0; | 640 return 0; |
| 643 } | 641 } |
| 644 } | 642 } |
| 645 | 643 |
| 646 #endif /* #if !UCONFIG_NO_NORMALIZATION */ | 644 #endif /* #if !UCONFIG_NO_NORMALIZATION */ |
| OLD | NEW |