Represents a card and its associated metadata, properties, and relationships. More...
#include <card_info.h>
Classes | |
| class | UiAttributes |
| Attributes of the card that affect display and game logic. More... | |
Public Member Functions | |
| CardInfo (const QString &_name, const QString &_text, bool _isToken, QVariantHash _properties, const QList< CardRelation * > &_relatedCards, const QList< CardRelation * > &_reverseRelatedCards, SetToPrintingsMap _sets, UiAttributes _uiAttributes) | |
| Constructs a CardInfo with full initialization. | |
| CardInfo (const CardInfo &other) | |
| Copy constructor for CardInfo. | |
| CardInfoPtr | clone () const |
| Clones the current CardInfo instance. | |
| void | setSmartPointer (CardInfoPtr _ptr) |
| Sets the internal smart pointer to self. | |
Basic Properties Accessors | |
| const QString & | getName () const |
| const QString & | getSimpleName () const |
| const QSet< QString > & | getAltNames () |
| const QString & | getText () const |
| void | setText (const QString &_text) |
| bool | getIsToken () const |
| QStringList | getProperties () const |
| QString | getProperty (const QString &propertyName) const |
| void | setProperty (const QString &_name, const QString &_value) |
| bool | hasProperty (const QString &propertyName) const |
| const SetToPrintingsMap & | getSets () const |
| const QString & | getSetsNames () const |
Related Cards Accessors | |
| const QList< CardRelation * > & | getRelatedCards () const |
| const QList< CardRelation * > & | getReverseRelatedCards () const |
| const QList< CardRelation * > & | getReverseRelatedCards2Me () const |
| QList< CardRelation * > | getAllRelatedCards () const |
| void | resetReverseRelatedCards2Me () |
| void | addReverseRelatedCards2Me (CardRelation *cardRelation) |
UI Positioning | |
| const UiAttributes & | getUiAttributes () const |
| const QChar | getColorChar () const |
Static Public Member Functions | |
| static CardInfoPtr | newInstance (const QString &_name) |
| Creates a new instance with only the card name. | |
| static CardInfoPtr | newInstance (const QString &_name, const QString &_text, bool _isToken, QVariantHash _properties, const QList< CardRelation * > &_relatedCards, const QList< CardRelation * > &_reverseRelatedCards, SetToPrintingsMap _sets, UiAttributes _uiAttributes) |
| Creates a new instance with full initialization. | |
Private Attributes | |
Private Card Properties | |
| CardInfoPtr | smartThis |
| Smart pointer to self for safe cross-references. | |
| QString | name |
| Full name of the card. | |
| QString | simpleName |
| Simplified name for fuzzy matching. | |
| QString | text |
| Text description or rules text of the card. | |
| bool | isToken |
| Whether this card is a token or not. | |
| QVariantHash | properties |
| Key-value store of dynamic card properties. | |
| QList< CardRelation * > | relatedCards |
| Forward references to related cards. | |
| QList< CardRelation * > | reverseRelatedCards |
| Cards that refer back to this card. | |
| QList< CardRelation * > | reverseRelatedCardsToMe |
| Cards that consider this card as related. | |
| SetToPrintingsMap | setsToPrintings |
| Mapping from set names to printing variations. | |
| UiAttributes | uiAttributes |
| Attributes that affect display and game logic. | |
| QString | setsNames |
| Cached, human-readable list of set names. | |
| QSet< QString > | altNames |
| Cached set of alternate names, used when searching. | |
Legacy/Convenience Property Accessors | |
| const QString | getCardType () const |
| void | setCardType (const QString &value) |
| const QString | getCmc () const |
| const QString | getColors () const |
| void | setColors (const QString &value) |
| const QString | getLoyalty () const |
| const QString | getMainCardType () const |
| const QString | getManaCost () const |
| const QString | getPowTough () const |
| void | setPowTough (const QString &value) |
| QString | getCorrectedName () const |
| Returns a version of the card name safe for file storage or fuzzy matching. | |
| void | addToSet (const CardSetPtr &_set, PrintingInfo _info=PrintingInfo()) |
| Adds a printing to a specific set. | |
| void | combineLegalities (const QVariantHash &props) |
| Combines legality properties from a provided map. | |
| void | refreshCachedSets () |
| Refreshes all cached fields that are calculated from the contained sets and printings. | |
| static QString | simplifyName (const QString &name) |
| Simplifies a name for fuzzy matching. | |
| void | refreshCachedSetNames () |
| Refreshes the cached, human-readable list of set names. | |
| void | refreshCachedAltNames () |
| Refreshes the cached list of alt names for the card. | |
| void | pixmapUpdated (const PrintingInfo &printing) |
| Emitted when a pixmap for this card has been updated or finished loading. | |
| void | cardInfoChanged (CardInfoPtr card) |
| Emitted when card properties or state have changed. | |
Represents a card and its associated metadata, properties, and relationships.
CardInfo holds both static information (name, text, flags) and dynamic data (properties, set memberships, relationships). It also integrates with signals/slots, allowing observers to react to property or visual updates.
Each CardInfo may belong to multiple sets through its printings, and can be related to other cards through defined relationships.
|
explicit |
Constructs a CardInfo with full initialization.
| _name | The name of the card. |
| _text | Rules text or description of the card. |
| _isToken | Flag indicating whether the card is a token. |
| _properties | Arbitrary key-value properties. |
| _relatedCards | Forward references to related cards. |
| _reverseRelatedCards | Backward references to related cards. |
| _sets | Map of set names to printing information. |
| _uiAttributes | Attributes that affect display and game logic |
|
inline |
|
inline |
| void CardInfo::addToSet | ( | const CardSetPtr & | _set, |
| PrintingInfo | _info = PrintingInfo() ) |
Adds a printing to a specific set.
Updates the mapping and refreshes the cached list of set names.
| _set | The set to which the card should be added. |
| _info | Optional printing information. |
|
signal |
Emitted when card properties or state have changed.
| card | Shared pointer to the CardInfo instance that changed. |
|
inlinenodiscard |
| void CardInfo::combineLegalities | ( | const QVariantHash & | props | ) |
Combines legality properties from a provided map.
Useful for merging format legality flags from multiple sources.
| props | Key-value mapping of format legalities. |
|
inlinenodiscard |
|
inline |
|
nodiscard |
|
nodiscard |
|
nodiscard |
|
nodiscard |
|
nodiscard |
Returns a version of the card name safe for file storage or fuzzy matching.
Removes invalid characters, replaces spacing markers, and normalizes diacritics.
|
inlinenodiscard |
|
nodiscard |
|
nodiscard |
|
nodiscard |
|
inlinenodiscard |
|
nodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
static |
Creates a new instance with only the card name.
All other fields are set to defaults.
| _name | The card name. |
|
static |
Creates a new instance with full initialization.
| _name | Name of the card. |
| _text | Rules text or description. |
| _isToken | Token flag. |
| _properties | Arbitrary properties. |
| _relatedCards | Forward relationships. |
| _reverseRelatedCards | Reverse relationships. |
| _sets | Printing information per set. |
| _uiAttributes | Attributes that affect display and game logic |
|
signal |
Emitted when a pixmap for this card has been updated or finished loading.
| printing | Specific printing for which the pixmap has updated. |
|
private |
Refreshes the cached list of alt names for the card.
Typically called after adding or modifying the contained printings.
|
private |
Refreshes the cached, human-readable list of set names.
Typically called after adding or modifying set memberships.
| void CardInfo::refreshCachedSets | ( | ) |
Refreshes all cached fields that are calculated from the contained sets and printings.
Typically called after adding or modifying set memberships or printings.
| void CardInfo::resetReverseRelatedCards2Me | ( | ) |
| void CardInfo::setCardType | ( | const QString & | value | ) |
| void CardInfo::setColors | ( | const QString & | value | ) |
| void CardInfo::setPowTough | ( | const QString & | value | ) |
|
inline |
|
inline |
|
inline |
|
static |
Simplifies a name for fuzzy matching.
Converts to lowercase, removes punctuation/spacing.
| name | Original name string. |
|
private |
Cached set of alternate names, used when searching.
|
private |
Whether this card is a token or not.
|
private |
Full name of the card.
|
private |
Key-value store of dynamic card properties.
|
private |
Forward references to related cards.
|
private |
Cards that refer back to this card.
|
private |
Cards that consider this card as related.
|
private |
Cached, human-readable list of set names.
|
private |
Mapping from set names to printing variations.
|
private |
Simplified name for fuzzy matching.
|
private |
Smart pointer to self for safe cross-references.
|
private |
Text description or rules text of the card.
|
private |
Attributes that affect display and game logic.