Artifact b43784b0eb6c4bdebf8f36dc35bb87d3f25611549d25dada607bf8032a6f2185:
- File
src/OFMutableArray.m
— part of check-in
[526d04018d]
at
2009-05-23 21:53:20
on branch trunk
— A few renames.
OFArray:
* -[add:] to -[addObject:].
* -[last] to -[lastObject].OFAutoreleasePool:
* +[addToPool:] to +[addObjectToTopmostPool:].
* -[addToPool:] to -[addObject:].OFDataArray:
* -[add:] to -[addItem:].
* -[last] to -[lastItem].OFObject:
* -[addToMemoryPool:] to -[addItemToMemoryPool:]. (user: js, size: 1043) [annotate] [blame] [check-ins using]
/* * Copyright (c) 2008 - 2009 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import "config.h" #import "OFMutableArray.h" #import "OFExceptions.h" @implementation OFMutableArray - (id)copy { OFArray *new = [[OFArray alloc] init]; OFObject **objs; size_t len, i; objs = [array data]; len = [array count]; [new->array addNItems: len fromCArray: objs]; for (i = 0; i < len; i++) [objs[i] retain]; return new; } - addObject: (OFObject*)obj { [array addItem: &obj]; [obj retain]; return self; } - removeNObjects: (size_t)nobjects { OFObject **objs; size_t len, i; objs = [array data]; len = [array count]; if (nobjects > len) @throw [OFOutOfRangeException newWithClass: isa]; for (i = len - nobjects; i < len; i++) [objs[i] release]; [array removeNItems: nobjects]; return self; } @end