Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
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
15inline Q_LOGGING_CATEGORY(CardListLog, "card_list");
16
17class CardItem;
18
19class CardList : public QList<CardItem *>
20{
21protected:
23
24public:
26 {
28
29 // Options that are used by groupBy
30 // Should partition all cards into a reasonable number of buckets
34
35 // Options that are used by sortBy
36 // We don't care about buckets; we want as many distinct values as possible.
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
Definition card_item.h:33
static std::function< QString(CardItem *)> getExtractorFor(SortOption option)
returns the function that extracts the given property from the CardItem.
Definition card_list.cpp:121
SortOption
Definition card_list.h:26
@ SortByColorGrouping
Definition card_list.h:33
@ SortByType
Definition card_list.h:38
@ SortByPrinting
Definition card_list.h:43
@ SortByManaValue
Definition card_list.h:32
@ SortByMainType
Definition card_list.h:31
@ SortBySet
Definition card_list.h:42
@ SortByPt
Definition card_list.h:41
@ SortByColors
Definition card_list.h:40
@ NoSort
Definition card_list.h:27
@ SortByManaCost
Definition card_list.h:39
@ SortByName
Definition card_list.h:37
bool getContentsKnown() const
Definition card_list.h:47
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
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(bool _contentsKnown)
Definition card_list.cpp:14
bool contentsKnown
Definition card_list.h:22
Definition remote_connection_controller.h:20
Q_LOGGING_CATEGORY(CrashReportLog, "crash_report")