Parses version 3 of the Cockatrice XML Schema.
More...
#include <cockatrice_xml_3.h>
|
| void | loadCardsFromXml (QXmlStreamReader &xml) |
| | Load all <card> elements from the XML stream.
|
| void | loadSetsFromXml (QXmlStreamReader &xml) |
| | Load all <set> elements from the XML stream.
|
| QString | getMainCardType (QString &type) |
| | Extracts the main card type from a full type string.
|
Parses version 3 of the Cockatrice XML Schema.
This parser reads a Cockatrice XML3 database and emits CardInfoPtr and CardSetPtr objects. All card properties are read individually.
- Note
- Differences from v4:
- No <prop> block; properties are hardcoded (manacost, cmc, type, pt, loyalty, etc.).
- No set priority field.
- No support for rebalanced cards or preferences.
- Related cards support only attach, exclude, variable, and count attributes.
◆ CockatriceXml3Parser()
| CockatriceXml3Parser::CockatriceXml3Parser |
( |
| ) |
|
|
default |
◆ ~CockatriceXml3Parser()
| CockatriceXml3Parser::~CockatriceXml3Parser |
( |
| ) |
|
|
overridedefault |
◆ getCanParseFile()
| bool CockatriceXml3Parser::getCanParseFile |
( |
const QString & | name, |
|
|
QIODevice & | device ) |
|
overridevirtual |
Determines if the parser can handle this file.
- Parameters
-
| name | File name. |
| device | Open QIODevice containing the XML. |
- Returns
- True if the file is a Cockatrice XML3 database.
Implements ICardDatabaseParser.
◆ getMainCardType()
| QString CockatriceXml3Parser::getMainCardType |
( |
QString & | type | ) |
|
|
private |
Extracts the main card type from a full type string.
- Parameters
-
| type | The full type string (e.g., "Legendary Artifact Creature - Golem") |
- Returns
- The primary type (e.g., "Creature").
◆ loadCardsFromXml()
| void CockatriceXml3Parser::loadCardsFromXml |
( |
QXmlStreamReader & | xml | ) |
|
|
private |
Load all <card> elements from the XML stream.
- Parameters
-
| xml | The open QXmlStreamReader positioned at the <cards> element. Parses each <card> node and emits addCard signals for each CardInfoPtr created. |
◆ loadSetsFromXml()
| void CockatriceXml3Parser::loadSetsFromXml |
( |
QXmlStreamReader & | xml | ) |
|
|
private |
Load all <set> elements from the XML stream.
- Parameters
-
| xml | The open QXmlStreamReader positioned at the <sets> element. Parses each <set> node and adds them to the shared set cache. |
◆ parseFile()
| void CockatriceXml3Parser::parseFile |
( |
QIODevice & | device | ) |
|
|
overridevirtual |
Parse the XML database.
- Parameters
-
| device | Open QIODevice positioned at start of file. |
Implements ICardDatabaseParser.
◆ saveToFile()
| bool CockatriceXml3Parser::saveToFile |
( |
SetNameMap | _sets, |
|
|
CardNameMap | cards, |
|
|
const QString & | fileName, |
|
|
const QString & | sourceUrl = "unknown", |
|
|
const QString & | sourceVersion = "unknown" ) |
|
overridevirtual |
The documentation for this class was generated from the following files: