VirtualBox

source: vbox/trunk/src/VBox/Main/webservice/websrv-gsoapH.xsl@ 29532

Last change on this file since 29532 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
File size: 35.6 KB
Line 
1<?xml version="1.0"?>
2
3<!--
4 websrv-gsoapH.xsl:
5 XSLT stylesheet that generates vboxweb_gsoapH.h from
6 the WSDL file previously generated from VirtualBox.xidl.
7 The gsoap.h "header" file can then be fed into gSOAP's
8 soapcpp2 to create web service client headers and server
9 stubs.
10 See webservice/Makefile.kmk for an overview of all the things
11 generated for the webservice.
12
13 Copyright (C) 2006-2010 Oracle Corporation
14
15 This file is part of VirtualBox Open Source Edition (OSE), as
16 available from http://www.virtualbox.org. This file is free software;
17 you can redistribute it and/or modify it under the terms of the GNU
18 General Public License (GPL) as published by the Free Software
19 Foundation, in version 2 as it comes in the "COPYING" file of the
20 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
21 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
22-->
23
24<xsl:stylesheet
25 version="1.0"
26 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
27 xmlns:xsd="http://www.w3.org/2001/XMLSchema">
28
29 <xsl:param name="G_argDebug" />
30
31 <xsl:output method="text"/>
32
33 <xsl:strip-space elements="*"/>
34
35<!-- - - - - - - - - - - - - - - - - - - - - - -
36 global XSLT variables
37 - - - - - - - - - - - - - - - - - - - - - - -->
38
39<xsl:variable name="G_xsltFilename" select="'websrv-gsoapH.xsl'" />
40
41<xsl:include href="websrv-shared.inc.xsl" />
42
43<!-- collect all interfaces with "wsmap='suppress'" in a global variable for
44 quick lookup -->
45<xsl:variable name="G_setSuppressedInterfaces"
46 select="//interface[@wsmap='suppress']" />
47
48<!--
49 emitConvertedType:
50 first type converter (from XIDL type to SOAP/C++ input types),
51 used for generating the argument lists with method implementation
52 headers.
53 -->
54<xsl:template name="emitConvertedType">
55 <xsl:param name="type" />
56
57 <xsl:choose>
58 <xsl:when test="$type='wstring'">std::string</xsl:when>
59 <xsl:when test="$type='boolean'">bool</xsl:when>
60 <xsl:when test="$type='double'">double</xsl:when>
61 <xsl:when test="$type='float'">float</xsl:when>
62 <!-- <xsl:when test="$type='octet'">byte</xsl:when> -->
63 <xsl:when test="$type='short'">short</xsl:when>
64 <xsl:when test="$type='unsigned short'">unsigned short</xsl:when>
65 <xsl:when test="$type='long'">long</xsl:when>
66 <xsl:when test="$type='long long'">long long</xsl:when>
67 <xsl:when test="$type='unsigned long'">unsigned long</xsl:when>
68 <xsl:when test="$type='unsigned long long'">unsigned long long</xsl:when>
69 <xsl:when test="$type='result'">unsigned long</xsl:when>
70 <xsl:when test="$type='uuid'">std::string</xsl:when>
71 <xsl:when test="$type='global'"><xsl:value-of select="$G_typeObjectRef_gsoapH" /></xsl:when>
72 <xsl:when test="$type='managed'"><xsl:value-of select="$G_typeObjectRef_gsoapH" /></xsl:when>
73 <xsl:when test="$type='explicit'"><xsl:value-of select="$G_typeObjectRef_gsoapH" /></xsl:when>
74 <!-- not a standard type: then it better be one of the types defined in the XIDL -->
75 <xsl:when test="//enum[@name=$type]">
76 <xsl:value-of select="concat('enum vbox__', $type)" />
77 </xsl:when>
78 <xsl:when test="//collection[@name=$type]">
79 <xsl:value-of select="concat('vbox__ArrayOf', //collection[@name=$type]/@type, '*')" />
80 </xsl:when>
81 <xsl:when test="//interface[@name=$type]">
82 <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
83 <xsl:variable name="wsmap" select="(//interface[@name=$type]/@wsmap) | (//collection[@name=$type]/@wsmap)" />
84 <xsl:choose>
85 <xsl:when test="$wsmap='global'"><xsl:value-of select="$G_typeObjectRef_gsoapH" /></xsl:when>
86 <xsl:when test="$wsmap='managed'"><xsl:value-of select="$G_typeObjectRef_gsoapH" /></xsl:when>
87 <xsl:when test="$wsmap='explicit'"><xsl:value-of select="$G_typeObjectRef_gsoapH" /></xsl:when>
88 <xsl:when test="$wsmap='struct'"><xsl:value-of select="concat('vbox__', $type, '*')" /></xsl:when>
89 </xsl:choose>
90 </xsl:when>
91 </xsl:choose>
92</xsl:template>
93
94<xsl:template name="convertTypeAndEmitPartOrElement">
95 <xsl:param name="ifname" />
96 <xsl:param name="methodname" />
97 <xsl:param name="name" />
98 <xsl:param name="type" />
99
100 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('....', $type, ' ', $name)" /></xsl:call-template>
101
102 <xsl:value-of select="concat(' ', '')"/>
103 <xsl:call-template name="emitConvertedType">
104 <xsl:with-param name="ifname" select="$ifname" />
105 <xsl:with-param name="methodname" select="$methodname" />
106 <xsl:with-param name="type" select="$type" />
107 </xsl:call-template>
108 <xsl:value-of select="concat(' ', $name, ' 1;')"/>
109 <xsl:call-template name="emitNewline" />
110</xsl:template>
111
112<xsl:template name="emitRequestArgs">
113 <xsl:param name="_ifname" /> <!-- interface name -->
114 <xsl:param name="_wsmap" /> <!-- interface's wsmap attribute -->
115 <xsl:param name="_methodname" />
116 <xsl:param name="_params" />
117 <xsl:param name="_valuetype" /> <!-- optional, for attribute setter messages -->
118
119 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $_ifname, '::', $_methodname, ': ', 'emitRequestArgs')" /></xsl:call-template>
120 <!-- first parameter will be object on which method is called, depending on wsmap attribute -->
121 <xsl:choose>
122 <xsl:when test="($_wsmap='managed') or ($_wsmap='explicit')">
123 <xsl:call-template name="convertTypeAndEmitPartOrElement">
124 <xsl:with-param name="ifname" select="$_ifname" />
125 <xsl:with-param name="methodname" select="$_methodname" />
126 <xsl:with-param name="name" select="$G_nameObjectRefEncoded" />
127 <xsl:with-param name="type" select="$_wsmap" />
128 </xsl:call-template>
129 </xsl:when>
130 </xsl:choose>
131 <!-- now for the real parameters, if any -->
132 <xsl:for-each select="$_params">
133 <!-- <xsl:value-of select="concat('// param &quot;', @name, '&quot;: direction &quot;', @dir, '&quot;')" />
134 <xsl:call-template name="emitNewline" /> -->
135 <!-- emit only parts for "in" parameters -->
136 <xsl:if test="@dir='in'">
137 <xsl:call-template name="convertTypeAndEmitPartOrElement">
138 <xsl:with-param name="ifname" select="$_ifname" />
139 <xsl:with-param name="methodname" select="$_methodname" />
140 <xsl:with-param name="name" select="@name" />
141 <xsl:with-param name="type" select="@type" />
142 </xsl:call-template>
143 </xsl:if>
144 </xsl:for-each>
145 <xsl:if test="$_valuetype">
146 <xsl:call-template name="convertTypeAndEmitPartOrElement">
147 <xsl:with-param name="ifname" select="$_ifname" />
148 <xsl:with-param name="methodname" select="$_methodname" />
149 <xsl:with-param name="name" select="@name" />
150 <xsl:with-param name="type" select="@type" />
151 </xsl:call-template>
152 </xsl:if>
153</xsl:template>
154
155<xsl:template name="emitResultArgs">
156 <xsl:param name="_ifname" />
157 <xsl:param name="_methodname" />
158 <xsl:param name="_params" /> <!-- set of parameter elements -->
159 <xsl:param name="_resulttype" /> <!-- for attribute getter methods only -->
160
161 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $_ifname, '::', $_methodname, ': ', 'emitResultArgs')" /></xsl:call-template>
162 <xsl:choose>
163 <xsl:when test="$_resulttype">
164 <xsl:call-template name="convertTypeAndEmitPartOrElement">
165 <xsl:with-param name="ifname" select="$_ifname" />
166 <xsl:with-param name="methodname" select="$_methodname" />
167 <xsl:with-param name="name" select="$G_result" />
168 <xsl:with-param name="type" select="$_resulttype" />
169 </xsl:call-template>
170 </xsl:when>
171 <xsl:otherwise>
172 <xsl:for-each select="$_params">
173 <!-- emit only parts for "out" parameters -->
174 <xsl:if test="@dir='out'">
175 <xsl:call-template name="convertTypeAndEmitPartOrElement">
176 <xsl:with-param name="ifname" select="$_ifname" />
177 <xsl:with-param name="methodname" select="$_methodname" />
178 <xsl:with-param name="name"><xsl:value-of select="@name" /></xsl:with-param>
179 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
180 </xsl:call-template>
181 </xsl:if>
182 <xsl:if test="@dir='return'">
183 <xsl:call-template name="convertTypeAndEmitPartOrElement">
184 <xsl:with-param name="ifname" select="$_ifname" />
185 <xsl:with-param name="methodname" select="$_methodname" />
186 <xsl:with-param name="name"><xsl:value-of select="$G_result" /></xsl:with-param>
187 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
188 </xsl:call-template>
189 </xsl:if>
190 </xsl:for-each>
191 </xsl:otherwise>
192 </xsl:choose>
193</xsl:template>
194
195
196<!-- - - - - - - - - - - - - - - - - - - - - - -
197 root match
198 - - - - - - - - - - - - - - - - - - - - - - -->
199
200<xsl:template match="/idl">
201 <xsl:text><![CDATA[
202/* DO NOT EDIT! This is a generated file.
203 * Generated from: src/VBox/Main/idl/VirtualBox.xidl (VirtualBox's interface definitions in XML)
204 * Generator: src/VBox/Main/webservice/websrv-gsoapH.xsl
205 *
206 * Note: This is not a real C/C++ header file. Instead, gSOAP uses files like this
207 * one -- with a pseudo-C-header syntax -- to describe a web service API.
208 */
209
210// STL vector containers
211#import "stlvector.h"
212
213]]></xsl:text>
214
215 <xsl:value-of select="concat('//gsoap vbox schema namespace: ', $G_targetNamespace)" />
216 <xsl:value-of select="concat('//gsoap vbox schema form: unqualified', '')" />
217
218 <xsl:apply-templates />
219</xsl:template>
220
221<!-- - - - - - - - - - - - - - - - - - - - - - -
222 if
223 - - - - - - - - - - - - - - - - - - - - - - -->
224
225<!--
226 * ignore all |if|s except those for WSDL target
227-->
228<xsl:template match="if">
229 <xsl:if test="@target='wsdl'">
230 <xsl:apply-templates/>
231 </xsl:if>
232</xsl:template>
233
234<!-- - - - - - - - - - - - - - - - - - - - - - -
235 cpp
236 - - - - - - - - - - - - - - - - - - - - - - -->
237
238<xsl:template match="cpp">
239<!-- ignore this -->
240</xsl:template>
241
242<!-- - - - - - - - - - - - - - - - - - - - - - -
243 library
244 - - - - - - - - - - - - - - - - - - - - - - -->
245
246<xsl:template match="library">
247 <xsl:text>
248/****************************************************************************
249 *
250 * forward declarations
251 *
252 ****************************************************************************/
253</xsl:text>
254
255 <xsl:call-template name="emitNewline" />
256 <xsl:text>// *** interfaces with wsmap="struct"</xsl:text>
257 <xsl:call-template name="emitNewline" />
258
259 <xsl:for-each select="//interface[@wsmap='struct']">
260 <xsl:value-of select="concat('class vbox__', @name, ';')" />
261 <xsl:call-template name="emitNewline" />
262 </xsl:for-each>
263
264 <xsl:call-template name="emitNewline" />
265 <xsl:text>// *** collections</xsl:text>
266 <xsl:call-template name="emitNewline" />
267
268 <xsl:for-each select="//collection">
269 <xsl:value-of select="concat('class vbox__ArrayOf', @type, ';')" />
270 <xsl:call-template name="emitNewline" />
271 </xsl:for-each>
272
273 <xsl:if test="$G_basefmt='document'">
274 <xsl:call-template name="emitNewline" />
275 <xsl:text>// elements for message arguments (parts)</xsl:text>
276 <xsl:call-template name="emitNewline" />
277
278 <xsl:for-each select="//interface">
279 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
280 <xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
281
282 <xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") )'>
283 <xsl:value-of select="concat('// Interface ', $ifname)" />
284 <xsl:call-template name="emitNewline" />
285
286 <xsl:for-each select="attribute">
287 <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
288 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
289 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
290 <xsl:choose>
291 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
292 <xsl:value-of select="concat('// skipping attribute ', $attrtype, ' for it is of a suppressed type')" />
293 <xsl:call-template name="emitNewline" />
294 </xsl:when>
295 <xsl:otherwise>
296 <xsl:choose>
297 <xsl:when test="@readonly='yes'">
298 <xsl:value-of select="concat('// readonly attribute ', $ifname, '::', $attrname)" />
299 </xsl:when>
300 <xsl:otherwise>
301 <xsl:value-of select="concat('// read/write attribute ', $ifname, '::', $attrname)" />
302 </xsl:otherwise>
303 </xsl:choose>
304 <xsl:call-template name="emitNewline" />
305 <!-- aa) emit getter -->
306 <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
307 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrGetter, $G_requestMessageElementSuffix, ';')" />
308 <xsl:call-template name="emitNewline" />
309 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrGetter, $G_responseMessageElementSuffix, ';')" />
310 <xsl:call-template name="emitNewline" />
311 <!-- bb) emit setter if the attribute is read/write -->
312 <xsl:if test="not($attrreadonly='yes')">
313 <xsl:variable name="attrSetter"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
314 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrSetter, $G_requestMessageElementSuffix, ';')" />
315 <xsl:call-template name="emitNewline" />
316 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrSetter, $G_responseMessageElementSuffix, ';')" />
317 <xsl:call-template name="emitNewline" />
318 </xsl:if>
319 </xsl:otherwise>
320 </xsl:choose>
321 </xsl:for-each> <!-- select="attribute" -->
322 <xsl:for-each select="method">
323 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
324 <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
325 <xsl:choose>
326 <xsl:when test="param[@type=($G_setSuppressedInterfaces/@name)]">
327 <xsl:value-of select="concat('// skipping method ', $ifname, '::', $methodname, ' for it has parameters with suppressed types')" />
328 <xsl:call-template name="emitNewline" />
329 </xsl:when>
330 <xsl:otherwise>
331 <xsl:value-of select="concat('// method ', $ifname, '::', $methodname)" />
332 <xsl:call-template name="emitNewline" />
333 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $methodname, $G_requestMessageElementSuffix, ';')" />
334 <xsl:call-template name="emitNewline" />
335 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $methodname, $G_responseMessageElementSuffix, ';')" />
336 <xsl:call-template name="emitNewline" />
337 </xsl:otherwise>
338 </xsl:choose>
339 </xsl:for-each>
340 </xsl:if>
341 </xsl:for-each>
342 </xsl:if> <!-- document style -->
343
344 <xsl:text>
345/****************************************************************************
346 *
347 * faults
348 *
349 ****************************************************************************/
350 </xsl:text>
351
352 <xsl:text>
353class _vbox__InvalidObjectFault
354{ public:
355 std::string badObjectID 1;
356 struct soap *soap;
357};
358
359class _vbox__RuntimeFault
360{ public:
361 long resultCode 1;
362 std::string interfaceID 1;
363 std::string component 1;
364 std::string text 1;
365 struct soap *soap;
366};
367
368struct SOAP_ENV__Detail
369{
370 _vbox__InvalidObjectFault *vbox__InvalidObjectFault;
371 _vbox__RuntimeFault *vbox__RuntimeFault;
372 int __type;
373 void *fault;
374 _XML __any;
375};</xsl:text>
376 <xsl:call-template name="emitNewline" />
377
378 <xsl:text>
379/****************************************************************************
380 *
381 * enums
382 *
383 ****************************************************************************/
384</xsl:text>
385
386 <xsl:for-each select="//enum">
387 <xsl:call-template name="emitNewline" />
388 <xsl:variable name="enumname" select="@name" />
389 <xsl:value-of select="concat('enum vbox__', $enumname)" />
390 <xsl:call-template name="emitNewline" />
391 <xsl:text>{</xsl:text>
392 <xsl:call-template name="emitNewline" />
393 <xsl:for-each select="const">
394 <xsl:if test="position() > 1">
395 <xsl:text>,</xsl:text>
396 <xsl:call-template name="emitNewline" />
397 </xsl:if>
398 <xsl:value-of select="concat(' vbox__', $enumname, '__')" />
399 <!-- escape all "_" in @name -->
400 <xsl:call-template name="escapeUnderscores">
401 <xsl:with-param name="string" select="@name" />
402 </xsl:call-template>
403 </xsl:for-each>
404 <xsl:call-template name="emitNewline" />
405 <xsl:text>};</xsl:text>
406 <xsl:call-template name="emitNewline" />
407 </xsl:for-each>
408
409 <xsl:text>
410/****************************************************************************
411 *
412 * structs
413 *
414 ****************************************************************************/
415</xsl:text>
416
417 <xsl:for-each select="//interface[@wsmap='struct']">
418 <xsl:call-template name="emitNewline" />
419 <xsl:value-of select="concat('// interface ', @name, ' as struct: ')" />
420 <xsl:call-template name="emitNewline" />
421
422 <xsl:value-of select="concat('class vbox__', @name)" />
423 <xsl:call-template name="emitNewline" />
424 <xsl:text>{ public:</xsl:text>
425 <xsl:call-template name="emitNewline" />
426
427 <xsl:for-each select="attribute">
428 <xsl:text> </xsl:text>
429 <xsl:call-template name="emitConvertedType"><xsl:with-param name="type" select="@type" /></xsl:call-template>
430 <xsl:value-of select="concat(' ', @name, ' 1;')" />
431 <xsl:call-template name="emitNewline" />
432 </xsl:for-each>
433
434 <xsl:text> struct soap *soap;</xsl:text>
435 <xsl:call-template name="emitNewline" />
436 <xsl:text>};</xsl:text>
437 <xsl:call-template name="emitNewline" />
438 </xsl:for-each>
439
440 <xsl:text>
441/****************************************************************************
442 *
443 * arrays
444 *
445 ****************************************************************************/
446</xsl:text>
447
448 <xsl:for-each select="//collection">
449 <xsl:call-template name="emitNewline" />
450 <xsl:value-of select="concat('class vbox__ArrayOf', @type)" />
451 <xsl:call-template name="emitNewline" />
452 <xsl:text>{ public:</xsl:text>
453 <xsl:call-template name="emitNewline" />
454 <xsl:text> std::vector&lt;</xsl:text>
455 <xsl:call-template name="emitConvertedType"><xsl:with-param name="type" select="@type" /></xsl:call-template>
456 <xsl:text>&gt; array 0;</xsl:text>
457 <xsl:call-template name="emitNewline" />
458
459 <xsl:text> struct soap *soap;</xsl:text>
460 <xsl:call-template name="emitNewline" />
461 <xsl:text>};</xsl:text>
462 <xsl:call-template name="emitNewline" />
463 </xsl:for-each>
464
465
466 <xsl:if test="$G_basefmt='document'">
467 <xsl:text>
468/****************************************************************************
469 *
470 * elements for message arguments (parts); generated for WSDL 'document' style
471 *
472 ****************************************************************************/
473
474</xsl:text>
475
476 <xsl:for-each select="//interface">
477 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
478 <xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
479
480 <xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") )'>
481 <xsl:call-template name="emitNewline" />
482 <xsl:value-of select="concat('// Interface ', $ifname)" />
483 <xsl:call-template name="emitNewline" />
484
485 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat($ifname, ' interface: ', 'all attributes')" /></xsl:call-template>
486 <xsl:for-each select="attribute">
487 <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
488 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
489 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
490 <xsl:call-template name="emitNewline" />
491 <xsl:choose>
492 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
493 <xsl:value-of select="concat('// skipping attribute ', $attrtype, ' for it is of a suppressed type')" />
494 <xsl:call-template name="emitNewline" />
495 </xsl:when>
496 <xsl:otherwise>
497 <xsl:choose>
498 <xsl:when test="@readonly='yes'">
499 <xsl:value-of select="concat('// readonly attribute ', $ifname, '::', $attrname)" />
500 </xsl:when>
501 <xsl:otherwise>
502 <xsl:value-of select="concat('// read/write attribute ', $ifname, '::', $attrname)" />
503 </xsl:otherwise>
504 </xsl:choose>
505 <xsl:call-template name="emitNewline" />
506 <!-- aa) emit getter -->
507 <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
508 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrGetter, $G_requestMessageElementSuffix)" />
509 <xsl:call-template name="emitNewline" />
510 <xsl:text>{ public:</xsl:text>
511 <xsl:call-template name="emitNewline" />
512 <xsl:call-template name="emitRequestArgs">
513 <xsl:with-param name="_ifname" select="$ifname" />
514 <xsl:with-param name="_wsmap" select="$wsmap" />
515 <xsl:with-param name="_methodname" select="$attrGetter" />
516 <xsl:with-param name="_params" select="/.." />
517 <!-- <xsl:with-param name="_valuetype" select="$attrtype" /> -->
518 </xsl:call-template>
519 <xsl:text> struct soap *soap;</xsl:text>
520 <xsl:call-template name="emitNewline" />
521 <xsl:text>};</xsl:text>
522 <xsl:call-template name="emitNewline" />
523
524 <xsl:call-template name="emitNewline" />
525 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrGetter, $G_responseMessageElementSuffix)" />
526 <xsl:call-template name="emitNewline" />
527 <xsl:text>{ public:</xsl:text>
528 <xsl:call-template name="emitNewline" />
529 <xsl:call-template name="emitResultArgs">
530 <xsl:with-param name="_ifname" select="$ifname" />
531 <xsl:with-param name="_methodname" select="$attrGetter" />
532 <xsl:with-param name="_params" select="/.." />
533 <xsl:with-param name="_resulttype" select="$attrtype" />
534 </xsl:call-template>
535 <xsl:text> struct soap *soap;</xsl:text>
536 <xsl:call-template name="emitNewline" />
537 <xsl:text>};</xsl:text>
538 <xsl:call-template name="emitNewline" />
539 <!-- bb) emit setter if the attribute is read/write -->
540 <xsl:if test="not($attrreadonly='yes')">
541 <xsl:variable name="attrSetter"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
542 <xsl:call-template name="emitNewline" />
543 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrSetter, $G_requestMessageElementSuffix)" />
544 <xsl:call-template name="emitNewline" />
545 <xsl:text>{ public:</xsl:text>
546 <xsl:call-template name="emitRequestArgs">
547 <xsl:with-param name="_ifname" select="$ifname" />
548 <xsl:with-param name="_wsmap" select="$wsmap" />
549 <xsl:with-param name="_methodname" select="$attrSetter" />
550 <xsl:with-param name="_params" select="/.." />
551 <xsl:with-param name="_valuetype" select="$attrtype" />
552 </xsl:call-template>
553 <xsl:call-template name="emitNewline" />
554 <xsl:text> struct soap *soap;</xsl:text>
555 <xsl:call-template name="emitNewline" />
556 <xsl:text>};</xsl:text>
557 <xsl:call-template name="emitNewline" />
558 <xsl:call-template name="emitNewline" />
559 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrSetter, $G_responseMessageElementSuffix)" />
560 <xsl:call-template name="emitNewline" />
561 <xsl:text>{ public:</xsl:text>
562 <xsl:call-template name="emitNewline" />
563 <xsl:call-template name="emitResultArgs">
564 <xsl:with-param name="_ifname" select="$ifname" />
565 <xsl:with-param name="_methodname" select="$attrSetter" />
566 <xsl:with-param name="_params" select="/.." />
567 </xsl:call-template>
568 <xsl:text> struct soap *soap;</xsl:text>
569 <xsl:call-template name="emitNewline" />
570 <xsl:text>};</xsl:text>
571 <xsl:call-template name="emitNewline" />
572 </xsl:if>
573 </xsl:otherwise>
574 </xsl:choose>
575 </xsl:for-each> <!-- select="attribute" -->
576
577 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat($ifname, ' interface: ', 'all methods')" /></xsl:call-template>
578 <xsl:for-each select="method">
579 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
580 <xsl:call-template name="emitNewline" />
581 <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
582 <xsl:choose>
583 <xsl:when test="param[@type=($G_setSuppressedInterfaces/@name)]">
584 <xsl:value-of select="concat('// skipping method ', $ifname, '::', $methodname, ' for it has parameters with suppressed types')" />
585 <xsl:call-template name="emitNewline" />
586 </xsl:when>
587 <xsl:otherwise>
588 <xsl:value-of select="concat('// method ', $ifname, '::', $methodname)" />
589 <xsl:call-template name="emitNewline" />
590 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $methodname, $G_requestMessageElementSuffix)" />
591 <xsl:call-template name="emitNewline" />
592 <xsl:text>{ public:</xsl:text>
593 <xsl:call-template name="emitNewline" />
594 <xsl:call-template name="emitRequestArgs">
595 <xsl:with-param name="_ifname" select="$ifname" />
596 <xsl:with-param name="_wsmap" select="$wsmap" />
597 <xsl:with-param name="_methodname" select="$methodname" />
598 <xsl:with-param name="_params" select="param" />
599 </xsl:call-template>
600 <xsl:text> struct soap *soap;</xsl:text>
601 <xsl:call-template name="emitNewline" />
602 <xsl:text>};</xsl:text>
603 <xsl:call-template name="emitNewline" />
604 <!-- <xsl:if test="(count(param[@dir='out'] | param[@dir='return']) > 0)"> -->
605 <xsl:call-template name="emitNewline" />
606 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $methodname, $G_responseMessageElementSuffix)" />
607 <xsl:call-template name="emitNewline" />
608 <xsl:text>{ public:</xsl:text>
609 <xsl:call-template name="emitNewline" />
610 <xsl:call-template name="emitResultArgs">
611 <xsl:with-param name="_ifname" select="$ifname" />
612 <xsl:with-param name="_wsmap" select="$wsmap" />
613 <xsl:with-param name="_methodname" select="$methodname" />
614 <xsl:with-param name="_params" select="param" />
615 </xsl:call-template>
616 <xsl:text> struct soap *soap;</xsl:text>
617 <xsl:call-template name="emitNewline" />
618 <xsl:text>};</xsl:text>
619 <xsl:call-template name="emitNewline" />
620 <!-- </xsl:if> -->
621 </xsl:otherwise>
622 </xsl:choose>
623 </xsl:for-each>
624 </xsl:if>
625 </xsl:for-each> <!-- interface (element declarations -->
626
627 <xsl:text>
628/****************************************************************************
629 *
630 * service descriptions
631 *
632 ****************************************************************************/
633
634</xsl:text>
635
636 <xsl:value-of select="concat('//gsoap vbox service name: vbox', $G_bindingSuffix)" />
637 <xsl:call-template name="emitNewline" />
638 <xsl:value-of select="concat('//gsoap vbox service type: vbox', $G_portTypeSuffix)" />
639 <xsl:call-template name="emitNewline" />
640 <xsl:value-of select="concat('//gsoap vbox service namespace: ', $G_targetNamespace, $G_targetNamespaceSeparator)" />
641 <xsl:call-template name="emitNewline" />
642 <xsl:value-of select="concat('//gsoap vbox service transport: ', 'http://schemas.xmlsoap.org/soap/http')" />
643 <xsl:call-template name="emitNewline" />
644
645 </xsl:if> <!-- document style -->
646
647 <xsl:apply-templates />
648
649</xsl:template>
650
651<!-- - - - - - - - - - - - - - - - - - - - - - -
652 class
653 - - - - - - - - - - - - - - - - - - - - - - -->
654
655<xsl:template match="module/class">
656<!-- swallow -->
657</xsl:template>
658
659<!-- - - - - - - - - - - - - - - - - - - - - - -
660 enum
661 - - - - - - - - - - - - - - - - - - - - - - -->
662
663<xsl:template match="enum">
664</xsl:template>
665
666<!-- - - - - - - - - - - - - - - - - - - - - - -
667 const
668 - - - - - - - - - - - - - - - - - - - - - - -->
669
670<!--
671<xsl:template match="const">
672 <xsl:apply-templates />
673</xsl:template>
674-->
675
676<!-- - - - - - - - - - - - - - - - - - - - - - -
677 desc
678 - - - - - - - - - - - - - - - - - - - - - - -->
679
680<xsl:template match="desc">
681<!-- swallow -->
682</xsl:template>
683
684<!-- - - - - - - - - - - - - - - - - - - - - - -
685 note
686 - - - - - - - - - - - - - - - - - - - - - - -->
687
688<xsl:template match="note">
689 <xsl:apply-templates />
690</xsl:template>
691
692<xsl:template name="emitMethod">
693 <xsl:param name="ifname" />
694 <xsl:param name="methodname" />
695 <xsl:param name="fOutParams" />
696
697 <xsl:variable name="methodname2" select="concat($ifname, '_USCORE', $methodname)" />
698
699 <xsl:call-template name="emitNewline" />
700 <xsl:value-of select="concat('//gsoap vbox service method-style: ', $methodname2, ' ', $G_basefmt)" />
701 <xsl:call-template name="emitNewline" />
702 <xsl:value-of select="concat('//gsoap vbox service method-encoding: ', $methodname2, ' ', $G_parmfmt)" />
703 <xsl:call-template name="emitNewline" />
704 <xsl:value-of select="concat('//gsoap vbox service method-action: ', $methodname2, ' &quot;&quot;')" />
705 <xsl:call-template name="emitNewline" />
706 <xsl:value-of select="concat('//gsoap vbox service method-fault: ', $methodname2, ' vbox__InvalidObjectFault')" />
707 <xsl:call-template name="emitNewline" />
708 <xsl:value-of select="concat('//gsoap vbox service method-fault: ', $methodname2, ' vbox__RuntimeFault')" />
709 <xsl:call-template name="emitNewline" />
710 <xsl:value-of select="concat('int __vbox__', $methodname2, '(')" />
711 <xsl:call-template name="emitNewline" />
712 <xsl:value-of select="concat(' _vbox__', $methodname2, $G_requestMessageElementSuffix, '* vbox__', $ifname, '_USCORE', $methodname, $G_requestMessageElementSuffix)" />
713 <xsl:if test="$fOutParams">
714 <xsl:text>,</xsl:text>
715 <xsl:call-template name="emitNewline" />
716 <xsl:value-of select="concat(' _vbox__', $methodname2, $G_responseMessageElementSuffix, '* vbox__', $ifname, '_USCORE', $methodname, $G_responseMessageElementSuffix)" />
717 </xsl:if>
718 <xsl:call-template name="emitNewline" />
719 <xsl:text>);</xsl:text>
720 <xsl:call-template name="emitNewline" />
721
722</xsl:template>
723
724<!-- - - - - - - - - - - - - - - - - - - - - - -
725 interface
726 - - - - - - - - - - - - - - - - - - - - - - -->
727
728<xsl:template match="interface">
729 <!-- remember the interface name in local variables -->
730 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
731 <xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
732
733 <!-- we can save ourselves verifying the interface here as it's already
734 done in the WSDL converter -->
735
736 <xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") )'>
737 <xsl:text>
738/****************************************************************************
739 *
740 * interface </xsl:text>
741<xsl:value-of select="$ifname" />
742<xsl:text>
743 *
744 ****************************************************************************/
745</xsl:text>
746
747 <!--
748 here come the attributes
749 -->
750 <xsl:for-each select="attribute">
751 <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
752 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
753 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
754 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('messages for ', $ifname, '::', $attrname, ': attribute of type &quot;', $attrtype, '&quot;, readonly: ', $attrreadonly)" /></xsl:call-template>
755 <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
756 <xsl:choose>
757 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
758 <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrtype, ' for it is of a suppressed type')" /></xsl:comment>
759 </xsl:when>
760 <xsl:otherwise>
761 <xsl:choose>
762 <xsl:when test="@readonly='yes'">
763 <xsl:comment> readonly attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
764 </xsl:when>
765 <xsl:otherwise>
766 <xsl:comment> read/write attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
767 </xsl:otherwise>
768 </xsl:choose>
769 <!-- aa) get method: emit request and result -->
770 <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
771 <xsl:call-template name="emitMethod">
772 <xsl:with-param name="ifname" select="$ifname" />
773 <xsl:with-param name="methodname" select="$attrGetter" />
774 <xsl:with-param name="fOutParams" select="1" />
775 </xsl:call-template>
776 <!-- bb) emit a set method if the attribute is read/write -->
777 <xsl:if test="not($attrreadonly='yes')">
778 <xsl:variable name="attrSetter"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
779 <xsl:call-template name="emitMethod">
780 <xsl:with-param name="ifname" select="$ifname" />
781 <xsl:with-param name="methodname" select="$attrSetter" />
782 <xsl:with-param name="fOutParams" select="1" />
783 </xsl:call-template>
784 </xsl:if>
785 </xsl:otherwise>
786 </xsl:choose>
787 </xsl:for-each> <!-- select="attribute" -->
788
789 <!--
790 here come the real methods
791 -->
792
793 <xsl:for-each select="method">
794 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
795
796 <xsl:choose>
797 <xsl:when test="param[@type=($G_setSuppressedInterfaces/@name)]">
798 <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
799 </xsl:when>
800 <xsl:otherwise>
801 <xsl:call-template name="emitMethod">
802 <xsl:with-param name="ifname" select="$ifname" />
803 <xsl:with-param name="methodname" select="$methodname" />
804 <xsl:with-param name="fOutParams" select="1" /> <!-- (count(param[@dir='out'] | param[@dir='return']) > 0)" /> -->
805 </xsl:call-template>
806 </xsl:otherwise>
807 </xsl:choose>
808 </xsl:for-each>
809 </xsl:if>
810
811</xsl:template>
812
813</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette