From c0c336500955a23e344651e5412c9d9d441ef4ee Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Wed, 28 Jun 2023 22:22:32 +0100 Subject: first pass of T2DLL --- src/T2DLL/T2PeopleLinkIterator.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src/T2DLL/T2PeopleLinkIterator.cpp') 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; } -- cgit v1.2.3