mirror of https://github.com/axmolengine/axmol.git
issue #6: add getObjectAtIndex() to NSMutableArray
This commit is contained in:
parent
c39a43c0cc
commit
577399d2cb
|
@ -25,6 +25,7 @@ THE SOFTWARE.
|
|||
#include "NSMutableArray.h"
|
||||
#include <stdarg.h>
|
||||
#include <vector>
|
||||
#include <assert.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -252,3 +253,16 @@ NSMutableArray* arrayWithArray(NSMutableArray *pArray)
|
|||
|
||||
return pNewArray;
|
||||
}
|
||||
|
||||
NSObject* NSMutableArray::getObjectAtIndex(UINT32 uIndex)
|
||||
{
|
||||
assert(uIndex < count());
|
||||
assert(uIndex >= 0);
|
||||
|
||||
if (uIndex <= 0 || uIndex >= count())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return m_array[uIndex];
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
UINT32 getIndexOfObject(NSObject *pObject);
|
||||
bool containsObject(NSObject *pObject);
|
||||
NSObject* getLastObject(void);
|
||||
NSObject* getObjectAtIndex(UINT32 uIndex);
|
||||
|
||||
// Adding objects
|
||||
void addObject(NSObject *pObject);
|
||||
|
|
Loading…
Reference in New Issue