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_list.h
Go to the documentation of this file.
1
6
7
#ifndef CARDLIST_H
8
#define CARDLIST_H
9
10
#include <QList>
11
#include <QLoggingCategory>
12
#include <QString>
13
#include <functional>
14
15
inline
Q_LOGGING_CATEGORY
(CardListLog,
"card_list"
);
16
17
class
CardItem
;
18
19
class
CardList
:
public
QList
<CardItem *>
20
{
21
protected
:
22
bool
contentsKnown
;
23
24
public
:
25
enum
SortOption
26
{
27
NoSort
,
28
29
// Options that are used by groupBy
30
// Should partition all cards into a reasonable number of buckets
31
SortByMainType
,
32
SortByManaValue
,
33
SortByColorGrouping
,
34
35
// Options that are used by sortBy
36
// We don't care about buckets; we want as many distinct values as possible.
37
SortByName
,
38
SortByType
,
39
SortByManaCost
,
40
SortByColors
,
41
SortByPt
,
42
SortBySet
,
43
SortByPrinting
44
};
45
explicit
CardList
(
bool
_contentsKnown);
46
CardItem
*
findCard
(
const
int
cardId)
const
;
47
bool
getContentsKnown
()
const
48
{
49
return
contentsKnown
;
50
}
51
52
void
sortBy
(
const
QList<SortOption>
&options);
53
54
static
std::function<QString(
CardItem
*)>
getExtractorFor
(
SortOption
option);
55
};
56
57
#endif
CardItem
Definition
card_item.h:33
CardList::getExtractorFor
static std::function< QString(CardItem *)> getExtractorFor(SortOption option)
returns the function that extracts the given property from the CardItem.
Definition
card_list.cpp:121
CardList::SortOption
SortOption
Definition
card_list.h:26
CardList::SortByColorGrouping
@ SortByColorGrouping
Definition
card_list.h:33
CardList::SortByType
@ SortByType
Definition
card_list.h:38
CardList::SortByPrinting
@ SortByPrinting
Definition
card_list.h:43
CardList::SortByManaValue
@ SortByManaValue
Definition
card_list.h:32
CardList::SortByMainType
@ SortByMainType
Definition
card_list.h:31
CardList::SortBySet
@ SortBySet
Definition
card_list.h:42
CardList::SortByPt
@ SortByPt
Definition
card_list.h:41
CardList::SortByColors
@ SortByColors
Definition
card_list.h:40
CardList::NoSort
@ NoSort
Definition
card_list.h:27
CardList::SortByManaCost
@ SortByManaCost
Definition
card_list.h:39
CardList::SortByName
@ SortByName
Definition
card_list.h:37
CardList::getContentsKnown
bool getContentsKnown() const
Definition
card_list.h:47
CardList::sortBy
void sortBy(const QList< SortOption > &options)
sorts the list by using string comparison on properties extracted from the CardItem The cards are com...
Definition
card_list.cpp:47
CardList::findCard
CardItem * findCard(const int cardId) const
Finds the CardItem with the given id in the list. If contentsKnown is false, then this just returns t...
Definition
card_list.cpp:26
CardList::CardList
CardList(bool _contentsKnown)
Definition
card_list.cpp:14
CardList::contentsKnown
bool contentsKnown
Definition
card_list.h:22
QList
Definition
remote_connection_controller.h:20
Q_LOGGING_CATEGORY
Q_LOGGING_CATEGORY(CrashReportLog, "crash_report")
cockatrice
src
game
board
card_list.h
Generated by
1.18.0