blob: e2b1a7066f3cf3cf5978d2340ed6c4b6a0d58d10 (
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
|
#include "T2Name.h"
#include "T2NameComparator.h"
/*virtual*/ int T2NameComparator::Compare(const void* inItemOne, const void* inItemTwo, unsigned int inSizeOne, unsigned int inSizeTwo) const {
T2Name *a = *((T2Name **) inItemOne);
T2Name *b = *((T2Name **) inItemTwo);
if (!b)
return -1;
else if (!a)
return 1;
return (a->IsFavorite() != b->IsFavorite()) ? (a->IsFavorite() - b->IsFavorite())
: (a->GetType() != b->GetType()) ? (a->GetType() - b->GetType())
: (a->GetID() - b->GetID());
}
/*virtual*/ BOOL T2NameComparator::IsEqualTo(const void* inItemOne, const void* inItemTwo, unsigned int inSizeOne, unsigned int inSizeTwo) const {
T2Name *a = *((T2Name **) inItemOne);
T2Name *b = *((T2Name **) inItemTwo);
return (a->IsFavorite() == b->IsFavorite()) && (a->GetType() == b->GetType()) && (a->GetID() == b->GetID());
}
/*static*/ T2NameComparator* T2NameComparator::sT2NameComparator;
/*static*/ T2NameComparator* T2NameComparator::GetComparator() {
if (!sT2NameComparator)
sT2NameComparator = new T2NameComparator;
return sT2NameComparator;
}
|