Parses version 4 of the Cockatrice XML Schema.
More...
#include <cockatrice_xml_4.h>
|
| QVariantHash | loadCardPropertiesFromXml (QXmlStreamReader &xml) |
| | Loads a generic <prop> block from a <card> element.
|
| void | loadCardsFromXml (QXmlStreamReader &xml) |
| | Load all <card> elements from the XML stream.
|
| void | loadSetsFromXml (QXmlStreamReader &xml) |
| | Load all <set> elements from the XML stream.
|
Parses version 4 of the Cockatrice XML Schema.
This parser reads a Cockatrice XML4 database and emits CardInfoPtr and CardSetPtr objects. Card properties are read inside <prop> blocks, making the parser more extensible and schema-compliant.
- Note
- Differences from v3:
- Card properties are stored in <prop> blocks as a QVariantHash.
- Sets can include a <priority> element.
- Supports user preferences via ICardPreferenceProvider (e.g., skipping rebalanced cards).
- Related cards support persistent relations and multiple attach types (e.g., transform).
- More robust serialization; easier to extend schema in the future.
◆ CockatriceXml4Parser()
◆ ~CockatriceXml4Parser()
| CockatriceXml4Parser::~CockatriceXml4Parser |
( |
| ) |
|
|
overridedefault |
◆ getCanParseFile()
| bool CockatriceXml4Parser::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 XML4 database.
Implements ICardDatabaseParser.
◆ loadCardPropertiesFromXml()
| QVariantHash CockatriceXml4Parser::loadCardPropertiesFromXml |
( |
QXmlStreamReader & | xml | ) |
|
|
private |
Loads a generic <prop> block from a <card> element.
- Parameters
-
| xml | The open QXmlStreamReader positioned at a <prop> element. |
- Returns
- A QVariantHash mapping property names to values.
◆ loadCardsFromXml()
| void CockatriceXml4Parser::loadCardsFromXml |
( |
QXmlStreamReader & | xml | ) |
|
|
private |
Load all <card> elements from the XML stream.
- Parameters
-
| xml | The open QXmlStreamReader positioned at the <cards> element. Honors the user's preference regarding rebalanced cards. |
◆ loadSetsFromXml()
| void CockatriceXml4Parser::loadSetsFromXml |
( |
QXmlStreamReader & | xml | ) |
|
|
private |
Load all <set> elements from the XML stream.
- Parameters
-
| xml | The open QXmlStreamReader positioned at the <sets> element. Parses <set> nodes including priority information. |
◆ parseFile()
| void CockatriceXml4Parser::parseFile |
( |
QIODevice & | device | ) |
|
|
overridevirtual |
Parse the XML database.
- Parameters
-
| device | Open QIODevice positioned at start of file. |
Implements ICardDatabaseParser.
◆ saveToFile()
| bool CockatriceXml4Parser::saveToFile |
( |
SetNameMap | _sets, |
|
|
CardNameMap | cards, |
|
|
const QString & | fileName, |
|
|
const QString & | sourceUrl = "unknown", |
|
|
const QString & | sourceVersion = "unknown" ) |
|
overridevirtual |
◆ cardPreferenceProvider
Interface to handle user preferences.
The documentation for this class was generated from the following files: