diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/bfc/foreach.cpp | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/Wasabi/bfc/foreach.cpp')
-rw-r--r-- | Src/Wasabi/bfc/foreach.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Src/Wasabi/bfc/foreach.cpp b/Src/Wasabi/bfc/foreach.cpp new file mode 100644 index 00000000..022eadd5 --- /dev/null +++ b/Src/Wasabi/bfc/foreach.cpp @@ -0,0 +1,22 @@ +#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; } + + |