mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-07 22:38:51 +00:00
Monotone-Parent: 04980f497e9c317b4d93db9ab0dae2f1e8e464ba
Monotone-Revision: af5a859ee61b26ffd727e648f95c54ee60e3079e Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-08-15T19:48:35 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2007-08-15 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/NSDictionary+Utilities.m ([NSDictionary
|
||||
-keysWithFormat:keyFormat]): new method inspired by the python
|
||||
string formatting system and which replaces occurences of "%{key}"
|
||||
by the corresponding keys.
|
||||
|
||||
2007-08-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* Main/SOGo.m ([SOGo -run]): check for channel-type specific
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
@interface NSDictionary (SOGoDictionaryUtilities)
|
||||
|
||||
- (NSString *) jsonRepresentation;
|
||||
- (NSString *) keysWithFormat: (NSString *) keyFormat;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import "NSArray+Utilities.h"
|
||||
#import "NSObject+Utilities.h"
|
||||
#import "NSDictionary+Utilities.h"
|
||||
|
||||
@@ -52,4 +53,27 @@
|
||||
return representation;
|
||||
}
|
||||
|
||||
- (NSString *) keysWithFormat: (NSString *) keyFormat
|
||||
{
|
||||
NSArray *keys, *allKeys;
|
||||
unsigned int count, max;
|
||||
NSMutableString *keysWithFormat;
|
||||
id value;
|
||||
|
||||
keysWithFormat = [NSMutableString stringWithString: keyFormat];
|
||||
|
||||
allKeys = [self allKeys];
|
||||
keys = [allKeys stringsWithFormat: @"%{%@}"];
|
||||
|
||||
max = [allKeys count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
value = [self objectForKey: [allKeys objectAtIndex: count]];
|
||||
[keysWithFormat replaceString: [keys objectAtIndex: count]
|
||||
withString: [value description]];
|
||||
}
|
||||
|
||||
return keysWithFormat;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user