summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2PeopleLinkIterator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/T2DLL/T2PeopleLinkIterator.cpp')
-rw-r--r--src/T2DLL/T2PeopleLinkIterator.cpp24
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;
}