0
|
1 |
<!DOCTYPE xsl:stylesheet [
|
|
2 |
<!ENTITY endl " ">
|
|
3 |
]>
|
|
4 |
<xsl:stylesheet version="1.0"
|
|
5 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
6 |
xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
|
7 |
|
|
8 |
<!-- Hack to make names camel case
|
|
9 |
All names in UI files are lowercase, while the element names are
|
|
10 |
capital case. To make the UI files conforming to the XSD file + keep
|
|
11 |
the DOM interface we rename them here -->
|
|
12 |
<xsl:template name="camel-case">
|
|
13 |
<xsl:param name="text"/>
|
|
14 |
<xsl:choose>
|
|
15 |
<xsl:when test="$text='exportmacro'">exportMacro</xsl:when>
|
|
16 |
<xsl:when test="$text='layoutdefault'">layoutDefault</xsl:when>
|
|
17 |
<xsl:when test="$text='layoutfunction'">layoutFunction</xsl:when>
|
|
18 |
<xsl:when test="$text='pixmapfunction'">pixmapFunction</xsl:when>
|
|
19 |
<xsl:when test="$text='customwidgets'">customWidgets</xsl:when>
|
|
20 |
<xsl:when test="$text='tabstops'">tabStops</xsl:when>
|
|
21 |
<xsl:when test="$text='tabstop'">tabStop</xsl:when>
|
|
22 |
<xsl:when test="$text='buttongroups'">buttonGroups</xsl:when>
|
|
23 |
<xsl:when test="$text='exportmacro'">exportMacro</xsl:when>
|
|
24 |
<xsl:when test="$text='actiongroup'">actionGroup</xsl:when>
|
|
25 |
<xsl:when test="$text='buttongroup'">buttonGroup</xsl:when>
|
|
26 |
<xsl:when test="$text='customwidget'">customWidget</xsl:when>
|
|
27 |
<xsl:when test="$text='sizehint'">sizeHint</xsl:when>
|
|
28 |
<xsl:when test="$text='addpagemethod'">addPageMethod</xsl:when>
|
|
29 |
<xsl:when test="$text='sizepolicy'">sizePolicy</xsl:when>
|
|
30 |
<xsl:when test="$text='hordata'">horData</xsl:when>
|
|
31 |
<xsl:when test="$text='verdata'">verData</xsl:when>
|
|
32 |
<xsl:when test="$text='rowspan'">rowSpan</xsl:when>
|
|
33 |
<xsl:when test="$text='colspan'">colSpan</xsl:when>
|
|
34 |
<xsl:when test="$text='addaction'">addAction</xsl:when>
|
|
35 |
<xsl:when test="$text='zorder'">zOrder</xsl:when>
|
|
36 |
<xsl:when test="$text='startx'">startX</xsl:when>
|
|
37 |
<xsl:when test="$text='starty'">startY</xsl:when>
|
|
38 |
<xsl:when test="$text='endx'">endX</xsl:when>
|
|
39 |
<xsl:when test="$text='endy'">endY</xsl:when>
|
|
40 |
<xsl:when test="$text='centralx'">centralX</xsl:when>
|
|
41 |
<xsl:when test="$text='centraly'">centralY</xsl:when>
|
|
42 |
<xsl:when test="$text='focalx'">focalX</xsl:when>
|
|
43 |
<xsl:when test="$text='focaly'">focalY</xsl:when>
|
|
44 |
<xsl:when test="$text='widgetdata'">widgetData</xsl:when>
|
|
45 |
<xsl:when test="$text='coordinatemode'">coordinateMode</xsl:when>
|
|
46 |
<xsl:when test="$text='brushstyle'">brushStyle</xsl:when>
|
|
47 |
<xsl:when test="$text='colorrole'">colorRole</xsl:when>
|
|
48 |
<xsl:when test="$text='pointsize'">pointSize</xsl:when>
|
|
49 |
<xsl:when test="$text='strikeout'">strikeOut</xsl:when>
|
|
50 |
<xsl:when test="$text='stylestrategy'">styleStrategy</xsl:when>
|
|
51 |
<xsl:when test="$text='hsizetype'">hSizeType</xsl:when>
|
|
52 |
<xsl:when test="$text='vsizetype'">vSizeType</xsl:when>
|
|
53 |
<xsl:when test="$text='horstretch'">horStretch</xsl:when>
|
|
54 |
<xsl:when test="$text='verstretch'">verStretch</xsl:when>
|
|
55 |
<xsl:when test="$text='normaloff'">normalOff</xsl:when>
|
|
56 |
<xsl:when test="$text='normalon'">normalOn</xsl:when>
|
|
57 |
<xsl:when test="$text='disabledoff'">disabledOff</xsl:when>
|
|
58 |
<xsl:when test="$text='disabledon'">disabledOn</xsl:when>
|
|
59 |
<xsl:when test="$text='activeoff'">activeOff</xsl:when>
|
|
60 |
<xsl:when test="$text='activeon'">activeOn</xsl:when>
|
|
61 |
<xsl:when test="$text='selectedoff'">selectedOff</xsl:when>
|
|
62 |
<xsl:when test="$text='selectedon'">selectedOn</xsl:when>
|
|
63 |
<xsl:when test="$text='cursorshape'">cursorShape</xsl:when>
|
|
64 |
<xsl:when test="$text='iconset'">iconSet</xsl:when>
|
|
65 |
<xsl:when test="$text='stringlist'">stringList</xsl:when>
|
|
66 |
<xsl:when test="$text='datetime'">dateTime</xsl:when>
|
|
67 |
<xsl:when test="$text='pointf'">pointF</xsl:when>
|
|
68 |
<xsl:when test="$text='rectf'">rectF</xsl:when>
|
|
69 |
<xsl:when test="$text='sizef'">sizeF</xsl:when>
|
|
70 |
<xsl:when test="$text='longlong'">longLong</xsl:when>
|
|
71 |
<xsl:when test="$text='uint'">UInt</xsl:when>
|
|
72 |
<xsl:when test="$text='ulonglong'">uLongLong</xsl:when>
|
|
73 |
<xsl:when test="$text='rowstretch'">rowStretch</xsl:when>
|
|
74 |
<xsl:when test="$text='columnstretch'">columnStretch</xsl:when>
|
|
75 |
<xsl:when test="$text='rowminimumheight'">rowMinimumHeight</xsl:when>
|
|
76 |
<xsl:when test="$text='columnminimumwidth'">columnMinimumWidth</xsl:when>
|
|
77 |
<xsl:when test="$text='extracomment'">extraComment</xsl:when>
|
|
78 |
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
|
79 |
</xsl:choose>
|
|
80 |
</xsl:template>
|
|
81 |
|
|
82 |
|
|
83 |
<!-- Convenience templates -->
|
|
84 |
|
|
85 |
<xsl:template name="cap-first-char">
|
|
86 |
<xsl:param name="text"/>
|
|
87 |
<xsl:value-of select="concat(translate(substring($text, 1, 1), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), substring($text, 2))" />
|
|
88 |
</xsl:template>
|
|
89 |
|
|
90 |
<xsl:template name="lower-text">
|
|
91 |
<xsl:param name="text"/>
|
|
92 |
|
|
93 |
<xsl:if test="boolean($text)">
|
|
94 |
<xsl:variable name="head" select="substring($text, 1, 1)"/>
|
|
95 |
<xsl:variable name="tail" select="substring($text, 2)"/>
|
|
96 |
<xsl:variable name="lower-head" select="translate($text, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
|
|
97 |
<xsl:variable name="lower-tail">
|
|
98 |
<xsl:call-template name="lower-text">
|
|
99 |
<xsl:with-param name="text" select="tail"/>
|
|
100 |
</xsl:call-template>
|
|
101 |
</xsl:variable>
|
|
102 |
<xsl:value-of select='concat($lower-head, $lower-tail)'/>
|
|
103 |
</xsl:if>
|
|
104 |
</xsl:template>
|
|
105 |
|
|
106 |
<xsl:template name="powers-of-two">
|
|
107 |
<xsl:param name="num"/>
|
|
108 |
|
|
109 |
<xsl:choose>
|
|
110 |
<xsl:when test="$num=0">1</xsl:when>
|
|
111 |
<xsl:otherwise>
|
|
112 |
<xsl:variable name="x">
|
|
113 |
<xsl:call-template name="powers-of-two">
|
|
114 |
<xsl:with-param name="num" select="$num - 1"/>
|
|
115 |
</xsl:call-template>
|
|
116 |
</xsl:variable>
|
|
117 |
<xsl:value-of select="2*$x"/>
|
|
118 |
</xsl:otherwise>
|
|
119 |
</xsl:choose>
|
|
120 |
</xsl:template>
|
|
121 |
|
|
122 |
<!-- Convenience templates: xs-types to c++ types conversions -->
|
|
123 |
|
|
124 |
<xsl:template name="xs-type-from-qstring-func">
|
|
125 |
<xsl:param name="xs-type"/>
|
|
126 |
<xsl:param name="val"/>
|
|
127 |
<xsl:choose>
|
|
128 |
<xsl:when test="$xs-type='xs:string'">
|
|
129 |
<xsl:value-of select="$val"/>
|
|
130 |
</xsl:when>
|
|
131 |
<xsl:when test="$xs-type='xs:integer'">
|
|
132 |
<xsl:value-of select="$val"/>
|
|
133 |
<xsl:text>.toInt()</xsl:text>
|
|
134 |
</xsl:when>
|
|
135 |
<xsl:when test="$xs-type='xs:float'">
|
|
136 |
<xsl:value-of select="$val"/>
|
|
137 |
<xsl:text>.toFloat()</xsl:text>
|
|
138 |
</xsl:when>
|
|
139 |
<xsl:when test="$xs-type='xs:double'">
|
|
140 |
<xsl:value-of select="$val"/>
|
|
141 |
<xsl:text>.toDouble()</xsl:text>
|
|
142 |
</xsl:when>
|
|
143 |
<xsl:when test="$xs-type='xs:boolean'">
|
|
144 |
<xsl:text>(</xsl:text>
|
|
145 |
<xsl:value-of select="$val"/>
|
|
146 |
<xsl:text> == QLatin1String("true") ? true : false)</xsl:text>
|
|
147 |
</xsl:when>
|
|
148 |
<xsl:when test="$xs-type='xs:long'">
|
|
149 |
<xsl:value-of select="$val"/>
|
|
150 |
<xsl:text>.toLongLong()</xsl:text>
|
|
151 |
</xsl:when>
|
|
152 |
<xsl:when test="$xs-type='xs:unsignedInt'">
|
|
153 |
<xsl:value-of select="$val"/>
|
|
154 |
<xsl:text>.toUInt()</xsl:text>
|
|
155 |
</xsl:when>
|
|
156 |
<xsl:when test="$xs-type='xs:unsignedLong'">
|
|
157 |
<xsl:value-of select="$val"/>
|
|
158 |
<xsl:text>.toULongLong()</xsl:text>
|
|
159 |
</xsl:when>
|
|
160 |
<xsl:otherwise>### BZZZZT! ###</xsl:otherwise>
|
|
161 |
</xsl:choose>
|
|
162 |
</xsl:template>
|
|
163 |
|
|
164 |
<xsl:template name="xs-type-to-qstring-func">
|
|
165 |
<xsl:param name="xs-type"/>
|
|
166 |
<xsl:param name="val"/>
|
|
167 |
<xsl:choose>
|
|
168 |
<xsl:when test="$xs-type='xs:string'">
|
|
169 |
<xsl:value-of select="$val"/>
|
|
170 |
</xsl:when>
|
|
171 |
<xsl:when test="$xs-type='xs:integer'">
|
|
172 |
<xsl:text>QString::number(</xsl:text>
|
|
173 |
<xsl:value-of select="$val"/>
|
|
174 |
<xsl:text>)</xsl:text>
|
|
175 |
</xsl:when>
|
|
176 |
<xsl:when test="$xs-type='xs:long'">
|
|
177 |
<xsl:text>QString::number(</xsl:text>
|
|
178 |
<xsl:value-of select="$val"/>
|
|
179 |
<xsl:text>)</xsl:text>
|
|
180 |
</xsl:when>
|
|
181 |
<xsl:when test="$xs-type='xs:unsignedInt'">
|
|
182 |
<xsl:text>QString::number(</xsl:text>
|
|
183 |
<xsl:value-of select="$val"/>
|
|
184 |
<xsl:text>)</xsl:text>
|
|
185 |
</xsl:when>
|
|
186 |
<xsl:when test="$xs-type='xs:unsignedLong'">
|
|
187 |
<xsl:text>QString::number(</xsl:text>
|
|
188 |
<xsl:value-of select="$val"/>
|
|
189 |
<xsl:text>)</xsl:text>
|
|
190 |
</xsl:when>
|
|
191 |
<xsl:when test="$xs-type='xs:float'">
|
|
192 |
<xsl:text>QString::number(</xsl:text>
|
|
193 |
<xsl:value-of select="$val"/>
|
|
194 |
<xsl:text>, 'f', 8)</xsl:text>
|
|
195 |
</xsl:when>
|
|
196 |
<xsl:when test="$xs-type='xs:double'">
|
|
197 |
<xsl:text>QString::number(</xsl:text>
|
|
198 |
<xsl:value-of select="$val"/>
|
|
199 |
<xsl:text>, 'f', 15)</xsl:text>
|
|
200 |
</xsl:when>
|
|
201 |
<xsl:when test="$xs-type='xs:boolean'">
|
|
202 |
<xsl:text>(</xsl:text>
|
|
203 |
<xsl:value-of select="$val"/>
|
|
204 |
<xsl:text> ? QLatin1String("true") : QLatin1String("false"))</xsl:text>
|
|
205 |
</xsl:when>
|
|
206 |
<xsl:otherwise>### BZZZZT! ###</xsl:otherwise>
|
|
207 |
</xsl:choose>
|
|
208 |
</xsl:template>
|
|
209 |
|
|
210 |
<xsl:template name="xs-type-category">
|
|
211 |
<xsl:param name="xs-type"/>
|
|
212 |
<xsl:param name="array" select="false"/>
|
|
213 |
<xsl:choose>
|
|
214 |
<xsl:when test="$array">value</xsl:when>
|
|
215 |
<xsl:otherwise>
|
|
216 |
<xsl:choose>
|
|
217 |
<xsl:when test="$xs-type='xs:string'">value</xsl:when>
|
|
218 |
<xsl:when test="$xs-type='xs:integer'">value</xsl:when>
|
|
219 |
<xsl:when test="$xs-type='xs:float'">value</xsl:when>
|
|
220 |
<xsl:when test="$xs-type='xs:double'">value</xsl:when>
|
|
221 |
<xsl:when test="$xs-type='xs:boolean'">value</xsl:when>
|
|
222 |
<xsl:when test="$xs-type='xs:long'">value</xsl:when>
|
|
223 |
<xsl:when test="$xs-type='xs:unsignedInt'">value</xsl:when>
|
|
224 |
<xsl:when test="$xs-type='xs:unsignedLong'">value</xsl:when>
|
|
225 |
<xsl:otherwise>pointer</xsl:otherwise>
|
|
226 |
</xsl:choose>
|
|
227 |
</xsl:otherwise>
|
|
228 |
</xsl:choose>
|
|
229 |
</xsl:template>
|
|
230 |
|
|
231 |
<xsl:template name="xs-type-to-cpp-type">
|
|
232 |
<xsl:param name="xs-type"/>
|
|
233 |
<xsl:param name="array" select="false"/>
|
|
234 |
<xsl:choose>
|
|
235 |
<xsl:when test="$array">
|
|
236 |
<xsl:choose>
|
|
237 |
<xsl:when test="$xs-type='xs:string'">QStringList</xsl:when>
|
|
238 |
<xsl:when test="$xs-type='xs:integer'">QList<int></xsl:when>
|
|
239 |
<xsl:when test="$xs-type='xs:float'">QList<float></xsl:when>
|
|
240 |
<xsl:when test="$xs-type='xs:double'">QList<double></xsl:when>
|
|
241 |
<xsl:when test="$xs-type='xs:boolean'">QList<bool></xsl:when>
|
|
242 |
<xsl:when test="$xs-type='xs:long'">QList<qlonglong></xsl:when>
|
|
243 |
<xsl:when test="$xs-type='xs:unsignedInt'">QList<uint></xsl:when>
|
|
244 |
<xsl:when test="$xs-type='xs:unsignedLong'">QList<qulonglong></xsl:when>
|
|
245 |
<xsl:otherwise>QList<Dom<xsl:value-of select="$xs-type"/>*></xsl:otherwise>
|
|
246 |
</xsl:choose>
|
|
247 |
</xsl:when>
|
|
248 |
<xsl:otherwise>
|
|
249 |
<xsl:choose>
|
|
250 |
<xsl:when test="$xs-type='xs:string'">QString</xsl:when>
|
|
251 |
<xsl:when test="$xs-type='xs:integer'">int</xsl:when>
|
|
252 |
<xsl:when test="$xs-type='xs:float'">float</xsl:when>
|
|
253 |
<xsl:when test="$xs-type='xs:double'">double</xsl:when>
|
|
254 |
<xsl:when test="$xs-type='xs:boolean'">bool</xsl:when>
|
|
255 |
<xsl:when test="$xs-type='xs:long'">qlonglong</xsl:when>
|
|
256 |
<xsl:when test="$xs-type='xs:unsignedInt'">uint</xsl:when>
|
|
257 |
<xsl:when test="$xs-type='xs:unsignedLong'">qulonglong</xsl:when>
|
|
258 |
<xsl:otherwise>Dom<xsl:value-of select="$xs-type"/></xsl:otherwise>
|
|
259 |
</xsl:choose>
|
|
260 |
</xsl:otherwise>
|
|
261 |
</xsl:choose>
|
|
262 |
</xsl:template>
|
|
263 |
|
|
264 |
<xsl:template name="xs-type-to-cpp-return-type">
|
|
265 |
<xsl:param name="xs-type"/>
|
|
266 |
<xsl:param name="array" select="false"/>
|
|
267 |
<xsl:choose>
|
|
268 |
<xsl:when test="$array">
|
|
269 |
<xsl:choose>
|
|
270 |
<xsl:when test="$xs-type='xs:string'">QStringList</xsl:when>
|
|
271 |
<xsl:when test="$xs-type='xs:integer'">QList<int></xsl:when>
|
|
272 |
<xsl:when test="$xs-type='xs:float'">QList<float></xsl:when>
|
|
273 |
<xsl:when test="$xs-type='xs:double'">QList<double></xsl:when>
|
|
274 |
<xsl:when test="$xs-type='xs:boolean'">QList<bool></xsl:when>
|
|
275 |
<xsl:when test="$xs-type='xs:long'">QList<qlonglong></xsl:when>
|
|
276 |
<xsl:when test="$xs-type='xs:unsignedInt'">QList<uint></xsl:when>
|
|
277 |
<xsl:when test="$xs-type='xs:unsignedLong'">QList<qulonglong></xsl:when>
|
|
278 |
<xsl:otherwise>QList<Dom<xsl:value-of select="$xs-type"/>*></xsl:otherwise>
|
|
279 |
</xsl:choose>
|
|
280 |
</xsl:when>
|
|
281 |
<xsl:otherwise>
|
|
282 |
<xsl:choose>
|
|
283 |
<xsl:when test="$xs-type='xs:string'">QString</xsl:when>
|
|
284 |
<xsl:when test="$xs-type='xs:integer'">int</xsl:when>
|
|
285 |
<xsl:when test="$xs-type='xs:float'">float</xsl:when>
|
|
286 |
<xsl:when test="$xs-type='xs:double'">double</xsl:when>
|
|
287 |
<xsl:when test="$xs-type='xs:boolean'">bool</xsl:when>
|
|
288 |
<xsl:when test="$xs-type='xs:long'">qlonglong</xsl:when>
|
|
289 |
<xsl:when test="$xs-type='xs:unsignedInt'">uint</xsl:when>
|
|
290 |
<xsl:when test="$xs-type='xs:unsignedLong'">qulonglong</xsl:when>
|
|
291 |
<xsl:otherwise>Dom<xsl:value-of select="$xs-type"/>*</xsl:otherwise>
|
|
292 |
</xsl:choose>
|
|
293 |
</xsl:otherwise>
|
|
294 |
</xsl:choose>
|
|
295 |
</xsl:template>
|
|
296 |
|
|
297 |
<xsl:template name="xs-type-to-cpp-argument-type">
|
|
298 |
<xsl:param name="xs-type"/>
|
|
299 |
<xsl:param name="array" select="false"/>
|
|
300 |
<xsl:choose>
|
|
301 |
<xsl:when test="$array">
|
|
302 |
<xsl:choose>
|
|
303 |
<xsl:when test="$xs-type='xs:string'">const QStringList&</xsl:when>
|
|
304 |
<xsl:when test="$xs-type='xs:integer'">const QList<int>&</xsl:when>
|
|
305 |
<xsl:when test="$xs-type='xs:float'">const QList<float>&</xsl:when>
|
|
306 |
<xsl:when test="$xs-type='xs:double'">const QList<double>&</xsl:when>
|
|
307 |
<xsl:when test="$xs-type='xs:boolean'">const QList<bool>&</xsl:when>
|
|
308 |
<xsl:when test="$xs-type='xs:long'">const QList<qlonglong>&</xsl:when>
|
|
309 |
<xsl:when test="$xs-type='xs:unsignedInt'">const QList<uint>&</xsl:when>
|
|
310 |
<xsl:when test="$xs-type='xs:unsignedLong'">const QList<qulonglong>&</xsl:when>
|
|
311 |
<xsl:otherwise>const QList<Dom<xsl:value-of select="$xs-type"/>*>&</xsl:otherwise>
|
|
312 |
</xsl:choose>
|
|
313 |
</xsl:when>
|
|
314 |
<xsl:otherwise>
|
|
315 |
<xsl:choose>
|
|
316 |
<xsl:when test="$xs-type='xs:string'">const QString&</xsl:when>
|
|
317 |
<xsl:when test="$xs-type='xs:integer'">int</xsl:when>
|
|
318 |
<xsl:when test="$xs-type='xs:float'">float</xsl:when>
|
|
319 |
<xsl:when test="$xs-type='xs:double'">double</xsl:when>
|
|
320 |
<xsl:when test="$xs-type='xs:boolean'">bool</xsl:when>
|
|
321 |
<xsl:when test="$xs-type='xs:long'">qlonglong</xsl:when>
|
|
322 |
<xsl:when test="$xs-type='xs:unsignedInt'">uint</xsl:when>
|
|
323 |
<xsl:when test="$xs-type='xs:unsignedLong'">qulonglong</xsl:when>
|
|
324 |
<xsl:otherwise>Dom<xsl:value-of select="$xs-type"/>*</xsl:otherwise>
|
|
325 |
</xsl:choose>
|
|
326 |
</xsl:otherwise>
|
|
327 |
</xsl:choose>
|
|
328 |
</xsl:template>
|
|
329 |
|
|
330 |
|
|
331 |
</xsl:stylesheet>
|