2016-03-03 01:43:48 +01:00
|
|
|
/*!
|
|
|
|
* \file xmlparsermacros.h
|
|
|
|
* \brief Macros to utilize XML parsing using QXmlStreamReader.
|
|
|
|
* \sa For an example, see dbquery.cpp of the tageditor project.
|
|
|
|
*/
|
|
|
|
|
2016-03-06 17:12:50 +01:00
|
|
|
// ensure there are no conflicting macros defined
|
|
|
|
#include "./undefxmlparsermacros.h"
|
2016-03-03 01:43:48 +01:00
|
|
|
|
2017-05-01 03:16:25 +02:00
|
|
|
#define iftag(tagName) if (xmlReader.name() == QLatin1String(tagName))
|
|
|
|
#define eliftag(tagName) else if (xmlReader.name() == QLatin1String(tagName))
|
|
|
|
#define else_skip \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
xmlReader.skipCurrentElement(); \
|
|
|
|
}
|
|
|
|
#define children while (xmlReader.readNextStartElement())
|
2016-08-31 23:39:04 +02:00
|
|
|
#define text (xmlReader.readElementText(QXmlStreamReader::ErrorOnUnexpectedElement))
|
|
|
|
#define attribute(attributeName) (xmlReader.attributes().value(QLatin1String(attributeName)))
|
2017-05-01 03:16:25 +02:00
|
|
|
#define attributeFlag(attributeName) \
|
|
|
|
(xmlReader.attributes().hasAttribute(QLatin1String(attributeName)) \
|
|
|
|
&& xmlReader.attributes().value(QLatin1String(attributeName)) != QLatin1String("false"))
|