Moved some essentials into core

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2893 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1998-08-01 21:34:58 +00:00
parent 1faf1e7110
commit 929fbc4e17

View file

@ -129,6 +129,59 @@ static Class NSMutableArray_concrete_class;
return nil;
}
/* The NSCoding Protocol */
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[self subclassResponsibility:_cmd];
}
- (id) initWithCoder: (NSCoder*)aCoder
{
[self subclassResponsibility:_cmd];
return nil;
}
/* The NSCopying Protocol */
- copyWithZone: (NSZone*)zone
{
/* a deep copy */
unsigned count = [self count];
id oldObjects[count];
id newObjects[count];
id newArray;
unsigned i;
BOOL needCopy = [self isKindOfClass: [NSMutableArray class]];
if (NSShouldRetainWithZone(self, zone) == NO)
needCopy = YES;
[self getObjects: oldObjects];
for (i = 0; i < count; i++)
{
newObjects[i] = [oldObjects[i] copyWithZone:zone];
if (newObjects[i] != oldObjects[i])
needCopy = YES;
}
if (needCopy)
newArray = [[[[self class] _concreteClass] allocWithZone:zone]
initWithObjects:newObjects count:count];
else
newArray = [self retain];
for (i = 0; i < count; i++)
[newObjects[i] release];
return newArray;
}
/* The NSMutableCopying Protocol */
- mutableCopyWithZone: (NSZone*)zone
{
/* a shallow copy */
return [[[[self class] _mutableConcreteClass] allocWithZone:zone]
initWithArray:self];
}
@end
@ -630,46 +683,6 @@ static Class NSMutableArray_concrete_class;
return [result autorelease];
}
/* The NSCopying Protocol */
- copyWithZone: (NSZone*)zone
{
/* a deep copy */
unsigned count = [self count];
id oldObjects[count];
id newObjects[count];
id newArray;
unsigned i;
BOOL needCopy = [self isKindOfClass: [NSMutableArray class]];
if (NSShouldRetainWithZone(self, zone) == NO)
needCopy = YES;
[self getObjects: oldObjects];
for (i = 0; i < count; i++)
{
newObjects[i] = [oldObjects[i] copyWithZone:zone];
if (newObjects[i] != oldObjects[i])
needCopy = YES;
}
if (needCopy)
newArray = [[[[self class] _concreteClass] allocWithZone:zone]
initWithObjects:newObjects count:count];
else
newArray = [self retain];
for (i = 0; i < count; i++)
[newObjects[i] release];
return newArray;
}
/* The NSMutableCopying Protocol */
- mutableCopyWithZone: (NSZone*)zone
{
/* a shallow copy */
return [[[[self class] _mutableConcreteClass] allocWithZone:zone]
initWithArray:self];
}
@end