Base class for all nodes in the deck list tree. More...
#include <abstract_deck_list_node.h>
Public Member Functions | |
| 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). | |
| InnerDecklistNode * | getParent () const |
| int | depth () const |
| Compute the depth of this node in the tree. | |
| virtual int | height () const =0 |
| Compute the "height" of this node. | |
| virtual bool | compare (AbstractDecklistNode *other) const =0 |
| Compare this node against another for sorting. | |
Core identification properties | |
These methods provide a standard way for the model to retrieve identifying information about a node, regardless of type. | |
| virtual QString | getName () const =0 |
| virtual QString | getCardProviderId () const =0 |
| virtual QString | getCardSetShortName () const =0 |
| virtual QString | getCardCollectorNumber () const =0 |
XML serialization | |
These methods support reading and writing decks from/to Cockatrice deck XML format. | |
| virtual bool | readElement (QXmlStreamReader *xml)=0 |
| virtual void | writeElement (QXmlStreamWriter *xml)=0 |
Protected Attributes | |
| InnerDecklistNode * | parent |
| Pointer to the parent node, or nullptr if this is the root. | |
| DeckSortMethod | sortMethod |
| Current sorting strategy for this node's children. | |
Base class for all nodes in the deck list tree.
This class defines the common interface for every node in the deck representation: zones, groupings, and cards.
Responsibilities:
Lifetime / Ownership:
InnerDecklistNode parents.Extension:
InnerDecklistNode is the concrete subclass representing "folders" in the tree (zones, groups).DecklistCardNode and DecklistModelCardNode represent actual card entries.
|
explicit |
Construct a new AbstractDecklistNode and insert it into its parent.
| _parent | Parent node. May be nullptr if this is the root. |
| position | Optional index at which to insert into the parent's children. If -1, the node is appended to the end. |
If a parent is provided, the constructor automatically appends or inserts this node into the parent’s child list.
|
virtualdefault |
Virtual destructor. Child classes must clean up their resources.
|
pure virtual |
Compare this node against another for sorting.
The semantics of comparison depend on the node type and the current sortMethod.
| other | The node to compare against. |
other. Implemented in AbstractDecklistCardNode, and InnerDecklistNode.
|
nodiscard |
Compute the depth of this node in the tree.
|
nodiscardpure virtual |
Implemented in AbstractDecklistCardNode, DecklistCardNode, DecklistModelCardNode, and InnerDecklistNode.
|
nodiscardpure virtual |
Implemented in AbstractDecklistCardNode, DecklistCardNode, DecklistModelCardNode, and InnerDecklistNode.
|
nodiscardpure virtual |
Implemented in AbstractDecklistCardNode, DecklistCardNode, DecklistModelCardNode, and InnerDecklistNode.
|
nodiscardpure virtual |
Implemented in AbstractDecklistCardNode, DecklistCardNode, DecklistModelCardNode, and InnerDecklistNode.
|
inlinenodiscard |
|
nodiscardpure virtual |
Compute the "height" of this node.
Height is defined by subclasses; it usually represents how many levels of descendants this node spans.
For example:
Implemented in AbstractDecklistCardNode, and InnerDecklistNode.
|
nodiscardpure virtual |
Whether this node is the "deck header" (deck metadata).
This distinguishes special nodes that represent deck-level information rather than cards or groupings.
Implemented in DecklistCardNode, DecklistModelCardNode, and InnerDecklistNode.
|
pure virtual |
Implemented in AbstractDecklistCardNode, and InnerDecklistNode.
|
inlinevirtual |
Set the sort method for this node’s children.
| method | The sorting strategy to use. |
Subclasses may override if they need to apply additional logic.
Reimplemented in InnerDecklistNode.
|
pure virtual |
Implemented in AbstractDecklistCardNode, and InnerDecklistNode.
|
protected |
Pointer to the parent node, or nullptr if this is the root.
Ownership note: The parent is responsible for destroying this node when it is removed from the tree.
|
protected |
Current sorting strategy for this node's children.
Sorting is applied recursively by the DeckListModel when the view requests it.