Subversion Repositories Scribus

Rev

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 "scribusbuilder.h" 
\#include "${c.name}.h"
#for $i in $c.classincludes
\#include $i
#end for 

#def makeNewValue($a, $attributes)
#if $a.builder != None
builder.create${a.builder}( #slurp
#for $p in $a.builderargs
${p[0]}${attributes}.valueAsQString("${p[1]}")${p[2]} #slurp
#end for
)#slurp
#else if $a.initial != None
$a.initial #slurp
#else
${a.datatype}() #slurp
#end if
#end def

void ${c.name}::xmlIn(ScXmlStreamReader& r, ScribusBuilder& builder, const QString& stopAtTag)
{

        for (QVector<QXmlStreamAttribute>::const_iterator i = r.attributes().constBegin(); i != r.attributes().constEnd(); ++i)
        {
                        if (false) {}   
#for $a in $c.properties
#if $a.type == "value"
                        else if (i->qualifiedName().compare(QString("${a.xmlName}")) == 0)
                                ${a.name} = parse<${a.datatype}>(r.attributes().value("${a.xmlName}").toString());
#end if
#end for
        }
       
        while (r.readNextStartElement())
        {
                        if( r.name().compare(stopAtTag) == 0)
                                return;
#for $a in $c.properties
                        else if (r.name().compare(QString("${a.xmlName}")) == 0)
#if $a.type == "value"
                                ${a.name} = parse<${a.datatype}>(r.readElementText());
#else if $a.type == "coll"
                                {
#if $a.builder != None
                                        ${a.builder}* o = ${makeNewValue($a, "r.scAttributes()")};
                    o->xmlIn(r, builder, stopAtTag);
                    o = builder.finish${a.builder}(o);
#else
                                        ${a.name}.push_back(${makeNewValue($a, "r.scAttributes()")});
                                        (${a.name}.back())->xmlIn(r, builder, stopAtTag);
#end if
                                }
#else
                                ${a.name}.xmlIn(r, builder, stopAtTag);
#end if
#end for
        }
}
 
void ${c.name}::xmlOut(ScXmlStreamWriter& w, const QString& xmlName) const
{
    if(!xmlName.isEmpty())
        w.writeStartElement(xmlName);
#for $a in $c.properties
#if $a.type == "value"
        w.writeAttribute(QString("${a.xmlName}"), toXMLString(${a.name}));
#end if
#end for

#for $a in $c.properties
#if $a.type == "coll"
        for (${a.datatype}::const_iterator i = ${a.name}.begin(); i != ${a.name}.end(); ++i)
        {
                (*i)->xmlOut(w, QString("${a.xmlName}"));
        }
#else if $a.type != "value"
        ${a.name}.xmlOut(w, QString("${a.xmlName}"));
#end if
#end for
        if(!xmlName.isEmpty())
                w.writeEndElement();
}