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/T2TempPluginComparator.cpp | |
parent | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff) | |
download | t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip |
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/T2TempPluginComparator.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/T2DLL/T2TempPluginComparator.cpp b/src/T2DLL/T2TempPluginComparator.cpp index e3ff485..09da5fa 100644 --- a/src/T2DLL/T2TempPluginComparator.cpp +++ b/src/T2DLL/T2TempPluginComparator.cpp @@ -1,13 +1,28 @@ +#include "T2TemplatePlugin.h" #include "T2TempPluginComparator.h" -/*virtual*/ int T2TempPluginComparator::Compare(const void*, const void*, unsigned int, unsigned int) const { -} +/*virtual*/ int T2TempPluginComparator::Compare(const void* inItemOne, const void* inItemTwo, unsigned int inSizeOne, unsigned int inSizeTwo) const { + T2TemplatePlugin *p1 = *((T2TemplatePlugin **) inItemOne); + T2TemplatePlugin *p2 = *((T2TemplatePlugin **) inItemTwo); -/*virtual*/ int T2TempPluginComparator::IsEqualTo(const void*, const void*, unsigned int, unsigned int) const { + if (!p2) + return -1; + else if (!p1) + return 1; + else + return p1->GetSortKey() - p2->GetSortKey(); } -/*static*/ T2TempPluginComparator* T2TempPluginComparator::GetComparator() { +/*virtual*/ BOOL T2TempPluginComparator::IsEqualTo(const void* inItemOne, const void* inItemTwo, unsigned int inSizeOne, unsigned int inSizeTwo) const { + T2TemplatePlugin *p1 = *((T2TemplatePlugin **) inItemOne); + T2TemplatePlugin *p2 = *((T2TemplatePlugin **) inItemTwo); + return p1->GetSortKey() == p2->GetSortKey(); } -/*static*/ T2TempPluginComparator* T2TempPluginComparator::sT2TempPluginComparator { +/*static*/ T2TempPluginComparator* T2TempPluginComparator::sT2TempPluginComparator; + +/*static*/ T2TempPluginComparator* T2TempPluginComparator::GetComparator() { + if (!sT2TempPluginComparator) + sT2TempPluginComparator = new T2TempPluginComparator; + return sT2TempPluginComparator; } |