ObjFW  Diff

Differences From Artifact [a65668b812]:

To Artifact [748986426d]:


215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
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
274
275
276
277
278
279
280
281
282
283
					   length: len];
	} @finally {
		[self freeMemory: str_c];
	}
	return ret;
}

- addAttribute: (OFXMLAttribute*)attr
{
	if (attrs == nil)
		attrs = [[OFMutableArray alloc] init];

	/* FIXME: Prevent having it twice! */

	[attrs addObject: attr];

	return self;
}

- addAttributeWithName: (OFString*)name_
	   stringValue: (OFString*)value
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	[self addAttribute: [OFXMLAttribute attributeWithName: name_
						       prefix: nil
						    namespace: nil
						  stringValue: value]];
	[pool release];

	return self;
}

/* TODO: Replace attribute */
/* TODO: Remove attribute */

- addChild: (OFXMLElement*)child
{
	if (stringval != nil)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	if (children == nil)
		children = [[OFMutableArray alloc] init];

	[children addObject: child];

	return self;
}

- (void)dealloc
{
	[name release];
	[attrs release];
	[stringval release];
	[children release];

	[super dealloc];
}
@end

@implementation OFString (OFXMLEscaping)
- stringByXMLEscaping
{
	char *str_c, *append, *tmp;
	size_t len, append_len;
	size_t i, j;
	OFString *ret;

	j = 0;







|







|
<
|
<
|
|







<
<





|









<
<














|







215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230

231

232
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
274
275
276
277
					   length: len];
	} @finally {
		[self freeMemory: str_c];
	}
	return ret;
}

- (void)addAttribute: (OFXMLAttribute*)attr
{
	if (attrs == nil)
		attrs = [[OFMutableArray alloc] init];

	/* FIXME: Prevent having it twice! */

	[attrs addObject: attr];
}



- (void)addAttributeWithName: (OFString*)name_
		 stringValue: (OFString*)value
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	[self addAttribute: [OFXMLAttribute attributeWithName: name_
						       prefix: nil
						    namespace: nil
						  stringValue: value]];
	[pool release];


}

/* TODO: Replace attribute */
/* TODO: Remove attribute */

- (void)addChild: (OFXMLElement*)child
{
	if (stringval != nil)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	if (children == nil)
		children = [[OFMutableArray alloc] init];

	[children addObject: child];


}

- (void)dealloc
{
	[name release];
	[attrs release];
	[stringval release];
	[children release];

	[super dealloc];
}
@end

@implementation OFString (OFXMLEscaping)
- (OFString*)stringByXMLEscaping
{
	char *str_c, *append, *tmp;
	size_t len, append_len;
	size_t i, j;
	OFString *ret;

	j = 0;