summaryrefslogtreecommitdiff
path: root/src/T2DLL/CFilePluginList.cpp
blob: 283e16a9619c832a9251c6c2dda1937034077074 (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
44
45
46
47
48
49
50
#include "StdAfx.h"
#include "CFilePlugin.h"
#include "CFilePluginList.h"

CFilePluginList::CFilePluginList(DWORD pluginType) {
	mPluginType = pluginType;
}

/*virtual*/ CFilePluginList::~CFilePluginList() {
}

/*virtual*/ void CFilePluginList::AllClear() {
	RemoveAll();
}

/*virtual*/ BOOL CFilePluginList::Add(CFilePlugin* plugin) {
	BOOL found = false;
	POSITION pos = GetHeadPosition();

	while (!found && pos) {
		CFilePlugin *check = GetNext(pos);
		if (check->GetID() == plugin->GetID())
			found = true;
	}

	if (!found)
		AddTail(plugin);

	return !found;
}

/*virtual*/ unsigned int CFilePluginList::GetItemCount() {
	return GetCount();
}

/*virtual*/ CFilePlugin* CFilePluginList::GetItemAt(POSITION pos) {
	return GetAt(pos);
}

CFilePlugin* CFilePluginList::GetItem(DWORD id) {
	POSITION pos = GetHeadPosition();

	while (pos) {
		CFilePlugin *check = GetNext(pos);
		if (check->GetID() == id)
			return check;
	}

	return NULL;
}