summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2TemplatePluginDB.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/T2DLL/T2TemplatePluginDB.cpp68
1 files changed, 64 insertions, 4 deletions
diff --git a/src/T2DLL/T2TemplatePluginDB.cpp b/src/T2DLL/T2TemplatePluginDB.cpp
index 4a62bc5..7b7b94c 100644
--- a/src/T2DLL/T2TemplatePluginDB.cpp
+++ b/src/T2DLL/T2TemplatePluginDB.cpp
@@ -1,19 +1,79 @@
+#include "T2TemplatePlugin.h"
#include "T2TemplatePluginDB.h"
+#include "T2TemplatePluginList.h"
-T2TemplatePluginDB::T2TemplatePluginDB() {
+T2TemplatePluginDB::T2TemplatePluginDB()
+ : LArray(sizeof(T2TemplatePluginList *))
+{
}
/*virtual*/ T2TemplatePluginDB::~T2TemplatePluginDB() {
}
-void T2TemplatePluginDB::Regist(T2TemplatePlugin*) {
+void T2TemplatePluginDB::Regist(T2TemplatePlugin* plugin) {
+ if (!plugin)
+ return;
+
+ LArrayIterator iterator(*this);
+ T2TemplatePluginList *list;
+ BOOL found = false;
+
+ while (!found && iterator.Next(&list)) {
+ if (list->GetPluginType() == plugin->GetType()) {
+ list->Add(plugin);
+ found = true;
+ }
+ }
+
+ if (!found) {
+ list = new T2TemplatePluginList(plugin->GetType());
+ list->Add(plugin);
+ InsertItemsAt(1, mItemCount + 1, &list);
+ }
}
-void T2TemplatePluginDB::Add(T2TemplatePluginList*) {
+void T2TemplatePluginDB::Add(T2TemplatePluginList* list) {
+ LArrayIterator iterator(*this);
+ T2TemplatePluginList *existingList;
+ BOOL found = false;
+
+ while (!found && iterator.Next(&existingList)) {
+ if (existingList->GetPluginType() == list->GetPluginType()) {
+ LArrayIterator pluginIterator(*list);
+ T2TemplatePlugin *plugin;
+
+ while (pluginIterator.Next(&plugin)) {
+ existingList->Add(plugin);
+ }
+
+ found = true;
+ }
+ }
+
+ if (!found)
+ InsertItemsAt(1, mItemCount + 1, &list);
}
-T2TemplatePluginList* T2TemplatePluginDB::GetTemplatePluginList(unsigned long) {
+T2TemplatePluginList* T2TemplatePluginDB::GetTemplatePluginList(DWORD pluginType) {
+ LArrayIterator iterator(*this);
+ T2TemplatePluginList *list;
+
+ while (iterator.Next(&list)) {
+ if (list->GetPluginType() == pluginType)
+ return list;
+ }
+
+ return NULL;
}
T2TenantDef* T2TemplatePluginDB::FindFloor() {
+ LArrayIterator iterator(*this);
+ T2TemplatePluginList *list;
+
+ while (iterator.Next(&list)) {
+ if (list->GetPluginType() == 'TnPl')
+ return list->FindFloor();
+ }
+
+ return NULL;
}