ObjFW  Diff

Differences From Artifact [0df520b24c]:

To Artifact [9e3f055893]:


139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159

160
161
162
163
164
165
166
139
140
141
142
143
144
145

146

147
148
149
150
151
152
153
154

155

156
157
158
159
160
161
162
163







-

-








-

-
+







	OF_UNRECOGNIZED_SELECTOR
}

- (OFString*)description
{
	OFMutableString *ret;
	void *pool;
	OFEnumerator *enumerator;
	size_t i, count = [self count];
	id object;

	if (count == 0)
		return @"{()}";

	ret = [OFMutableString stringWithString: @"{(\n"];

	pool = objc_autoreleasePoolPush();

	enumerator = [self objectEnumerator];
	i = 0;
	while ((object = [enumerator nextObject]) != nil) {
	for (id object in self) {
		void *pool2 = objc_autoreleasePoolPush();

		[ret appendString: object];
		[ret appendFormat: @": %zu", [self countForObject: object]];

		if (++i < count)
			[ret appendString: @",\n"];
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202

203
204
205
206
207
208
209
210
185
186
187
188
189
190
191


192
193
194
195


196

197
198
199
200
201
202
203







-
-




-
-
+
-







	return [[OFCountedSet alloc] initWithSet: self];
}

- (OFXMLElement*)XMLElementBySerializing
{
	void *pool = objc_autoreleasePoolPush();
	OFXMLElement *element;
	OFEnumerator *enumerator;
	id <OFSerialization> object;

	element = [OFXMLElement elementWithName: @"OFCountedSet"
				      namespace: OF_SERIALIZATION_NS];

	enumerator = [self objectEnumerator];

	for (id <OFSerialization> object in self) {
	while ((object = [enumerator nextObject]) != nil) {
		void *pool2 = objc_autoreleasePoolPush();

		OFXMLElement *objectElement;
		OFString *count;

		count =
		    [OFString stringWithFormat: @"%zu",
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
233
234
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







-
-

-
+





-
+
-
-
+
-
-

-










-
-

-
+





-
+
-
-
+
-
-

-





- (void)minusSet: (OFSet*)set
{
	void *pool = objc_autoreleasePoolPush();

	if ([set isKindOfClass: [OFCountedSet class]]) {
		OFCountedSet *countedSet = (OFCountedSet*)set;
		OFEnumerator *enumerator = [countedSet objectEnumerator];
		id object;

		while ((object = [enumerator nextObject]) != nil) {
		for (id object in countedSet) {
			size_t i, count = [countedSet countForObject: object];

			for (i = 0; i < count; i++)
				[self removeObject: object];
		}
	} else {
	} else
		OFEnumerator *enumerator = [set objectEnumerator];
		id object;
		for (id object in set)

		while ((object = [enumerator nextObject]) != nil)
			[self removeObject: object];
	}

	objc_autoreleasePoolPop(pool);
}

- (void)unionSet: (OFSet*)set
{
	void *pool = objc_autoreleasePoolPush();

	if ([set isKindOfClass: [OFCountedSet class]]) {
		OFCountedSet *countedSet = (OFCountedSet*)set;
		OFEnumerator *enumerator = [countedSet objectEnumerator];
		id object;

		while ((object = [enumerator nextObject]) != nil) {
		for (id object in countedSet) {
			size_t i, count = [countedSet countForObject: object];

			for (i = 0; i < count; i++)
				[self addObject: object];
		}
	} else {
	} else
		OFEnumerator *enumerator = [set objectEnumerator];
		id object;
		for (id object in set)

		while ((object = [enumerator nextObject]) != nil)
			[self addObject: object];
	}

	objc_autoreleasePoolPop(pool);
}
@end