diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
commit | c0c336500955a23e344651e5412c9d9d441ef4ee (patch) | |
tree | 790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/T2TemplatePluginDB.cpp | |
parent | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff) | |
download | t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip |
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/T2TemplatePluginDB.cpp | 68 |
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; } |