summaryrefslogtreecommitdiff
path: root/src/T2DLL/CFilePluginDB.cpp
blob: 65afb4d2f09ac0ada58bab1587c280538026998e (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
#include "CFilePlugin.h"
#include "CFilePluginDB.h"
#include "CFilePluginList.h"

CFilePluginDB::CFilePluginDB()
	: LArray(sizeof(CFilePlugin *))
{
}

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

/*virtual*/ void CFilePluginDB::Add(CFilePlugin* plugin) {
	LArrayIterator iter(*this);
	BOOL added = false;
	CFilePluginList *list;

	while (!added && iter.Next(&list)) {
		if (list->GetPluginType() == plugin->GetType()) {
			list->Add(plugin);
			added = true;
		}
	}

	if (!added) {
		list = new CFilePluginList(plugin->GetType());
		list->Add(plugin);
		InsertItemsAt(1, mItemCount + 1, &list);
	}
}

/*virtual*/ CFilePluginList* CFilePluginDB::GetFilePluginList(DWORD pluginType) {
	LArrayIterator iter(*this);
	CFilePluginList *list;

	while (iter.Next(&list)) {
		if (list->GetPluginType() == pluginType)
			return list;
	}

	return NULL;
}