Blame | Last modification | View Log | RSS feed
// Generated file, do not edit!
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
\#include "${c.name}.h"
void ${c.name}::clear()
{
#for $a in $c.properties
${a.name} = ${a.initial};
#end for
#for $a in $c.properties
#if $a.optional
_have${a.name} = 0;
#endif
#end for
}
void ${c.name}::xmlIn(ScXmlStreamReader& r, ScribusBuilder& builder)
{
clear();
for (QVector<QXmlStreamAttribute>::const_iterator i = r.attributes().constBegin(); i != r.attributes().constEnd(); ++i)
{
#for $a in $c.properties
if (i->qualifiedName().compare(QString("${a.xmlName}")) == 0)
{
#if $a.type == "coll"
assert("can't use attributes for collection ${a.xmlName}");
#else if $a.optional
scribusXmlIn(_${a.name}, r, builder, "${a.xmlName}");
_have${a.name} = 1;
#else
scribusXmlIn(_${a.name}, r, builder, "${a.xmlName}");
#end if
}
else
#end for
{}
}
while (r.readNextStartElement())
{
#for $a in $c.properties
if (r.name().compare(QString("${a.xmlName}")) == 0)
{
#if $a.type == "coll"
${a.datatype}::value_type tmp_${a.name} = builder.create${a.name}();
scribusXmlIn(tmp_${a.name}, r, builder, QString());
${a.name}.push_back(tmp_${a.name});
#else if $a.optional
scribusXmlIn(_${a.name}, r, builder, QString());
_have${a.name} = 1;
#else
scribusXmlIn(_${a.name}, r, builder, QString());
#end if
}
else
#end for
{}
}
}
void ${c.name}::xmlOut(ScXmlStreamWriter& w, const QString& xmlName) const
{
w.writeStartElement(xmlName);
#for $a in $c.properties
#if $a.type == "coll"
for (${a.datatype}::iterator i=_${a.name}.begin(); i != _${a.name}.end(); ++i)
{
scribusXmlOut(*i, w, QString("${a.xmlName}"), false);
}
#else if $a.optional
if (_have${a.name})
{
#if $a.type == "value"
scribusXmlOut(_${a.name}, w, QString("${a.xmlName}"), true);
#else
scribusXmlOut(_${a.name}, w, QString("${a.xmlName}"), false);
#end if
}
#else
#if $a.type == "value"
scribusXmlOut(_${a.name}, w, QString("${a.xmlName}"), true);
#else
scribusXmlOut(_${a.name}, w, QString("${a.xmlName}"), false);
#end if
#end if
#end for
w.writeEndElement();
}