mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
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:
parent
c52ed1b132
commit
7c62fa16e6
3 changed files with 17 additions and 2 deletions
|
@ -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.
|
||||
|
|
|
@ -130,6 +130,7 @@ typedef xmlNsType GSXMLNamespaceType;
|
|||
- (GSXMLNode*) prev;
|
||||
- (GSXMLAttribute*) properties;
|
||||
- (NSMutableDictionary*) propertiesAsDictionary;
|
||||
- (NSMutableDictionary*) propertiesAsDictionaryWithKeyTransformationSel:(SEL)keyTransformSel;
|
||||
- (GSXMLElementType) type;
|
||||
- (NSString*) typeDescription;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue