diff --git a/ChangeLog b/ChangeLog index b93da339b..59e378506 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-06-19 Wolfgang Sourdeau + + * SoObjects/SOGo/NSString+DAV.m (asWebDAVTupleWithContent:): new + method that returns a DAV dictionary from a flat DAV element (self) + string and a content. + + * SoObjects/SOGo/NSArray+DAV.m (asWebDavStringWithNamespaces:): we + no longer use an NSEnumerator in order to be a bit faster. + 2009-06-18 Wolfgang Sourdeau * SoObjects/SOGo/DOMNode+SOGo.m diff --git a/SoObjects/SOGo/NSArray+DAV.m b/SoObjects/SOGo/NSArray+DAV.m index 84e49b33b..56cba073d 100644 --- a/SoObjects/SOGo/NSArray+DAV.m +++ b/SoObjects/SOGo/NSArray+DAV.m @@ -33,14 +33,17 @@ asWebDavStringWithNamespaces: (NSMutableDictionary *) namespaces { NSMutableString *webdavString; - NSEnumerator *children; + unsigned int count, max; NSObject *child; webdavString = [NSMutableString string]; - children = [self objectEnumerator]; - while ((child = [children nextObject])) - [webdavString appendString: - [child asWebDavStringWithNamespaces: namespaces]]; + max = [self count]; + for (count = 0; count < max; count++) + { + child = [self objectAtIndex: count]; + [webdavString appendString: + [child asWebDavStringWithNamespaces: namespaces]]; + } return webdavString; } diff --git a/SoObjects/SOGo/NSString+DAV.h b/SoObjects/SOGo/NSString+DAV.h index 75cbde590..156d06ced 100644 --- a/SoObjects/SOGo/NSString+DAV.h +++ b/SoObjects/SOGo/NSString+DAV.h @@ -31,7 +31,8 @@ - (NSString *) asWebDavStringWithNamespaces: (NSMutableDictionary *) namespaces; -- (NSDictionary *) asWebDAVTuple; +- (NSMutableDictionary *) asWebDAVTuple; +- (NSMutableDictionary *) asWebDAVTupleWithContent: (id) content; @end diff --git a/SoObjects/SOGo/NSString+DAV.m b/SoObjects/SOGo/NSString+DAV.m index 1f44cb3dd..9052c6d54 100644 --- a/SoObjects/SOGo/NSString+DAV.m +++ b/SoObjects/SOGo/NSString+DAV.m @@ -35,7 +35,7 @@ } #warning we should use the same nomenclature as the webdav values... -- (NSDictionary *) asWebDAVTuple +- (NSMutableDictionary *) asWebDAVTuple { NSString *namespace, *nodeName; NSRange nsEnd; @@ -44,9 +44,19 @@ namespace = [self substringFromRange: NSMakeRange (1, nsEnd.location - 1)]; nodeName = [self substringFromIndex: nsEnd.location + 1]; - return [NSDictionary dictionaryWithObjectsAndKeys: namespace, @"ns", - nodeName, @"method", nil]; + return [NSMutableDictionary + dictionaryWithObjectsAndKeys: namespace, @"ns", + nodeName, @"method", nil]; } +- (NSMutableDictionary *) asWebDAVTupleWithContent: (id) content +{ + NSMutableDictionary *tuple; + + tuple = [self asWebDAVTuple]; + [tuple setObject: content forKey: @"content"]; + + return tuple; +} @end