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

Abstract base class for all deck list nodes that represent actual card entries. More...

#include <abstract_deck_list_card_node.h>

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

Public Member Functions

 AbstractDecklistCardNode (InnerDecklistNode *_parent=nullptr, int position=-1)
 Construct a new AbstractDecklistCardNode.
virtual int getNumber () const =0
virtual void setNumber (int _number)=0
QString getName () const override=0
virtual void setName (const QString &_name)=0
virtual QString getCardProviderId () const override=0
virtual void setCardProviderId (const QString &_cardProviderId)=0
virtual QString getCardSetShortName () const override=0
virtual void setCardSetShortName (const QString &_cardSetShortName)=0
virtual QString getCardCollectorNumber () const override=0
virtual void setCardCollectorNumber (const QString &_cardSetNumber)=0
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.
virtual bool isDeckHeader () const =0
 Whether this node is the "deck header" (deck metadata).
InnerDecklistNodegetParent () const
int depth () const
 Compute the depth of this node in the tree.

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

Abstract base class for all deck list nodes that represent actual card entries.

While AbstractDecklistNode provides the general interface for all nodes in the deck tree (zones, groups, cards), this subclass refines the interface to cover properties specific to cards:

  • Quantity (number of copies).
  • Name.
  • Set code and collector number.
  • Provider ID.

Role in the hierarchy:

Responsibilities:

  • Defines getters/setters for all card-identifying attributes.
  • Provides comparison logic for sorting by name or number.
  • Implements XML serialization for saving/loading deck files.

Ownership:

Constructor & Destructor Documentation

◆ AbstractDecklistCardNode()

AbstractDecklistCardNode::AbstractDecklistCardNode ( InnerDecklistNode * _parent = nullptr,
int position = -1 )
inlineexplicit

Construct a new AbstractDecklistCardNode.

Parameters
_parentOptional parent node. If provided, this node will be inserted into the parent’s children list.
positionIndex at which to insert into parent’s children. If -1, the node is appended to the end.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ compare()

bool AbstractDecklistCardNode::compare ( AbstractDecklistNode * other) const
overridevirtual

Compare this card node against another for sorting.

Uses the node’s current sortMethod to determine how to compare:

  • ByName: Alphabetical comparison.
  • ByNumber: Numerical comparison.
  • Default: Falls back to implementation-defined behavior.
Parameters
otherAnother node to compare against.
Returns
true if this node should sort before other.

Implements AbstractDecklistNode.

Here is the call graph for this function:

◆ compareName()

bool AbstractDecklistCardNode::compareName ( AbstractDecklistNode * other) const

Compare this card node to another by name.

Parameters
otherNode to compare against.
Returns
true if this node’s name comes before other’s name.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compareNumber()

bool AbstractDecklistCardNode::compareNumber ( AbstractDecklistNode * other) const

Compare this card node to another by quantity.

Parameters
otherNode to compare against.
Returns
true if this node’s number < other’s number.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCardCollectorNumber()

virtual QString AbstractDecklistCardNode::getCardCollectorNumber ( ) const
nodiscardoverridepure virtual
Returns
The collector number of the card within its set.

Implements AbstractDecklistNode.

Implemented in DecklistCardNode, and DecklistModelCardNode.

Here is the caller graph for this function:

◆ getCardProviderId()

virtual QString AbstractDecklistCardNode::getCardProviderId ( ) const
nodiscardoverridepure virtual
Returns
The provider identifier for this card (e.g., UUID).

Implements AbstractDecklistNode.

Implemented in DecklistCardNode, and DecklistModelCardNode.

Here is the caller graph for this function:

◆ getCardSetShortName()

virtual QString AbstractDecklistCardNode::getCardSetShortName ( ) const
nodiscardoverridepure virtual
Returns
The abbreviated set code (e.g., "NEO").

Implements AbstractDecklistNode.

Implemented in DecklistCardNode, and DecklistModelCardNode.

Here is the caller graph for this function:

◆ getName()

QString AbstractDecklistCardNode::getName ( ) const
nodiscardoverridepure virtual
Returns
The display name of this card.

Implements AbstractDecklistNode.

Implemented in DecklistCardNode, and DecklistModelCardNode.

Here is the caller graph for this function:

◆ getNumber()

virtual int AbstractDecklistCardNode::getNumber ( ) const
nodiscardpure virtual
Returns
The number of copies of this card in the deck.

Implemented in DecklistCardNode, and DecklistModelCardNode.

Here is the caller graph for this function:

◆ height()

int AbstractDecklistCardNode::height ( ) const
inlinenodiscardoverridevirtual

Get the height of this node in the tree.

For card nodes, height is always 0 because they are leaf nodes and do not contain children.

Returns
0

Implements AbstractDecklistNode.

◆ readElement()

bool AbstractDecklistCardNode::readElement ( QXmlStreamReader * xml)
overridevirtual

Deserialize this node’s properties from XML.

Parameters
xmlQXmlStreamReader positioned at the element.
Returns
true if parsing succeeded.

This supports loading deck files from Cockatrice’s XML format.

Implements AbstractDecklistNode.

◆ setCardCollectorNumber()

virtual void AbstractDecklistCardNode::setCardCollectorNumber ( const QString & _cardSetNumber)
pure virtual
Parameters
_cardSetNumberSet the collector number.

Implemented in DecklistCardNode, and DecklistModelCardNode.

◆ setCardProviderId()

virtual void AbstractDecklistCardNode::setCardProviderId ( const QString & _cardProviderId)
pure virtual
Parameters
_cardProviderIdSet the provider identifier for this card.

Implemented in DecklistCardNode, and DecklistModelCardNode.

◆ setCardSetShortName()

virtual void AbstractDecklistCardNode::setCardSetShortName ( const QString & _cardSetShortName)
pure virtual
Parameters
_cardSetShortNameSet the abbreviated set code.

Implemented in DecklistCardNode, and DecklistModelCardNode.

◆ setName()

virtual void AbstractDecklistCardNode::setName ( const QString & _name)
pure virtual
Parameters
_nameSet the display name of this card.

Implemented in DecklistCardNode, and DecklistModelCardNode.

◆ setNumber()

virtual void AbstractDecklistCardNode::setNumber ( int _number)
pure virtual
Parameters
_numberSet the number of copies of this card.

Implemented in DecklistCardNode, and DecklistModelCardNode.

◆ writeElement()

void AbstractDecklistCardNode::writeElement ( QXmlStreamWriter * xml)
overridevirtual

Serialize this node’s properties to XML.

Parameters
xmlWriter to append this node’s XML element.

This supports saving deck files to Cockatrice’s XML format.

Implements AbstractDecklistNode.

Here is the call graph for this function:

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