From 1824ae6360c9ce1897e75404163d39df08ee5fbf Mon Sep 17 00:00:00 2001 From: bamse16 Date: Sat, 11 Apr 2009 09:14:42 +0000 Subject: Added printing support via WebKit WebView --- Source/NSArray_DeepMutableCopy.m | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Source/NSArray_DeepMutableCopy.m (limited to 'Source/NSArray_DeepMutableCopy.m') diff --git a/Source/NSArray_DeepMutableCopy.m b/Source/NSArray_DeepMutableCopy.m new file mode 100644 index 00000000..72f64c06 --- /dev/null +++ b/Source/NSArray_DeepMutableCopy.m @@ -0,0 +1,42 @@ +// +// NSArray_DeepMutableCopy.m +// +// Created by Matt Gemmell on 02/05/2008. +// Copyright 2008 Instinctive Code. All rights reserved. +// + +#import "NSArray_DeepMutableCopy.h" + + +@implementation NSArray (DeepMutableCopy) + + +- (NSMutableArray *)deepMutableCopy; +{ + NSMutableArray *newArray; + unsigned int index, count; + + count = [self count]; + newArray = [[NSMutableArray allocWithZone:[self zone]] initWithCapacity:count]; + for (index = 0; index < count; index++) { + id anObject; + + anObject = [self objectAtIndex:index]; + if ([anObject respondsToSelector:@selector(deepMutableCopy)]) { + anObject = [anObject deepMutableCopy]; + [newArray addObject:anObject]; + [anObject release]; + } else if ([anObject respondsToSelector:@selector(mutableCopyWithZone:)]) { + anObject = [anObject mutableCopyWithZone:nil]; + [newArray addObject:anObject]; + [anObject release]; + } else { + [newArray addObject:anObject]; + } + } + + return newArray; +} + + +@end -- cgit v1.2.3