Cockatrice 2026-09-01-Development-3.1.0-beta.10
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
11
12#include <QLoggingCategory>
13#include <QString>
14#include <functional>
15
16inline Q_LOGGING_CATEGORY(DeckFilterStringLog, "deck_filter_string");
17
25{
26 const LoadedDeck *deck = nullptr;
27 QString filePath;
28 QString displayName;
30};
31
32typedef std::function<bool(const DeckSearchData &data)> DeckFilter;
33
35{
36public:
38 explicit DeckFilterString(const QString &expr);
39 bool check(const DeckSearchData &data) const
40 {
41 return filter(data);
42 }
43
44 [[nodiscard]] bool valid() const
45 {
46 return _error.isEmpty();
47 }
48
49 QString error()
50 {
51 return _error;
52 }
53
54private:
55 QString _error;
57};
58#endif // DECK_FILTER_STRING_H
QString _error
Definition deck_filter_string.h:55
DeckFilter filter
Definition deck_filter_string.h:56
bool check(const DeckSearchData &data) const
Definition deck_filter_string.h:39
DeckFilterString()
Definition deck_filter_string.cpp:149
bool valid() const
Definition deck_filter_string.h:44
QString error()
Definition deck_filter_string.h:49
Q_LOGGING_CATEGORY(DeckFilterStringLog, "deck_filter_string")
std::function< bool(const DeckSearchData &data)> DeckFilter
Definition deck_filter_string.h:32
Definition deck_filter_string.h:25
const LoadedDeck * deck
The loaded deck. Must not be null.
Definition deck_filter_string.h:26
QString filePath
Absolute path of the deck file.
Definition deck_filter_string.h:27
QString relativeFilePath
File path relative to the deck folder.
Definition deck_filter_string.h:29
QString displayName
Deck name, or the file name if the deck has no name.
Definition deck_filter_string.h:28
Represents a deck that was loaded from somewhere. Contains the DeckList itself, as well as info about...
Definition loaded_deck.h:14