QGIS API Documentation  3.24.2-Tisler (13c1a02865)
Static Public Member Functions | List of all members
QgsXmlUtils Class Reference

Assorted helper methods for reading and writing chunks of XML. More...

#include <qgsxmlutils.h>

Static Public Member Functions

template<class T >
static T readFlagAttribute (const QDomElement &element, const QString &attributeName, T defaultValue)
 Read a flag value from an attribute of the element. More...
 
static QgsUnitTypes::DistanceUnit readMapUnits (const QDomElement &element)
 Decodes a distance unit from a DOM element. More...
 
static QgsRectangle readRectangle (const QDomElement &element)
 
static QVariant readVariant (const QDomElement &element)
 Read a QVariant from a QDomElement. More...
 
static QDomElement writeMapUnits (QgsUnitTypes::DistanceUnit units, QDomDocument &doc)
 Encodes a distance unit to a DOM element. More...
 
static QDomElement writeRectangle (const QgsRectangle &rect, QDomDocument &doc, const QString &elementName=QStringLiteral("extent"))
 Encodes a rectangle to a DOM element. More...
 
static QDomElement writeVariant (const QVariant &value, QDomDocument &doc)
 Write a QVariant to a QDomElement. More...
 

Detailed Description

Assorted helper methods for reading and writing chunks of XML.

Definition at line 35 of file qgsxmlutils.h.

Member Function Documentation

◆ readFlagAttribute()

template<class T >
static T QgsXmlUtils::readFlagAttribute ( const QDomElement &  element,
const QString &  attributeName,
defaultValue 
)
inlinestatic

Read a flag value from an attribute of the element.

Parameters
elementthe element to read the attribute from
attributeNamethe attribute name
defaultValuethe default value as a flag
Note
The flag value is a text as returned by
See also
QMetaEnum::valueToKeys. The flag must have been declared with Q_ENUM macro.
Since
QGIS 3.4

Definition at line 99 of file qgsxmlutils.h.

◆ readMapUnits()

QgsUnitTypes::DistanceUnit QgsXmlUtils::readMapUnits ( const QDomElement &  element)
static

Decodes a distance unit from a DOM element.

Parameters
elementDOM element to decode
Returns
distance units
See also
writeMapUnits()

Definition at line 26 of file qgsxmlutils.cpp.

◆ readRectangle()

QgsRectangle QgsXmlUtils::readRectangle ( const QDomElement &  element)
static

Definition at line 39 of file qgsxmlutils.cpp.

◆ readVariant()

QVariant QgsXmlUtils::readVariant ( const QDomElement &  element)
static

Read a QVariant from a QDomElement.

Definition at line 251 of file qgsxmlutils.cpp.

◆ writeMapUnits()

QDomElement QgsXmlUtils::writeMapUnits ( QgsUnitTypes::DistanceUnit  units,
QDomDocument &  doc 
)
static

Encodes a distance unit to a DOM element.

Parameters
unitsunits to encode
docDOM document
Returns
element containing encoded units
See also
readMapUnits()

Definition at line 69 of file qgsxmlutils.cpp.

◆ writeRectangle()

QDomElement QgsXmlUtils::writeRectangle ( const QgsRectangle rect,
QDomDocument &  doc,
const QString &  elementName = QStringLiteral( "extent" ) 
)
static

Encodes a rectangle to a DOM element.

Parameters
rectrectangle to encode
docDOM document
elementNamename of the DOM element
Returns
element containing encoded rectangle

Definition at line 81 of file qgsxmlutils.cpp.

◆ writeVariant()

QDomElement QgsXmlUtils::writeVariant ( const QVariant &  value,
QDomDocument &  doc 
)
static

Write a QVariant to a QDomElement.

Supported types are

Definition at line 106 of file qgsxmlutils.cpp.


The documentation for this class was generated from the following files: