#include "T2TemplatePlugin.h" #include "T2TemplatePluginDB.h" #include "T2TemplatePluginList.h" T2TemplatePluginDB::T2TemplatePluginDB() : LArray(sizeof(T2TemplatePluginList *)) { } /*virtual*/ T2TemplatePluginDB::~T2TemplatePluginDB() { } void T2TemplatePluginDB::Regist(T2TemplatePlugin* plugin) { if (!plugin) return; LArrayIterator iterator(*this); T2TemplatePluginList *list; BOOL added = false; while (!added && iterator.Next(&list)) { if (list->GetPluginType() == plugin->GetType()) { list->Add(plugin); added = true; } } if (!added) { list = new T2TemplatePluginList(plugin->GetType()); list->Add(plugin); InsertItemsAt(1, mItemCount + 1, &list); } } void T2TemplatePluginDB::Add(T2TemplatePluginList* list) { LArrayIterator iterator(*this); T2TemplatePluginList *existingList; BOOL added = false; while (!added && iterator.Next(&existingList)) { if (existingList->GetPluginType() == list->GetPluginType()) { LArrayIterator pluginIterator(*list); T2TemplatePlugin *plugin; while (pluginIterator.Next(&plugin)) { existingList->Add(plugin); } added = true; } } if (!added) InsertItemsAt(1, mItemCount + 1, &list); } 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; }