Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
deck_filter_string.h
Go to the documentation of this file.
1
6
7#ifndef DECK_FILTER_STRING_H
8#define DECK_FILTER_STRING_H
9
10#include <QLoggingCategory>
11#include <QString>
12#include <functional>
14
16struct LoadedDeck;
17
18inline Q_LOGGING_CATEGORY(DeckFilterStringLog, "deck_filter_string");
19
27{
28 const LoadedDeck *deck = nullptr;
29 QString filePath;
30 QString displayName;
32};
33
34typedef std::function<bool(const DeckSearchData &data)> DeckFilter;
35
37{
38public:
40 explicit DeckFilterString(const QString &expr, const CardSearchLanguage &searchLanguage = {});
41 bool check(const DeckSearchData &data) const
42 {
43 return filter(data);
44 }
45
46 [[nodiscard]] bool valid() const
47 {
48 return _error.isEmpty();
49 }
50
51 QString error()
52 {
53 return _error;
54 }
55
56private:
57 QString _error;
59};
60#endif // DECK_FILTER_STRING_H
QString _error
Definition deck_filter_string.h:57
DeckFilter filter
Definition deck_filter_string.h:58
bool check(const DeckSearchData &data) const
Definition deck_filter_string.h:41
DeckFilterString()
Definition deck_filter_string.cpp:173
bool valid() const
Definition deck_filter_string.h:46
QString error()
Definition deck_filter_string.h:51
Q_LOGGING_CATEGORY(CrashReportLog, "crash_report")
std::function< bool(const DeckSearchData &data)> DeckFilter
Definition deck_filter_string.h:34
The card language and matching mode searches run against.
Definition card_localization.h:27
Definition deck_filter_string.h:27
const LoadedDeck * deck
The loaded deck. Must not be null.
Definition deck_filter_string.h:28
QString filePath
Absolute path of the deck file.
Definition deck_filter_string.h:29
QString relativeFilePath
File path relative to the deck folder.
Definition deck_filter_string.h:31
QString displayName
Deck name, or the file name if the deck has no name.
Definition deck_filter_string.h:30
Represents a deck that was loaded from somewhere. Contains the DeckList itself, as well as info about...
Definition loaded_deck.h:14