Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform 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 <QtCore/QXmlStreamWriter>
21
41
43
73{
74protected:
82
90
91public:
102 explicit AbstractDecklistNode(InnerDecklistNode *_parent = nullptr, int position = -1);
103
105 virtual ~AbstractDecklistNode() = default;
106
113 virtual void setSortMethod(DeckSortMethod method)
114 {
115 sortMethod = method;
116 }
117
125 [[nodiscard]] virtual QString getName() const = 0;
126 [[nodiscard]] virtual QString getCardProviderId() const = 0;
127 [[nodiscard]] virtual QString getCardSetShortName() const = 0;
128 [[nodiscard]] virtual QString getCardCollectorNumber() const = 0;
130
137 [[nodiscard]] virtual bool isDeckHeader() const = 0;
138
140 [[nodiscard]] InnerDecklistNode *getParent() const
141 {
142 return parent;
143 }
144
149 [[nodiscard]] int depth() const;
150
161 [[nodiscard]] virtual int height() const = 0;
162
172 virtual bool compare(AbstractDecklistNode *other) const = 0;
173
180 virtual bool readElement(QXmlStreamReader *xml) = 0;
181 virtual void writeElement(QXmlStreamWriter *xml) = 0;
183};
184
185#endif // COCKATRICE_ABSTRACT_DECK_LIST_NODE_H
@ ByNumber
Sort by numeric properties (e.g. collector number).
Definition abstract_deck_list_node.h:37
@ Default
Leave in insertion order.
Definition abstract_deck_list_node.h:39
@ ByName
Sort by card name (locale-aware comparison).
Definition abstract_deck_list_node.h:38
InnerDecklistNode * getParent() const
Definition abstract_deck_list_node.h:140
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:81
virtual void setSortMethod(DeckSortMethod method)
Set the sort method for this node’s children.
Definition abstract_deck_list_node.h:113
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:89
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 bool readElement(QXmlStreamReader *xml)=0
virtual QString getCardCollectorNumber() const =0
virtual int height() const =0
Compute the "height" of this node.
virtual QString getCardProviderId() const =0
Represents a container node in the deck list hierarchy (zones and groupings).
Definition inner_deck_list_node.h:62
DeckSortMethod
Defines the different sort strategies a node may use to order its children.
Definition abstract_deck_list_node.h:36