Cockatrice 2026-10-19-Development-3.1.2-beta.2
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 <QHash>
8#include <QList>
9#include <QMap>
10#include <QSharedPointer>
11#include <QString>
12#include <QStringList>
13
14class PrintingInfo;
15
17
31{
32public:
39 explicit PrintingInfo(const CardSetPtr &_set = nullptr, const LazyPropertiesHash &_properties = {});
40
46 ~PrintingInfo() = default;
47
57 bool operator==(const PrintingInfo &other) const
58 {
59 return this->set == other.set && this->getPropertiesHash() == other.getPropertiesHash();
60 }
61
67 bool isEmpty() const
68 {
69 return set == nullptr && getPropertiesHash().isEmpty();
70 }
71
72private:
75
76public:
82 [[nodiscard]] CardSetPtr getSet() const
83 {
84 return set;
85 }
86
92 [[nodiscard]] QStringList getProperties() const
93 {
94 return getPropertiesHash().keys();
95 }
96
97 [[nodiscard]] const QHash<QString, QString> &getPropertiesHash() const
98 {
100 }
101
108 [[nodiscard]] QString getProperty(const QString &propertyName) const
109 {
110 return properties.value(propertyName);
111 }
112
121 void setProperty(const QString &_name, const QString &_value);
122
128 [[nodiscard]] QString getUuid() const;
129
135 [[nodiscard]] QString getFlavorName() const;
136
144 [[nodiscard]] QString getArtist() const
145 {
146 return getProperty("artist");
147 }
148};
149
150#endif // COCKATRICE_PRINTING_INFO_H
QMap< QString, QList< PrintingInfo > > SetToPrintingsMap
Definition card_info.h:32
QSharedPointer< CardSet > CardSetPtr
Definition card_info.h:30
A property map that can lazily deserialize blobs to avoid loading overhead.
Definition lazy_properties_hash.h:19
const QHash< QString, QString > & getProperties() const
Gets a view of the materialized properties hash.
Definition lazy_properties_hash.cpp:93
QString value(const QString &key) const
Gets the value from the materialized properties hash.
Definition lazy_properties_hash.cpp:75
Represents metadata for a specific variation of a card within a set.
Definition printing_info.h:31
CardSetPtr getSet() const
Returns the set this printing belongs to.
Definition printing_info.h:82
QString getFlavorName() const
Returns the flavorName for this printing.
Definition printing_info.cpp:23
LazyPropertiesHash properties
Key-value store for variation-specific attributes.
Definition printing_info.h:74
bool operator==(const PrintingInfo &other) const
Equality operator.
Definition printing_info.h:57
QString getProperty(const QString &propertyName) const
Retrieves the value of a specific property.
Definition printing_info.h:108
void setProperty(const QString &_name, const QString &_value)
Sets or updates the value of a specific property.
Definition printing_info.cpp:10
PrintingInfo(const CardSetPtr &_set=nullptr, const LazyPropertiesHash &_properties={})
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:67
const QHash< QString, QString > & getPropertiesHash() const
Definition printing_info.h:97
QString getUuid() const
Returns the providerID for this printing.
Definition printing_info.cpp:18
QStringList getProperties() const
Returns the list of property names defined for this printing.
Definition printing_info.h:92
QString getArtist() const
Returns the artist name credited for this printing's artwork.
Definition printing_info.h:144
~PrintingInfo()=default
Destroys the PrintingInfo.
CardSetPtr set
The set this variation belongs to.
Definition printing_info.h:73
Definition mana_curve_category_widget.h:11
Definition game.h:18