OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * | 3 * |
4 * Copyright (C) 2009-2013, International Business Machines | 4 * Copyright (C) 2009-2015, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 * | 6 * |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 * file name: unorm2.h | 8 * file name: unorm2.h |
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: 2009dec15 | 13 * created on: 2009dec15 |
14 * created by: Markus W. Scherer | 14 * created by: Markus W. Scherer |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 * Tests if the character is normalization-inert. | 517 * Tests if the character is normalization-inert. |
518 * For details see the Normalizer2 base class documentation. | 518 * For details see the Normalizer2 base class documentation. |
519 * @param norm2 UNormalizer2 instance | 519 * @param norm2 UNormalizer2 instance |
520 * @param c character to test | 520 * @param c character to test |
521 * @return TRUE if c is normalization-inert | 521 * @return TRUE if c is normalization-inert |
522 * @stable ICU 4.4 | 522 * @stable ICU 4.4 |
523 */ | 523 */ |
524 U_STABLE UBool U_EXPORT2 | 524 U_STABLE UBool U_EXPORT2 |
525 unorm2_isInert(const UNormalizer2 *norm2, UChar32 c); | 525 unorm2_isInert(const UNormalizer2 *norm2, UChar32 c); |
526 | 526 |
| 527 /** |
| 528 * Option bit for unorm_compare: |
| 529 * Both input strings are assumed to fulfill FCD conditions. |
| 530 * @stable ICU 2.2 |
| 531 */ |
| 532 #define UNORM_INPUT_IS_FCD 0x20000 |
| 533 |
| 534 /** |
| 535 * Option bit for unorm_compare: |
| 536 * Perform case-insensitive comparison. |
| 537 * @stable ICU 2.2 |
| 538 */ |
| 539 #define U_COMPARE_IGNORE_CASE 0x10000 |
| 540 |
| 541 #ifndef U_COMPARE_CODE_POINT_ORDER |
| 542 /* see also unistr.h and ustring.h */ |
| 543 /** |
| 544 * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc: |
| 545 * Compare strings in code point order instead of code unit order. |
| 546 * @stable ICU 2.2 |
| 547 */ |
| 548 #define U_COMPARE_CODE_POINT_ORDER 0x8000 |
| 549 #endif |
| 550 |
| 551 /** |
| 552 * Compares two strings for canonical equivalence. |
| 553 * Further options include case-insensitive comparison and |
| 554 * code point order (as opposed to code unit order). |
| 555 * |
| 556 * Canonical equivalence between two strings is defined as their normalized |
| 557 * forms (NFD or NFC) being identical. |
| 558 * This function compares strings incrementally instead of normalizing |
| 559 * (and optionally case-folding) both strings entirely, |
| 560 * improving performance significantly. |
| 561 * |
| 562 * Bulk normalization is only necessary if the strings do not fulfill the FCD |
| 563 * conditions. Only in this case, and only if the strings are relatively long, |
| 564 * is memory allocated temporarily. |
| 565 * For FCD strings and short non-FCD strings there is no memory allocation. |
| 566 * |
| 567 * Semantically, this is equivalent to |
| 568 * strcmp[CodePointOrder](NFD(foldCase(NFD(s1))), NFD(foldCase(NFD(s2)))) |
| 569 * where code point order and foldCase are all optional. |
| 570 * |
| 571 * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match |
| 572 * the case folding must be performed first, then the normalization. |
| 573 * |
| 574 * @param s1 First source string. |
| 575 * @param length1 Length of first source string, or -1 if NUL-terminated. |
| 576 * |
| 577 * @param s2 Second source string. |
| 578 * @param length2 Length of second source string, or -1 if NUL-terminated. |
| 579 * |
| 580 * @param options A bit set of options: |
| 581 * - U_FOLD_CASE_DEFAULT or 0 is used for default options: |
| 582 * Case-sensitive comparison in code unit order, and the input strings |
| 583 * are quick-checked for FCD. |
| 584 * |
| 585 * - UNORM_INPUT_IS_FCD |
| 586 * Set if the caller knows that both s1 and s2 fulfill the FCD conditions. |
| 587 * If not set, the function will quickCheck for FCD |
| 588 * and normalize if necessary. |
| 589 * |
| 590 * - U_COMPARE_CODE_POINT_ORDER |
| 591 * Set to choose code point order instead of code unit order |
| 592 * (see u_strCompare for details). |
| 593 * |
| 594 * - U_COMPARE_IGNORE_CASE |
| 595 * Set to compare strings case-insensitively using case folding, |
| 596 * instead of case-sensitively. |
| 597 * If set, then the following case folding options are used. |
| 598 * |
| 599 * - Options as used with case-insensitive comparisons, currently: |
| 600 * |
| 601 * - U_FOLD_CASE_EXCLUDE_SPECIAL_I |
| 602 * (see u_strCaseCompare for details) |
| 603 * |
| 604 * - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_
SHIFT |
| 605 * |
| 606 * @param pErrorCode ICU error code in/out parameter. |
| 607 * Must fulfill U_SUCCESS before the function call. |
| 608 * @return <0 or 0 or >0 as usual for string comparisons |
| 609 * |
| 610 * @see unorm_normalize |
| 611 * @see UNORM_FCD |
| 612 * @see u_strCompare |
| 613 * @see u_strCaseCompare |
| 614 * |
| 615 * @stable ICU 2.2 |
| 616 */ |
| 617 U_STABLE int32_t U_EXPORT2 |
| 618 unorm_compare(const UChar *s1, int32_t length1, |
| 619 const UChar *s2, int32_t length2, |
| 620 uint32_t options, |
| 621 UErrorCode *pErrorCode); |
| 622 |
527 #endif /* !UCONFIG_NO_NORMALIZATION */ | 623 #endif /* !UCONFIG_NO_NORMALIZATION */ |
528 #endif /* __UNORM2_H__ */ | 624 #endif /* __UNORM2_H__ */ |
OLD | NEW |