Archived
1
0
This repository has been archived on 2024-10-17. You can view files and clone it, but cannot push or open issues or pull requests.
winamp/Src/Wasabi/bfc/foreach.cpp
2024-09-24 14:54:57 +02:00

23 lines
623 B
C++

#include "foreach.h"
__foreach::__foreach(const PtrListRoot &ptrlist, int reverse) :
list(ptrlist.getNumItems(), ptrlist.getItemList()), pos(0)
{
if (reverse) list.reverse();
}
__foreach::__foreach(const PtrListRoot *ptrlist, int reverse) :
list(ptrlist->getNumItems(), ptrlist->getItemList()), pos(0) {
if (reverse) list.reverse();
}
int __foreach::done() const { return (pos >= list.getSize()); }
void *__foreach::next(int advance) { if (advance) pos++; return getPtr(); }
void *__foreach::getPtr() const { return (pos < list.getSize()) ? list[pos] : NULL; }
int __foreach::getPos() const { return pos; }