1
2
3
4
5
6
7
8
9
10
11
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019, 2020
* Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
<
<
|
|
1
2
3
4
5
6
7
8
9
|
/*
* Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
handlers = [[OFMutableDictionary alloc] init];
#ifdef OF_HAVE_THREADS
mutex = [[OFMutex alloc] init];
atexit(releaseMutex);
#endif
#ifdef OF_HAVE_FILES
[self registerClass: [OFFileURLHandler class]
forScheme: @"file"];
#endif
#if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_THREADS)
[self registerClass: [OFHTTPURLHandler class]
forScheme: @"http"];
[self registerClass: [OFHTTPURLHandler class]
forScheme: @"https"];
#endif
}
+ (bool)registerClass: (Class)class
forScheme: (OFString *)scheme
{
#ifdef OF_HAVE_THREADS
[mutex lock];
@try {
#endif
OFURLHandler *handler;
if ([handlers objectForKey: scheme] != nil)
return false;
handler = [[class alloc] initWithScheme: scheme];
@try {
[handlers setObject: handler
forKey: scheme];
} @finally {
[handler release];
}
#ifdef OF_HAVE_THREADS
} @finally {
[mutex unlock];
}
|
|
<
|
<
|
<
|
<
|
<
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
handlers = [[OFMutableDictionary alloc] init];
#ifdef OF_HAVE_THREADS
mutex = [[OFMutex alloc] init];
atexit(releaseMutex);
#endif
#ifdef OF_HAVE_FILES
[self registerClass: [OFFileURLHandler class] forScheme: @"file"];
#endif
#if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_THREADS)
[self registerClass: [OFHTTPURLHandler class] forScheme: @"http"];
[self registerClass: [OFHTTPURLHandler class] forScheme: @"https"];
#endif
}
+ (bool)registerClass: (Class)class forScheme: (OFString *)scheme
{
#ifdef OF_HAVE_THREADS
[mutex lock];
@try {
#endif
OFURLHandler *handler;
if ([handlers objectForKey: scheme] != nil)
return false;
handler = [[class alloc] initWithScheme: scheme];
@try {
[handlers setObject: handler forKey: scheme];
} @finally {
[handler release];
}
#ifdef OF_HAVE_THREADS
} @finally {
[mutex unlock];
}
|
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
- (void)dealloc
{
[_scheme release];
[super dealloc];
}
- (OFStream *)openItemAtURL: (OFURL *)URL
mode: (OFString *)mode
{
OF_UNRECOGNIZED_SELECTOR
}
- (of_file_attributes_t)attributesOfItemAtURL: (OFURL *)URL
{
OF_UNRECOGNIZED_SELECTOR
|
|
<
|
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
- (void)dealloc
{
[_scheme release];
[super dealloc];
}
- (OFStream *)openItemAtURL: (OFURL *)URL mode: (OFString *)mode
{
OF_UNRECOGNIZED_SELECTOR
}
- (of_file_attributes_t)attributesOfItemAtURL: (OFURL *)URL
{
OF_UNRECOGNIZED_SELECTOR
|
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
}
- (void)removeItemAtURL: (OFURL *)URL
{
OF_UNRECOGNIZED_SELECTOR
}
- (void)linkItemAtURL: (OFURL *)source
toURL: (OFURL *)destination
{
OF_UNRECOGNIZED_SELECTOR
}
- (void)createSymbolicLinkAtURL: (OFURL *)destination
withDestinationPath: (OFString *)source
{
OF_UNRECOGNIZED_SELECTOR
}
- (bool)copyItemAtURL: (OFURL *)source
toURL: (OFURL *)destination
{
return false;
}
- (bool)moveItemAtURL: (OFURL *)source
toURL: (OFURL *)destination
{
return false;
}
@end
|
|
<
|
<
|
<
|
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
}
- (void)removeItemAtURL: (OFURL *)URL
{
OF_UNRECOGNIZED_SELECTOR
}
- (void)linkItemAtURL: (OFURL *)source toURL: (OFURL *)destination
{
OF_UNRECOGNIZED_SELECTOR
}
- (void)createSymbolicLinkAtURL: (OFURL *)destination
withDestinationPath: (OFString *)source
{
OF_UNRECOGNIZED_SELECTOR
}
- (bool)copyItemAtURL: (OFURL *)source toURL: (OFURL *)destination
{
return false;
}
- (bool)moveItemAtURL: (OFURL *)source toURL: (OFURL *)destination
{
return false;
}
@end
|