Monotone-Parent: d28c051b2f83062ff54891a804d548e9ca666837

Monotone-Revision: 4e94693f8d0d9bd27638178db0ec3d7df3939ff0

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-10-26T18:28:22
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-10-26 18:28:22 +00:00
parent d441ff54cb
commit 1d623e943a
3 changed files with 25 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2010-10-26 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/NSArray+Utilities.m (-mergedArrayWithArray:): new
method that returns the contact of the current array merged with
a unique copy of the objects of the array passed as parameter.
* SoObjects/SOGo/SOGoUserDefaults.m (-{set}ContactsCategories):
renamed version of the "contactCategories" accessors.

View File

@ -57,6 +57,8 @@
/* foreach ... */
- (NSArray *) resultsOfSelector: (SEL) operation;
- (NSArray *) mergedArrayWithArray: (NSArray *) otherArray;
@end
@interface NSMutableArray (SOGoArrayUtilities)

View File

@ -204,6 +204,25 @@
return results;
}
- (NSArray *) mergedArrayWithArray: (NSArray *) otherArray
{
NSMutableArray *mergedArray;
NSUInteger count, max;
id object;
max = [otherArray count];
mergedArray = [NSMutableArray arrayWithCapacity: (max + [self count])];
[mergedArray setArray: self];
for (count = 0; count < max; count++)
{
object = [otherArray objectAtIndex: count];
if (![mergedArray containsObject: object])
[mergedArray addObject: object];
}
return mergedArray;
}
- (NSString *) jsonRepresentation
{
id currentElement;