16#ifndef COCKATRICE_INNER_DECK_LIST_NODE_H
17#define COCKATRICE_INNER_DECK_LIST_NODE_H
25#include <qnamespace.h>
28class QXmlStreamReader;
31#define DECK_ZONE_MAIN "main"
33#define DECK_ZONE_SIDE "side"
35#define DECK_ZONE_TOKENS "tokens"
37#define DECK_ZONE_MAYBEBOARD "maybeboard"
108 [[nodiscard]] QString
getName()
const override
190 const QString &_providerId =
"",
191 const QString &_cardNumber =
"");
197 [[nodiscard]]
int height()
const override;
205 [[nodiscard]]
int recursiveCount(
bool countTotalCards =
false)
const;
230 QVector<QPair<int, int>>
sort(Qt::SortOrder order = Qt::AscendingOrder);
243 QVector<QPair<int, int>>
applySortedOrder(
const QVector<QPair<int, AbstractDecklistNode *>> &sorted);
Defines the AbstractDecklistNode base class used as the foundation for all nodes in the deck list tre...
Base class for all nodes in the deck list tree.
Definition abstract_deck_list_node.h:75
AbstractDecklistNode(InnerDecklistNode *_parent=nullptr, int position=-1)
Construct a new AbstractDecklistNode and insert it into its parent.
Definition abstract_deck_list_node.cpp:5
Represents a container node in the deck list hierarchy (zones and groupings).
Definition inner_deck_list_node.h:73
int readCardElement(QXmlStreamReader *xml, int remainingBudget)
Reads a single card element and appends it to this node.
Definition inner_deck_list_node.cpp:166
static QString visibleNameFromName(const QString &_name)
Translate an internal name into a user-visible name.
Definition inner_deck_list_node.cpp:35
void clearTree()
Delete all children of this node, recursively.
Definition inner_deck_list_node.cpp:70
QString getCardCollectorNumber() const override
Definition inner_deck_list_node.h:156
bool compareNumber(AbstractDecklistNode *other) const
Compare this node against another for sorting.
Definition inner_deck_list_node.cpp:144
int readElement(QXmlStreamReader *xml, int limit)
Deserialize this node and its children from XML.
Definition inner_deck_list_node.cpp:176
int recursiveCount(bool countTotalCards=false) const
Count cards recursively under this node.
Definition inner_deck_list_node.cpp:115
AbstractDecklistNode * findCardChildByNameProviderIdAndNumber(const QString &_name, const QString &_providerId="", const QString &_cardNumber="")
Find a child card node by name, provider ID, and collector number.
Definition inner_deck_list_node.cpp:88
virtual QString getVisibleName() const
Get this node’s display-friendly name.
Definition inner_deck_list_node.cpp:65
bool compareName(AbstractDecklistNode *other) const
Compare this node against another for sorting.
Definition inner_deck_list_node.cpp:156
QString getCardProviderId() const override
Definition inner_deck_list_node.h:144
void writeElement(QXmlStreamWriter *xml) override
Serialize this node and its children to XML.
Definition inner_deck_list_node.cpp:197
QString getCardSetShortName() const override
Definition inner_deck_list_node.h:150
void setName(const QString &_name)
Definition inner_deck_list_node.h:114
QVector< QPair< int, AbstractDecklistNode * > > indexedSnapshot() const
Snapshots the current children as (old index, node) pairs.
Definition inner_deck_list_node.cpp:207
bool isDeckHeader() const override
Definition inner_deck_list_node.h:162
int height() const override
Compute the height of this node.
Definition inner_deck_list_node.cpp:107
QString name
Internal identifier for this node (zone or group name).
Definition inner_deck_list_node.h:74
InnerDecklistNode(QString _name=QString(), InnerDecklistNode *_parent=nullptr, int position=-1)
Construct a new InnerDecklistNode.
Definition inner_deck_list_node.h:84
static const QList< QString > & boardZoneNames()
The standard board zone names, in display order.
Definition inner_deck_list_node.cpp:58
QString getName() const override
Definition inner_deck_list_node.h:108
QVector< QPair< int, int > > sort(Qt::SortOrder order=Qt::AscendingOrder)
Sort this node’s children recursively.
Definition inner_deck_list_node.cpp:228
bool compare(AbstractDecklistNode *other) const override
Compare this node against another for sorting.
Definition inner_deck_list_node.cpp:132
AbstractDecklistNode * findChild(const QString &_name)
Find a direct child node by name.
Definition inner_deck_list_node.cpp:78
void setSortMethod(DeckSortMethod method) override
Set the sorting method for this node and all children.
Definition inner_deck_list_node.cpp:50
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.
Definition inner_deck_list_node.cpp:217
Definition remote_connection_controller.h:20
DeckSortMethod
Defines the different sort strategies a node may use to order its children.
Definition abstract_deck_list_node.h:38