blob: 188661337ac9edd8429eb7657c335efcaefb5da5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include "CPluginInfo.h"
#include "CPluginInfoComparator.h"
/*virtual*/ int CPluginInfoComparator::Compare(const void* inItemOne, const void* inItemTwo, unsigned int inSizeOne, unsigned int inSizeTwo) const {
CPluginInfo *infoOne = *((CPluginInfo **) inItemOne);
CPluginInfo *infoTwo = *((CPluginInfo **) inItemTwo);
if (!infoTwo)
return -1;
else if (!infoOne)
return 1;
else
return infoOne->GetID() - infoTwo->GetID();
}
/*virtual*/ BOOL CPluginInfoComparator::IsEqualTo(const void* inItemOne, const void* inItemTwo, unsigned int inSizeOne, unsigned int inSizeTwo) const {
CPluginInfo *infoOne = *((CPluginInfo **) inItemOne);
CPluginInfo *infoTwo = *((CPluginInfo **) inItemTwo);
return infoOne->GetID() == infoTwo->GetID();
}
/*virtual*/ int CPluginInfoComparator::CompareToKey(const void* inItem, unsigned int inSize, const void* inKey) const {
CPluginInfo *item = *((CPluginInfo **) inItem);
DWORD key = *((const DWORD *) inKey);
return item->GetID() - key;
}
/*static*/ CPluginInfoComparator* CPluginInfoComparator::sCPluginInfoComparator;
/*static*/ CPluginInfoComparator* CPluginInfoComparator::GetComparator() {
if (!sCPluginInfoComparator)
sCPluginInfoComparator = new CPluginInfoComparator;
return sCPluginInfoComparator;
}
|