コード例 #1
0
ファイル: decklist.cpp プロジェクト: VanNostrand/Cockatrice
bool InnerDecklistNode::readElement(QXmlStreamReader *xml)
{
	while (!xml->atEnd()) {
		xml->readNext();
		const QString childName = xml->name().toString();
		if (xml->isStartElement()) {
			if (childName == "zone") {
				InnerDecklistNode *newZone = new InnerDecklistNode(xml->attributes().value("name").toString(), this);
				newZone->readElement(xml);
			} else if (childName == "card") {
				float price = (xml->attributes().value("price") != NULL) ? xml->attributes().value("price").toString().toFloat() : 0;
				DecklistCardNode *newCard = new DecklistCardNode(xml->attributes().value("name").toString(), xml->attributes().value("number").toString().toInt(), price, this);
				newCard->readElement(xml);
			}
		} else if (xml->isEndElement() && (childName == "zone"))
			return false;
	}
	return true;
}