Overview
Comment: | Add -[OFString stringByAppendingURLPathComponent:] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
ad18d4f97601639e3c9438ca352101a3 |
User & Date: | js on 2017-11-14 23:27:31 |
Other Links: | manifest | tags |
Context
2017-11-14
| ||
23:30 | Fix -[OFURL initFileURLWithPath:] on Windows check-in: 8dd0438ada user: js tags: trunk | |
23:27 | Add -[OFString stringByAppendingURLPathComponent:] check-in: ad18d4f976 user: js tags: trunk | |
23:19 | Improve -[stringByAppendingPathComponent:] check-in: 80ac05eb8f user: js tags: trunk | |
Changes
Modified src/OFConstantString.m from [ee41b1b8bf] to [25aa3b8ad6].
︙ | ︙ | |||
429 430 431 432 433 434 435 436 437 438 439 440 441 442 | - (OFString *)stringByAppendingPathComponent: (OFString *)component { [self finishInitialization]; return [self stringByAppendingPathComponent: component]; } - (OFString *)stringByPrependingString: (OFString *)string { [self finishInitialization]; return [self stringByPrependingString: string]; } | > > > > > > > | 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | - (OFString *)stringByAppendingPathComponent: (OFString *)component { [self finishInitialization]; return [self stringByAppendingPathComponent: component]; } - (OFString *)stringByAppendingURLPathComponent: (OFString *)component { [self finishInitialization]; return [self stringByAppendingURLPathComponent: component]; } - (OFString *)stringByPrependingString: (OFString *)string { [self finishInitialization]; return [self stringByPrependingString: string]; } |
︙ | ︙ |
Modified src/OFString.h from [848475bff2] to [42499c2971].
︙ | ︙ | |||
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 | * @brief Creates a new string by appending a path component. * * @param component The path component to append * @return A new, autoreleased OFString with the path component appended */ - (OFString *)stringByAppendingPathComponent: (OFString *)component; /*! * @brief Creates a new string by prepending another string. * * @param string The string to prepend * @return A new autoreleased OFString with the specified string prepended */ - (OFString *)stringByPrependingString: (OFString *)string; | > > > > > > > > | 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | * @brief Creates a new string by appending a path component. * * @param component The path component to append * @return A new, autoreleased OFString with the path component appended */ - (OFString *)stringByAppendingPathComponent: (OFString *)component; /*! * @brief Creates a new string by appending a URL path component. * * @param component The URL path component to append * @return A new, autoreleased OFString with the URL path component appended */ - (OFString *)stringByAppendingURLPathComponent: (OFString *)component; /*! * @brief Creates a new string by prepending another string. * * @param string The string to prepend * @return A new autoreleased OFString with the specified string prepended */ - (OFString *)stringByPrependingString: (OFString *)string; |
︙ | ︙ |
Modified src/OFString.m from [90e49f1e77] to [2722cbc855].
︙ | ︙ | |||
2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 | return [self stringByAppendingString: component]; else { OFMutableString *ret = [[self mutableCopy] autorelease]; [ret appendString: OF_PATH_DELIMITER_STRING]; [ret appendString: component]; [ret makeImmutable]; return ret; } } - (OFString *)stringByPrependingString: (OFString *)string | > > > > > > > > > > > > > > > > | 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 | return [self stringByAppendingString: component]; else { OFMutableString *ret = [[self mutableCopy] autorelease]; [ret appendString: OF_PATH_DELIMITER_STRING]; [ret appendString: component]; [ret makeImmutable]; return ret; } } - (OFString *)stringByAppendingURLPathComponent: (OFString *)component { if ([self hasSuffix: @"/"]) return [self stringByAppendingString: component]; else { OFMutableString *ret = [[self mutableCopy] autorelease]; [ret appendString: @"/"]; [ret appendString: component]; [ret makeImmutable]; return ret; } } - (OFString *)stringByPrependingString: (OFString *)string |
︙ | ︙ |
Modified tests/OFStringTests.m from [4115eec41d] to [da8182eef0].
︙ | ︙ | |||
557 558 559 560 561 562 563 564 565 566 567 568 569 570 | [s[1] appendString: OF_PATH_DELIMITER_STRING]; is = [stringClass stringWithString: s[1]]; [s[1] appendString: @"baz"]; TEST(@"-[stringByAppendingPathComponent:]", [[s[0] stringByAppendingPathComponent: @"baz"] isEqual: s[1]] && [[is stringByAppendingPathComponent: @"baz"] isEqual: s[1]]) TEST(@"-[hasPrefix:]", [C(@"foobar") hasPrefix: @"foo"] && ![C(@"foobar") hasPrefix: @"foobar0"]) TEST(@"-[hasSuffix:]", [C(@"foobar") hasSuffix: @"bar"] && ![C(@"foobar") hasSuffix: @"foobar0"]) i = 0; | > > > > > > > > > > > | 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | [s[1] appendString: OF_PATH_DELIMITER_STRING]; is = [stringClass stringWithString: s[1]]; [s[1] appendString: @"baz"]; TEST(@"-[stringByAppendingPathComponent:]", [[s[0] stringByAppendingPathComponent: @"baz"] isEqual: s[1]] && [[is stringByAppendingPathComponent: @"baz"] isEqual: s[1]]) s[0] = [mutableStringClass stringWithString: @"foo"]; [s[0] appendString: @"/"]; [s[0] appendString: @"bar"]; s[1] = [mutableStringClass stringWithString: s[0]]; [s[1] appendString: @"/"]; is = [stringClass stringWithString: s[1]]; [s[1] appendString: @"baz"]; TEST(@"-[stringByAppendingURLPathComponent:]", [[s[0] stringByAppendingURLPathComponent: @"baz"] isEqual: s[1]] && [[is stringByAppendingURLPathComponent: @"baz"] isEqual: s[1]]) TEST(@"-[hasPrefix:]", [C(@"foobar") hasPrefix: @"foo"] && ![C(@"foobar") hasPrefix: @"foobar0"]) TEST(@"-[hasSuffix:]", [C(@"foobar") hasSuffix: @"bar"] && ![C(@"foobar") hasSuffix: @"foobar0"]) i = 0; |
︙ | ︙ |