From 853cc1312e839b3241d13a0a710bb589d3a7e453 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 19 Jun 2009 14:48:25 +0000 Subject: [PATCH] Monotone-Parent: a87d7a6ebe1e63e7828494f7104ff49289abc15e Monotone-Revision: e785838ad834b8a805eeb85700cd115f2501c0f7 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-06-19T14:48:25 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 9 +++++++++ SoObjects/SOGo/NSArray+DAV.m | 13 ++++++++----- SoObjects/SOGo/NSString+DAV.h | 3 ++- SoObjects/SOGo/NSString+DAV.m | 16 +++++++++++++--- 4 files changed, 32 insertions(+), 9 deletions(-) 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