1#ifndef COCKATRICE_DECKLIST_NODE_TREE_H
2#define COCKATRICE_DECKLIST_NODE_TREE_H
46 QList<const DecklistCardNode *>
getCardNodes(
const QSet<QString> &restrictToZones = {})
const;
58 void write(QXmlStreamWriter *xml)
const;
65 DecklistCardNode *
addCard(
const QString &cardName,
67 const QString &zoneName,
69 const QString &cardSetName = QString(),
70 const QString &cardSetCollectorNumber = QString(),
71 const QString &cardProviderId = QString(),
72 const bool formatLegal =
true);
73 bool deleteNode(AbstractDecklistNode *node, InnerDecklistNode *rootNode =
nullptr);
80 void forEachCard(
const std::function<
void(InnerDecklistNode *, DecklistCardNode *)> &func)
const;
InnerDecklistNode * getRoot() const
Gets a pointer to the underlying root node. Note: DO NOT call this method unless the object needs to ...
Definition deck_list_node_tree.h:29
bool isEmpty() const
Definition deck_list_node_tree.cpp:30
InnerDecklistNode * root
Root of the deck tree (zones + cards).
Definition deck_list_node_tree.h:12
DecklistNodeTree()
Constructs an empty DecklistNodeTree.
Definition deck_list_node_tree.cpp:8
DecklistCardNode * addCard(const QString &cardName, int amount, const QString &zoneName, int position, const QString &cardSetName=QString(), const QString &cardSetCollectorNumber=QString(), const QString &cardProviderId=QString(), const bool formatLegal=true)
Definition deck_list_node_tree.cpp:112
InnerDecklistNode * getZoneObjFromName(const QString &zoneName) const
Definition deck_list_node_tree.cpp:176
DecklistNodeTree & operator=(const DecklistNodeTree &other)
Copy-assignment operator. Deep copies the tree.
Definition deck_list_node_tree.cpp:16
QString computeDeckHash() const
Computes the deck hash.
Definition deck_list_node_tree.cpp:72
QList< const DecklistCardNode * > getCardNodes(const QSet< QString > &restrictToZones={}) const
Definition deck_list_node_tree.cpp:40
void clear()
Deletes all nodes except the root.
Definition deck_list_node_tree.cpp:35
void readZoneElement(QXmlStreamReader *xml)
Reads a "zone" section of the xml to this tree.
Definition deck_list_node_tree.cpp:105
void forEachCard(const std::function< void(InnerDecklistNode *, DecklistCardNode *)> &func) const
Apply a function to every card in the deck tree. This can modify the cards.
Definition deck_list_node_tree.cpp:160
void write(QXmlStreamWriter *xml) const
Writes the contents of the deck to xml.
Definition deck_list_node_tree.cpp:98
bool deleteNode(AbstractDecklistNode *node, InnerDecklistNode *rootNode=nullptr)
Definition deck_list_node_tree.cpp:127
virtual ~DecklistNodeTree()
Definition deck_list_node_tree.cpp:25
QList< const InnerDecklistNode * > getZoneNodes() const
Definition deck_list_node_tree.cpp:59
Represents a container node in the deck list hierarchy (zones and groupings).
Definition inner_deck_list_node.h:62
Defines the DecklistCardNode class, representing a single card entry in the deck list tree.
Defines the InnerDecklistNode class, which represents structural nodes (zones and groups) in the deck...