2000-11-01 Manuel Guesdon <mguesdon@orange-concept.com>

* Headers/Foundation/GSXML.h: added GSXMLNode
		propertiesAsDictionaryWithKeyTransformationSel:
	* Source/GSXML.m: added GSXMLNode
		propertiesAsDictionaryWithKeyTransformationSel:


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@7967 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Manuel Guesdon 2000-11-01 14:14:37 +00:00
parent c52ed1b132
commit 7c62fa16e6
3 changed files with 17 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2000-11-01 Manuel Guesdon <mguesdon@orange-concept.com>
* Headers/Foundation/GSXML.h: added GSXMLNode
propertiesAsDictionaryWithKeyTransformationSel:
* Source/GSXML.m: added GSXMLNode
propertiesAsDictionaryWithKeyTransformationSel:
2000-11-01 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUserDefaults.m: Fixed uninitialised variable bug.

View file

@ -130,6 +130,7 @@ typedef xmlNsType GSXMLNamespaceType;
- (GSXMLNode*) prev;
- (GSXMLAttribute*) properties;
- (NSMutableDictionary*) propertiesAsDictionary;
- (NSMutableDictionary*) propertiesAsDictionaryWithKeyTransformationSel:(SEL)keyTransformSel;
- (GSXMLElementType) type;
- (NSString*) typeDescription;

View file

@ -551,6 +551,11 @@ static NSMapTable *nodeNames = 0;
}
- (NSMutableDictionary*) propertiesAsDictionary
{
return [self propertiesAsDictionaryWithKeyTransformationSel:NULL];
};
- (NSMutableDictionary*) propertiesAsDictionaryWithKeyTransformationSel:(SEL)keyTransformSel
{
xmlAttrPtr prop;
NSMutableDictionary *d = [NSMutableDictionary dictionary];
@ -560,16 +565,19 @@ static NSMapTable *nodeNames = 0;
while (prop != NULL)
{
const void *name = prop->name;
NSString*key=UTF8Str(name);
if (keyTransformSel)
key=[key performSelector:keyTransformSel];
if (prop->children != NULL)
{
const void *content = prop->children->content;
[d setObject: UTF8Str(content) forKey: UTF8Str(name)];
[d setObject: UTF8Str(content) forKey: key];
}
else
{
[d setObject: @"" forKey: UTF8Str(name)];
[d setObject: @"" forKey: key];
}
prop = prop->next;
}