Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
cockatrice_xml_3.h
Go to the documentation of this file.
1#ifndef COCKATRICE_XML3_H
2#define COCKATRICE_XML3_H
3
5
6#include <QLoggingCategory>
7#include <QXmlStreamReader>
8
9inline Q_LOGGING_CATEGORY(CockatriceXml3Log, "cockatrice_xml.xml_3_parser");
10
26{
27 Q_OBJECT
28public:
30 ~CockatriceXml3Parser() override = default;
31
38 bool getCanParseFile(const QString &name, QIODevice &device) override;
39
44 void parseFile(QIODevice &device) override;
45
49 bool saveToFile(SetNameMap _sets,
50 CardNameMap cards,
51 const QString &fileName,
52 const QString &sourceUrl = "unknown",
53 const QString &sourceVersion = "unknown") override;
54
55private:
61 void loadCardsFromXml(QXmlStreamReader &xml);
62
68 void loadSetsFromXml(QXmlStreamReader &xml);
69
75 QString getMainCardType(QString &type);
76};
77
78#endif
QHash< QString, CardSetPtr > SetNameMap
Definition card_info.h:28
QHash< QString, CardInfoPtr > CardNameMap
Definition card_info.h:27
~CockatriceXml3Parser() override=default
QString getMainCardType(QString &type)
Extracts the main card type from a full type string.
Definition cockatrice_xml_3.cpp:114
bool getCanParseFile(const QString &name, QIODevice &device) override
Determines if the parser can handle this file.
Definition cockatrice_xml_3.cpp:17
CockatriceXml3Parser()=default
void loadCardsFromXml(QXmlStreamReader &xml)
Load all <card> elements from the XML stream.
Definition cockatrice_xml_3.cpp:152
void parseFile(QIODevice &device) override
Parse the XML database.
Definition cockatrice_xml_3.cpp:48
void loadSetsFromXml(QXmlStreamReader &xml)
Load all <set> elements from the XML stream.
Definition cockatrice_xml_3.cpp:77
bool saveToFile(SetNameMap _sets, CardNameMap cards, const QString &fileName, const QString &sourceUrl="unknown", const QString &sourceVersion="unknown") override
Save sets and cards back to an XML3 file.
Definition cockatrice_xml_3.cpp:441
Defines the base parser interface (ICardDatabaseParser) for all card database parsers.
Definition card_database_parser.h:20
Q_LOGGING_CATEGORY(CockatriceXml3Log, "cockatrice_xml.xml_3_parser")