diff --git a/SOPE/NGCards/versitCardsSaxDriver/ChangeLog b/SOPE/NGCards/versitCardsSaxDriver/ChangeLog index a39b14061..f166451be 100644 --- a/SOPE/NGCards/versitCardsSaxDriver/ChangeLog +++ b/SOPE/NGCards/versitCardsSaxDriver/ChangeLog @@ -1,3 +1,7 @@ +2009-03-24 Wolfgang Sourdeau + + * VSStringFormatter.[hm]: removed useless module. + 2007-08-27 Wolfgang Sourdeau * VSSaxDriver.m ([VSSaxDriver diff --git a/SOPE/NGCards/versitCardsSaxDriver/GNUmakefile b/SOPE/NGCards/versitCardsSaxDriver/GNUmakefile index b28f46d96..edb6e1097 100644 --- a/SOPE/NGCards/versitCardsSaxDriver/GNUmakefile +++ b/SOPE/NGCards/versitCardsSaxDriver/GNUmakefile @@ -14,8 +14,7 @@ versitCardsSaxDriver_PCH_FILE = common.h versitCardsSaxDriver_OBJC_FILES = \ VSSaxDriver.m \ - VSCardSaxDriver.m \ - VSStringFormatter.m \ + VSCardSaxDriver.m versitCardsSaxDriver_RESOURCE_FILES = bundle-info.plist diff --git a/SOPE/NGCards/versitCardsSaxDriver/VSSaxDriver.m b/SOPE/NGCards/versitCardsSaxDriver/VSSaxDriver.m index 22ad7653c..38ff8bffa 100644 --- a/SOPE/NGCards/versitCardsSaxDriver/VSSaxDriver.m +++ b/SOPE/NGCards/versitCardsSaxDriver/VSSaxDriver.m @@ -29,7 +29,6 @@ are not expected in a sax handler... this is all wrong. */ #import "VSSaxDriver.h" -#import "VSStringFormatter.h" #import #import #import @@ -164,8 +163,6 @@ static NSCharacterSet *colonAndSemicolonCharSet = nil; static NSCharacterSet *colonSemicolonAndDquoteCharSet = nil; static NSCharacterSet *whitespaceCharSet = nil; -static VSStringFormatter *stringFormatter = nil; - + (void) initialize { static BOOL didInit = NO; @@ -190,8 +187,6 @@ static VSStringFormatter *stringFormatter = nil; [[NSCharacterSet characterSetWithCharactersInString: @":;\""] retain]; whitespaceCharSet = [[NSCharacterSet whitespaceCharacterSet] retain]; - - stringFormatter = [VSStringFormatter sharedFormatter]; } - (id) init { @@ -382,7 +377,6 @@ static VSStringFormatter *stringFormatter = nil; *attr_ = attrName; *value_ = [attrValue unescapedFromCard]; -// *value_ = [stringFormatter stringByUnescapingRFC2445Text: attrValue]; } - (SaxAttributes *) _mapAttrs: (NSArray *) _attrs diff --git a/SOPE/NGCards/versitCardsSaxDriver/VSStringFormatter.h b/SOPE/NGCards/versitCardsSaxDriver/VSStringFormatter.h deleted file mode 100644 index 13d901203..000000000 --- a/SOPE/NGCards/versitCardsSaxDriver/VSStringFormatter.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (C) 2004-2005 OpenGroupware.org - - This file is part of versitCardsSaxDriver, written for the OpenGroupware.org - project (OGo). - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. - */ - - -#ifndef __VSStringFormatter_H_ -#define __VSStringFormatter_H_ - -#import - -@interface VSStringFormatter : NSObject -{ -} - -+ (id)sharedFormatter; -- (NSString *)stringByUnescapingRFC2445Text:(NSString *)_s; - -@end - -#endif /* __VSStringFormatter_H_ */ diff --git a/SOPE/NGCards/versitCardsSaxDriver/VSStringFormatter.m b/SOPE/NGCards/versitCardsSaxDriver/VSStringFormatter.m deleted file mode 100644 index 5535e5ebb..000000000 --- a/SOPE/NGCards/versitCardsSaxDriver/VSStringFormatter.m +++ /dev/null @@ -1,94 +0,0 @@ -/* - Copyright (C) 2004-2005 OpenGroupware.org - - This file is part of versitCardsSaxDriver, written for the OpenGroupware.org - project (OGo). - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "VSStringFormatter.h" -#include "common.h" - -@implementation VSStringFormatter - -static NSCharacterSet *escSet = nil; - -+ (void)initialize { - static BOOL didInit = NO; - - if(didInit) - return; - - didInit = YES; - escSet = [[NSCharacterSet characterSetWithCharactersInString:@"\\"] retain]; -} - -+ (id)sharedFormatter { - static id sharedInstance = nil; - if(!sharedInstance) { - sharedInstance = [[self alloc] init]; - } - return sharedInstance; -} - -- (NSString *)stringByUnescapingRFC2445Text:(NSString *)_s { - NSMutableString *safeString; - unsigned length; - NSRange prevRange, escRange; - NSRange todoRange; - BOOL needsEscaping; - - length = [_s length]; - prevRange = NSMakeRange(0, length); - escRange = [_s rangeOfCharacterFromSet:escSet options:0 range:prevRange]; - - needsEscaping = escRange.length > 0 ? YES : NO; - if (!needsEscaping) - return _s; /* cheap */ - - safeString = [NSMutableString stringWithCapacity:length]; - - do { - prevRange.length = escRange.location - prevRange.location; - if (prevRange.length > 0) - [safeString appendString:[_s substringWithRange:prevRange]]; - - /* test edge case */ - if(NSMaxRange(escRange) < length) { - unichar c = [_s characterAtIndex:escRange.location + 1]; - if(c == 'n' || c == 'N') { - [safeString appendString:@"\n"]; - escRange.length += 1; /* skip the 'n' */ - } - } - - prevRange.location = NSMaxRange(escRange); - todoRange.location = prevRange.location; - todoRange.length = length - prevRange.location; - escRange = [_s rangeOfCharacterFromSet:escSet - options:0 - range:todoRange]; - } - while(escRange.length > 0); - - if (todoRange.length > 0) - [safeString appendString:[_s substringWithRange:todoRange]]; - - return safeString; -} - -@end /* VSStringFormatter */