summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2PeopleLinkIterator.cpp
blob: 1a7b56a0fc7c5b017d88a503fdbf3e1a6335c036 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#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;
}