Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
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
13{
14public:
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
31{
32public:
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
49{
50public:
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
QSharedPointer< CardSet > CardSetPtr
Definition card_info.h:24
Definition card_set_comparator.h:49
bool operator()(const PrintingInfo &a, const PrintingInfo &b) const
Definition card_set_comparator.h:56
Represents metadata for a specific variation of a card within a set.
Definition printing_info.h:27
CardSetPtr getSet() const
Returns the set this printing belongs to.
Definition printing_info.h:67
Definition card_set_comparator.h:13
bool operator()(const CardSetPtr &a, const CardSetPtr &b) const
Definition card_set_comparator.h:20
Definition card_set_comparator.h:31
bool operator()(const CardSetPtr &a, const CardSetPtr &b) const
Definition card_set_comparator.h:38