Cockatrice 2026-01-14-Development-2.11.0-beta.46
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
DecklistNodeTree Class Reference

#include <deck_list_node_tree.h>

Collaboration diagram for DecklistNodeTree:
[legend]

Public Member Functions

 DecklistNodeTree ()
 Constructs an empty DecklistNodeTree.
 DecklistNodeTree (const DecklistNodeTree &other)
 Copy constructor. Deep copies the tree.
DecklistNodeTreeoperator= (const DecklistNodeTree &other)
 Copy-assignment operator. Deep copies the tree.
virtual ~DecklistNodeTree ()
InnerDecklistNodegetRoot () const
 Gets a pointer to the underlying root node. Note: DO NOT call this method unless the object needs to have access to the underlying model. For now, only the DeckListModel should be calling this.
bool isEmpty () const
void clear ()
 Deletes all nodes except the root.
QList< const DecklistCardNode * > getCardNodes (const QSet< QString > &restrictToZones={}) const
QList< const InnerDecklistNode * > getZoneNodes () const
QString computeDeckHash () const
 Computes the deck hash.
void write (QXmlStreamWriter *xml) const
 Writes the contents of the deck to xml.
void readZoneElement (QXmlStreamReader *xml)
 Reads a "zone" section of the xml to this tree.
DecklistCardNodeaddCard (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)
bool deleteNode (AbstractDecklistNode *node, InnerDecklistNode *rootNode=nullptr)
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.

Private Member Functions

InnerDecklistNodegetZoneObjFromName (const QString &zoneName) const

Private Attributes

InnerDecklistNoderoot
 Root of the deck tree (zones + cards).

Constructor & Destructor Documentation

◆ DecklistNodeTree() [1/2]

DecklistNodeTree::DecklistNodeTree ( )
explicit

Constructs an empty DecklistNodeTree.

Here is the caller graph for this function:

◆ DecklistNodeTree() [2/2]

DecklistNodeTree::DecklistNodeTree ( const DecklistNodeTree & other)
explicit

Copy constructor. Deep copies the tree.

Here is the call graph for this function:

◆ ~DecklistNodeTree()

DecklistNodeTree::~DecklistNodeTree ( )
virtual

Member Function Documentation

◆ addCard()

DecklistCardNode * DecklistNodeTree::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 )
Here is the call graph for this function:

◆ clear()

void DecklistNodeTree::clear ( )

Deletes all nodes except the root.

◆ computeDeckHash()

QString DecklistNodeTree::computeDeckHash ( ) const

Computes the deck hash.

Here is the call graph for this function:

◆ deleteNode()

bool DecklistNodeTree::deleteNode ( AbstractDecklistNode * node,
InnerDecklistNode * rootNode = nullptr )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ forEachCard()

void DecklistNodeTree::forEachCard ( const std::function< void(InnerDecklistNode *, DecklistCardNode *)> & func) const

Apply a function to every card in the deck tree. This can modify the cards.

Parameters
funcFunction taking (zone node, card node).

◆ getCardNodes()

QList< const DecklistCardNode * > DecklistNodeTree::getCardNodes ( const QSet< QString > & restrictToZones = {}) const

Gets all card nodes in the tree

Parameters
restrictToZonesOnly get the nodes in these zones
Returns
A QList containing all the card nodes in the zone.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRoot()

InnerDecklistNode * DecklistNodeTree::getRoot ( ) const
inline

Gets a pointer to the underlying root node. Note: DO NOT call this method unless the object needs to have access to the underlying model. For now, only the DeckListModel should be calling this.

◆ getZoneNodes()

QList< const InnerDecklistNode * > DecklistNodeTree::getZoneNodes ( ) const
Here is the caller graph for this function:

◆ getZoneObjFromName()

InnerDecklistNode * DecklistNodeTree::getZoneObjFromName ( const QString & zoneName) const
private

Gets the InnerDecklistNode that is the root node for the given zone, creating a new node if it doesn't exist.

Here is the caller graph for this function:

◆ isEmpty()

bool DecklistNodeTree::isEmpty ( ) const

◆ operator=()

DecklistNodeTree & DecklistNodeTree::operator= ( const DecklistNodeTree & other)

Copy-assignment operator. Deep copies the tree.

Here is the call graph for this function:

◆ readZoneElement()

void DecklistNodeTree::readZoneElement ( QXmlStreamReader * xml)

Reads a "zone" section of the xml to this tree.

Here is the call graph for this function:

◆ write()

void DecklistNodeTree::write ( QXmlStreamWriter * xml) const

Writes the contents of the deck to xml.

Member Data Documentation

◆ root

InnerDecklistNode* DecklistNodeTree::root
private

Root of the deck tree (zones + cards).


The documentation for this class was generated from the following files: