Cockatrice 2026-04-21-Development-2.11.0-beta.61
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
printing_info.h
Go to the documentation of this file.
1#ifndef COCKATRICE_PRINTING_INFO_H
2#define COCKATRICE_PRINTING_INFO_H
3
4#include "../set/card_set.h"
5
6#include <QList>
7#include <QMap>
8#include <QVariant>
9
10class PrintingInfo;
11
12using SetToPrintingsMap = QMap<QString, QList<PrintingInfo>>;
13
27{
28public:
34 explicit PrintingInfo(const CardSetPtr &_set = nullptr);
35
41 ~PrintingInfo() = default;
42
52 bool operator==(const PrintingInfo &other) const
53 {
54 return this->set == other.set && this->properties == other.properties;
55 }
56
62 bool isEmpty() const
63 {
64 return set == nullptr && properties.isEmpty();
65 }
66
67private:
69 QVariantHash properties;
70
71public:
77 [[nodiscard]] CardSetPtr getSet() const
78 {
79 return set;
80 }
81
87 [[nodiscard]] QStringList getProperties() const
88 {
89 return properties.keys();
90 }
91
98 [[nodiscard]] QString getProperty(const QString &propertyName) const
99 {
100 return properties.value(propertyName).toString();
101 }
102
111 void setProperty(const QString &_name, const QString &_value)
112 {
113 properties.insert(_name, _value);
114 }
115
121 [[nodiscard]] QString getUuid() const;
122
128 [[nodiscard]] QString getFlavorName() const;
129};
130
131#endif // COCKATRICE_PRINTING_INFO_H
QMap< QString, QList< PrintingInfo > > SetToPrintingsMap
Definition card_info.h:27
QSharedPointer< CardSet > CardSetPtr
Definition card_info.h:25
Represents metadata for a specific variation of a card within a set.
Definition printing_info.h:27
CardSetPtr getSet() const
Returns the set this printing belongs to.
Definition printing_info.h:77
QString getFlavorName() const
Returns the flavorName for this printing.
Definition printing_info.cpp:17
bool operator==(const PrintingInfo &other) const
Equality operator.
Definition printing_info.h:52
QString getProperty(const QString &propertyName) const
Retrieves the value of a specific property.
Definition printing_info.h:98
void setProperty(const QString &_name, const QString &_value)
Sets or updates the value of a specific property.
Definition printing_info.h:111
PrintingInfo(const CardSetPtr &_set=nullptr)
Constructs a PrintingInfo associated with a specific set.
Definition printing_info.cpp:5
bool isEmpty() const
check if the info is empty, as if default constructed.
Definition printing_info.h:62
QString getUuid() const
Returns the providerID for this printing.
Definition printing_info.cpp:12
QStringList getProperties() const
Returns the list of property names defined for this printing.
Definition printing_info.h:87
~PrintingInfo()=default
Destroys the PrintingInfo.
CardSetPtr set
The set this variation belongs to.
Definition printing_info.h:68
QVariantHash properties
Key-value store for variation-specific attributes.
Definition printing_info.h:69