OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * Copyright (C) 1996-2014, International Business Machines | 3 * Copyright (C) 1996-2015, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ******************************************************************************* | 5 ******************************************************************************* |
6 * file name: ucol.cpp | 6 * file name: ucol.cpp |
7 * encoding: US-ASCII | 7 * encoding: US-ASCII |
8 * tab size: 8 (not used) | 8 * tab size: 8 (not used) |
9 * indentation:4 | 9 * indentation:4 |
10 * | 10 * |
11 * Modification history | 11 * Modification history |
12 * Date Name Comments | 12 * Date Name Comments |
13 * 1996-1999 various members of ICU team maintained C API for collation framewo
rk | 13 * 1996-1999 various members of ICU team maintained C API for collation framewo
rk |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 /* */ | 434 /* */ |
435 /* ucol_strcoll Main public API string comparison function */ | 435 /* ucol_strcoll Main public API string comparison function */ |
436 /* */ | 436 /* */ |
437 U_CAPI UCollationResult U_EXPORT2 | 437 U_CAPI UCollationResult U_EXPORT2 |
438 ucol_strcoll( const UCollator *coll, | 438 ucol_strcoll( const UCollator *coll, |
439 const UChar *source, | 439 const UChar *source, |
440 int32_t sourceLength, | 440 int32_t sourceLength, |
441 const UChar *target, | 441 const UChar *target, |
442 int32_t targetLength) | 442 int32_t targetLength) |
443 { | 443 { |
444 U_ALIGN_CODE(16); | |
445 | |
446 UTRACE_ENTRY(UTRACE_UCOL_STRCOLL); | 444 UTRACE_ENTRY(UTRACE_UCOL_STRCOLL); |
447 if (UTRACE_LEVEL(UTRACE_VERBOSE)) { | 445 if (UTRACE_LEVEL(UTRACE_VERBOSE)) { |
448 UTRACE_DATA3(UTRACE_VERBOSE, "coll=%p, source=%p, target=%p", coll, sour
ce, target); | 446 UTRACE_DATA3(UTRACE_VERBOSE, "coll=%p, source=%p, target=%p", coll, sour
ce, target); |
449 UTRACE_DATA2(UTRACE_VERBOSE, "source string = %vh ", source, sourceLengt
h); | 447 UTRACE_DATA2(UTRACE_VERBOSE, "source string = %vh ", source, sourceLengt
h); |
450 UTRACE_DATA2(UTRACE_VERBOSE, "target string = %vh ", target, targetLengt
h); | 448 UTRACE_DATA2(UTRACE_VERBOSE, "target string = %vh ", target, targetLengt
h); |
451 } | 449 } |
452 | 450 |
453 UErrorCode status = U_ZERO_ERROR; | 451 UErrorCode status = U_ZERO_ERROR; |
454 UCollationResult returnVal = Collator::fromUCollator(coll)-> | 452 UCollationResult returnVal = Collator::fromUCollator(coll)-> |
455 compare(source, sourceLength, target, targetLength, status); | 453 compare(source, sourceLength, target, targetLength, status); |
456 UTRACE_EXIT_VALUE_STATUS(returnVal, status); | 454 UTRACE_EXIT_VALUE_STATUS(returnVal, status); |
457 return returnVal; | 455 return returnVal; |
458 } | 456 } |
459 | 457 |
460 U_CAPI UCollationResult U_EXPORT2 | 458 U_CAPI UCollationResult U_EXPORT2 |
461 ucol_strcollUTF8( | 459 ucol_strcollUTF8( |
462 const UCollator *coll, | 460 const UCollator *coll, |
463 const char *source, | 461 const char *source, |
464 int32_t sourceLength, | 462 int32_t sourceLength, |
465 const char *target, | 463 const char *target, |
466 int32_t targetLength, | 464 int32_t targetLength, |
467 UErrorCode *status) | 465 UErrorCode *status) |
468 { | 466 { |
469 U_ALIGN_CODE(16); | |
470 | |
471 UTRACE_ENTRY(UTRACE_UCOL_STRCOLLUTF8); | 467 UTRACE_ENTRY(UTRACE_UCOL_STRCOLLUTF8); |
472 if (UTRACE_LEVEL(UTRACE_VERBOSE)) { | 468 if (UTRACE_LEVEL(UTRACE_VERBOSE)) { |
473 UTRACE_DATA3(UTRACE_VERBOSE, "coll=%p, source=%p, target=%p", coll, sour
ce, target); | 469 UTRACE_DATA3(UTRACE_VERBOSE, "coll=%p, source=%p, target=%p", coll, sour
ce, target); |
474 UTRACE_DATA2(UTRACE_VERBOSE, "source string = %vb ", source, sourceLengt
h); | 470 UTRACE_DATA2(UTRACE_VERBOSE, "source string = %vb ", source, sourceLengt
h); |
475 UTRACE_DATA2(UTRACE_VERBOSE, "target string = %vb ", target, targetLengt
h); | 471 UTRACE_DATA2(UTRACE_VERBOSE, "target string = %vb ", target, targetLengt
h); |
476 } | 472 } |
477 | 473 |
478 if (U_FAILURE(*status)) { | 474 if (U_FAILURE(*status)) { |
479 /* do nothing */ | 475 /* do nothing */ |
480 UTRACE_EXIT_VALUE_STATUS(UCOL_EQUAL, *status); | 476 UTRACE_EXIT_VALUE_STATUS(UCOL_EQUAL, *status); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 return set->toUSet(); | 609 return set->toUSet(); |
614 } | 610 } |
615 | 611 |
616 U_CAPI UBool U_EXPORT2 | 612 U_CAPI UBool U_EXPORT2 |
617 ucol_equals(const UCollator *source, const UCollator *target) { | 613 ucol_equals(const UCollator *source, const UCollator *target) { |
618 return source == target || | 614 return source == target || |
619 (*Collator::fromUCollator(source)) == (*Collator::fromUCollator(target))
; | 615 (*Collator::fromUCollator(source)) == (*Collator::fromUCollator(target))
; |
620 } | 616 } |
621 | 617 |
622 #endif /* #if !UCONFIG_NO_COLLATION */ | 618 #endif /* #if !UCONFIG_NO_COLLATION */ |
OLD | NEW |