cocos2d-x  3.1rc0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
__Array Class Reference

#include <CCArray.h>

Inheritance diagram for __Array:
Ref Clonable

Public Member Functions

 ~__Array ()
bool init ()
 Initializes an array. More...
 
bool initWithObject (Ref *object)
 Initializes an array with one object. More...
 
bool initWithObjects (Ref *object,...) CC_REQUIRES_NULL_TERMINATION
 Initializes an array with some objects. More...
 
bool initWithCapacity (ssize_t capacity)
 Initializes an array with capacity. More...
 
bool initWithArray (__Array *otherArray)
 Initializes an array with an existing array. More...
 
ssize_t count () const
 Returns element count of the array. More...
 
ssize_t capacity () const
 Returns capacity of the array. More...
 
ssize_t getIndexOfObject (Ref *object) const
 Returns index of a certain object, return UINT_MAX if doesn't contain the object. More...
 
CC_DEPRECATED_ATTRIBUTE ssize_t indexOfObject (Ref *object) const
RefgetObjectAtIndex (ssize_t index)
 Returns an element with a certain index. More...
 
CC_DEPRECATED_ATTRIBUTE RefobjectAtIndex (ssize_t index)
RefgetLastObject ()
 Returns the last element of the array. More...
 
CC_DEPRECATED_ATTRIBUTE ReflastObject ()
RefgetRandomObject ()
 Returns a random element. More...
 
CC_DEPRECATED_ATTRIBUTE RefrandomObject ()
bool containsObject (Ref *object) const
 Returns a Boolean value that indicates whether object is present in array. More...
 
bool isEqualToArray (__Array *otherArray)
void addObject (Ref *object)
 Add a certain object. More...
 
void addObjectsFromArray (__Array *otherArray)
void insertObject (Ref *object, ssize_t index)
 Insert a certain object at a certain index. More...
 
void setObject (Ref *object, ssize_t index)
 sets a certain object at a certain index More...
 
void fastSetObject (Ref *object, ssize_t index)
 sets a certain object at a certain index without retaining. More...
 
void swap (ssize_t indexOne, ssize_t indexTwo)
void removeLastObject (bool releaseObj=true)
 Remove last object. More...
 
void removeObject (Ref *object, bool releaseObj=true)
 Remove a certain object. More...
 
void removeObjectAtIndex (ssize_t index, bool releaseObj=true)
 Remove an element with a certain index. More...
 
void removeObjectsInArray (__Array *otherArray)
 Remove all elements. More...
 
void removeAllObjects ()
 Remove all objects. More...
 
void fastRemoveObject (Ref *object)
 Fast way to remove a certain object. More...
 
void fastRemoveObjectAtIndex (ssize_t index)
 Fast way to remove an element with a certain index. More...
 
void exchangeObject (Ref *object1, Ref *object2)
 Swap two elements. More...
 
void exchangeObjectAtIndex (ssize_t index1, ssize_t index2)
 Swap two elements with certain indexes. More...
 
void replaceObjectAtIndex (ssize_t index, Ref *object, bool releaseObject=true)
 Replace object at index with another object. More...
 
void reverseObjects ()
 Revers the array. More...
 
void reduceMemoryFootprint ()
virtual void acceptVisitor (DataVisitor &visitor)
virtual __Arrayclone () const
 returns a copy of the Ref More...
 
Ref ** begin ()
Ref ** end ()
 __Array ()
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
- Public Member Functions inherited from Clonable
virtual ~Clonable ()
CC_DEPRECATED_ATTRIBUTE Refcopy () const
 returns a copy of the Ref. More...
 

Static Public Member Functions

static __Arraycreate ()
 Creates an empty array. More...
 
static __Arraycreate (Ref *object,...) CC_REQUIRES_NULL_TERMINATION
 Create an array with objects. More...
 
static __ArraycreateWithObject (Ref *object)
 Create an array with one object. More...
 
static __ArraycreateWithCapacity (ssize_t capacity)
 Create an array with a default capacity. More...
 
static __ArraycreateWithArray (__Array *otherArray)
 Create an array with from an existing array. More...
 
static __ArraycreateWithContentsOfFile (const std::string &pFileName)
 Generate a Array pointer by file. More...
 
static __ArraycreateWithContentsOfFileThreadSafe (const std::string &pFileName)

Public Attributes

ccArray * data

Additional Inherited Members

- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 

Constructor & Destructor Documentation

~__Array ( )
__Array ( )

Member Function Documentation

virtual void acceptVisitor ( DataVisitor visitor)
virtual
void addObject ( Ref object)

Add a certain object.

void addObjectsFromArray ( __Array otherArray)
Ref** begin ( )
inline
ssize_t capacity ( ) const
inline

Returns capacity of the array.

virtual __Array* clone ( ) const
virtual

returns a copy of the Ref

Implements Clonable.

bool containsObject ( Ref object) const

Returns a Boolean value that indicates whether object is present in array.

ssize_t count ( ) const
inline

Returns element count of the array.

static __Array* create ( )
static

Creates an empty array.

Default capacity is 10

static __Array* create ( Ref object,
  ... 
)
static

Create an array with objects.

static __Array* createWithArray ( __Array otherArray)
static

Create an array with from an existing array.

static __Array* createWithCapacity ( ssize_t  capacity)
static

Create an array with a default capacity.

static __Array*
createWithContentsOfFile
( const std::string &  pFileName)
static

Generate a Array pointer by file.

Parameters
pFileNameThe file name of *.plist file
Returns
The Array pointer generated from the file
static __Array*
createWithContentsOfFileThreadSafe
( const std::string &  pFileName)
static
static __Array* createWithObject ( Ref object)
static

Create an array with one object.

Ref** end ( )
inline
void exchangeObject ( Ref object1,
Ref object2 
)

Swap two elements.

void exchangeObjectAtIndex ( ssize_t  index1,
ssize_t  index2 
)

Swap two elements with certain indexes.

void fastRemoveObject ( Ref object)

Fast way to remove a certain object.

void fastRemoveObjectAtIndex ( ssize_t  index)

Fast way to remove an element with a certain index.

void fastSetObject ( Ref object,
ssize_t  index 
)
inline

sets a certain object at a certain index without retaining.

Use it with caution

ssize_t getIndexOfObject ( Ref object) const

Returns index of a certain object, return UINT_MAX if doesn't contain the object.

Ref* getLastObject ( )
inline

Returns the last element of the array.

Ref* getObjectAtIndex ( ssize_t  index)
inline

Returns an element with a certain index.

Ref* getRandomObject ( )

Returns a random element.

CC_DEPRECATED_ATTRIBUTE
ssize_t indexOfObject
( Ref object) const
inline
bool init ( )

Initializes an array.

bool initWithArray ( __Array otherArray)

Initializes an array with an existing array.

bool initWithCapacity ( ssize_t  capacity)

Initializes an array with capacity.

bool initWithObject ( Ref object)

Initializes an array with one object.

bool initWithObjects ( Ref object,
  ... 
)

Initializes an array with some objects.

void insertObject ( Ref object,
ssize_t  index 
)

Insert a certain object at a certain index.

bool isEqualToArray ( __Array otherArray)
Since
1.1
CC_DEPRECATED_ATTRIBUTE Ref*
lastObject
( )
inline
CC_DEPRECATED_ATTRIBUTE Ref*
objectAtIndex
( ssize_t  index)
inline
CC_DEPRECATED_ATTRIBUTE Ref*
randomObject
( )
inline
void reduceMemoryFootprint ( )
void removeAllObjects ( )

Remove all objects.

void removeLastObject ( bool  releaseObj = true)

Remove last object.

void removeObject ( Ref object,
bool  releaseObj = true 
)

Remove a certain object.

void removeObjectAtIndex ( ssize_t  index,
bool  releaseObj = true 
)

Remove an element with a certain index.

void removeObjectsInArray ( __Array otherArray)

Remove all elements.

void replaceObjectAtIndex ( ssize_t  index,
Ref object,
bool  releaseObject = true 
)

Replace object at index with another object.

void reverseObjects ( )

Revers the array.

void setObject ( Ref object,
ssize_t  index 
)

sets a certain object at a certain index

void swap ( ssize_t  indexOne,
ssize_t  indexTwo 
)
inline

Member Data Documentation

ccArray* data

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