diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
commit | c0c336500955a23e344651e5412c9d9d441ef4ee (patch) | |
tree | 790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/T2PeopleLinkIterator.cpp | |
parent | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff) | |
download | t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip |
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/T2PeopleLinkIterator.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/T2DLL/T2PeopleLinkIterator.cpp b/src/T2DLL/T2PeopleLinkIterator.cpp index 96ad5d8..c0bdf00 100644 --- a/src/T2DLL/T2PeopleLinkIterator.cpp +++ b/src/T2DLL/T2PeopleLinkIterator.cpp @@ -1,15 +1,16 @@ +#include "T2People.h" #include "T2PeopleLinkIterator.h" T2PeopleLinkIterator::T2PeopleLinkIterator(T2People* people) : mFirst(people) - , mCurrent(people) + , mCurrent(NULL) { } /*virtual*/ T2PeopleLinkIterator::~T2PeopleLinkIterator() { } -int T2PeopleLinkIterator::Current(T2People** pPeople) { +BOOL T2PeopleLinkIterator::Current(T2People** pPeople) { if (mCurrent) { *pPeople = mCurrent; return true; @@ -17,12 +18,25 @@ int T2PeopleLinkIterator::Current(T2People** pPeople) { return false; } -int T2PeopleLinkIterator::Prev(T2People** pPeople) { - // TODO once T2Matter, T2People is done +BOOL T2PeopleLinkIterator::Prev(T2People** pPeople) { + if (mCurrent) { + mCurrent = (T2People *) mCurrent->mPrev; + return Current(pPeople); + } else { + return false; + } } -int T2PeopleLinkIterator::Next(T2People** pPeople) { +BOOL T2PeopleLinkIterator::Next(T2People** pPeople) { + if (mCurrent) { + mCurrent = (T2People *) mCurrent->mNext; + return Current(pPeople); + } else { + mCurrent = mFirst; + return Current(pPeople); + } } void T2PeopleLinkIterator::Reset() { + mCurrent = NULL; } |