VirtualBox

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

Last change on this file since 26600 was 26370, checked in by vboxsync, 15 years ago

Webservice: code documentation

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