1#ifndef COCKATRICE_DECKLIST_NODE_TREE_H
2#define COCKATRICE_DECKLIST_NODE_TREE_H
47 QList<const DecklistCardNode *>
getCardNodes(
const QSet<QString> &restrictToZones = {})
const;
54 QList<const InnerDecklistNode *>
getZoneNodes(
const QSet<QString> &restrictToZones = {})
const;
64 void write(QXmlStreamWriter *xml)
const;
71 DecklistCardNode *
addCard(
const QString &cardName,
73 const QString &zoneName,
75 const QString &cardSetName = QString(),
76 const QString &cardSetCollectorNumber = QString(),
77 const QString &cardProviderId = QString(),
78 const bool formatLegal =
true);
79 bool deleteNode(AbstractDecklistNode *node, InnerDecklistNode *rootNode =
nullptr);
91 InnerDecklistNode *
addCustomZone(
const QString &boardZoneName,
const QString &zoneName);
97 bool renameCustomZone(
const QString &oldZoneName,
const QString &newZoneName);
103 bool moveCustomZone(
const QString &zoneName,
const QString &newBoardZoneName);
116 QList<const InnerDecklistNode *>
getCustomZones(
const QString &boardZoneName)
const;
124 void forEachCard(
const std::function<
void(InnerDecklistNode *, DecklistCardNode *)> &func)
const;
129 InnerDecklistNode *
findBoardZone(
const QString &boardZoneName)
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:30
bool hasZoneName(const QString &zoneName) const
Definition deck_list_node_tree.cpp:336
int totalCards
Definition deck_list_node_tree.h:13
InnerDecklistNode * findOrCreateBoardZone(const QString &boardZoneName)
Definition deck_list_node_tree.cpp:221
bool isEmpty() const
Definition deck_list_node_tree.cpp:32
bool moveCustomZone(const QString &zoneName, const QString &newBoardZoneName)
Moves a custom zone (and all its cards) to another board zone.
Definition deck_list_node_tree.cpp:262
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:10
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:121
InnerDecklistNode * getZoneObjFromName(const QString &zoneName) const
Definition deck_list_node_tree.cpp:200
DecklistNodeTree & operator=(const DecklistNodeTree &other)
Copy-assignment operator. Deep copies the tree.
Definition deck_list_node_tree.cpp:18
QList< const InnerDecklistNode * > getCustomZones(const QString &boardZoneName) const
Gets all custom zones nested under a board zone.
Definition deck_list_node_tree.cpp:299
QString computeDeckHash() const
Computes the deck hash.
Definition deck_list_node_tree.cpp:81
QList< const DecklistCardNode * > getCardNodes(const QSet< QString > &restrictToZones={}) const
Definition deck_list_node_tree.cpp:42
void clear()
Deletes all nodes except the root.
Definition deck_list_node_tree.cpp:37
bool renameCustomZone(const QString &oldZoneName, const QString &newZoneName)
Renames a custom zone.
Definition deck_list_node_tree.cpp:247
InnerDecklistNode * addCustomZone(const QString &boardZoneName, const QString &zoneName)
Creates a new custom zone nested under a board zone.
Definition deck_list_node_tree.cpp:232
void readZoneElement(QXmlStreamReader *xml)
Reads a "zone" section of the xml to this tree.
Definition deck_list_node_tree.cpp:114
void forEachCard(const std::function< void(InnerDecklistNode *, DecklistCardNode *)> &func) const
Applies a function to every card in the deck tree. This can modify the cards.
Definition deck_list_node_tree.cpp:172
void write(QXmlStreamWriter *xml) const
Writes the contents of the deck to xml.
Definition deck_list_node_tree.cpp:107
bool deleteNode(AbstractDecklistNode *node, InnerDecklistNode *rootNode=nullptr)
Definition deck_list_node_tree.cpp:138
virtual ~DecklistNodeTree()
Definition deck_list_node_tree.cpp:27
QList< const InnerDecklistNode * > getZoneNodes(const QSet< QString > &restrictToZones={}) const
Definition deck_list_node_tree.cpp:64
InnerDecklistNode * findBoardZone(const QString &boardZoneName) const
Definition deck_list_node_tree.cpp:216
InnerDecklistNode * findCustomZoneByName(const QString &zoneName) const
Definition deck_list_node_tree.cpp:317
bool removeCustomZone(const QString &zoneName)
Removes a custom zone and all its cards.
Definition deck_list_node_tree.cpp:285
Represents a container node in the deck list hierarchy (zones and groupings).
Definition inner_deck_list_node.h:64
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...