Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
ICardDatabaseParser Class Referenceabstract

Defines the base parser interface (ICardDatabaseParser) for all card database parsers. More...

#include <card_database_parser.h>

Inheritance diagram for ICardDatabaseParser:
[legend]
Collaboration diagram for ICardDatabaseParser:
[legend]

Signals

void addCard (CardInfoPtr card)
void addSet (CardSetPtr set)

Public Member Functions

 ~ICardDatabaseParser () override=default
virtual bool getCanParseFile (const QString &name, QIODevice &device)=0
 Checks whether this parser can parse the given file.
virtual void parseFile (QIODevice &device)=0
 Parses a database file and emits addCard/addSet signals.
virtual bool saveToFile (SetNameMap sets, CardNameMap cards, const QString &fileName, const QString &sourceUrl="unknown", const QString &sourceVersion="unknown")=0
 Saves card and set data to a file.

Static Public Member Functions

static void clearSetlist ()
 Clears the cached global set list.

Protected Member Functions

CardSetPtr internalAddSet (const QString &setName, const QString &longName="", const QString &setType="", const QDate &releaseDate=QDate(), const CardSet::Priority priority=CardSet::PriorityFallback)
 Internal helper to add a set to the global set cache.

Static Protected Attributes

static SetNameMap sets
 Cached global list of sets shared between all parsers.

Detailed Description

Defines the base parser interface (ICardDatabaseParser) for all card database parsers.

Provides methods for checking file compatibility, parsing, and saving card databases. Also provides shared access to the global set list for cross-referencing.

Constructor & Destructor Documentation

◆ ~ICardDatabaseParser()

ICardDatabaseParser::~ICardDatabaseParser ( )
overridedefault

Member Function Documentation

◆ addCard

void ICardDatabaseParser::addCard ( CardInfoPtr card)
signal

Emitted when a card is loaded from the database.

Here is the caller graph for this function:

◆ addSet

void ICardDatabaseParser::addSet ( CardSetPtr set)
signal

Emitted when a set is loaded from the database.

Here is the caller graph for this function:

◆ clearSetlist()

void ICardDatabaseParser::clearSetlist ( )
static

Clears the cached global set list.

Here is the caller graph for this function:

◆ getCanParseFile()

virtual bool ICardDatabaseParser::getCanParseFile ( const QString & name,
QIODevice & device )
pure virtual

Checks whether this parser can parse the given file.

Parameters
nameFile name (used for extension checks).
deviceQIODevice representing the file content.
Returns
true if the parser can handle this file.

Implemented in CockatriceXml3Parser, and CockatriceXml4Parser.

◆ internalAddSet()

CardSetPtr ICardDatabaseParser::internalAddSet ( const QString & setName,
const QString & longName = "",
const QString & setType = "",
const QDate & releaseDate = QDate(),
const CardSet::Priority priority = CardSet::PriorityFallback )
protected

Internal helper to add a set to the global set cache.

Parameters
setNameShort set name.
longNameOptional full name.
setTypeOptional set type string.
releaseDateOptional release date.
priorityOptional priority (fallback if not specified).
Returns
Pointer to the added or existing CardSet instance.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseFile()

virtual void ICardDatabaseParser::parseFile ( QIODevice & device)
pure virtual

Parses a database file and emits addCard/addSet signals.

Parameters
deviceQIODevice representing the file content.

Implemented in CockatriceXml3Parser, and CockatriceXml4Parser.

◆ saveToFile()

virtual bool ICardDatabaseParser::saveToFile ( SetNameMap sets,
CardNameMap cards,
const QString & fileName,
const QString & sourceUrl = "unknown",
const QString & sourceVersion = "unknown" )
pure virtual

Saves card and set data to a file.

Parameters
setsMap of sets to save.
cardsMap of cards to save.
fileNameTarget file path.
sourceUrlOptional source URL of the database.
sourceVersionOptional version string of the source.
Returns
true if save succeeded.

Implemented in CockatriceXml3Parser, and CockatriceXml4Parser.

Member Data Documentation

◆ sets

SetNameMap ICardDatabaseParser::sets
staticprotected

Cached global list of sets shared between all parsers.


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