Differences From Artifact [7c53691cc2]:
- File src/OFURL.m — part of check-in [fb515e8e24] at 2012-10-09 15:07:30 on branch trunk — Make use of instancetype. (user: js, size: 11267) [annotate] [blame] [check-ins using]
To Artifact [3b200a0eea]:
- File
src/OFURL.m
— part of check-in
[12a4d43f67]
at
2012-12-11 12:12:33
on branch trunk
— OFURL: Add +[URL].
This also makes -[description] more robust, as with this change, it is
now possible that required parts of the URL are nil. (user: js, size: 11394) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
74 75 76 77 78 79 80 81 82 83 84 85 86 87 | objc_autoreleasePoolPop(pool); return [ret autorelease]; } @implementation OFURL + (instancetype)URLWithString: (OFString*)string { return [[[self alloc] initWithString: string] autorelease]; } + (instancetype)URLWithString: (OFString*)string relativeToURL: (OFURL*)URL | > > > > > | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | objc_autoreleasePoolPop(pool); return [ret autorelease]; } @implementation OFURL + (instancetype)URL { return [[[self alloc] init] autorelease]; } + (instancetype)URLWithString: (OFString*)string { return [[[self alloc] initWithString: string] autorelease]; } + (instancetype)URLWithString: (OFString*)string relativeToURL: (OFURL*)URL |
︙ | ︙ | |||
509 510 511 512 513 514 515 | - (OFString*)string { OFMutableString *ret = [OFMutableString stringWithFormat: @"%@://", scheme]; BOOL needPort = YES; if ([scheme isEqual: @"file"]) { | > | > > | > | | 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | - (OFString*)string { OFMutableString *ret = [OFMutableString stringWithFormat: @"%@://", scheme]; BOOL needPort = YES; if ([scheme isEqual: @"file"]) { if (path != nil) [ret appendString: path]; return ret; } if (user != nil && password != nil) [ret appendFormat: @"%@:%@@", user, password]; else if (user != nil) [ret appendFormat: @"%@@", user]; if (host != nil) [ret appendString: host]; if (([scheme isEqual: @"http"] && port == 80) || ([scheme isEqual: @"https"] && port == 443)) needPort = NO; if (needPort) [ret appendFormat: @":%d", port]; if (path != nil) [ret appendString: path]; if (parameters != nil) [ret appendFormat: @";%@", parameters]; if (query != nil) [ret appendFormat: @"?%@", query]; |
︙ | ︙ |