Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform 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
13inline Q_LOGGING_CATEGORY(CardListLog, "card_list");
14
15class CardItem;
16
17class CardList : public QList<CardItem *>
18{
19protected:
21
22public:
24 {
26
27 // Options that are used by groupBy
28 // Should partition all cards into a reasonable number of buckets
32
33 // Options that are used by sortBy
34 // We don't care about buckets; we want as many distinct values as possible.
42 };
43 explicit CardList(bool _contentsKnown);
44 CardItem *findCard(const int cardId) const;
45 bool getContentsKnown() const
46 {
47 return contentsKnown;
48 }
49
50 void sortBy(const QList<SortOption> &options);
51
52 static std::function<QString(CardItem *)> getExtractorFor(SortOption option);
53};
54
55#endif
Q_LOGGING_CATEGORY(CardListLog, "card_list")
Definition card_item.h:29
static std::function< QString(CardItem *)> getExtractorFor(SortOption option)
returns the function that extracts the given property from the CardItem.
Definition card_list.cpp:116
SortOption
Definition card_list.h:24
@ SortByColorGrouping
Definition card_list.h:31
@ SortByType
Definition card_list.h:36
@ SortByPrinting
Definition card_list.h:41
@ SortByManaValue
Definition card_list.h:30
@ SortByMainType
Definition card_list.h:29
@ SortBySet
Definition card_list.h:40
@ SortByPt
Definition card_list.h:39
@ SortByColors
Definition card_list.h:38
@ NoSort
Definition card_list.h:25
@ SortByManaCost
Definition card_list.h:37
@ SortByName
Definition card_list.h:35
bool getContentsKnown() const
Definition card_list.h:45
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:42
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:21
CardList(bool _contentsKnown)
Definition card_list.cpp:9
bool contentsKnown
Definition card_list.h:20