![]() |
Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
|
Represents a container node in the deck list hierarchy (zones and groupings). More...
#include <inner_deck_list_node.h>
Public Member Functions | |
| InnerDecklistNode (QString _name=QString(), InnerDecklistNode *_parent=nullptr, int position=-1) | |
| Construct a new InnerDecklistNode. | |
| InnerDecklistNode (InnerDecklistNode *other, InnerDecklistNode *_parent=nullptr) | |
| Copy constructor with parent reassignment. | |
| ~InnerDecklistNode () override | |
| Destructor. Recursively deletes all child nodes. | |
| void | setSortMethod (DeckSortMethod method) override |
| Set the sorting method for this node and all children. | |
| QString | getName () const override |
| void | setName (const QString &_name) |
| virtual QString | getVisibleName () const |
| Get this node’s display-friendly name. | |
| QString | getCardProviderId () const override |
| QString | getCardSetShortName () const override |
| QString | getCardCollectorNumber () const override |
| bool | isDeckHeader () const override |
| void | clearTree () |
| Delete all children of this node, recursively. | |
| AbstractDecklistNode * | findChild (const QString &_name) |
| Find a direct child node by name. | |
| AbstractDecklistNode * | findCardChildByNameProviderIdAndNumber (const QString &_name, const QString &_providerId="", const QString &_cardNumber="") |
| Find a child card node by name, provider ID, and collector number. | |
| int | height () const override |
| Compute the height of this node. | |
| int | recursiveCount (bool countTotalCards=false) const |
| Count cards recursively under this node. | |
| bool | compare (AbstractDecklistNode *other) const override |
| Compare this node against another for sorting. | |
| bool | compareNumber (AbstractDecklistNode *other) const |
| Compare this node against another for sorting. | |
| bool | compareName (AbstractDecklistNode *other) const |
| Compare this node against another for sorting. | |
| QVector< QPair< int, int > > | sort (Qt::SortOrder order=Qt::AscendingOrder) |
| Sort this node’s children recursively. | |
| int | readElement (QXmlStreamReader *xml, int limit) |
| Deserialize this node and its children from XML. | |
| void | writeElement (QXmlStreamWriter *xml) override |
| Serialize this node and its children 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. | |
| InnerDecklistNode * | getParent () const |
| void | setParent (InnerDecklistNode *newParent) |
| int | depth () const |
| Compute the depth of this node in the tree. | |
Static Public Member Functions | |
| static QString | visibleNameFromName (const QString &_name) |
| Translate an internal name into a user-visible name. | |
| static const QList< QString > & | boardZoneNames () |
| The standard board zone names, in display order. | |
Private Member Functions | |
| QVector< QPair< int, AbstractDecklistNode * > > | indexedSnapshot () const |
| Snapshots the current children as (old index, node) pairs. | |
| QVector< QPair< int, int > > | applySortedOrder (const QVector< QPair< int, AbstractDecklistNode * > > &sorted) |
Replaces this node's children with sorted and maps old indexes to new ones. | |
| int | readCardElement (QXmlStreamReader *xml, int remainingBudget) |
| Reads a single card element and appends it to this node. | |
Private Attributes | |
| QString | name |
| Internal identifier for this node (zone or group name). | |
Additional Inherited Members | |
| Protected Attributes inherited from AbstractDecklistNode | |
| InnerDecklistNode * | parent |
| Pointer to the parent node, or nullptr if this is the root. | |
| DeckSortMethod | sortMethod |
| Current sorting strategy for this node's children. | |
Represents a container node in the deck list hierarchy (zones and groupings).
Unlike DecklistCardNode, which holds leaf card data, this class manages collections of child nodes, which may themselves be InnerDecklistNode or DecklistCardNode objects.
|
inlineexplicit |
Construct a new InnerDecklistNode.
| _name | Internal name (e.g., "main", "side", "tokens", or group label). |
| _parent | Parent node (may be nullptr for the root). |
| position | Optional index for insertion into parent. -1 = append. |
|
explicit |
Copy constructor with parent reassignment.
| other | Node to copy from (deep copy of children). |
| _parent | Parent node for the copy. |
|
override |
Destructor. Recursively deletes all child nodes.
|
private |
Replaces this node's children with sorted and maps old indexes to new ones.
|
static |
The standard board zone names, in display order.
| void InnerDecklistNode::clearTree | ( | ) |
Delete all children of this node, recursively.
|
overridevirtual |
Compare this node against another for sorting.
Uses current sortMethod to determine the comparison.
| other | Node to compare. |
other. Implements AbstractDecklistNode.
| bool InnerDecklistNode::compareName | ( | AbstractDecklistNode * | other | ) | const |
Compare this node against another for sorting.
Uses current sortMethod to determine the comparison.
| other | Node to compare. |
other. | bool InnerDecklistNode::compareNumber | ( | AbstractDecklistNode * | other | ) | const |
Compare this node against another for sorting.
Uses current sortMethod to determine the comparison.
| other | Node to compare. |
other. | AbstractDecklistNode * InnerDecklistNode::findCardChildByNameProviderIdAndNumber | ( | const QString & | _name, |
| const QString & | _providerId = "", | ||
| const QString & | _cardNumber = "" ) |
Find a child card node by name, provider ID, and collector number.
Searches immediate children only.
| _name | Card name to match. |
| _providerId | Optional provider ID to match. |
| _cardNumber | Optional collector number to match. |
| AbstractDecklistNode * InnerDecklistNode::findChild | ( | const QString & | _name | ) |
Find a direct child node by name.
| _name | Name to match. |
|
inlinenodiscardoverridevirtual |
Implements AbstractDecklistNode.
|
inlinenodiscardoverridevirtual |
Implements AbstractDecklistNode.
|
inlinenodiscardoverridevirtual |
Implements AbstractDecklistNode.
|
inlinenodiscardoverridevirtual |
Implements AbstractDecklistNode.
|
nodiscardvirtual |
Get this node’s display-friendly name.
|
nodiscardoverridevirtual |
Compute the height of this node.
Implements AbstractDecklistNode.
|
private |
Snapshots the current children as (old index, node) pairs.
|
inlinenodiscardoverridevirtual |
Implements AbstractDecklistNode.
|
private |
Reads a single card element and appends it to this node.
The card's quantity is capped at remainingBudget so a malicious or oversized deck file cannot push the total card count past the deck size limit.
| int InnerDecklistNode::readElement | ( | QXmlStreamReader * | xml, |
| int | limit ) |
Deserialize this node and its children from XML.
| xml | Reader positioned at this element. |
| limit | The maximum amount of cards to read |
|
nodiscard |
Count cards recursively under this node.
| countTotalCards | If true, sums up quantities of cards. If false, counts unique card nodes. |
|
inline |
| _name | Set the internal name of this node. |
|
overridevirtual |
Set the sorting method for this node and all children.
| method | Sort method to apply recursively. |
Reimplemented from AbstractDecklistNode.
| QVector< QPair< int, int > > InnerDecklistNode::sort | ( | Qt::SortOrder | order = Qt::AscendingOrder | ) |
Sort this node’s children recursively.
| order | Ascending or descending. |
|
static |
Translate an internal name into a user-visible name.
For example, the internal string "main" is presented as "Mainboard" in the UI.
| _name | Internal identifier. |
|
overridevirtual |
Serialize this node and its children to XML.
| xml | Writer to append elements to. |
Implements AbstractDecklistNode.
|
private |
Internal identifier for this node (zone or group name).