Extension category to support cocos3d functionality. More...
#import <CC3CC2Extensions.h>
Public Member Functions | |
(void) | - addUnretainedObject: |
(void) | - fastReplaceObjectAtIndex:withObject: |
(NSString *) | - fullDescription |
(NSUInteger) | - indexOfObjectIdenticalTo: |
(id) | - initWithZeroCapacity |
(void) | - insertUnretainedObject:atIndex: |
(void) | - releaseAsUnretained |
(void) | - removeAllObjectsAsUnretained |
(void) | - removeObjectIdenticalTo: |
(void) | - removeUnretainedObjectAtIndex: |
(void) | - removeUnretainedObjectIdenticalTo: |
(BOOL) | - setCapacity: |
Static Public Member Functions | |
(id) | + arrayWithZeroCapacity |
Extension category to support cocos3d functionality.
This extension includes a number of methods that add or remove objects to and from the array without retaining and releasing them. These methods are identified by the word Unretained in their names, and are faster than their standard equivalent methods that do retain and release objects.
It is critical that use of these methods is consistent for any object added. If an object is added using an "Unretained" method, then it must be removed using an "Unretained" method.
- (void) addUnretainedObject: | (id) | anObject |
Adds the specified object to the end of the array, but does not retain the object.
When removing the object, it must not be released. Use one the removeUnretainedObject... methods to remove the object.
+ (id) arrayWithZeroCapacity |
Allocates and initializes an autoreleased instance to have zero initial capacity.
It will be expanded automatically when objects are added, or can be expanced explicity using the setCapacity: method.
- (void) fastReplaceObjectAtIndex: | (NSUInteger) | index | |
withObject: | (id) | anObject | |
Replaces the object at the specified index with the specified object.
This performs a simple replacement, which is faster than the implementation of the replaceObjectAtIndex: method, which adds and then removes.
- (NSString*) fullDescription |
Returns a more detailed description of this instance.
- (NSUInteger) indexOfObjectIdenticalTo: | (id) | anObject |
Returns the index of the specified object, by comparing objects using the == operator.
- (id) initWithZeroCapacity |
Initializes this instance to have zero initial capacity.
It will be expanded automatically when objects are added, or can be expanced explicity using the setCapacity: method.
- (void) insertUnretainedObject: | (id) | anObject | |
atIndex: | (NSUInteger) | index | |
Inserts the specified object at the specified index within the array, but does not retain the object.
The elements in the array after the specified index position are shuffled up to make room for the new object.
When removing the object, it must not be released. Use one the removeUnretainedObject... methods to remove the object.
- (void) releaseAsUnretained |
Releases the array without releasing each contained object.
All contained objects must not have been retained when added to the array.
- (void) removeAllObjectsAsUnretained |
Removes all objects in the array, without releasing them.
All objects being removed must not have been retained when added to the array.
- (void) removeObjectIdenticalTo: | (id) | anObject |
Removes the specified object, by comparing objects using the == operator.
- (void) removeUnretainedObjectAtIndex: | (NSUInteger) | index |
Removes the object at the specified index, without releasing it.
The objects after this object in the array are shuffled down to fill in the gap.
The object being removed must not have been retained when added to the array.
- (void) removeUnretainedObjectIdenticalTo: | (id) | anObject |
Removes the specified object from the array, without releasing it, by comparing objects using the == operator.
The objects after this object in the array are shuffled down to fill in the gap.
The object being removed must not have been retained when added to the array.
- (BOOL) setCapacity: | (NSUInteger) | newCapacity |
Expands or shrinks the array to the specified capacity.
If the new capacity is less than the current number of elements, the excess elements are released.
Returns whether the size of the array was changed.