mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-30 03:15:38 -05:00
32 lines
782 B
C++
32 lines
782 B
C++
|
#include "xnucxx/LiteIterator.h"
|
||
|
#include "xnucxx/LiteCollection.h"
|
||
|
#include "xnucxx/LiteMemOpt.h"
|
||
|
|
||
|
void LiteCollectionIterator::reset() {
|
||
|
collection->initIterator(innerIterator);
|
||
|
}
|
||
|
|
||
|
bool LiteCollectionIterator::initWithCollection(const LiteCollectionInterface *inCollection) {
|
||
|
int *ndxPtr = (int *)LiteMemOpt::alloc(sizeof(int));
|
||
|
innerIterator = (void *)ndxPtr;
|
||
|
|
||
|
inCollection->initIterator(this->innerIterator);
|
||
|
collection = inCollection;
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
LiteObject *LiteCollectionIterator::getNextObject() {
|
||
|
LiteObject *retObj;
|
||
|
collection->getNextObjectForIterator(this->innerIterator, &retObj);
|
||
|
return retObj;
|
||
|
}
|
||
|
|
||
|
void LiteCollectionIterator::release() {
|
||
|
if (innerIterator) {
|
||
|
LiteMemOpt::free(innerIterator, sizeof(int));
|
||
|
|
||
|
innerIterator = NULL;
|
||
|
}
|
||
|
}
|