ObjFW  Diff

Differences From Artifact [258a8f4b24]:

To Artifact [e5de8c4c10]:


36
37
38
39
40
41
42
43

44
45
46
47
48
49
50

51
52
53
54
55
56
57
58
36
37
38
39
40
41
42

43

44
45
46
47
48

49

50
51
52
53
54
55
56







-
+
-





-
+
-








- (instancetype)initWithDictionary: (OFDictionary *)dictionary
{
	return (id)[[OFMutableMapTableDictionary alloc]
	    initWithDictionary: dictionary];
}

- (instancetype)initWithObject: (id)object
- (instancetype)initWithObject: (id)object forKey: (id)key
			forKey: (id)key
{
	return (id)[[OFMutableMapTableDictionary alloc] initWithObject: object
								forKey: key];
}

- (instancetype)initWithObjects: (OFArray *)objects
- (instancetype)initWithObjects: (OFArray *)objects forKeys: (OFArray *)keys
			forKeys: (OFArray *)keys
{
	return (id)[[OFMutableMapTableDictionary alloc] initWithObjects: objects
								forKeys: keys];
}

- (instancetype)initWithObjects: (id const *)objects
			forKeys: (id const *)keys
72
73
74
75
76
77
78
79

80
81
82
83
84
85
86
87
70
71
72
73
74
75
76

77

78
79
80
81
82
83
84







-
+
-







	ret = (id)[[OFMutableMapTableDictionary alloc] initWithKey: firstKey
							 arguments: arguments];
	va_end(arguments);

	return ret;
}

- (instancetype)initWithKey: (id)firstKey
- (instancetype)initWithKey: (id)firstKey arguments: (va_list)arguments
		  arguments: (va_list)arguments
{
	return (id)[[OFMutableMapTableDictionary alloc] initWithKey: firstKey
							  arguments: arguments];
}

- (instancetype)initWithSerialization: (OFXMLElement *)element
{
152
153
154
155
156
157
158
159

160
161
162
163
164
165

166
167
168
169

170
171
172
173
174
175
176
177
149
150
151
152
153
154
155

156

157
158
159
160

161

162
163

164

165
166
167
168
169
170
171







-
+
-




-
+
-


-
+
-







}

- (instancetype)initWithCapacity: (size_t)capacity
{
	OF_INVALID_INIT_METHOD
}

- (void)setObject: (id)object
- (void)setObject: (id)object forKey: (id)key
	   forKey: (id)key
{
	OF_UNRECOGNIZED_SELECTOR
}

-   (void)setObject: (id)object
- (void)setObject: (id)object forKeyedSubscript: (id)key
  forKeyedSubscript: (id)key
{
	if (object != nil)
		[self setObject: object
		[self setObject: object forKey: key];
			 forKey: key];
	else
		[self removeObjectForKey: key];
}

- (void)removeObjectForKey: (id)key
{
	OF_UNRECOGNIZED_SELECTOR
197
198
199
200
201
202
203
204

205
206
207
208
209
210
211

212
213
214
215
216
217
218

219
220
221
222
223
224
225
226
227
228
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
217
218
219
220







-
+
-





-
+






-
+
-









	void *pool = objc_autoreleasePoolPush();
	OFEnumerator *keyEnumerator = [dictionary keyEnumerator];
	OFEnumerator *objectEnumerator = [dictionary objectEnumerator];
	id key, object;

	while ((key = [keyEnumerator nextObject]) != nil &&
	    (object = [objectEnumerator nextObject]) != nil)
		[self setObject: object
		[self setObject: object forKey: key];
			 forKey: key];

	objc_autoreleasePoolPop(pool);
}

#ifdef OF_HAVE_BLOCKS
- (void)replaceObjectsUsingBlock: (of_dictionary_replace_block_t)block
- (void)replaceObjectsUsingBlock: (OFDictionaryReplaceBlock)block
{
	[self enumerateKeysAndObjectsUsingBlock: ^ (id key, id object,
	    bool *stop) {
		id new = block(key, object);

		if (new != object) {
			[self setObject: block(key, object)
			[self setObject: block(key, object) forKey: key];
				 forKey: key];
		}
	}];
}
#endif

- (void)makeImmutable
{
}
@end