Represents a complete deck, including metadata, zones, cards, and sideboard plans.
More...
|
| | DeckList () |
| | Construct an empty deck.
|
| | DeckList (const QString &nativeString) |
| | Construct from a serialized native-format string.
|
| | DeckList (const Metadata &metadata, const DecklistNodeTree &tree, const QMap< QString, SideboardPlan > &sideboardPlans={}) |
| | Construct from components.
|
| DecklistNodeTree * | getTree () |
| | Gets a pointer to the underlying node tree. 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 | isBlankDeck () const |
| void | forEachCard (const std::function< void(InnerDecklistNode *, DecklistCardNode *)> &func) const |
| | Apply a function to every card in the deck tree.
|
| DeckListMemento | createMemento (const QString &reason) const |
| void | restoreMemento (const DeckListMemento &m) |
| void | setName (const QString &_name=QString()) |
| void | setComments (const QString &_comments=QString()) |
| void | setTags (const QStringList &_tags=QStringList()) |
| void | addTag (const QString &_tag) |
| void | clearTags () |
| void | setBannerCard (const CardRef &_bannerCard={}) |
| void | setLastLoadedTimestamp (const QString &_lastLoadedTimestamp=QString()) |
| void | setGameFormat (const QString &_gameFormat=QString()) |
The individual metadata getters still exist for backwards compatibility.
|
| const Metadata & | getMetadata () const |
| QString | getName () const |
| QString | getComments () const |
| QStringList | getTags () const |
| CardRef | getBannerCard () const |
| QString | getLastLoadedTimestamp () const |
| QString | getGameFormat () const |
| QList< MoveCard_ToZone > | getCurrentSideboardPlan () const |
| void | setCurrentSideboardPlan (const QList< MoveCard_ToZone > &plan) |
| const QMap< QString, SideboardPlan > & | getSideboardPlans () const |
| bool | readElement (QXmlStreamReader *xml) |
| void | write (QXmlStreamWriter *xml) const |
| bool | loadFromXml (QXmlStreamReader *xml) |
| bool | loadFromString_Native (const QString &nativeString) |
| QString | writeToString_Native () const |
| bool | loadFromFile_Native (QIODevice *device) |
| bool | saveToFile_Native (QIODevice *device) |
| bool | loadFromStream_Plain (QTextStream &stream, bool preserveMetadata) |
| bool | loadFromFile_Plain (QIODevice *device) |
| bool | saveToStream_Plain (QTextStream &stream, bool prefixSideboardCards, bool slashTappedOutSplitCards) |
| bool | saveToFile_Plain (QIODevice *device, bool prefixSideboardCards=true, bool slashTappedOutSplitCards=false) |
| QString | writeToString_Plain (bool prefixSideboardCards=true, bool slashTappedOutSplitCards=false) |
| void | cleanList (bool preserveMetadata=false) |
| bool | isEmpty () const |
| QStringList | getCardList () const |
| QList< CardRef > | getCardRefList () const |
| QList< const DecklistCardNode * > | getCardNodes (const QSet< QString > &restrictToZones={}) const |
| QList< const InnerDecklistNode * > | getZoneNodes () const |
| int | getSideboardSize () const |
| DecklistCardNode * | addCard (const QString &cardName, const QString &zoneName, int position=-1, const QString &cardSetName=QString(), const QString &cardSetCollectorNumber=QString(), const QString &cardProviderId=QString(), const bool formatLegal=true) |
| QString | getDeckHash () const |
| void | refreshDeckHash () |
Represents a complete deck, including metadata, zones, cards, and sideboard plans.
A DeckList is a wrapper around an InnerDecklistNode tree, enriched with metadata like deck name, comments, tags, banner card, and multiple sideboard plans.
Core responsibilities:
- Store and manage the root node tree (zones → groups → cards).
- Provide deck-level metadata (name, comments, tags, banner).
- Support multiple sideboard plans (meta-game strategies).
- Provide import/export in multiple formats:
- Cockatrice native XML format.
- Plain-text list format.
- Provide hashing for deck identity (deck hash).
Ownership:
Example workflow:
deck.
addCard(
"Lightning Bolt",
"main");
void addTag(const QString &_tag)
Definition deck_list.h:106
DeckList()
Construct an empty deck.
Definition deck_list.cpp:31
bool saveToFile_Native(QIODevice *device)
Definition deck_list.cpp:185
DecklistCardNode * addCard(const QString &cardName, const QString &zoneName, int position=-1, const QString &cardSetName=QString(), const QString &cardSetCollectorNumber=QString(), const QString &cardProviderId=QString(), const bool formatLegal=true)
Definition deck_list.cpp:484
void setName(const QString &_name=QString())
Definition deck_list.h:94