22 #include <QDomElement>
25 #include "qgis_core.h"
49 static QgsRectangle readRectangle(
const QDomElement &element );
69 static QDomElement writeRectangle(
const QgsRectangle &rect, QDomDocument &doc,
const QString &elementName = QStringLiteral(
"extent" ) );
83 static QDomElement writeVariant(
const QVariant &value, QDomDocument &doc );
88 static QVariant readVariant(
const QDomElement &element );
101 T value = defaultValue;
103 const QMetaEnum metaEnum = QMetaEnum::fromType<T>();
104 const QString sourceCategoriesStr( element.attribute( attributeName, metaEnum.valueToKeys(
static_cast<int>( defaultValue ) ) ) );
105 if ( metaEnum.isValid() )
108 const int newValue = metaEnum.keysToValue( sourceCategoriesStr.toUtf8().constData(), &ok );
110 value =
static_cast<T
>( newValue );
117 #endif // QGSXMLUTILS_H