cocos2d-x  2.2.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CCArrayForObjectSorting Class Reference

#include <CCSorting.h>

Inheritance diagram for CCArrayForObjectSorting:
CCArray CCObject CCCopying

Public Member Functions

 CCArrayForObjectSorting ()
void insertSortedObject (CCSortableObject *object)
 Inserts a given object into array. More...
 
void removeSortedObject (CCSortableObject *object)
 Removes an object in array. More...
 
void setObjectID_ofSortedObject (unsigned int tag, CCSortableObject *object)
 Sets a new value of the key for the given object. More...
 
CCSortableObjectobjectWithObjectID (unsigned int tag)
CCSortableObjectgetObjectWithObjectID (unsigned int tag)
 Returns an object with given key and value. More...
 
unsigned int indexOfSortedObject (CCSortableObject *obj)
 Returns an index of the object with given key and value. More...
 
- Public Member Functions inherited from CCArray
 ~CCArray ()
bool init ()
 Initializes an array. More...
 
bool initWithObject (CCObject *pObject)
 Initializes an array with one object. More...
 
bool initWithObjects (CCObject *pObject,...)
 Initializes an array with some objects. More...
 
bool initWithCapacity (unsigned int capacity)
 Initializes an array with capacity. More...
 
bool initWithArray (CCArray *otherArray)
 Initializes an array with an existing array. More...
 
unsigned int count () const
 Returns element count of the array. More...
 
unsigned int capacity () const
 Returns capacity of the array. More...
 
local capacity ()
 Returns capacity of the array. More...
 
unsigned int indexOfObject (CCObject *object) const
 Returns index of a certain object, return UINT_MAX if doesn't contain the object. More...
 
local indexOfObject ( local object)
 Returns index of a certain object, return UINT_MAX if doesn't contain the object. More...
 
CCObjectobjectAtIndex (unsigned int index)
 Returns an element with a certain index. More...
 
local objectAtIndex ( local index)
 Returns an element with a certain index. More...
 
CCObjectlastObject ()
 Returns last element. More...
 
CCObjectrandomObject ()
 Returns a random element. More...
 
local randomObject ()
 Returns a random element. More...
 
bool containsObject (CCObject *object) const
 Returns a Boolean value that indicates whether object is present in array. More...
 
local containsObject ( local object)
 Returns a Boolean value that indicates whether object is present in array. More...
 
bool isEqualToArray (CCArray *pOtherArray)
void addObject (CCObject *object)
 Add a certain object. More...
 
local addObject ( local object)
 Add a certain object. More...
 
void addObjectsFromArray (CCArray *otherArray)
 Add all elements of an existing array. More...
 
local addObjectsFromArray ( local otherArray)
 Add all elements of an existing array. More...
 
void insertObject (CCObject *object, unsigned int index)
 Insert a certain object at a certain index. More...
 
local insertObject ( local object, local index)
 Insert a certain object at a certain index. More...
 
void removeLastObject (bool bReleaseObj=true)
 Remove last object. More...
 
void removeObject (CCObject *object, bool bReleaseObj=true)
 Remove a certain object. More...
 
local removeObject ( local object, local true)
 Remove a certain object. More...
 
void removeObjectAtIndex (unsigned int index, bool bReleaseObj=true)
 Remove an element with a certain index. More...
 
local removeObjectAtIndex ( local index, local true)
 Remove an element with a certain index. More...
 
void removeObjectsInArray (CCArray *otherArray)
 Remove all elements. More...
 
local removeObjectsInArray ( local otherArray)
 Remove all elements. More...
 
void removeAllObjects ()
 Remove all objects. More...
 
local removeAllObjects ()
 Remove all objects. More...
 
void fastRemoveObject (CCObject *object)
 Fast way to remove a certain object. More...
 
local fastRemoveObject ( local object)
 Fast way to remove a certain object. More...
 
void fastRemoveObjectAtIndex (unsigned int index)
 Fast way to remove an element with a certain index. More...
 
local fastRemoveObjectAtIndex ( local index)
 Fast way to remove an element with a certain index. More...
 
void exchangeObject (CCObject *object1, CCObject *object2)
 Swap two elements. More...
 
local exchangeObject ( local object1, local object2)
 Swap two elements. More...
 
void exchangeObjectAtIndex (unsigned int index1, unsigned int index2)
 Swap two elements with certain indexes. More...
 
local exchangeObjectAtIndex ( local index1, local index2)
 Swap two elements with certain indexes. More...
 
void replaceObjectAtIndex (unsigned int uIndex, CCObject *pObject, bool bReleaseObject=true)
 Replace object at index with another object. More...
 
local replaceObjectAtIndex ( local uIndex, local pObject, local true)
 Replace object at index with another object. More...
 
void reverseObjects ()
 Revers the array. More...
 
void reduceMemoryFootprint ()
local reduceMemoryFootprint ()
virtual CCObjectcopyWithZone (CCZone *pZone)
 override functions More...
 
virtual void acceptVisitor (CCDataVisitor &visitor)
 CCArray ()
 CCArray (unsigned int capacity)
- Public Member Functions inherited from CCObject
 CCObject (void)
virtual ~CCObject (void)
void release (void)
void retain (void)
CCObjectautorelease (void)
CCObjectcopy (void)
bool isSingleReference (void) const
unsigned int retainCount (void) const
virtual bool isEqual (const CCObject *pObject)
virtual void update (float dt)

Additional Inherited Members

- Static Public Member Functions inherited from CCArray
static CCArraycreate ()
 Create an array. More...
 
local create ()
 Create an array. More...
 
static CCArraycreate (CCObject *pObject,...)
 Create an array with some objects. More...
 
static CCArraycreateWithObject (CCObject *pObject)
 Create an array with one object. More...
 
local createWithObject ( local pObject)
 Create an array with one object. More...
 
static CCArraycreateWithCapacity (unsigned int capacity)
 Create an array with capacity. More...
 
local createWithCapacity ( local capacity)
 Create an array with capacity. More...
 
static CCArraycreateWithArray (CCArray *otherArray)
 Create an array with an existing array. More...
 
local createWithArray ( local otherArray)
 Create an array with an existing array. More...
 
static CCArraycreateWithContentsOfFile (const char *pFileName)
 Generate a CCArray pointer by file. More...
 
local createWithContentsOfFile ( local pFileName)
 Generate a CCArray pointer by file. More...
 
static CCArraycreateWithContentsOfFileThreadSafe (const char *pFileName)
- Public Attributes inherited from CCArray
ccArray * data
- Public Attributes inherited from CCObject
unsigned int m_uID
int m_nLuaID
- Protected Attributes inherited from CCObject
unsigned int m_uReference
unsigned int m_uAutoReleaseCount

Constructor & Destructor Documentation

Member Function Documentation

CCSortableObject*
getObjectWithObjectID
( unsigned int  tag)

Returns an object with given key and value.

Returns an object with given key and value. If no object is found, it returns nil.

Parameters
valueto locate object
Returns
object found or nil.
unsigned int indexOfSortedObject ( CCSortableObject obj)

Returns an index of the object with given key and value.

Returns the index of an object with given key and value. If no object is found, it returns an index at which the given object value would have been located. If object must be located at the end of array, it returns the length of the array, which is out of bound.

Parameters
valueto locate object
Returns
index of an object found
void insertSortedObject ( CCSortableObject object)

Inserts a given object into array.

Inserts a given object into array with key and value that are used in sorting. "value" must respond to message, compare:, which returns (NSComparisonResult). If it does not respond to the message, it is appended. If the compare message does not result NSComparisonResult, sorting behavior is not defined. It ignores duplicate entries and inserts next to it.

Parameters
objectto insert
CCSortableObject*
objectWithObjectID
( unsigned int  tag)
void removeSortedObject ( CCSortableObject object)

Removes an object in array.

Removes an object with given key and value. If no object is found in array with the key and value, no action is taken.

Parameters
valueto remove
void setObjectID_ofSortedObject ( unsigned int  tag,
CCSortableObject object 
)

Sets a new value of the key for the given object.

In case where sorting value must be changed, this message must be sent to keep consistency of being sorted. If it is changed externally, it must be sorted completely again.

Parameters
valueto set
objectthe object which has the value

The documentation for this class was generated from the following file: