diff options
Diffstat (limited to 'src/T2DLL/T2TempPluginComparator.cpp')
-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; } |