#include "Question.h"
#include <QDomElement>

Question::Question()
{
}

Question::~Question()
{
}

bool Question::loadFromNode(const QDomElement& element)
{
	for ( QDomNode child = element.firstChild(); ! child.isNull(); child = child.nextSibling() )
	{
		QDomElement element = child.toElement();
		if ( element.isNull() ) continue;

		if ( element.tagName() == "text" )
			text = element.text();
		else if ( element.tagName() == "answer" )
			answer = element.text();
	}
	return true;
}

#include <iostream>

void Question::print() const
{
	std::cout << '[' << qPrintable(text) << ": " << qPrintable(answer) << ']' << std::endl;
}
