Monotone-Parent: 0df73c55c83973b5088ccb3350d103006525098c

Monotone-Revision: 0836ff89730377219eb53f7caa175eefe1f680a3

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-10-03T16:09:43
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2006-10-03 16:09:43 +00:00
parent 29f8ab0852
commit 6ca2e1bfcf
8 changed files with 48 additions and 44 deletions
-6
View File
@@ -12,9 +12,6 @@ libSOGoUI_HEADER_FILES_INSTALL_DIR = /SOGoUI
FHS_HEADER_DIRS = SOGoUI
libSOGoUI_HEADER_FILES += \
\
NSDictionary+URL.h \
NSString+URL.h \
\
UIxComponent.h \
SOGoDateFormatter.h \
@@ -23,9 +20,6 @@ libSOGoUI_HEADER_FILES += \
WOContext+UIx.h \
libSOGoUI_OBJC_FILES += \
\
NSDictionary+URL.m \
NSString+URL.m \
\
UIxComponent.m \
SOGoDateFormatter.m \
-36
View File
@@ -1,36 +0,0 @@
/* NSDictionary+URL.h - this file is part of SOGo
*
* Copyright (C) 2006 Inverse groupe conseil
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef NSDICTIONARY_URL_H
#define NSDICTIONARY_URL_H
#import <Foundation/NSDictionary.h>
@class NSString;
@interface NSDictionary (SOGoURLExtension)
- (NSString *) asURLParameters;
@end
#endif /* NSDICTIONARY_URL_H */
-61
View File
@@ -1,61 +0,0 @@
/* NSDictionary+URL.m - this file is part of SOGo
*
* Copyright (C) 2006 Inverse groupe conseil
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSString.h>
#import "NSDictionary+URL.h"
@implementation NSDictionary (SOGoURLExtension)
- (NSString *) asURLParameters
{
NSMutableString *urlParameters;
NSArray *keys;
NSEnumerator *keysEnum;
NSString *currentKey;
BOOL isFirst;
urlParameters = [NSMutableString new];
[urlParameters autorelease];
keys = [self allKeys];
if ([keys count] > 0)
{
isFirst = YES;
keysEnum = [keys objectEnumerator];
currentKey = [keysEnum nextObject];
while (currentKey)
{
[urlParameters appendFormat: @"%@%@=%@",
((isFirst) ? @"?" : @"&"),
currentKey, [self objectForKey: currentKey]];
isFirst = NO;
currentKey = [keysEnum nextObject];
}
}
return urlParameters;
}
@end
-39
View File
@@ -1,39 +0,0 @@
/* NSString+URL.h - this file is part of SOGo
*
* Copyright (C) 2006 Inverse groupe conseil
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef NSSTRING_URL_H
#define NSSTRING_URL_H
#import <Foundation/NSString.h>
@class NSDictionary;
@interface NSString (SOGoURLExtension)
- (NSString *) composeURLWithAction: (NSString *) action
parameters: (NSDictionary *) urlParameters
andHash: (BOOL) useHash;
- (NSString *) hostlessURL;
@end
#endif /* NSSTRING_URL_H */
-66
View File
@@ -1,66 +0,0 @@
/* NSString+URL.m - this file is part of SOGo
*
* Copyright (C) 2006 Inverse group conseil
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import "NSString+URL.h"
#import "NSDictionary+URL.h"
@implementation NSString (SOGoURLExtension)
- (NSString *) composeURLWithAction: (NSString *) action
parameters: (NSDictionary *) urlParameters
andHash: (BOOL) useHash
{
NSMutableString *completeURL;
completeURL = [NSMutableString new];
[completeURL autorelease];
[completeURL appendString: self];
if (![completeURL hasSuffix: @"/"])
[completeURL appendString: @"/"];
[completeURL appendString: action];
[completeURL appendString: [urlParameters asURLParameters]];
if (useHash)
[completeURL appendString: @"#"];
return completeURL;
}
- (NSString *) hostlessURL
{
NSString *newURL;
NSRange hostR, locationR;
if ([self hasPrefix: @"/"])
newURL = [self copy];
else
{
hostR = [self rangeOfString: @"://"];
locationR = [[self substringFromIndex: (hostR.location + hostR.length)]
rangeOfString: @"/"];
newURL = [self substringFromIndex: (hostR.location + hostR.length + locationR.location)];
}
return newURL;
}
@end