Subversion Repositories Scribus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
19111 avox 1
// Generated file, do not edit!
2
/*
3
 For general Scribus (>=1.3.2) copyright and licensing information please refer
4
 to the COPYING file provided with the program. Following this notice may exist
5
 a copyright and/or license notice that predates the release of Scribus 1.3.2
6
 for which a new license (GPL+exception) is in place.
7
 */
8
 
9
\#include "scribusbuilder.h"
10
\#include "${c.name}.h"
11
#for $i in $c.classincludes
12
\#include $i
13
#end for
14
 
15
#def makeNewValue($a, $attributes)
16
#if $a.builder != None
17
builder.create${a.builder}( #slurp
18
#for $p in $a.builderargs
19
${p[0]}${attributes}.valueAsQString("${p[1]}")${p[2]} #slurp
20
#end for
21
)#slurp
22
#else if $a.initial != None
23
$a.initial #slurp
24
#else
25
${a.datatype}() #slurp
26
#end if
27
#end def
28
 
29
void ${c.name}::xmlIn(ScXmlStreamReader& r, ScribusBuilder& builder, const QString& stopAtTag)
30
{
31
 
32
        for (QVector<QXmlStreamAttribute>::const_iterator i = r.attributes().constBegin(); i != r.attributes().constEnd(); ++i)
33
        {
34
			if (false) {}
35
#for $a in $c.properties
36
#if $a.type == "value"
37
			else if (i->qualifiedName().compare(QString("${a.xmlName}")) == 0)
38
				${a.name} = parse<${a.datatype}>(r.attributes().value("${a.xmlName}").toString());
39
#end if
40
#end for
41
        }
42
 
43
        while (r.readNextStartElement())
44
        {
45
			if( r.name().compare(stopAtTag) == 0)
46
				return;
47
#for $a in $c.properties
48
			else if (r.name().compare(QString("${a.xmlName}")) == 0)
49
#if $a.type == "value"
50
				${a.name} = parse<${a.datatype}>(r.readElementText());
51
#else if $a.type == "coll"
52
				{
53
#if $a.builder != None
54
					${a.builder}* o = ${makeNewValue($a, "r.scAttributes()")};
55
                    o->xmlIn(r, builder, stopAtTag);
56
                    o = builder.finish${a.builder}(o);
57
#else
58
					${a.name}.push_back(${makeNewValue($a, "r.scAttributes()")});
59
					(${a.name}.back())->xmlIn(r, builder, stopAtTag);
60
#end if
61
				}
62
#else
63
				${a.name}.xmlIn(r, builder, stopAtTag);
64
#end if
65
#end for
66
        }
67
}
68
 
69
void ${c.name}::xmlOut(ScXmlStreamWriter& w, const QString& xmlName) const
70
{
71
    if(!xmlName.isEmpty())
72
        w.writeStartElement(xmlName);
73
#for $a in $c.properties
74
#if $a.type == "value"
75
	w.writeAttribute(QString("${a.xmlName}"), toXMLString(${a.name}));
76
#end if
77
#end for
78
 
79
#for $a in $c.properties
80
#if $a.type == "coll"
81
	for (${a.datatype}::const_iterator i = ${a.name}.begin(); i != ${a.name}.end(); ++i)
82
	{
83
		(*i)->xmlOut(w, QString("${a.xmlName}"));
84
	}
85
#else if $a.type != "value"
86
	${a.name}.xmlOut(w, QString("${a.xmlName}"));
87
#end if
88
#end for
89
	if(!xmlName.isEmpty())
90
		w.writeEndElement();
91
}