Overview
Comment: | Add -[decomposedStringWithCompatibilityMapping] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
7989a8db10d2bea03fe21eac8cfa6034 |
User & Date: | js on 2017-07-02 13:21:07 |
Other Links: | manifest | tags |
Context
2017-07-02
| ||
19:22 | Use WRAPPER instead of TEST_LAUNCHER check-in: 08291826b1 user: js tags: trunk | |
13:21 | Add -[decomposedStringWithCompatibilityMapping] check-in: 7989a8db10 user: js tags: trunk | |
13:16 | TableGenerator: Generate decomp compat tables check-in: 4edfb80db7 user: js tags: trunk | |
Changes
Modified src/OFConstantString.m from [3d83fd1fce] to [33c7229c0d].
︙ | ︙ | |||
610 611 612 613 614 615 616 617 618 619 620 621 622 623 | #ifdef OF_HAVE_UNICODE_TABLES - (OFString *)decomposedStringWithCanonicalMapping { [self finishInitialization]; return [self decomposedStringWithCanonicalMapping]; } #endif - (void)writeToFile: (OFString *)path { [self finishInitialization]; [self writeToFile: path]; | > > > > > > > | 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | #ifdef OF_HAVE_UNICODE_TABLES - (OFString *)decomposedStringWithCanonicalMapping { [self finishInitialization]; return [self decomposedStringWithCanonicalMapping]; } - (OFString *)decomposedStringWithCompatibilityMapping { [self finishInitialization]; return [self decomposedStringWithCompatibilityMapping]; } #endif - (void)writeToFile: (OFString *)path { [self finishInitialization]; [self writeToFile: path]; |
︙ | ︙ |
Modified src/OFString.h from [a96c6fa4a6] to [2abf4074c0].
︙ | ︙ | |||
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 | #ifdef OF_HAVE_UNICODE_TABLES /*! * @brief Returns the string in Unicode Normalization Form D (NFD). * * @return The string in Unicode Normalization Form D (NFD) */ - (OFString *)decomposedStringWithCanonicalMapping; #endif #ifdef OF_HAVE_FILES /*! * @brief Writes the string into the specified file using UTF-8 encoding. * * @param path The path of the file to write to | > > > > > > > | 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 | #ifdef OF_HAVE_UNICODE_TABLES /*! * @brief Returns the string in Unicode Normalization Form D (NFD). * * @return The string in Unicode Normalization Form D (NFD) */ - (OFString *)decomposedStringWithCanonicalMapping; /*! * @brief Returns the string in Unicode Normalization Form KD (NFKD). * * @return The string in Unicode Normalization Form KD (NFKD) */ - (OFString *)decomposedStringWithCompatibilityMapping; #endif #ifdef OF_HAVE_FILES /*! * @brief Writes the string into the specified file using UTF-8 encoding. * * @param path The path of the file to write to |
︙ | ︙ |
Modified src/OFString.m from [6d858b8401] to [b020b18390].
︙ | ︙ | |||
342 343 344 345 346 347 348 349 350 351 352 353 354 355 | ret = [[array componentsJoinedByString: joinString] retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } static struct { Class isa; } placeholder; @interface OFString_placeholder: OFString @end | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | ret = [[array componentsJoinedByString: joinString] retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } static OFString * decomposedString(OFString *self, const char *const *const *table, size_t size) { OFMutableString *ret = [OFMutableString string]; void *pool = objc_autoreleasePoolPush(); const of_unichar_t *characters = [self characters]; size_t length = [self length]; for (size_t i = 0; i < length; i++) { of_unichar_t c = characters[i]; const char *const *page; if (c >= size) { [ret appendCharacters: &c length: 1]; continue; } page = table[c >> 8]; if (page != NULL && page[c & 0xFF] != NULL) [ret appendUTF8String: page[c & 0xFF]]; else [ret appendCharacters: &c length: 1]; } objc_autoreleasePoolPop(pool); return ret; } static struct { Class isa; } placeholder; @interface OFString_placeholder: OFString @end |
︙ | ︙ | |||
2711 2712 2713 2714 2715 2716 2717 | return ret; } #ifdef OF_HAVE_UNICODE_TABLES - (OFString *)decomposedStringWithCanonicalMapping { | < < < < | < < < < | < < < | < < < < < < < | < | | > | 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 | return ret; } #ifdef OF_HAVE_UNICODE_TABLES - (OFString *)decomposedStringWithCanonicalMapping { return decomposedString(self, of_unicode_decomposition_table, OF_UNICODE_DECOMPOSITION_TABLE_SIZE); } - (OFString *)decomposedStringWithCompatibilityMapping { return decomposedString(self, of_unicode_decomposition_compat_table, OF_UNICODE_DECOMPOSITION_COMPAT_TABLE_SIZE); } #endif #ifdef OF_HAVE_FILES - (void)writeToFile: (OFString *)path { [self writeToFile: path |
︙ | ︙ |
Modified tests/OFStringTests.m from [d944d8d727] to [addca37143].
︙ | ︙ | |||
897 898 899 900 901 902 903 904 | TEST(@"-[deleteEnclosingWhitespaces]", (s[0] = [mutableStringClass stringWithString: whitespace[0]]) && R([s[0] deleteEnclosingWhitespaces]) && [s[0] isEqual: @"asd"] && (s[0] = [mutableStringClass stringWithString: whitespace[1]]) && R([s[0] deleteEnclosingWhitespaces]) && [s[0] isEqual: @""]) TEST(@"-[decomposedStringWithCanonicalMapping]", | > | > > > > | > | 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 | TEST(@"-[deleteEnclosingWhitespaces]", (s[0] = [mutableStringClass stringWithString: whitespace[0]]) && R([s[0] deleteEnclosingWhitespaces]) && [s[0] isEqual: @"asd"] && (s[0] = [mutableStringClass stringWithString: whitespace[1]]) && R([s[0] deleteEnclosingWhitespaces]) && [s[0] isEqual: @""]) #ifdef OF_HAVE_UNICODE_TABLES TEST(@"-[decomposedStringWithCanonicalMapping]", [[@"H\xC3\xA4llj\xC3\xB6" decomposedStringWithCanonicalMapping] isEqual: @"H\x61\xCC\x88llj\x6F\xCC\x88"]); TEST(@"-[decomposedStringWithCompatibilityMapping]", [[@"H\xC3\xA4llj\xC3\xB6" decomposedStringWithCompatibilityMapping] isEqual: @"H\x61\xCC\x88llj\x6F\xCC\x88"]); #endif TEST(@"-[stringByXMLEscaping]", (is = [C(@"<hello> &world'\"!&") stringByXMLEscaping]) && [is isEqual: @"<hello> &world'"!&"]) TEST(@"-[stringByXMLUnescaping]", [[is stringByXMLUnescaping] isEqual: @"<hello> &world'\"!&"] && |
︙ | ︙ |