ObjFW  Diff

Differences From Artifact [b449554094]:

To Artifact [1f70933951]:

  • File src/OFXMLElement.m — part of check-in [48980f2297] at 2015-11-29 11:43:05 on branch trunk — Make properties a requirement and clean up code

    This increases the required GCC version from 4.0 to 4.6 (exception:
    Apple GCC, which already supports this with >= 4.0 starting with OS X
    10.5). Since even GCC 4.6 is really old by now, there is no point in
    still supporting something even older and making the code ugly because
    of that. While some hardware and OS support was dropped from GCC 4.6
    compared to GCC 4.0, there is nothing in there that would be an
    interesting target with the exception of BeOS maybe - but a port to BeOS
    can also be achieved using the Haiku support. The other dropped OSes are
    mostly old versions of OSes while newer ones are still being supported
    (and those newer versions of those OSes still support the same
    hardware). (user: js, size: 27300) [annotate] [blame] [check-ins using]


66
67
68
69
70
71
72



73
74
75
76
77
78
79
	[_element release];

	[super dealloc];
}
@end

@implementation OFXMLElement



+ (void)initialize
{
	if (self == [OFXMLElement class]) {
		charactersClass = [OFXMLCharacters class];
		CDATAClass = [OFXMLCDATA class];
	}
}







>
>
>







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
	[_element release];

	[super dealloc];
}
@end

@implementation OFXMLElement
@synthesize name = _name, namespace = _namespace;
@synthesize defaultNamespace = _defaultNamespace;

+ (void)initialize
{
	if (self == [OFXMLElement class]) {
		charactersClass = [OFXMLCharacters class];
		CDATAClass = [OFXMLCDATA class];
	}
}
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
	    autorelease];

	[parser setDelegate: builder];
	[builder setDelegate: delegate];

	[parser parseString: string];

	if (![parser finishedParsing])
		@throw [OFMalformedXMLException exceptionWithParser: parser];

	self = [delegate->_element retain];

	objc_autoreleasePoolPop(pool);

	return self;







|







224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
	    autorelease];

	[parser setDelegate: builder];
	[builder setDelegate: delegate];

	[parser parseString: string];

	if (![parser hasFinishedParsing])
		@throw [OFMalformedXMLException exceptionWithParser: parser];

	self = [delegate->_element retain];

	objc_autoreleasePoolPop(pool);

	return self;
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
	    autorelease];

	[parser setDelegate: builder];
	[builder setDelegate: delegate];

	[parser parseFile: path];

	if (![parser finishedParsing])
		@throw [OFMalformedXMLException exceptionWithParser: parser];

	self = [delegate->_element retain];

	objc_autoreleasePoolPop(pool);

	return self;







|







256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
	    autorelease];

	[parser setDelegate: builder];
	[builder setDelegate: delegate];

	[parser parseFile: path];

	if (![parser hasFinishedParsing])
		@throw [OFMalformedXMLException exceptionWithParser: parser];

	self = [delegate->_element retain];

	objc_autoreleasePoolPop(pool);

	return self;
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402


403
404
405
406
407
408
409
410
411
412
413
414
	[_attributes release];
	[_namespaces release];
	[_children release];

	[super dealloc];
}

- (void)setName: (OFString*)name
{
	if (name == nil)
		@throw [OFInvalidArgumentException exception];

	OF_SETTER(_name, name, true, 1)
}

- (OFString*)name
{
	OF_GETTER(_name, true)
}

- (void)setNamespace: (OFString*)namespace
{
	OF_SETTER(_namespace, namespace, true, 1)
}

- (OFString*)namespace
{
	OF_GETTER(_namespace, true)
}

- (OFArray*)attributes
{
	OF_GETTER(_attributes, true)
}

- (void)setChildren: (OFArray*)children
{
	OF_SETTER(_children, children, true, 2)


}

- (OFArray*)children
{
	OF_GETTER(_children, true)
}

- (void)setStringValue: (OFString*)stringValue
{
	void *pool = objc_autoreleasePoolPush();

	[self setChildren: [OFArray arrayWithObject:







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


|




|
>
>




|







368
369
370
371
372
373
374























375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
	[_attributes release];
	[_namespaces release];
	[_children release];

	[super dealloc];
}
























- (OFArray*)attributes
{
	return [[_attributes copy] autorelease];
}

- (void)setChildren: (OFArray*)children
{
	OFArray *old = _children;
	_children = [children copy];
	[old release];
}

- (OFArray*)children
{
	return [[_children copy] autorelease];
}

- (void)setStringValue: (OFString*)stringValue
{
	void *pool = objc_autoreleasePoolPush();

	[self setChildren: [OFArray arrayWithObject:
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
	[self setPrefix: prefix
	   forNamespace: namespace];
	[self addAttributeWithName: prefix
			 namespace: @"http://www.w3.org/2000/xmlns/"
		       stringValue: namespace];
}

- (OFString*)defaultNamespace
{
	OF_GETTER(_defaultNamespace, true)
}

- (void)setDefaultNamespace: (OFString*)defaultNamespace
{
	OF_SETTER(_defaultNamespace, defaultNamespace, true, 1)
}

- (void)addChild: (OFXMLNode*)child
{
	if ([child isKindOfClass: [OFXMLAttribute class]])
		@throw [OFInvalidArgumentException exception];

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







<
<
<
<
<
<
<
<
<
<







889
890
891
892
893
894
895










896
897
898
899
900
901
902
	[self setPrefix: prefix
	   forNamespace: namespace];
	[self addAttributeWithName: prefix
			 namespace: @"http://www.w3.org/2000/xmlns/"
		       stringValue: namespace];
}











- (void)addChild: (OFXMLNode*)child
{
	if ([child isKindOfClass: [OFXMLAttribute class]])
		@throw [OFInvalidArgumentException exception];

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