![]() |
cocos2d-iphone
1.0.1
Improved Cocos2D API Reference (iOS version) for Kobold2D developers
|
#import <Foundation/Foundation.h>
#import <stdlib.h>
#import <string.h>
#import "kkARCSupport.h"
Classes | |
struct | ccArray |
Defines | |
#define | CCARRAYDATA_FOREACH(__array__, __object__) __object__=__array__->arr[0]; for(NSUInteger i=0, num=__array__->num; i<num; i++, __object__=__array__->arr[i]) \ |
Typedefs | |
typedef ccArray | ccCArray |
Functions | |
ccArray * | ccArrayNew (NSUInteger capacity) |
void | ccArrayFree (ccArray *arr) |
void | ccArrayDoubleCapacity (ccArray *arr) |
void | ccArrayEnsureExtraCapacity (ccArray *arr, NSUInteger extra) |
void | ccArrayShrink (ccArray *arr) |
NSUInteger | ccArrayGetIndexOfObject (ccArray *arr, id object) |
BOOL | ccArrayContainsObject (ccArray *arr, id object) |
void | ccArrayAppendObject (ccArray *arr, id object) |
void | ccArrayAppendObjectWithResize (ccArray *arr, id object) |
void | ccArrayAppendArray (ccArray *arr, ccArray *plusArr) |
void | ccArrayAppendArrayWithResize (ccArray *arr, ccArray *plusArr) |
void | ccArrayInsertObjectAtIndex (ccArray *arr, id object, NSUInteger index) |
void | ccArraySwapObjectsAtIndexes (ccArray *arr, NSUInteger index1, NSUInteger index2) |
void | ccArrayRemoveAllObjects (ccArray *arr) |
void | ccArrayRemoveObjectAtIndex (ccArray *arr, NSUInteger index) |
void | ccArrayFastRemoveObjectAtIndex (ccArray *arr, NSUInteger index) |
void | ccArrayFastRemoveObject (ccArray *arr, id object) |
void | ccArrayRemoveObject (ccArray *arr, id object) |
void | ccArrayRemoveArray (ccArray *arr, ccArray *minusArr) |
void | ccArrayFullRemoveArray (ccArray *arr, ccArray *minusArr) |
void | ccArrayMakeObjectsPerformSelector (ccArray *arr, SEL sel) |
void | ccArrayMakeObjectsPerformSelectorWithObject (ccArray *arr, SEL sel, id object) |
ccCArray * | ccCArrayNew (NSUInteger capacity) |
void | ccCArrayFree (ccCArray *arr) |
void | ccCArrayDoubleCapacity (ccCArray *arr) |
void | ccCArrayEnsureExtraCapacity (ccCArray *arr, NSUInteger extra) |
NSUInteger | ccCArrayGetIndexOfValue (ccCArray *arr, void *value) |
BOOL | ccCArrayContainsValue (ccCArray *arr, void *value) |
void | ccCArrayInsertValueAtIndex (ccCArray *arr, void *value, NSUInteger index) |
void | ccCArrayAppendValue (ccCArray *arr, void *value) |
void | ccCArrayAppendValueWithResize (ccCArray *arr, void *value) |
void | ccCArrayAppendArray (ccCArray *arr, ccCArray *plusArr) |
void | ccCArrayAppendArrayWithResize (ccCArray *arr, ccCArray *plusArr) |
void | ccCArrayRemoveAllValues (ccCArray *arr) |
void | ccCArrayRemoveValueAtIndex (ccCArray *arr, NSUInteger index) |
void | ccCArrayFastRemoveValueAtIndex (ccCArray *arr, NSUInteger index) |
void | ccCArrayRemoveValue (ccCArray *arr, void *value) |
void | ccCArrayRemoveArray (ccCArray *arr, ccCArray *minusArr) |
void | ccCArrayFullRemoveArray (ccCArray *arr, ccCArray *minusArr) |
Based on Chipmunk cpArray. ccArray is a faster alternative to NSMutableArray, it does pretty much the same thing (stores NSObjects and retains/releases them appropriately). It's faster because:
There are 2 kind of functions:
Appends objects from plusArr to arr. Behaviour undefined if arr doesn't have enough capacity.
Appends objects from plusArr to arr. Capacity of arr is increased if needed.
void ccArrayAppendObject | ( | ccArray * | arr, |
id | object | ||
) |
Appends an object. Bahaviour undefined if array doesn't have enough capacity.
void ccArrayAppendObjectWithResize | ( | ccArray * | arr, |
id | object | ||
) |
Appends an object. Capacity of arr is increased if needed.
BOOL ccArrayContainsObject | ( | ccArray * | arr, |
id | object | ||
) |
Returns a Boolean value that indicates whether object is present in array.
void ccArrayDoubleCapacity | ( | ccArray * | arr | ) |
Doubles array capacity
void ccArrayEnsureExtraCapacity | ( | ccArray * | arr, |
NSUInteger | extra | ||
) |
Increases array capacity such that max >= num + extra.
void ccArrayFastRemoveObject | ( | ccArray * | arr, |
id | object | ||
) |
Removes object and fills the gap with the last object, thereby avoiding the need to push back subsequent objects. Behaviour undefined if index outside [0, num-1].
void ccArrayFastRemoveObjectAtIndex | ( | ccArray * | arr, |
NSUInteger | index | ||
) |
Removes object at specified index and fills the gap with the last object, thereby avoiding the need to push back subsequent objects. Behaviour undefined if index outside [0, num-1].
void ccArrayFree | ( | ccArray * | arr | ) |
Frees array after removing all remaining objects. Silently ignores nil arr.
Removes from arr all objects in minusArr. For each object in minusArr, all matching instances in arr will be removed.
NSUInteger ccArrayGetIndexOfObject | ( | ccArray * | arr, |
id | object | ||
) |
Returns index of first occurence of object, NSNotFound if object not found.
void ccArrayInsertObjectAtIndex | ( | ccArray * | arr, |
id | object, | ||
NSUInteger | index | ||
) |
Inserts an object at index
void ccArrayMakeObjectsPerformSelector | ( | ccArray * | arr, |
SEL | sel | ||
) |
Sends to each object in arr the message identified by given selector.
void ccArrayMakeObjectsPerformSelectorWithObject | ( | ccArray * | arr, |
SEL | sel, | ||
id | object | ||
) |
Sends to each object in arr the message identified by given selector with the object as parameter.
ccArray* ccArrayNew | ( | NSUInteger | capacity | ) |
Allocates and initializes a new array with specified capacity
void ccArrayRemoveAllObjects | ( | ccArray * | arr | ) |
Removes all objects from arr
Removes from arr all objects in minusArr. For each object in minusArr, the first matching instance in arr will be removed.
void ccArrayRemoveObject | ( | ccArray * | arr, |
id | object | ||
) |
Searches for the first occurance of object and removes it. If object is not found the function has no effect.
void ccArrayRemoveObjectAtIndex | ( | ccArray * | arr, |
NSUInteger | index | ||
) |
Removes object at specified index and pushes back all subsequent objects. Behaviour undefined if index outside [0, num-1].
void ccArrayShrink | ( | ccArray * | arr | ) |
shrinks the array so the memory footprint corresponds with the number of items
void ccArraySwapObjectsAtIndexes | ( | ccArray * | arr, |
NSUInteger | index1, | ||
NSUInteger | index2 | ||
) |
Swaps two objects
Appends values from plusArr to arr. Behaviour undefined if arr doesn't have enough capacity.
Appends values from plusArr to arr. Capacity of arr is increased if needed.
void ccCArrayAppendValue | ( | ccCArray * | arr, |
void * | value | ||
) |
Appends an value. Bahaviour undefined if array doesn't have enough capacity.
void ccCArrayAppendValueWithResize | ( | ccCArray * | arr, |
void * | value | ||
) |
Appends an value. Capacity of arr is increased if needed.
BOOL ccCArrayContainsValue | ( | ccCArray * | arr, |
void * | value | ||
) |
Returns a Boolean value that indicates whether value is present in the C array.
void ccCArrayDoubleCapacity | ( | ccCArray * | arr | ) |
Doubles C array capacity
void ccCArrayEnsureExtraCapacity | ( | ccCArray * | arr, |
NSUInteger | extra | ||
) |
Increases array capacity such that max >= num + extra.
void ccCArrayFastRemoveValueAtIndex | ( | ccCArray * | arr, |
NSUInteger | index | ||
) |
Removes value at specified index and fills the gap with the last value, thereby avoiding the need to push back subsequent values. Behaviour undefined if index outside [0, num-1].
void ccCArrayFree | ( | ccCArray * | arr | ) |
Frees C array after removing all remaining values. Silently ignores nil arr.
Removes from arr all values in minusArr. For each value in minusArr, all matching instances in arr will be removed.
NSUInteger ccCArrayGetIndexOfValue | ( | ccCArray * | arr, |
void * | value | ||
) |
Returns index of first occurence of value, NSNotFound if value not found.
void ccCArrayInsertValueAtIndex | ( | ccCArray * | arr, |
void * | value, | ||
NSUInteger | index | ||
) |
Inserts a value at a certain position. Behaviour undefined if aray doesn't have enough capacity
ccCArray* ccCArrayNew | ( | NSUInteger | capacity | ) |
Allocates and initializes a new C array with specified capacity
void ccCArrayRemoveAllValues | ( | ccCArray * | arr | ) |
Removes all values from arr
Removes from arr all values in minusArr. For each Value in minusArr, the first matching instance in arr will be removed.
void ccCArrayRemoveValue | ( | ccCArray * | arr, |
void * | value | ||
) |
Searches for the first occurance of value and removes it. If value is not found the function has no effect.
void ccCArrayRemoveValueAtIndex | ( | ccCArray * | arr, |
NSUInteger | index | ||
) |
Removes value at specified index and pushes back all subsequent values. Behaviour undefined if index outside [0, num-1].