ObjFW  Diff

Differences From Artifact [8f52b3e64a]:

To Artifact [2f5f515df2]:


12
13
14
15
16
17
18


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

30
31
32
33
34
35
36







+
+









-







 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include <stdlib.h>

#include <assert.h>

#import "OFDictionary.h"
#import "OFDictionary_hashtable.h"
#import "OFArray.h"
#import "OFString.h"
#import "OFXMLElement.h"

#import "OFInvalidArgumentException.h"
#import "OFNotImplementedException.h"

#import "autorelease.h"

static struct {
	Class isa;
} placeholder;

109
110
111
112
113
114
115
116
117
118





119
120
121
122
123
124
125
110
111
112
113
114
115
116



117
118
119
120
121
122
123
124
125
126
127
128







-
-
-
+
+
+
+
+








- (void)release
{
}

- (void)dealloc
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[super dealloc];	/* Get rid of a stupid warning */
	[self doesNotRecognizeSelector: _cmd];
	abort();

	/* Get rid of a stupid warning */
	[super dealloc];
}
@end

@implementation OFDictionary
+ (void)initialize
{
	if (self == [OFDictionary class])
179
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
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
211
212
213
214
215
216







+
-
-
-
+
+
+
+
+
-
+







+
-
-
-
+
+
+
+
+
-
+








	return ret;
}

- init
{
	if (object_getClass(self) == [OFDictionary class]) {
		@try {
		Class c = [self class];
		[self release];
		@throw [OFNotImplementedException exceptionWithClass: c
			[self doesNotRecognizeSelector: _cmd];
			abort();
		} @catch (id e) {
			[self release];
			@throw e;
							    selector: _cmd];
		}
	}

	return [super init];
}

- initWithDictionary: (OFDictionary*)dictionary
{
	@try {
	Class c = [self class];
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
		[self doesNotRecognizeSelector: _cmd];
		abort();
	} @catch (id e) {
		[self release];
		@throw e;
						    selector: _cmd];
	}
}

- initWithObject: (id)object
	  forKey: (id)key
{
	if (key == nil || object == nil)
		@throw [OFInvalidArgumentException
235
236
237
238
239
240
241

242
243
244





245

246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263

264
265
266





267

268
269
270
271

272
273
274





275

276
277
278
279
280
281


282
283
284
285
286
287
288
289
290
291
292


293
294
295
296
297
298
299
244
245
246
247
248
249
250
251



252
253
254
255
256

257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276



277
278
279
280
281

282
283
284
285
286
287



288
289
290
291
292

293
294
295
296
297


298
299
300
301
302
303
304
305
306
307
308


309
310
311
312
313
314
315
316
317







+
-
-
-
+
+
+
+
+
-
+


















+
-
-
-
+
+
+
+
+
-
+




+
-
-
-
+
+
+
+
+
-
+




-
-
+
+









-
-
+
+







			       count: count];
}

- initWithObjects: (id const*)objects
	  forKeys: (id const*)keys
	    count: (size_t)count
{
	@try {
	Class c = [self class];
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
		[self doesNotRecognizeSelector: _cmd];
		abort();
	} @catch (id e) {
		[self release];
		@throw e;
						    selector: _cmd];
	}
}

- initWithKeysAndObjects: (id)firstKey, ...
{
	id ret;
	va_list arguments;

	va_start(arguments, firstKey);
	ret = [self initWithKey: firstKey
		      arguments: arguments];
	va_end(arguments);

	return ret;
}

- initWithKey: (id)firstKey
    arguments: (va_list)arguments
{
	@try {
	Class c = [self class];
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
		[self doesNotRecognizeSelector: _cmd];
		abort();
	} @catch (id e) {
		[self release];
		@throw e;
						    selector: _cmd];
	}
}

- initWithSerialization: (OFXMLElement*)element
{
	@try {
	Class c = [self class];
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
		[self doesNotRecognizeSelector: _cmd];
		abort();
	} @catch (id e) {
		[self release];
		@throw e;
						    selector: _cmd];
	}
}

- (id)objectForKey: (id)key
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (id)objectForKeyedSubscript: (id)key
{
	return [self objectForKey: key];
}

- (size_t)count
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- copy
{
	return [self retain];
}

437
438
439
440
441
442
443
444
445


446
447
448
449
450
451


452
453
454
455
456
457
458
459


460
461
462
463
464
465
466
455
456
457
458
459
460
461


462
463
464
465
466
467


468
469
470
471
472
473
474
475


476
477
478
479
480
481
482
483
484







-
-
+
+




-
-
+
+






-
-
+
+







	}

	return ret;
}

- (OFEnumerator*)objectEnumerator
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (OFEnumerator*)keyEnumerator
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
			   objects: (id*)objects
			     count: (int)count_
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

#if defined(OF_HAVE_BLOCKS) && defined(OF_HAVE_FAST_ENUMERATION)
- (void)enumerateKeysAndObjectsUsingBlock:
    (of_dictionary_enumeration_block_t)block
{
	BOOL stop = NO;