Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
DecklistCardNode Class Reference

Concrete node type representing an actual card entry in the deck. More...

#include <deck_list_card_node.h>

Inheritance diagram for DecklistCardNode:
[legend]
Collaboration diagram for DecklistCardNode:
[legend]

Public Member Functions

 DecklistCardNode (QString _name=QString(), int _number=1, InnerDecklistNode *_parent=nullptr, int position=-1, QString _cardSetShortName=QString(), QString _cardSetNumber=QString(), QString _cardProviderId=QString())
 Construct a new DecklistCardNode.
 DecklistCardNode (DecklistCardNode *other, InnerDecklistNode *_parent)
 Copy constructor with new parent assignment.
int getNumber () const override
void setNumber (int _number) override
QString getName () const override
void setName (const QString &_name) override
QString getCardProviderId () const override
void setCardProviderId (const QString &_providerId) override
QString getCardSetShortName () const override
void setCardSetShortName (const QString &_cardSetShortName) override
QString getCardCollectorNumber () const override
void setCardCollectorNumber (const QString &_cardSetNumber) override
bool isDeckHeader () const override
CardRef toCardRef () const
 Convert this node to a CardRef.
Public Member Functions inherited from AbstractDecklistCardNode
 AbstractDecklistCardNode (InnerDecklistNode *_parent=nullptr, int position=-1)
 Construct a new AbstractDecklistCardNode.
int height () const override
 Get the height of this node in the tree.
bool compare (AbstractDecklistNode *other) const override
 Compare this card node against another for sorting.
bool compareNumber (AbstractDecklistNode *other) const
 Compare this card node to another by quantity.
bool compareName (AbstractDecklistNode *other) const
 Compare this card node to another by name.
bool readElement (QXmlStreamReader *xml) override
 Deserialize this node’s properties from XML.
void writeElement (QXmlStreamWriter *xml) override
 Serialize this node’s properties to XML.
Public Member Functions inherited from AbstractDecklistNode
 AbstractDecklistNode (InnerDecklistNode *_parent=nullptr, int position=-1)
 Construct a new AbstractDecklistNode and insert it into its parent.
virtual ~AbstractDecklistNode ()=default
 Virtual destructor. Child classes must clean up their resources.
virtual void setSortMethod (DeckSortMethod method)
 Set the sort method for this node’s children.
InnerDecklistNodegetParent () const
int depth () const
 Compute the depth of this node in the tree.

Private Attributes

QString name
 Display name of the card.
int number
 Quantity of this card in the deck.
QString cardSetShortName
 Short set code (e.g., "NEO").
QString cardSetNumber
 Collector number within the set.
QString cardProviderId
 External provider identifier (e.g., UUID).

Additional Inherited Members

Protected Attributes inherited from AbstractDecklistNode
InnerDecklistNodeparent
 Pointer to the parent node, or nullptr if this is the root.
DeckSortMethod sortMethod
 Current sorting strategy for this node's children.

Detailed Description

Concrete node type representing an actual card entry in the deck.

This class extends AbstractDecklistCardNode to hold all information needed to uniquely identify a card printing within the deck.

Role in the hierarchy:

  • Child of an InnerDecklistNode (which groups cards by zone or criteria).
  • Leaf node in the deck tree; it does not contain further children.

Data stored:

  • name: Card’s display name.
  • number: Quantity of this card in the deck.
  • cardSetShortName: Abbreviation of the set (e.g., "NEO" for Neon Dynasty).
  • cardSetNumber: Collector number within the set.
  • cardProviderId: External provider identifier (e.g., UUID or MTGJSON ID).

Usage:

  • Constructed directly when building a deck list from user input or file.
  • Used by DeckListModel to present cards in Qt views.
  • Convertible to CardRef for database lookups or cross-references.

Ownership:

  • Owned by its parent InnerDecklistNode.
  • Destroyed automatically when its parent is destroyed.

Constructor & Destructor Documentation

◆ DecklistCardNode() [1/2]

DecklistCardNode::DecklistCardNode ( QString _name = QString(),
int _number = 1,
InnerDecklistNode * _parent = nullptr,
int position = -1,
QString _cardSetShortName = QString(),
QString _cardSetNumber = QString(),
QString _cardProviderId = QString() )
inlineexplicit

Construct a new DecklistCardNode.

Parameters
_nameDisplay name of the card.
_numberQuantity of this card (default = 1).
_parentParent node in the tree (zone or group). May be nullptr.
positionIndex to insert into parent’s children. -1 = append.
_cardSetShortNameShort set code (e.g., "NEO").
_cardSetNumberCollector number within the set.
_cardProviderIdExternal provider ID (e.g., UUID).

On construction, if a parent is provided, this node is inserted into the parent’s children list automatically.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DecklistCardNode() [2/2]

DecklistCardNode::DecklistCardNode ( DecklistCardNode * other,
InnerDecklistNode * _parent )
explicit

Copy constructor with new parent assignment.

Parameters
otherExisting DecklistCardNode to copy.
_parentParent node for the copy.

Creates a deep copy of the card node’s properties, but attaches the new instance to a different parent in the tree.

Here is the call graph for this function:

Member Function Documentation

◆ getCardCollectorNumber()

QString DecklistCardNode::getCardCollectorNumber ( ) const
inlinenodiscardoverridevirtual
Returns
The collector number of this card within its set.

Implements AbstractDecklistCardNode.

Here is the caller graph for this function:

◆ getCardProviderId()

QString DecklistCardNode::getCardProviderId ( ) const
inlinenodiscardoverridevirtual
Returns
The provider identifier for this card.

Implements AbstractDecklistCardNode.

Here is the caller graph for this function:

◆ getCardSetShortName()

QString DecklistCardNode::getCardSetShortName ( ) const
inlinenodiscardoverridevirtual
Returns
The short set code (e.g., "NEO").

Implements AbstractDecklistCardNode.

Here is the caller graph for this function:

◆ getName()

QString DecklistCardNode::getName ( ) const
inlinenodiscardoverridevirtual
Returns
The display name of this card.

Implements AbstractDecklistCardNode.

Here is the caller graph for this function:

◆ getNumber()

int DecklistCardNode::getNumber ( ) const
inlinenodiscardoverridevirtual
Returns
The quantity of this card.

Implements AbstractDecklistCardNode.

Here is the caller graph for this function:

◆ isDeckHeader()

bool DecklistCardNode::isDeckHeader ( ) const
inlinenodiscardoverridevirtual
Returns
Always false; card nodes are not deck headers.

Implements AbstractDecklistNode.

◆ setCardCollectorNumber()

void DecklistCardNode::setCardCollectorNumber ( const QString & _cardSetNumber)
inlineoverridevirtual
Parameters
_cardSetNumberSet the collector number.

Implements AbstractDecklistCardNode.

Here is the caller graph for this function:

◆ setCardProviderId()

void DecklistCardNode::setCardProviderId ( const QString & _providerId)
inlineoverridevirtual
Parameters
_providerIdSet the provider identifier for this card.

Implements AbstractDecklistCardNode.

Here is the caller graph for this function:

◆ setCardSetShortName()

void DecklistCardNode::setCardSetShortName ( const QString & _cardSetShortName)
inlineoverridevirtual
Parameters
_cardSetShortNameSet the short set code.

Implements AbstractDecklistCardNode.

Here is the caller graph for this function:

◆ setName()

void DecklistCardNode::setName ( const QString & _name)
inlineoverridevirtual
Parameters
_nameSet the display name of this card.

Implements AbstractDecklistCardNode.

◆ setNumber()

void DecklistCardNode::setNumber ( int _number)
inlineoverridevirtual
Parameters
_numberSet the quantity of this card.

Implements AbstractDecklistCardNode.

Here is the caller graph for this function:

◆ toCardRef()

CardRef DecklistCardNode::toCardRef ( ) const
inlinenodiscard

Convert this node to a CardRef.

Returns
A CardRef with the card’s name and provider ID, suitable for database lookups or comparison with other card sources.
Here is the caller graph for this function:

Member Data Documentation

◆ cardProviderId

QString DecklistCardNode::cardProviderId
private

External provider identifier (e.g., UUID).

◆ cardSetNumber

QString DecklistCardNode::cardSetNumber
private

Collector number within the set.

◆ cardSetShortName

QString DecklistCardNode::cardSetShortName
private

Short set code (e.g., "NEO").

◆ name

QString DecklistCardNode::name
private

Display name of the card.

◆ number

int DecklistCardNode::number
private

Quantity of this card in the deck.


The documentation for this class was generated from the following files: