21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#import "OFNumber.h"
#import "OFString.h"
#import "OFURL+Private.h"
#import "OFInvalidFormatException.h"
@implementation OFMutableURL
@dynamic scheme, host, port, user, password, path, parameters, query, fragment;
+ (instancetype)URL
{
return [[[self alloc] init] autorelease];
}
- (instancetype)init
|
|
>
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#import "OFNumber.h"
#import "OFString.h"
#import "OFURL+Private.h"
#import "OFInvalidFormatException.h"
@implementation OFMutableURL
@dynamic scheme, host, port, user, password, path, pathComponents, parameters;
@dynamic query, fragment;
+ (instancetype)URL
{
return [[[self alloc] init] autorelease];
}
- (instancetype)init
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
- (void)setPath: (OFString *)path
{
OFString *old = _path;
_path = [path copy];
[old release];
}
- (void)setParameters: (OFString *)parameters
{
OFString *old = _parameters;
_parameters = [parameters copy];
[old release];
}
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
- (void)setPath: (OFString *)path
{
OFString *old = _path;
_path = [path copy];
[old release];
}
- (void)setPathComponents: (OFArray *)components
{
void *pool = objc_autoreleasePoolPush();
if (components == nil) {
[self setPath: nil];
return;
}
if ([components count] == 0)
@throw [OFInvalidFormatException exception];
if ([[components firstObject] length] != 0)
@throw [OFInvalidFormatException exception];
[self setPath: [components componentsJoinedByString: @"/"]];
objc_autoreleasePoolPop(pool);
}
- (void)setParameters: (OFString *)parameters
{
OFString *old = _parameters;
_parameters = [parameters copy];
[old release];
}
|
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
- (void)setFragment: (OFString *)fragment
{
OFString *old = _fragment;
_fragment = [fragment copy];
[old release];
}
- (void)setPathComponents: (OFArray *)components
{
void *pool = objc_autoreleasePoolPush();
if (components == nil) {
[self setPath: nil];
return;
}
if ([components count] == 0)
@throw [OFInvalidFormatException exception];
if ([[components firstObject] length] != 0)
@throw [OFInvalidFormatException exception];
[self setPath: [components componentsJoinedByString: @"/"]];
objc_autoreleasePoolPop(pool);
}
- (id)copy
{
OFMutableURL *copy = [self mutableCopy];
[copy makeImmutable];
return copy;
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
- (void)setFragment: (OFString *)fragment
{
OFString *old = _fragment;
_fragment = [fragment copy];
[old release];
}
- (id)copy
{
OFMutableURL *copy = [self mutableCopy];
[copy makeImmutable];
return copy;
|