Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
abstract_deck_list_node.h
Go to the documentation of this file.
1
16
17#ifndef COCKATRICE_ABSTRACT_DECK_LIST_NODE_H
18#define COCKATRICE_ABSTRACT_DECK_LIST_NODE_H
19
20#include <QString>
21
22class QXmlStreamWriter;
23
43
45
75{
76protected:
84
92
93public:
104 explicit AbstractDecklistNode(InnerDecklistNode *_parent = nullptr, int position = -1);
105
107 virtual ~AbstractDecklistNode() = default;
108
115 virtual void setSortMethod(DeckSortMethod method)
116 {
117 sortMethod = method;
118 }
119
127 [[nodiscard]] virtual QString getName() const = 0;
128 [[nodiscard]] virtual QString getCardProviderId() const = 0;
129 [[nodiscard]] virtual QString getCardSetShortName() const = 0;
130 [[nodiscard]] virtual QString getCardCollectorNumber() const = 0;
132
139 [[nodiscard]] virtual bool isDeckHeader() const = 0;
140
142 [[nodiscard]] InnerDecklistNode *getParent() const
143 {
144 return parent;
145 }
146
149 {
150 parent = newParent;
151 }
152
157 [[nodiscard]] int depth() const;
158
169 [[nodiscard]] virtual int height() const = 0;
170
180 virtual bool compare(AbstractDecklistNode *other) const = 0;
181
188 virtual void writeElement(QXmlStreamWriter *xml) = 0;
190};
191
192#endif // COCKATRICE_ABSTRACT_DECK_LIST_NODE_H
@ ByNumber
Sort by numeric properties (e.g. collector number).
Definition abstract_deck_list_node.h:39
@ Default
Leave in insertion order.
Definition abstract_deck_list_node.h:41
@ ByName
Sort by card name (locale-aware comparison).
Definition abstract_deck_list_node.h:40
InnerDecklistNode * getParent() const
Definition abstract_deck_list_node.h:142
virtual QString getCardSetShortName() const =0
virtual ~AbstractDecklistNode()=default
Virtual destructor. Child classes must clean up their resources.
virtual bool compare(AbstractDecklistNode *other) const =0
Compare this node against another for sorting.
InnerDecklistNode * parent
Pointer to the parent node, or nullptr if this is the root.
Definition abstract_deck_list_node.h:83
virtual void setSortMethod(DeckSortMethod method)
Set the sort method for this node’s children.
Definition abstract_deck_list_node.h:115
AbstractDecklistNode(InnerDecklistNode *_parent=nullptr, int position=-1)
Construct a new AbstractDecklistNode and insert it into its parent.
Definition abstract_deck_list_node.cpp:5
int depth() const
Compute the depth of this node in the tree.
Definition abstract_deck_list_node.cpp:17
DeckSortMethod sortMethod
Current sorting strategy for this node's children.
Definition abstract_deck_list_node.h:91
virtual bool isDeckHeader() const =0
Whether this node is the "deck header" (deck metadata).
virtual QString getName() const =0
virtual void writeElement(QXmlStreamWriter *xml)=0
virtual QString getCardCollectorNumber() const =0
virtual int height() const =0
Compute the "height" of this node.
virtual QString getCardProviderId() const =0
void setParent(InnerDecklistNode *newParent)
Definition abstract_deck_list_node.h:148
Represents a container node in the deck list hierarchy (zones and groupings).
Definition inner_deck_list_node.h:73
DeckSortMethod
Defines the different sort strategies a node may use to order its children.
Definition abstract_deck_list_node.h:38