Represents a specific card instance, defined by its CardInfo and a particular printing. More...
#include <exact_card.h>
Public Member Functions | |
| ExactCard () | |
| Constructs an empty ExactCard. | |
| ExactCard (const CardInfoPtr &_card, const PrintingInfo &_printing=PrintingInfo()) | |
| Constructs an ExactCard from a card and printing. | |
| CardInfoPtr | getCardPtr () const |
| Returns the underlying CardInfoPtr. | |
| PrintingInfo | getPrinting () const |
| Returns the printing information associated with this card. | |
| bool | operator== (const ExactCard &other) const |
| Compares both card pointer and printing for equality. | |
| QString | getName () const |
| Convenience helper to get the card's display name. | |
| const CardInfo & | getInfo () const |
| Returns a reference to the underlying CardInfo object. | |
| QString | getPixmapCacheKey () const |
| Generates a stable cache key for pixmap caching. | |
| bool | isEmpty () const |
| Indicates whether this ExactCard represents no valid card. | |
| operator bool () const | |
| Boolean conversion indicating whether the card is valid (non-empty). | |
| void | emitPixmapUpdated () const |
| Emits the pixmapUpdated signal on the underlying CardInfo. | |
Private Attributes | |
| CardInfoPtr | card |
| PrintingInfo | printing |
Represents a specific card instance, defined by its CardInfo and a particular printing.
An ExactCard identifies a card not only by its underlying CardInfoPtr (which may be null), but also by its PrintingInfo, which specifies the exact printing/variant. This allows distinguishing between different printings of the same logical card (e.g., different sets, promos, foils).
| ExactCard::ExactCard | ( | ) |
Constructs an empty ExactCard.
The CardInfoPtr will be null, and PrintingInfo will be default-constructed. An empty ExactCard represents "no card".
Default constructor. This will set the CardInfoPtr to null. The printing will be the default-constructed PrintingInfo.
|
explicit |
Constructs an ExactCard from a card and printing.
| _card | The card info pointer. May be null. |
| _printing | The printing details. Defaults to an empty PrintingInfo. |
| _card | The card. Can be null. |
| _printing | The printing. Can be empty. |
| void ExactCard::emitPixmapUpdated | ( | ) | const |
Emits the pixmapUpdated signal on the underlying CardInfo.
Assumes CardInfoPtr is non-null. If called on an empty ExactCard, the behavior is undefined.
Gets the CardInfo to emit the pixmapUpdated signal
|
inlinenodiscard |
Returns the underlying CardInfoPtr.
May be null if the ExactCard is empty.
|
nodiscard |
Returns a reference to the underlying CardInfo object.
If the CardInfoPtr is null, returns a reference to a static empty CardInfo instance instead. This avoids null-dereferencing but means modifications to the returned object do not affect the ExactCard.
Gets a view of the underlying cardInfoPtr.
|
nodiscard |
Convenience helper to get the card's display name.
Convenience method to safely get the card's name.
|
nodiscard |
Generates a stable cache key for pixmap caching.
The key includes the card's name and (if present) the printing UUID, allowing different printings of the same card to map to different cache entries.
The key used to identify this exact printing in the cache
|
inlinenodiscard |
Returns the printing information associated with this card.
May be empty if no specific printing was assigned.
|
nodiscard |
Indicates whether this ExactCard represents no valid card.
An ExactCard is considered empty if the CardInfoPtr is null or the card's name is empty.
Checks if the card is null or empty.
|
explicit |
Boolean conversion indicating whether the card is valid (non-empty).
Returns true if isEmpty() is false
| bool ExactCard::operator== | ( | const ExactCard & | other | ) | const |
Compares both card pointer and printing for equality.
Two ExactCard objects are equal only if both their CardInfoPtr and PrintingInfo values are equal.
|
private |
|
private |