4#ifndef SERIALIZABLEXMLLIST_H
5#define SERIALIZABLEXMLLIST_H
9#include "iserializabletoxml.h"
10#include "ideserializablefromxml.h"
28 for(
int i = 0;i < SerializableXmlList<T>::count() && result ==
true;i++) {
29 result = this->at(i) == other.at(i);
47 static_assert(std::is_base_of<ISerializableToDomElement, T>::value,
"T not derived from ISerializableToDomElement");
49 QDomElement result = doc.createElement(tagName);
50 for(
typename QList<T>::const_iterator it = this->constBegin();it != this->constEnd();it++) {
54 result.appendChild(obj);
67 static_assert(std::is_base_of<IDeserializableFromDomElement, T>::value,
"T not derived from IDeserializableFromDomElement");
68 for(QDomElement childElement = element.firstChildElement();childElement.isNull() ==
false;childElement = childElement.nextSiblingElement()) {
Interface for objects that can deserialize themselves from a QDomElement.
virtual void deserializeFromDomElement(const QDomElement &element)=0
Populate this object from a QDomElement.
Interface for objects that can serialize themselves to a QDomElement.
virtual QDomElement serializeToDomElement() const =0
Serialize this object into a QDomElement.
Template helper for serializing and deserializing lists of XML-capable objects.
void deserializeFromDomElement(const QDomElement &element)
Populate this list by deserializing child elements of a QDomElement.
QDomElement serializeToDomElement(const QString &tagName) const
Serialize all elements into a QDomElement container.
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.