#include "StdAfx.h" #include "T2People.h" #include "T2PeopleLinkIterator.h" T2PeopleLinkIterator::T2PeopleLinkIterator(T2People* people) : mFirst(people) , mCurrent(NULL) { } /*virtual*/ T2PeopleLinkIterator::~T2PeopleLinkIterator() { } BOOL T2PeopleLinkIterator::Current(T2People** pPeople) { if (mCurrent) { *pPeople = mCurrent; return true; } return false; } BOOL T2PeopleLinkIterator::Prev(T2People** pPeople) { if (mCurrent) { mCurrent = (T2People *) mCurrent->mPrev; return Current(pPeople); } else { return false; } } 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; }