mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-05 20:10:33 +00:00
Monotone-Parent: 810ca1c510af3f2653d3478ccb575204bc309c5a
Monotone-Revision: d3d21b70ee927b400d90095e3cd2ed9de1afc2f4 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-06-10T20:54:02 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSNull.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
|
||||
#import "NSArray+Utilities.h"
|
||||
|
||||
@@ -199,17 +200,42 @@
|
||||
|
||||
@implementation NSMutableArray (SOGoArrayUtilities)
|
||||
|
||||
- (void) addNonNSObject: (void *) objectPtr
|
||||
withSize: (size_t) objectSize
|
||||
copy: (BOOL) doCopy
|
||||
{
|
||||
void *newObjectPtr;
|
||||
|
||||
if (doCopy)
|
||||
{
|
||||
newObjectPtr = NSZoneMalloc (NULL, objectSize);
|
||||
memcpy (newObjectPtr, objectPtr, objectSize);
|
||||
}
|
||||
else
|
||||
newObjectPtr = objectPtr;
|
||||
|
||||
[self addObject: [NSValue valueWithPointer: newObjectPtr]];
|
||||
}
|
||||
|
||||
- (void) freeNonNSObjects
|
||||
{
|
||||
unsigned int count, max;
|
||||
void *objectPtr;
|
||||
|
||||
max = [self count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
objectPtr = [[self objectAtIndex: count] pointerValue];
|
||||
NSZoneFree (NULL, objectPtr);
|
||||
}
|
||||
}
|
||||
|
||||
- (void) addObjectUniquely: (id) object
|
||||
{
|
||||
if (![self containsObject: object])
|
||||
[self addObject: object];
|
||||
}
|
||||
|
||||
- (void) addRange: (NSRange) newRange
|
||||
{
|
||||
[self addObject: NSStringFromRange (newRange)];
|
||||
}
|
||||
|
||||
- (BOOL) hasRangeIntersection: (NSRange) testRange
|
||||
{
|
||||
NSEnumerator *ranges;
|
||||
|
||||
Reference in New Issue
Block a user