Create an array
Class CCArray
#include <Geode/cocos/cocoa/CCArray.h>
Examples0
Public static methods7
staticcocos2d::CCArray*create()
staticcocos2d::CCArray*create(cocos2d::CCObject*pObject)
Create an array with some objects
staticcocos2d::CCArray*createWithObject(cocos2d::CCObject*pObject)
Create an array with one object
staticcocos2d::CCArray*createWithCapacity(uintcapacity)
Create an array with capacity
staticcocos2d::CCArray*createWithArray(cocos2d::CCArray*otherArray)
Create an array with an existing array
staticcocos2d::CCArray*createWithContentsOfFile(charconst*pFileName)
Generate a CCArray pointer by file
pFileName
staticcocos2d::CCArray*createWithContentsOfFileThreadSafe(charconst*pFileName)
Public member functions39
boolinit()
Initializes an array
boolinitWithObject(cocos2d::CCObject*pObject)
Initializes an array with one object
boolinitWithObjects(cocos2d::CCObject*pObject)
Initializes an array with some objects
boolinitWithArray(cocos2d::CCArray*otherArray)
Initializes an array with an existing array
uintcount()const
Returns element count of the array
uintcapacity()const
Returns capacity of the array
uintindexOfObject(cocos2d::CCObject*object)const
Returns index of a certain object, return UINT_MAX if doesn’t contain the object
cocos2d::CCObject*objectAtIndex(uintindex)
Returns an element with a certain index
cocos2d::CCString*stringAtIndex(uintindex)
Rob modification Returns an element with a certain index casted to CCString
cocos2d::CCObject*firstObject()
Returns first element, or null if empty
ℹ Geode addition
cocos2d::CCObject*lastObject()
Returns last element
cocos2d::CCObject*randomObject()
Returns a random element
boolcontainsObject(cocos2d::CCObject*object)const
Returns a Boolean value that indicates whether object is present in array.
boolisEqualToArray(cocos2d::CCArray*pOtherArray)
voidaddObject(cocos2d::CCObject*object)
Add a certain object
voidaddObjectNew(cocos2d::CCObject*object)
Rob modification Add a certain object
voidaddObjectsFromArray(cocos2d::CCArray*otherArray)
Add all elements of an existing array
voidinsertObject(cocos2d::CCObject*object,uintindex)
Insert a certain object at a certain index
voidremoveFirstObject(boolbReleaseObj)
Remove first object, or do nothing if array is empty
ℹ Geode addition
voidremoveObject(cocos2d::CCObject*object,boolbReleaseObj)
Remove a certain object
voidremoveObjectsInArray(cocos2d::CCArray*otherArray)
Remove all elements
voidremoveAllObjects()
Remove all objects
voidfastRemoveObject(cocos2d::CCObject*object)
Fast way to remove a certain object
voidfastRemoveObjectAtIndexNew(uintindex)
Fast way to remove an element with a certain index
ℹ RobTop addition
voidrecreateNewIndexes()
voidexchangeObject(cocos2d::CCObject*object1,cocos2d::CCObject*object2)
Swap two elements
voidreplaceObjectAtIndex(uintuIndex,cocos2d::CCObject*pObject,boolbReleaseObject)
Replace object at index with another object.
voidreverseObjects()
Revers the array
voidreduceMemoryFootprint()
virtualcocos2d::CCObject*copyWithZone(cocos2d::CCZone*pZone)
override functions
cocos2d::CCArray*shallowCopy()
Creates a shallow copy of this array, aka only clones the pointers to the array members and not the members themselves