Abstract base class for all deck list nodes that represent actual card entries.
More...
#include <abstract_deck_list_card_node.h>
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:
- Leaf-oriented abstract class; no children of its own.
- Serves as the base for concrete implementations:
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:
◆ AbstractDecklistCardNode()
| AbstractDecklistCardNode::AbstractDecklistCardNode |
( |
InnerDecklistNode * | _parent = nullptr, |
|
|
int | position = -1 ) |
|
inlineexplicit |
Construct a new AbstractDecklistCardNode.
- Parameters
-
| _parent | Optional parent node. If provided, this node will be inserted into the parent’s children list. |
| position | Index at which to insert into parent’s children. If -1, the node is appended to the end. |
◆ compare()
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
-
| other | Another node to compare against. |
- Returns
- true if this node should sort before
other.
Implements AbstractDecklistNode.
◆ compareName()
Compare this card node to another by name.
- Parameters
-
| other | Node to compare against. |
- Returns
- true if this node’s name comes before other’s name.
◆ compareNumber()
Compare this card node to another by quantity.
- Parameters
-
| other | Node to compare against. |
- Returns
- true if this node’s number < other’s number.
◆ getCardCollectorNumber()
| virtual QString AbstractDecklistCardNode::getCardCollectorNumber |
( |
| ) |
const |
|
nodiscardoverridepure virtual |
◆ getCardProviderId()
| virtual QString AbstractDecklistCardNode::getCardProviderId |
( |
| ) |
const |
|
nodiscardoverridepure virtual |
◆ getCardSetShortName()
| virtual QString AbstractDecklistCardNode::getCardSetShortName |
( |
| ) |
const |
|
nodiscardoverridepure virtual |
◆ getName()
| QString AbstractDecklistCardNode::getName |
( |
| ) |
const |
|
nodiscardoverridepure virtual |
◆ getNumber()
| virtual int AbstractDecklistCardNode::getNumber |
( |
| ) |
const |
|
nodiscardpure virtual |
◆ 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
-
| xml | QXmlStreamReader 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 |
◆ setCardProviderId()
| virtual void AbstractDecklistCardNode::setCardProviderId |
( |
const QString & | _cardProviderId | ) |
|
|
pure virtual |
◆ setCardSetShortName()
| virtual void AbstractDecklistCardNode::setCardSetShortName |
( |
const QString & | _cardSetShortName | ) |
|
|
pure virtual |
◆ setName()
| virtual void AbstractDecklistCardNode::setName |
( |
const QString & | _name | ) |
|
|
pure virtual |
◆ setNumber()
| virtual void AbstractDecklistCardNode::setNumber |
( |
int | _number | ) |
|
|
pure virtual |
◆ writeElement()
| void AbstractDecklistCardNode::writeElement |
( |
QXmlStreamWriter * | xml | ) |
|
|
overridevirtual |
Serialize this node’s properties to XML.
- Parameters
-
| xml | Writer to append this node’s XML element. |
This supports saving deck files to Cockatrice’s XML format.
Implements AbstractDecklistNode.
The documentation for this class was generated from the following files: