ObjFW  Check-in [4369d4c8fb]

Overview
Comment:Add -[removeChild:] to OFXMLElement.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4369d4c8fb7c05b9a02de51d0198779add8eb814b8f7131948b91ccd3c8c1ec7
User & Date: js on 2011-09-10 22:27:33
Other Links: manifest | tags
Context
2011-09-10
23:54
Make use of the fact that -[retain] and -[release] must not throw. check-in: 3687c35784 user: js tags: trunk
22:27
Add -[removeChild:] to OFXMLElement. check-in: 4369d4c8fb user: js tags: trunk
22:17
Add -[setName:] and -[setNamespace:] to OFXMLElement. check-in: 2473176537 user: js tags: trunk
Changes

Modified src/OFXMLElement.h from [8ef6e6b71a] to [12642bbd41].

413
414
415
416
417
418
419







420
421
422
423
424
425
426
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433







+
+
+
+
+
+
+







/**
 * Adds a child to the OFXMLElement.
 *
 * \param child Another OFXMLElement which is added as a child
 */
- (void)addChild: (OFXMLElement*)child;

/**
 * Removes the first child that is equal to the specified OFXMLElement.
 *
 * \param child The child to remove from the OFXMLElement
 */
- (void)removeChild: (OFXMLElement*)child;

/**
 * Returns all children that are elements.
 *
 * \return All children that are elements
 */
- (OFArray*)elements;

Modified src/OFXMLElement.m from [3000b0638d] to [ddafe5133c].

1028
1029
1030
1031
1032
1033
1034









1035
1036
1037
1038
1039
1040
1041
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050







+
+
+
+
+
+
+
+
+







						       selector: _cmd];

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

	[children addObject: child];
}

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

	[children removeObject: child];
}

- (OFXMLElement*)elementForName: (OFString*)elementName
{
	return [[self elementsForName: elementName] firstObject];
}

- (OFXMLElement*)elementForName: (OFString*)elementName