Cockatrice 2026-09-01-Development-3.1.0-beta.10
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"
6
7#include <QList>
8#include <QMap>
9#include <QSharedPointer>
10
11class PrintingInfo;
12
13using SetToPrintingsMap = QMap<QString, QList<PrintingInfo>>;
14
28{
29public:
36 explicit PrintingInfo(const CardSetPtr &_set = nullptr, const LazyPropertiesHash &_properties = {});
37
43 ~PrintingInfo() = default;
44
54 bool operator==(const PrintingInfo &other) const
55 {
56 return this->set == other.set && this->getPropertiesHash() == other.getPropertiesHash();
57 }
58
64 bool isEmpty() const
65 {
66 return set == nullptr && getPropertiesHash().isEmpty();
67 }
68
69private:
72
73public:
79 [[nodiscard]] CardSetPtr getSet() const
80 {
81 return set;
82 }
83
89 [[nodiscard]] QStringList getProperties() const
90 {
91 return getPropertiesHash().keys();
92 }
93
94 [[nodiscard]] const QHash<QString, QString> &getPropertiesHash() const
95 {
96 return properties.getProperties();
97 }
98
105 [[nodiscard]] QString getProperty(const QString &propertyName) const
106 {
107 return properties.value(propertyName);
108 }
109
118 void setProperty(const QString &_name, const QString &_value);
119
125 [[nodiscard]] QString getUuid() const;
126
132 [[nodiscard]] QString getFlavorName() const;
133
141 [[nodiscard]] QString getArtist() const
142 {
143 return getProperty("artist");
144 }
145};
146
147#endif // COCKATRICE_PRINTING_INFO_H
QMap< QString, QList< PrintingInfo > > SetToPrintingsMap
Definition card_info.h:29
QSharedPointer< CardSet > CardSetPtr
Definition card_info.h:27
A property map that can lazily deserialize blobs to avoid loading overhead.
Definition lazy_properties_hash.h:17
Represents metadata for a specific variation of a card within a set.
Definition printing_info.h:28
CardSetPtr getSet() const
Returns the set this printing belongs to.
Definition printing_info.h:79
QString getFlavorName() const
Returns the flavorName for this printing.
Definition printing_info.cpp:26
LazyPropertiesHash properties
Key-value store for variation-specific attributes.
Definition printing_info.h:71
bool operator==(const PrintingInfo &other) const
Equality operator.
Definition printing_info.h:54
QString getProperty(const QString &propertyName) const
Retrieves the value of a specific property.
Definition printing_info.h:105
void setProperty(const QString &_name, const QString &_value)
Sets or updates the value of a specific property.
Definition printing_info.cpp:13
PrintingInfo(const CardSetPtr &_set=nullptr, const LazyPropertiesHash &_properties={})
Constructs a PrintingInfo associated with a specific set.
Definition printing_info.cpp:8
bool isEmpty() const
check if the info is empty, as if default constructed.
Definition printing_info.h:64
const QHash< QString, QString > & getPropertiesHash() const
Definition printing_info.h:94
QString getUuid() const
Returns the providerID for this printing.
Definition printing_info.cpp:21
QStringList getProperties() const
Returns the list of property names defined for this printing.
Definition printing_info.h:89
QString getArtist() const
Returns the artist name credited for this printing's artwork.
Definition printing_info.h:141
~PrintingInfo()=default
Destroys the PrintingInfo.
CardSetPtr set
The set this variation belongs to.
Definition printing_info.h:70