Cockatrice
2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Toggle main menu visibility
Loading...
Searching...
No Matches
card_set_comparator.h
Go to the documentation of this file.
1
6
7
#ifndef SET_PRIORITY_COMPARATOR_H
8
#define SET_PRIORITY_COMPARATOR_H
9
10
#include "
../card_info.h
"
11
12
class
SetPriorityComparator
13
{
14
public
:
15
/*
16
* Returns true if a has higher download priority than b
17
* Enabled sets have priority over disabled sets
18
* Both groups follow the user-defined order
19
*/
20
inline
bool
operator()
(
const
CardSetPtr
&a,
const
CardSetPtr
&b)
const
21
{
22
if
(a->getEnabled()) {
23
return
!b->getEnabled() || a->getSortKey() < b->getSortKey();
24
}
else
{
25
return
!b->getEnabled() && a->getSortKey() < b->getSortKey();
26
}
27
}
28
};
29
30
class
SetReleaseDateComparator
31
{
32
public
:
33
/*
34
* Returns true if a has higher download priority than b
35
* Enabled sets have priority over disabled sets
36
* Both groups follow the user-defined order
37
*/
38
inline
bool
operator()
(
const
CardSetPtr
&a,
const
CardSetPtr
&b)
const
39
{
40
if
(a->getEnabled()) {
41
return
!b->getEnabled() || a->getReleaseDate() < b->getReleaseDate();
42
}
else
{
43
return
!b->getEnabled() && a->getReleaseDate() < b->getReleaseDate();
44
}
45
}
46
};
47
48
class
CardSetPriorityComparator
49
{
50
public
:
51
/*
52
* Returns true if a has higher download priority than b
53
* Enabled sets have priority over disabled sets
54
* Both groups follow the user-defined order
55
*/
56
inline
bool
operator()
(
const
PrintingInfo
&a,
const
PrintingInfo
&b)
const
57
{
58
if
(a.
getSet
()->getEnabled()) {
59
return
!b.
getSet
()->getEnabled() || a.
getSet
()->getSortKey() < b.
getSet
()->getSortKey();
60
}
else
{
61
return
!b.
getSet
()->getEnabled() && a.
getSet
()->getSortKey() < b.
getSet
()->getSortKey();
62
}
63
}
64
};
65
66
#endif
// SET_PRIORITY_COMPARATOR_H
card_info.h
CardSetPtr
QSharedPointer< CardSet > CardSetPtr
Definition
card_info.h:30
CardSetPriorityComparator
Definition
card_set_comparator.h:49
CardSetPriorityComparator::operator()
bool operator()(const PrintingInfo &a, const PrintingInfo &b) const
Definition
card_set_comparator.h:56
PrintingInfo
Represents metadata for a specific variation of a card within a set.
Definition
printing_info.h:31
PrintingInfo::getSet
CardSetPtr getSet() const
Returns the set this printing belongs to.
Definition
printing_info.h:82
SetPriorityComparator
Definition
card_set_comparator.h:13
SetPriorityComparator::operator()
bool operator()(const CardSetPtr &a, const CardSetPtr &b) const
Definition
card_set_comparator.h:20
SetReleaseDateComparator
Definition
card_set_comparator.h:31
SetReleaseDateComparator::operator()
bool operator()(const CardSetPtr &a, const CardSetPtr &b) const
Definition
card_set_comparator.h:38
libcockatrice_card
libcockatrice
card
set
card_set_comparator.h
Generated by
1.18.0