diff --git a/ChangeLog b/ChangeLog index 736a1728a..663eb1de1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2006-12-14 Wolfgang Sourdeau + * SoObjects/SOGo/NSString+Utilities.[hm]: old "NSString+URL" + renamed. + ([NSString -davMethodToObjC]): method that returns the method name + for a DAV property implementation. + * SoObjects/SOGo/NSArray+Utilities.m: new extension module to NSArray. ([NSArray -stringsWithFormat:format]): new method that returns diff --git a/SoObjects/SOGo/NSString+URL.h b/SoObjects/SOGo/NSString+Utilities.h similarity index 97% rename from SoObjects/SOGo/NSString+URL.h rename to SoObjects/SOGo/NSString+Utilities.h index 9cdb529bb..45d76d7b2 100644 --- a/SoObjects/SOGo/NSString+URL.h +++ b/SoObjects/SOGo/NSString+Utilities.h @@ -36,6 +36,8 @@ - (NSString *) urlWithoutParameters; +- (NSString *) davMethodToObjC; + @end #endif /* NSSTRING_URL_H */ diff --git a/SoObjects/SOGo/NSString+URL.m b/SoObjects/SOGo/NSString+Utilities.m similarity index 80% rename from SoObjects/SOGo/NSString+URL.m rename to SoObjects/SOGo/NSString+Utilities.m index 72391f82d..ae0b79e85 100644 --- a/SoObjects/SOGo/NSString+URL.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -20,7 +20,7 @@ * Boston, MA 02111-1307, USA. */ -#import "NSString+URL.h" +#import "NSString+Utilities.h" #import "NSDictionary+URL.h" @implementation NSString (SOGoURLExtension) @@ -51,7 +51,10 @@ NSRange hostR, locationR; if ([self hasPrefix: @"/"]) - newURL = [self copy]; + { + newURL = [self copy]; + [newURL autorelease]; + } else { hostR = [self rangeOfString: @"://"]; @@ -77,4 +80,22 @@ return newUrl; } +- (NSString *) davMethodToObjC +{ + NSMutableString *newName; + NSEnumerator *components; + NSString *component; + + newName = [NSMutableString stringWithString: @"dav"]; + components = [[self componentsSeparatedByString: @"-"] objectEnumerator]; + component = [components nextObject]; + while (component) + { + [newName appendString: [component capitalizedString]]; + component = [components nextObject]; + } + + return newName; +} + @end