KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
Loading...
Searching...
No Matches
SerializableXmlList< T > Class Template Reference

Template helper for serializing and deserializing lists of XML-capable objects. More...

#include <serializablexmllist.h>

+ Inheritance diagram for SerializableXmlList< T >:
+ Collaboration diagram for SerializableXmlList< T >:

Public Member Functions

bool operator== (const SerializableXmlList< T > &other) const
 Equality comparison — lists are equal if they have the same elements in the same order.
 
bool operator!= (const SerializableXmlList< T > &other) const
 Inequality comparison.
 
QDomElement serializeToDomElement (const QString &tagName) const
 Serialize all elements into a QDomElement container.
 
void deserializeFromDomElement (const QDomElement &element)
 Populate this list by deserializing child elements of a QDomElement.
 

Detailed Description

template<typename T>
class SerializableXmlList< T >

Template helper for serializing and deserializing lists of XML-capable objects.

A QList subclass that serializes/deserializes its elements via ISerializableToDomElement.

Template Parameters
TElement type; must derive from both ISerializableToDomElement and IDeserializableFromDomElement.

Definition at line 19 of file serializablexmllist.h.

Member Function Documentation

◆ deserializeFromDomElement()

template<typename T >
void SerializableXmlList< T >::deserializeFromDomElement ( const QDomElement &  element)
inline

Populate this list by deserializing child elements of a QDomElement.

Each direct child element is passed to a default-constructed element's deserializeFromDomElement() method.

Parameters
elementParent DOM element whose children to deserialize

Definition at line 66 of file serializablexmllist.h.

References IDeserializableFromDomElement::deserializeFromDomElement().

◆ operator!=()

template<typename T >
bool SerializableXmlList< T >::operator!= ( const SerializableXmlList< T > &  other) const
inline

Inequality comparison.

Parameters
otherList to compare against
Returns
true if the lists differ

Definition at line 36 of file serializablexmllist.h.

◆ operator==()

template<typename T >
bool SerializableXmlList< T >::operator== ( const SerializableXmlList< T > &  other) const
inline

Equality comparison — lists are equal if they have the same elements in the same order.

Parameters
otherList to compare against
Returns
true if both lists have identical elements in the same order

Definition at line 25 of file serializablexmllist.h.

◆ serializeToDomElement()

template<typename T >
QDomElement SerializableXmlList< T >::serializeToDomElement ( const QString &  tagName) const
inline

Serialize all elements into a QDomElement container.

Each element's serializeToDomElement() result is appended as a child of a new element named tagName.

Parameters
tagNameXML tag name for the wrapper element
Returns
QDomElement with one child per list element

Definition at line 46 of file serializablexmllist.h.

References ISerializableToDomElement::serializeToDomElement().


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