VirtualBox

source: vbox/trunk/src/VBox/Main/webservice/websrv-cpp.xsl@ 20851

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

Webservice: handle NULL pointer object arguments in methods and return values correctly, both in raw webservice and OO JAX-WS wrappers

  • Property svn:eol-style set to native
File size: 69.7 KB
Line 
1<?xml version="1.0"?>
2
3<!--
4 websrv-cpp.xsl:
5 XSLT stylesheet that generates methodmaps.cpp from
6 VirtualBox.xidl. This generated C++ code contains
7 all the service implementations that one would
8 normally have to implement manually to create a
9 web service; our generated code automatically maps
10 all SOAP calls into COM/XPCOM method calls.
11
12 Copyright (C) 2006-2008 Sun Microsystems, Inc.
13
14 This file is part of VirtualBox Open Source Edition (OSE), as
15 available from http://www.virtualbox.org. This file is free software;
16 you can redistribute it and/or modify it under the terms of the GNU
17 General Public License (GPL) as published by the Free Software
18 Foundation, in version 2 as it comes in the "COPYING" file of the
19 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
20 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
21
22 Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23 Clara, CA 95054 USA or visit http://www.sun.com if you need
24 additional information or have any questions.
25-->
26
27<xsl:stylesheet
28 version="1.0"
29 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
30 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
31 xmlns:exsl="http://exslt.org/common"
32 extension-element-prefixes="exsl">
33
34 <xsl:output method="text"/>
35
36 <xsl:strip-space elements="*"/>
37
38<!-- - - - - - - - - - - - - - - - - - - - - - -
39 global XSLT variables
40 - - - - - - - - - - - - - - - - - - - - - - -->
41
42<xsl:variable name="G_xsltFilename" select="'websrv-cpp.xsl'" />
43
44<xsl:include href="websrv-shared.inc.xsl" />
45
46<!-- collect all interfaces with "wsmap='suppress'" in a global variable for
47 quick lookup -->
48<xsl:variable name="G_setSuppressedInterfaces"
49 select="//interface[@wsmap='suppress']" />
50
51<!-- - - - - - - - - - - - - - - - - - - - - - -
52 root match
53 - - - - - - - - - - - - - - - - - - - - - - -->
54
55<xsl:template match="/idl">
56 <xsl:text><![CDATA[
57/* DO NOT EDIT! This is a generated file.
58 * Generated from: src/VBox/Main/idl/VirtualBox.xidl (VirtualBox's interface definitions in XML)
59 * Generator: src/VBox/Main/webservice/websrv-cpp.xsl
60 */
61
62// vbox headers
63#include <VBox/com/com.h>
64#include <VBox/com/array.h>
65#include <VBox/com/string.h>
66#include <VBox/com/Guid.h>
67#include <VBox/com/ErrorInfo.h>
68#include <VBox/com/errorprint2.h>
69#include <VBox/com/EventQueue.h>
70#include <VBox/com/VirtualBox.h>
71#include <VBox/err.h>
72#include <VBox/log.h>
73
74#include <iprt/initterm.h>
75#include <iprt/stream.h>
76#include <iprt/string.h>
77
78// gSOAP headers (must come after vbox includes because it checks for conflicting defs)
79#include "soapH.h"
80
81// standard headers
82#include <map>
83#include <sstream>
84
85// shared webservice header
86#include "vboxweb.h"
87
88// shared strings for debug output
89const char *g_pcszCallingComMethod = " calling COM method %s\n";
90const char *g_pcszDoneCallingComMethod = " done calling COM method\n";
91const char *g_pcszConvertComOutputBack = " convert COM output \"%s\" back to caller format\n";
92const char *g_pcszDoneConvertingComOutputBack = " done converting COM output \"%s\" back to caller format\n";
93const char *g_pcszEntering = "\n-- entering %s\n";
94const char *g_pcszLeaving = "-- leaving %s, rc: 0x%lX (%d)\n";
95
96// generated string constants for all interface names
97const char *g_pcszIUnknown = "IUnknown";
98]]></xsl:text>
99
100 <xsl:for-each select="//interface">
101 <xsl:variable name="ifname" select="@name" />
102 <xsl:value-of select="concat('const char *g_pcsz', $ifname, ' = &quot;', $ifname, '&quot;;')" />
103 <xsl:call-template name="emitNewline" />
104 </xsl:for-each>
105 <xsl:apply-templates />
106</xsl:template>
107
108<!-- - - - - - - - - - - - - - - - - - - - - - -
109 if
110 - - - - - - - - - - - - - - - - - - - - - - -->
111
112<!--
113 * ignore all |if|s except those for WSDL target
114-->
115<xsl:template match="if">
116 <xsl:if test="@target='wsdl'">
117 <xsl:apply-templates/>
118 </xsl:if>
119</xsl:template>
120
121<!-- - - - - - - - - - - - - - - - - - - - - - -
122 cpp
123 - - - - - - - - - - - - - - - - - - - - - - -->
124
125<xsl:template match="cpp">
126<!-- ignore this -->
127</xsl:template>
128
129<!-- - - - - - - - - - - - - - - - - - - - - - -
130 library
131 - - - - - - - - - - - - - - - - - - - - - - -->
132
133<xsl:template match="library">
134 <xsl:text>
135/****************************************************************************
136 *
137 * types: enum converter helper functions
138 *
139 ****************************************************************************/
140 </xsl:text>
141 <!--
142 enum converter functions at top of file
143 -->
144 <xsl:for-each select="//enum">
145 <xsl:variable name="enumname" select="@name" />
146 <!-- generate enum converter for COM-to-SOAP -->
147 <xsl:call-template name="emitNewline" />
148 <xsl:value-of select="concat('vbox__', $enumname, ' ', $G_funcPrefixOutputEnumConverter, $enumname, '(', $enumname, '_T e)')" />
149 <xsl:call-template name="emitNewline" />
150 <xsl:text>{</xsl:text>
151 <xsl:call-template name="emitNewline" />
152 <xsl:value-of select="concat(' vbox__', $enumname, ' v;')" />
153 <xsl:call-template name="emitNewline" />
154 <xsl:call-template name="emitNewline" />
155 <xsl:text> switch(e)</xsl:text>
156 <xsl:call-template name="emitNewline" />
157 <xsl:text> {</xsl:text>
158 <xsl:call-template name="emitNewline" />
159 <xsl:for-each select="const[not(@wsmap='suppress')]">
160 <xsl:variable name="enumconst" select="@name" />
161 <xsl:value-of select="concat(' case ', $enumname, '_', $enumconst, ':')" />
162 <xsl:call-template name="emitNewlineIndent8" />
163 <xsl:value-of select="concat(' v = vbox__', $enumname, '__')" />
164 <!-- escape all "_" in $enumconst -->
165 <xsl:call-template name="escapeUnderscores">
166 <xsl:with-param name="string" select="$enumconst" />
167 </xsl:call-template>
168 <xsl:value-of select="';'" />
169 <xsl:call-template name="emitNewlineIndent8" />
170 <xsl:text>break;</xsl:text>
171 <xsl:call-template name="emitNewline" />
172 </xsl:for-each>
173 <xsl:text> }</xsl:text>
174 <xsl:call-template name="emitNewline" />
175 <xsl:call-template name="emitNewline" />
176 <xsl:text> return v;</xsl:text>
177 <xsl:call-template name="emitNewline" />
178 <xsl:text>}</xsl:text>
179 <xsl:call-template name="emitNewline" />
180 <!-- generate enum converter for SOAP-to-COM -->
181 <xsl:call-template name="emitNewline" />
182 <xsl:value-of select="concat($enumname, '_T ', $G_funcPrefixInputEnumConverter, $enumname, '(vbox__', $enumname, ' v)')" />
183 <xsl:call-template name="emitNewline" />
184 <xsl:text>{</xsl:text>
185 <xsl:call-template name="emitNewline" />
186 <xsl:value-of select="concat(' ', $enumname, '_T e;')" />
187 <xsl:call-template name="emitNewline" />
188 <xsl:call-template name="emitNewline" />
189 <xsl:text> switch(v)</xsl:text>
190 <xsl:call-template name="emitNewline" />
191 <xsl:text> {</xsl:text>
192 <xsl:call-template name="emitNewline" />
193 <xsl:for-each select="const[not(@wsmap='suppress')]">
194 <xsl:variable name="enumconst" select="@name" />
195 <xsl:value-of select="concat(' case vbox__', $enumname, '__')" />
196 <!-- escape all "_" in $enumconst -->
197 <xsl:call-template name="escapeUnderscores">
198 <xsl:with-param name="string" select="$enumconst" />
199 </xsl:call-template>
200 <xsl:value-of select="':'" />
201 <xsl:call-template name="emitNewlineIndent8" />
202 <xsl:value-of select="concat(' e = ', $enumname, '_', $enumconst, ';')" />
203 <xsl:call-template name="emitNewlineIndent8" />
204 <xsl:text>break;</xsl:text>
205 <xsl:call-template name="emitNewline" />
206 </xsl:for-each>
207 <xsl:text> }</xsl:text>
208 <xsl:call-template name="emitNewline" />
209 <xsl:call-template name="emitNewline" />
210 <xsl:text> return e;</xsl:text>
211 <xsl:call-template name="emitNewline" />
212 <xsl:text>}</xsl:text>
213 <xsl:call-template name="emitNewline" />
214 </xsl:for-each>
215
216 <xsl:text>
217/****************************************************************************
218 *
219 * types: struct converter helper functions
220 *
221 ****************************************************************************/
222 </xsl:text>
223
224 <xsl:for-each select="//interface[@wsmap='struct']">
225 <xsl:variable name="structname" select="@name" />
226
227 <xsl:call-template name="emitNewline" />
228 <xsl:value-of select="concat('// ', $structname, ' converter: called from method mappers to convert data from')" />
229 <xsl:call-template name="emitNewline" />
230 <xsl:value-of select="concat('// COM interface ', $structname, ', which has wsmap=&quot;struct&quot;, to SOAP structures')" />
231 <xsl:call-template name="emitNewline" />
232 <xsl:value-of select="concat('vbox__', $structname, '* ', $G_funcPrefixOutputEnumConverter, $structname, '(')" />
233 <xsl:call-template name="emitNewline" />
234 <xsl:value-of select="' struct soap *soap,'" />
235 <xsl:call-template name="emitNewline" />
236 <xsl:value-of select="' const WSDLT_ID &amp;idThis,'" />
237 <xsl:call-template name="emitNewline" />
238 <xsl:value-of select="' HRESULT &amp;rc,'" />
239 <xsl:call-template name="emitNewline" />
240 <xsl:value-of select="concat(' ComPtr&lt;', $structname, '&gt; &amp;in)')" />
241 <xsl:call-template name="emitNewline" />
242 <xsl:text>{</xsl:text>
243 <xsl:call-template name="emitNewline" />
244
245 <xsl:value-of select="concat(' vbox__', $structname, ' *resp = NULL;')" />
246 <xsl:call-template name="emitNewline" />
247
248 <xsl:call-template name="emitPrologue"><xsl:with-param name="fSkipHRESULT" select="'1'"/></xsl:call-template>
249
250 <xsl:value-of select="concat(' resp = soap_new_vbox__', $structname, '(soap, 1);')" />
251 <xsl:call-template name="emitNewline" />
252 <xsl:call-template name="emitNewline" />
253
254 <xsl:for-each select="//interface[@name=$structname]/attribute">
255 <xsl:value-of select="concat(' // -- ', $structname, '.', @name)" />
256 <xsl:call-template name="emitNewline" />
257 <!-- recurse! -->
258 <xsl:call-template name="emitGetAttributeComCall">
259 <xsl:with-param name="ifname" select="$structname" />
260 <xsl:with-param name="object" select="'in'" />
261 <xsl:with-param name="attrname" select="@name" />
262 <xsl:with-param name="attrtype" select="@type" />
263 <xsl:with-param name="callerprefix" select="concat('out', '.')" />
264 </xsl:call-template>
265 <xsl:call-template name="emitNewline" />
266 </xsl:for-each>
267
268 <xsl:call-template name="emitEpilogue"><xsl:with-param name="fSkipHRESULT" select="'1'"/></xsl:call-template>
269
270 </xsl:for-each>
271
272 <xsl:apply-templates />
273</xsl:template>
274
275<!-- - - - - - - - - - - - - - - - - - - - - - -
276 class
277 - - - - - - - - - - - - - - - - - - - - - - -->
278
279<xsl:template match="module/class">
280<!-- TODO swallow for now -->
281</xsl:template>
282
283<!-- - - - - - - - - - - - - - - - - - - - - - -
284 enum
285 - - - - - - - - - - - - - - - - - - - - - - -->
286
287<xsl:template match="enum">
288</xsl:template>
289
290<!-- - - - - - - - - - - - - - - - - - - - - - -
291 const
292 - - - - - - - - - - - - - - - - - - - - - - -->
293
294<!--
295<xsl:template match="const">
296 <xsl:apply-templates />
297</xsl:template>
298-->
299
300<!-- - - - - - - - - - - - - - - - - - - - - - -
301 desc
302 - - - - - - - - - - - - - - - - - - - - - - -->
303
304<xsl:template match="desc">
305<!-- TODO swallow for now -->
306</xsl:template>
307
308<!-- - - - - - - - - - - - - - - - - - - - - - -
309 note
310 - - - - - - - - - - - - - - - - - - - - - - -->
311
312<xsl:template match="note">
313<!-- TODO -->
314 <xsl:apply-templates />
315</xsl:template>
316
317<!--
318 emitBeginOfFunctionHeader:
319-->
320
321<xsl:template name="emitBeginOfFunctionHeader">
322 <xsl:param name="ifname" />
323 <xsl:param name="method" />
324
325 <xsl:call-template name="emitNewline" />
326 <xsl:value-of select="concat('int __vbox__', $ifname, '_USCORE', $method, '(')" />
327 <xsl:call-template name="emitNewline" />
328 <xsl:text> struct soap *soap</xsl:text>
329</xsl:template>
330
331<!--
332 convertTypeAndEmitArg:
333 first type converter (from XIDL type to SOAP/C++ input types),
334 used for generating the argument lists with method implementation
335 headers.
336-->
337<xsl:template name="convertTypeAndEmitArg">
338 <xsl:param name="ifname" />
339 <xsl:param name="method" />
340 <xsl:param name="name" />
341 <xsl:param name="type" />
342 <xsl:param name="dir" />
343 <xsl:param name="fFirst" />
344 <xsl:if test="not($fFirst)">
345 <xsl:text>,</xsl:text>
346 <xsl:call-template name="emitNewline" />
347 </xsl:if>
348 <xsl:text> </xsl:text>
349 <xsl:choose>
350 <xsl:when test="$type='wstring'">std::string</xsl:when>
351 <xsl:when test="$type='boolean'">bool</xsl:when>
352 <xsl:when test="$type='double'">double</xsl:when>
353 <xsl:when test="$type='float'">float</xsl:when>
354 <!-- <xsl:when test="$type='octet'">byte</xsl:when> -->
355 <xsl:when test="$type='short'">short</xsl:when>
356 <xsl:when test="$type='unsigned short'">unsigned short</xsl:when>
357 <xsl:when test="$type='long'">long</xsl:when>
358 <xsl:when test="$type='long long'">long long</xsl:when>
359 <xsl:when test="$type='unsigned long'">unsigned long</xsl:when>
360 <xsl:when test="$type='unsigned long long'">unsigned long long</xsl:when>
361 <xsl:when test="$type='result'">unsigned long</xsl:when>
362 <xsl:when test="$type='uuid'">vbox__uuid</xsl:when>
363 <xsl:when test="$type='global'"><xsl:value-of select="$G_typeObjectRef_CPP" /></xsl:when>
364 <xsl:when test="$type='managed'"><xsl:value-of select="$G_typeObjectRef_CPP" /></xsl:when>
365 <!-- not a standard type: then it better be one of the types defined in the XIDL -->
366 <xsl:when test="//enum[@name=$type]">
367 <xsl:choose>
368 <xsl:when test="$dir='return'">
369 <xsl:value-of select="concat('struct ', $ifname, '__', $method, 'Response')" />
370 </xsl:when>
371 <xsl:otherwise>
372 <xsl:value-of select="concat('enum vbox__', $type)" />
373 </xsl:otherwise>
374 </xsl:choose>
375 </xsl:when>
376 <xsl:when test="//collection[@name=$type]">
377 <xsl:choose>
378 <xsl:when test="$dir='return'">
379 <xsl:value-of select="concat('struct ', $ifname, '__', $method, 'Response')" />
380 </xsl:when>
381 <xsl:otherwise>
382 <xsl:value-of select="concat('vbox__', $type)" />
383 </xsl:otherwise>
384 </xsl:choose>
385 </xsl:when>
386 <xsl:when test="//interface[@name=$type]">
387 <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
388 <xsl:variable name="wsmap" select="(//interface[@name=$type]/@wsmap) | (//collection[@name=$type]/@wsmap)" />
389 <xsl:if test="not($wsmap)">
390 <xsl:call-template name="fatalError">
391 <xsl:with-param name="msg" select="concat('convertTypeAndEmitArg: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $ifname, '::', $method, '&quot; lacks wsmap attribute value in XIDL.')" />
392 </xsl:call-template>
393 </xsl:if>
394 <xsl:choose>
395 <xsl:when test="$wsmap='global'"><xsl:value-of select="$G_typeObjectRef_CPP" /></xsl:when>
396 <xsl:when test="$wsmap='managed'"><xsl:value-of select="$G_typeObjectRef_CPP" /></xsl:when>
397 <xsl:when test="$wsmap='struct'"><xsl:value-of select="concat('struct ', $ifname, '__', $method, 'Response')" /></xsl:when>
398 <xsl:otherwise>
399 <xsl:call-template name="fatalError">
400 <xsl:with-param name="msg" select="concat('convertTypeAndEmitArg: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $ifname, '::', $method, '&quot; has invalid wsmap attribute value &quot;', $wsmap, '&quot; in XIDL.')" />
401 </xsl:call-template>
402 </xsl:otherwise>
403 </xsl:choose>
404 </xsl:when>
405 </xsl:choose>
406 <!-- space between type & identifier -->
407 <xsl:text> </xsl:text>
408 <xsl:if test="$dir='return'"><xsl:text>&amp;</xsl:text></xsl:if>
409 <!-- identifier -->
410 <xsl:copy-of select="$name" />
411</xsl:template>
412
413<!--
414 emitCppTypeForWSDLType:
415 emits the C++ type that corresponds to the given WSDL type in $type.
416 -->
417<xsl:template name="emitCppTypeForWSDLType">
418 <xsl:param name="method" />
419 <xsl:param name="type" />
420 <xsl:param name="safearray" />
421 <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
422 <xsl:param name="inptr" /> <!-- whether to add INPTR to BSTR (Dmitry template magic) -->
423
424 <xsl:choose>
425 <xsl:when test="$type='boolean'">
426 <xsl:call-template name="emitTypeOrArray">
427 <xsl:with-param name="type" select="'BOOL'"/>
428 <xsl:with-param name="safearray" select="$safearray"/>
429 </xsl:call-template>
430 </xsl:when>
431 <xsl:when test="$type='short'">
432 <xsl:call-template name="emitTypeOrArray">
433 <xsl:with-param name="type" select="'SHORT'"/>
434 <xsl:with-param name="safearray" select="$safearray"/>
435 </xsl:call-template>
436 </xsl:when>
437 <xsl:when test="$type='unsigned short'">
438 <xsl:call-template name="emitTypeOrArray">
439 <xsl:with-param name="type" select="'USHORT'"/>
440 <xsl:with-param name="safearray" select="$safearray"/>
441 </xsl:call-template>
442 </xsl:when>
443 <xsl:when test="$type='long'">
444 <xsl:call-template name="emitTypeOrArray">
445 <xsl:with-param name="type" select="'LONG'"/>
446 <xsl:with-param name="safearray" select="$safearray"/>
447 </xsl:call-template>
448 </xsl:when>
449 <xsl:when test="$type='unsigned long'">
450 <xsl:call-template name="emitTypeOrArray">
451 <xsl:with-param name="type" select="'ULONG'"/>
452 <xsl:with-param name="safearray" select="$safearray"/>
453 </xsl:call-template>
454 </xsl:when>
455 <xsl:when test="$type='long long'">
456 <xsl:call-template name="emitTypeOrArray">
457 <xsl:with-param name="type" select="'LONG64'"/>
458 <xsl:with-param name="safearray" select="$safearray"/>
459 </xsl:call-template>
460 </xsl:when>
461 <xsl:when test="$type='unsigned long long'">
462 <xsl:call-template name="emitTypeOrArray">
463 <xsl:with-param name="type" select="'ULONG64'"/>
464 <xsl:with-param name="safearray" select="$safearray"/>
465 </xsl:call-template>
466 </xsl:when>
467 <xsl:when test="$type='result'">
468 <xsl:call-template name="emitTypeOrArray">
469 <xsl:with-param name="type" select="'HRESULT'"/>
470 <xsl:with-param name="safearray" select="$safearray"/>
471 </xsl:call-template>
472 </xsl:when>
473 <xsl:when test="$type='uuid'">
474 <xsl:choose>
475 <xsl:when test="$safearray='yes'">
476 <xsl:value-of select="'com::SafeGUIDArray'" />
477 </xsl:when>
478 <xsl:otherwise>
479 <xsl:value-of select="'com::Guid'" />
480 </xsl:otherwise>
481 </xsl:choose>
482 </xsl:when>
483 <xsl:when test="$type='wstring'">
484 <xsl:choose>
485 <xsl:when test="$safearray='yes'">
486 <xsl:choose>
487 <xsl:when test="$inptr='yes'">
488 <xsl:value-of select="'com::SafeArray&lt;IN_BSTR&gt;'" /> <!-- input string arrays must use IN_BSTR (see com/array.h) -->
489 </xsl:when>
490 <xsl:otherwise>
491 <xsl:value-of select="'com::SafeArray&lt;BSTR&gt;'" /> <!-- output string arrays use raw BSTR -->
492 </xsl:otherwise>
493 </xsl:choose>
494 </xsl:when>
495 <xsl:otherwise>
496 <xsl:value-of select="'com::Bstr'" />
497 </xsl:otherwise>
498 </xsl:choose>
499 </xsl:when>
500 <xsl:when test="//enum[@name=$type]">
501 <xsl:call-template name="emitTypeOrArray">
502 <xsl:with-param name="type" select="concat($type, '_T ')"/>
503 <xsl:with-param name="safearray" select="$safearray"/>
504 </xsl:call-template>
505 </xsl:when>
506 <xsl:when test="$type='$unknown'">
507 <xsl:choose>
508 <xsl:when test="$safearray='yes'">
509 <xsl:value-of select="'com::SafeIfaceArray&lt;IUnknown&gt;'" />
510 </xsl:when>
511 <xsl:otherwise>
512 <xsl:value-of select="'ComPtr&lt;IUnknown&gt;'" />
513 </xsl:otherwise>
514 </xsl:choose>
515 </xsl:when>
516 <xsl:when test="//interface[@name=$type]">
517 <xsl:variable name="thatif" select="//interface[@name=$type]" />
518 <xsl:variable name="thatifname" select="$thatif/@name" />
519 <xsl:choose>
520 <xsl:when test="$safearray='yes'">
521 <xsl:value-of select="concat('com::SafeIfaceArray&lt;', $thatifname, '&gt;')" />
522 </xsl:when>
523 <xsl:otherwise>
524 <xsl:value-of select="concat('ComPtr&lt;', $thatifname, '&gt;')" />
525 </xsl:otherwise>
526 </xsl:choose>
527 </xsl:when>
528 <xsl:when test="//collection[@name=$type]">
529 <xsl:variable name="thatif" select="//collection[@name=$type]" />
530 <xsl:variable name="thatifname" select="$thatif/@name" />
531 <xsl:value-of select="concat('ComPtr&lt;', $thatifname, '&gt;')" />
532 </xsl:when>
533 <xsl:otherwise>
534 <xsl:call-template name="fatalError">
535 <xsl:with-param name="msg" select="concat('emitOutputArgBuffer: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; is not supported.')" />
536 </xsl:call-template>
537 </xsl:otherwise>
538 </xsl:choose>
539</xsl:template>
540
541
542<!--
543 emitDocumentStyleArgStructs:
544 with WSDL "document" style only, emits those lengthy structs for
545 the input and output argument in the function header.
546-->
547<xsl:template name="emitDocumentStyleArgStructs">
548 <xsl:param name="ifname" />
549 <xsl:param name="methodname" />
550 <xsl:param name="fOutputs" /> <!-- if 1, emit output struct as well -->
551
552 <xsl:text>,</xsl:text>
553 <xsl:call-template name="emitNewline" />
554 <xsl:value-of select="concat(' _vbox__', $ifname, '_USCORE', $methodname, $G_requestMessageElementSuffix, ' *', $G_requestElementVarName)" />
555 <xsl:if test="$fOutputs">
556 <xsl:text>,</xsl:text>
557 <xsl:call-template name="emitNewline" />
558 <xsl:value-of select="concat(' _vbox__', $ifname, '_USCORE', $methodname, $G_responseMessageElementSuffix, ' *', $G_responseElementVarName)" />
559 <!-- <xsl:value-of select="concat(' struct ', $ifname, '__', $methodname, 'Response &amp;', $G_result)" /> -->
560 </xsl:if>
561
562</xsl:template>
563
564<!--
565 emitPrologue:
566 emits the closing ")" for the parameter list and the beginning
567 of the function body.
568 -->
569<xsl:template name="emitPrologue">
570 <xsl:text> WEBDEBUG((g_pcszEntering, __FUNCTION__));
571
572 do {</xsl:text>
573 <xsl:call-template name="emitNewline" />
574</xsl:template>
575
576<!--
577 emitEpilogue
578 -->
579<xsl:template name="emitEpilogue">
580 <xsl:param name="fSkipHRESULT" />
581
582 <xsl:text> } while (0);</xsl:text>
583 <xsl:call-template name="emitNewline" />
584 <xsl:call-template name="emitNewline" />
585 <xsl:text> WEBDEBUG((g_pcszLeaving, __FUNCTION__, rc, rc));</xsl:text>
586 <xsl:call-template name="emitNewline" />
587 <xsl:if test="not($fSkipHRESULT)">
588 <xsl:text>
589 if (rc)
590 return SOAP_FAULT;
591 return SOAP_OK;</xsl:text>
592 </xsl:if>
593 <xsl:if test="$fSkipHRESULT">
594 <xsl:text> return resp;</xsl:text>
595 </xsl:if>
596 <xsl:call-template name="emitNewline" />
597 <xsl:text>}</xsl:text>
598 <xsl:call-template name="emitNewline" />
599</xsl:template>
600
601<!--
602 emitObjForMethod:
603 after the function prologue, emit a "pObj" object that
604 specifies the object upon which the method should be invoked.
605-->
606<xsl:template name="emitObjForMethod">
607 <xsl:param name="ifname" />
608 <xsl:param name="wsmap" />
609 <xsl:param name="structprefix" /> <!-- with WSDL document style: req element prefix, like "vbox__IVirtualBox_USCOREcreateMachineRequestElement->" -->
610
611 <xsl:choose>
612 <xsl:when test="$wsmap='global'">
613 <xsl:choose>
614 <xsl:when test="$ifname='IVirtualBox'">
615 <xsl:text> // invoke method on global IVirtualBox instance</xsl:text>
616 <xsl:call-template name="emitNewlineIndent8" />
617 <xsl:text>ComPtr&lt;IVirtualBox&gt; pObj = G_pVirtualBox;</xsl:text>
618 <xsl:call-template name="emitNewline" />
619 </xsl:when>
620 <xsl:otherwise>
621 <xsl:call-template name="fatalError">
622 <xsl:with-param name="msg" select="concat('emitObjForMethod: Unknown interface &quot;', $ifname, '&quot; with wsmap=global in XIDL.')" />
623 </xsl:call-template>
624 </xsl:otherwise>
625 </xsl:choose>
626 </xsl:when>
627 <xsl:when test="($wsmap='managed')">
628 <xsl:text> // look up managed object reference for method call&#10;</xsl:text>
629 <xsl:value-of select="concat(' ComPtr&lt;', $ifname, '&gt; pObj;&#10;')" />
630 <xsl:value-of select="concat(' if (!', $G_requestElementVarName, ')&#10;')" />
631 <xsl:text> {&#10;</xsl:text>
632 <xsl:text> RaiseSoapInvalidObjectFault(soap, "");&#10;</xsl:text>
633 <xsl:text> break;&#10;</xsl:text>
634 <xsl:text> }&#10;</xsl:text>
635 <xsl:value-of select="concat(' const WSDLT_ID &amp;idThis = ', $structprefix, $G_nameObjectRefEncoded, ';&#10;')" />
636 <xsl:value-of select="' if ((rc = findComPtrFromId(soap, idThis, pObj, false)))&#10;'" />
637 <xsl:text> break;&#10;</xsl:text>
638 </xsl:when>
639 </xsl:choose>
640</xsl:template>
641
642<!--
643 emitInputArgConverter:
644 another type converter (from wsdl type to COM types),
645 that generates temporary variables on the stack with
646 the WSDL input parameters converted to the COM types,
647 so we can then pass them to the actual COM method call.
648-->
649<xsl:template name="emitInputArgConverter">
650 <xsl:param name="method" />
651 <xsl:param name="structprefix" /> <!-- with WSDL document style: req element prefix, like "vbox__IVirtualBox_USCOREcreateMachineRequestElement->" -->
652 <xsl:param name="name" />
653 <xsl:param name="type" />
654 <xsl:param name="safearray" />
655
656 <xsl:value-of select="concat(' // convert input arg ', $name)" />
657 <xsl:call-template name="emitNewlineIndent8" />
658
659 <xsl:choose>
660 <xsl:when test="$safearray='yes'">
661 <xsl:value-of select="concat('size_t c', $name, ' = ', $structprefix, $name, '.size();')" />
662 <xsl:call-template name="emitNewlineIndent8" />
663 <xsl:call-template name="emitCppTypeForWSDLType">
664 <xsl:with-param name="method" select="$method"/>
665 <xsl:with-param name="type" select="$type"/>
666 <xsl:with-param name="safearray" select="$safearray"/>
667 <xsl:with-param name="inptr" select="'yes'"/>
668 </xsl:call-template>
669 <xsl:value-of select="concat(' comcall_', $name, '(c', $name, ');')" />
670 <xsl:call-template name="emitNewlineIndent8" />
671 <xsl:value-of select="concat('for (size_t i = 0; i &lt; c', $name, '; ++i)')" />
672 <xsl:call-template name="emitNewlineIndent8" />
673 <xsl:value-of select="'{'" />
674 <xsl:call-template name="emitNewlineIndent8" />
675 <xsl:choose>
676 <xsl:when test="$type='$unknown'">
677 <xsl:value-of select="' ComPtr&lt;IUnknown&gt; tmpObject;'" />
678 <xsl:call-template name="emitNewlineIndent8" />
679 <xsl:value-of select="concat(' if ((rc = findComPtrFromId(soap, ', $structprefix, $name, '[i], tmpObject, true)))')" />
680 <xsl:call-template name="emitNewlineIndent8" />
681 <xsl:text> break;</xsl:text>
682 <xsl:call-template name="emitNewlineIndent8" />
683 <xsl:value-of select="concat(' IUnknown *tmpObject2(tmpObject); tmpObject2->AddRef(); comcall_', $name, '[i] = tmpObject;')" />
684 </xsl:when>
685 <xsl:when test="$type='wstring'">
686 <xsl:value-of select="concat(' com::Bstr tmpObject(', $structprefix, $name, '[i].c_str());')" />
687 <xsl:call-template name="emitNewlineIndent8" />
688 <xsl:value-of select="' BSTR tmpObjectB;'" />
689 <xsl:call-template name="emitNewlineIndent8" />
690 <xsl:value-of select="' tmpObject.detachTo(&amp;tmpObjectB);'" />
691 <xsl:call-template name="emitNewlineIndent8" />
692 <xsl:value-of select="concat(' comcall_', $name, '[i] = tmpObjectB;')" />
693 </xsl:when>
694 <xsl:when test="$type='long'">
695 <xsl:call-template name="emitNewlineIndent8" />
696 <xsl:value-of select="concat(' comcall_', $name, '[i] = ', $structprefix, $name, '[i];')" />
697 </xsl:when>
698 <xsl:when test="$type='boolean'">
699 <xsl:call-template name="emitNewlineIndent8" />
700 <xsl:value-of select="concat(' comcall_', $name, '[i] = ', $structprefix, $name, '[i];')" />
701 </xsl:when>
702 <xsl:otherwise>
703 <xsl:call-template name="fatalError">
704 <xsl:with-param name="msg" select="concat('emitInputArgConverter Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; is not yet supported in safearrays.')" />
705 </xsl:call-template>
706 </xsl:otherwise>
707 </xsl:choose>
708 <xsl:call-template name="emitNewlineIndent8" />
709 <xsl:value-of select="'}'" />
710 <xsl:call-template name="emitNewline" />
711 </xsl:when>
712 <xsl:otherwise>
713 <xsl:call-template name="emitCppTypeForWSDLType">
714 <xsl:with-param name="method" select="$method"/>
715 <xsl:with-param name="type" select="$type"/>
716 <xsl:with-param name="safearray" select="$safearray"/>
717 <xsl:with-param name="inptr" select="'yes'"/>
718 </xsl:call-template>
719 <xsl:choose>
720 <xsl:when test="$type='uuid'">
721 <xsl:value-of select="concat(' comcall_', $name, '(', $structprefix, $name, '.c_str())')" />
722 </xsl:when>
723 <xsl:when test="$type='wstring'">
724 <xsl:value-of select="concat(' comcall_', $name, '(', $structprefix, $name, '.c_str())')" />
725 </xsl:when>
726 <xsl:when test="//enum[@name=$type]">
727 <xsl:value-of select="concat(' comcall_', $name, ' = ', $G_funcPrefixInputEnumConverter, $type, '(', $structprefix, $name, ')')" />
728 </xsl:when>
729 <xsl:when test="$type='$unknown'">
730 <xsl:value-of select="concat(' comcall_', $name, ';')" />
731 <xsl:call-template name="emitNewlineIndent8" />
732 <xsl:value-of select="concat('if ((rc = findComPtrFromId(soap, ', $structprefix, $name, ', comcall_', $name,', true)))')" />
733 <xsl:call-template name="emitNewlineIndent8" />
734 <xsl:text> break</xsl:text>
735 </xsl:when>
736 <xsl:when test="(//interface[@name=$type]) or (//collection[@name=$type])">
737 <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
738 <xsl:variable name="thatif" select="(//interface[@name=$type]) | (//collection[@name=$type])" />
739 <xsl:variable name="wsmap" select="$thatif/@wsmap" />
740 <xsl:variable name="thatifname" select="$thatif/@name" />
741 <xsl:choose>
742 <xsl:when test="not($wsmap)">
743 <xsl:call-template name="fatalError">
744 <xsl:with-param name="msg" select="concat('emitInputArgConverter: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; lacks wsmap attribute in XIDL.')" />
745 </xsl:call-template>
746 </xsl:when>
747 <xsl:when test="($wsmap='managed')">
748 <xsl:value-of select="concat(' comcall_', $name, ';')" />
749 <xsl:call-template name="emitNewlineIndent8" />
750 <xsl:value-of select="concat('if ((rc = findComPtrFromId(soap, ', $structprefix, $name, ', comcall_', $name,', true)))')" />
751 <xsl:call-template name="emitNewlineIndent8" />
752 <xsl:text> break</xsl:text>
753 </xsl:when>
754 <xsl:otherwise>
755 <xsl:call-template name="fatalError">
756 <xsl:with-param name="msg" select="concat('emitInputArgConverter: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; has unsupported wsmap attribute value &quot;', $wsmap, '&quot; in XIDL.')" />
757 </xsl:call-template>
758 </xsl:otherwise>
759 </xsl:choose>
760 </xsl:when>
761 <xsl:otherwise>
762 <xsl:value-of select="concat(' comcall_', $name, ' = ', $structprefix, $name)" />
763 </xsl:otherwise>
764 </xsl:choose>
765 <xsl:text>;
766</xsl:text>
767 </xsl:otherwise>
768 </xsl:choose>
769
770</xsl:template>
771
772<!--
773 emitTypeOrArray
774-->
775
776<xsl:template name="emitTypeOrArray">
777 <xsl:param name="type" />
778 <xsl:param name="safearray" />
779
780 <xsl:choose>
781 <xsl:when test="$safearray='yes'">
782 <xsl:value-of select="concat('com::SafeArray&lt;', $type, '&gt;')" />
783 </xsl:when>
784 <xsl:otherwise>
785 <xsl:value-of select="$type" />
786 </xsl:otherwise>
787 </xsl:choose>
788</xsl:template>
789
790<!--
791 emitOutputArgBuffer:
792 another type converter (from wsdl type to COM types)
793 that generates a buffer variable which receives the
794 data from 'out' and 'return' parameters of the COM method call.
795-->
796<xsl:template name="emitOutputArgBuffer">
797 <xsl:param name="method" />
798 <xsl:param name="name" />
799 <xsl:param name="type" />
800 <xsl:param name="safearray" />
801 <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
802
803 <xsl:text> // com output arg for </xsl:text><xsl:value-of select="concat($name, ' (safearray: ', $safearray, ')')" /><xsl:text>
804 </xsl:text>
805 <xsl:call-template name="emitCppTypeForWSDLType">
806 <xsl:with-param name="method" select="$method" />
807 <xsl:with-param name="type" select="$type" />
808 <xsl:with-param name="safearray" select="$safearray" />
809 </xsl:call-template>
810 <xsl:value-of select="concat(' comcall_', $varprefix, $name, ';')" />
811 <xsl:call-template name="emitNewline" />
812</xsl:template>
813
814<!--
815 emitOutParam:
816-->
817<xsl:template name="emitOutParam">
818 <xsl:param name="name" />
819 <xsl:param name="type" />
820 <xsl:param name="safearray" />
821 <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
822
823 <xsl:variable name="varname" select="concat('comcall_', $varprefix, $name)" />
824
825 <xsl:choose>
826 <xsl:when test="$safearray='yes'">
827 <xsl:value-of select="concat('ComSafeArrayAsOutParam(', $varname, ')')" />
828 </xsl:when>
829 <xsl:otherwise>
830 <xsl:choose>
831 <xsl:when test=" ($type='boolean')
832 or ($type='short')
833 or ($type='unsigned short')
834 or ($type='long')
835 or ($type='unsigned long')
836 or ($type='long long')
837 or ($type='unsigned long long')
838 or ($type='result')
839 or (//enum[@name=$type])">
840 <xsl:text>&amp;</xsl:text><xsl:value-of select="$varname" />
841 </xsl:when>
842 <xsl:otherwise>
843 <xsl:value-of select="$varname" /><xsl:text>.asOutParam()</xsl:text>
844 </xsl:otherwise>
845 </xsl:choose>
846 </xsl:otherwise>
847 </xsl:choose>
848</xsl:template>
849
850<!--
851 emitComCall:
852 emits the actual method call with the arguments.
853-->
854<xsl:template name="emitComCall">
855 <xsl:param name="object" /> <!-- normally "pObj->" -->
856 <xsl:param name="methodname" />
857 <xsl:param name="attrname" /> <!-- with attributes only -->
858 <xsl:param name="attrtype" /> <!-- with attributes only -->
859 <xsl:param name="attrsafearray" /> <!-- with attributes only -->
860 <xsl:param name="attrdir" /> <!-- with attributes only: "in" or "return" -->
861 <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
862
863 <xsl:variable name="comMethodName">
864 <xsl:call-template name="capitalize"><xsl:with-param name="str" select="$methodname" /></xsl:call-template>
865 </xsl:variable>
866
867 <xsl:call-template name="emitNewlineIndent8" />
868 <xsl:value-of select="concat('WEBDEBUG((g_pcszCallingComMethod, &quot;', $comMethodName, '&quot;));')" />
869 <xsl:call-template name="emitNewlineIndent8" />
870 <xsl:value-of select="concat('rc = ', $object, '-&gt;', $comMethodName, '(')" />
871 <xsl:if test="$attrtype">
872 <xsl:choose>
873 <xsl:when test="$attrdir='in'">
874 <xsl:value-of select="concat('comcall_', $varprefix, @name)" />
875 </xsl:when>
876 <xsl:when test="$attrdir='return'">
877 <xsl:call-template name="emitOutParam">
878 <xsl:with-param name="name" select="$attrname" />
879 <xsl:with-param name="type" select="$attrtype" />
880 <xsl:with-param name="safearray" select="$attrsafearray" />
881 <xsl:with-param name="varprefix" select="$varprefix" />
882 </xsl:call-template>
883 </xsl:when>
884 </xsl:choose>
885 </xsl:if>
886 <xsl:for-each select="param">
887 <xsl:if test="position()=1">
888 <xsl:call-template name="emitNewline" />
889 </xsl:if>
890 <xsl:if test="position() > 1">
891 <xsl:text>,</xsl:text>
892 <xsl:call-template name="emitNewline" />
893 </xsl:if>
894 <xsl:text> </xsl:text>
895 <xsl:choose>
896 <xsl:when test="@dir='in'">
897 <xsl:choose>
898 <xsl:when test="@safearray='yes'">
899 <xsl:value-of select="concat('ComSafeArrayAsInParam(comcall_', $varprefix, @name, ')')" />
900 </xsl:when>
901 <xsl:otherwise>
902 <xsl:value-of select="concat('comcall_', $varprefix, @name)" />
903 </xsl:otherwise>
904 </xsl:choose>
905 </xsl:when>
906 <xsl:when test="@dir='out'">
907 <xsl:call-template name="emitOutParam">
908 <xsl:with-param name="name" select="@name" />
909 <xsl:with-param name="type" select="@type" />
910 <xsl:with-param name="safearray" select="@safearray" />
911 <xsl:with-param name="varprefix" select="$varprefix" />
912 </xsl:call-template>
913 </xsl:when>
914 <xsl:when test="@dir='return'">
915 <xsl:call-template name="emitOutParam">
916 <xsl:with-param name="name" select="$G_result" />
917 <xsl:with-param name="type" select="@type" />
918 <xsl:with-param name="safearray" select="@safearray" />
919 <xsl:with-param name="varprefix" select="$varprefix" />
920 </xsl:call-template>
921 </xsl:when>
922 </xsl:choose>
923 </xsl:for-each>
924 <xsl:text>);</xsl:text>
925 <xsl:call-template name="emitNewlineIndent8" />
926 <xsl:text>if (FAILED(rc))</xsl:text>
927 <xsl:call-template name="emitNewlineIndent8" />
928 <xsl:text>{</xsl:text>
929 <xsl:call-template name="emitNewlineIndent8" />
930 <xsl:value-of select="concat(' RaiseSoapRuntimeFault(soap, rc, ', $object, ');')" />
931 <xsl:call-template name="emitNewlineIndent8" />
932 <xsl:text> break;</xsl:text>
933 <xsl:call-template name="emitNewlineIndent8" />
934 <xsl:text>}</xsl:text>
935 <xsl:call-template name="emitNewlineIndent8" />
936 <xsl:text>WEBDEBUG((g_pcszDoneCallingComMethod));</xsl:text>
937 <xsl:call-template name="emitNewline" />
938</xsl:template>
939
940<!--
941 emitOutputArgBackConverter2: implementation details of emitOutputArgBackConverter.
942 -->
943
944<xsl:template name="emitOutputArgBackConverter2">
945 <xsl:param name="name" />
946 <xsl:param name="varname" />
947 <xsl:param name="type" />
948 <xsl:param name="callerprefix" />
949
950 <xsl:choose>
951 <xsl:when test="$type='wstring'">
952 <xsl:value-of select="concat('ConvertComString(', $varname, ')')" />
953 </xsl:when>
954 <xsl:when test="$type='boolean'">
955 <!-- the "!!" avoids a microsoft compiler warning -->
956 <xsl:value-of select="concat('!!', $varname)" />
957 </xsl:when>
958 <xsl:when test=" ($type='short')
959 or ($type='unsigned short')
960 or ($type='long')
961 or ($type='unsigned long')
962 or ($type='long long')
963 or ($type='unsigned long long')
964 or ($type='result')">
965 <xsl:value-of select="$varname" />
966 </xsl:when>
967 <xsl:when test="$type='uuid'">
968 <xsl:value-of select="concat($varname, '.toString().raw()')" />
969 </xsl:when>
970 <xsl:when test="//enum[@name=$type]">
971 <xsl:value-of select="concat($G_funcPrefixOutputEnumConverter, $type, '(', $varname, ')')" />
972 </xsl:when>
973 <xsl:when test="$type='$unknown'">
974 <xsl:value-of select="concat('createOrFindRefFromComPtr(idThis, g_pcszIUnknown, ', $varname, ')')" />
975 </xsl:when>
976 <xsl:when test="//interface[@name=$type]">
977 <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
978 <xsl:variable name="thatif" select="//interface[@name=$type]" />
979 <xsl:variable name="wsmap" select="$thatif/@wsmap" />
980 <xsl:variable name="thatifname" select="$thatif/@name" />
981 <xsl:choose>
982 <xsl:when test=" ($wsmap='managed') or ($wsmap='global')">
983 <xsl:value-of select="concat('createOrFindRefFromComPtr(idThis, g_pcsz', $thatifname, ', ', $varname, ')')" />
984 </xsl:when>
985 <xsl:when test="$wsmap='struct'">
986 <!-- prevent infinite recursion -->
987 <!-- <xsl:call-template name="fatalError"><xsl:with-param name="msg" select="concat('emitOutputArgBackConverter2: attempted infinite recursion for type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $ifname, '::', $method)" /></xsl:call-template> -->
988 <xsl:if test="not($callerprefix)">
989 <xsl:value-of select="concat('/* convert COM interface to struct */ ', $G_funcPrefixOutputEnumConverter, $type, '(soap, idThis, rc, ', $varname, ')')" />
990 </xsl:if>
991 </xsl:when>
992 <xsl:otherwise>
993 <xsl:call-template name="fatalError">
994 <xsl:with-param name="msg" select="concat('emitOutputArgBackConverter2: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $ifname, '::', $method, '&quot; has invalid wsmap attribute value &quot;', $wsmap, '&quot; in XIDL.')" />
995 </xsl:call-template>
996 </xsl:otherwise>
997 </xsl:choose>
998 </xsl:when>
999 <xsl:when test="//collection[@name=$type]">
1000 <!-- the type is a collection of our own types: then build an array from it -->
1001 <xsl:variable name="collectiontype" select="//collection[@name=$type]/@type" />
1002 <xsl:variable name="targetwsmap" select="//interface[@name=$collectiontype]/@wsmap" />
1003 <xsl:value-of select="concat('soap_new_vbox__ArrayOf', $collectiontype, '(soap, 1);')" />
1004 <xsl:call-template name="emitNewlineIndent8" />
1005 <xsl:variable name="enumerator" select="concat('comcall_', $callerprefix, $name, '_enum')" />
1006 <xsl:value-of select="concat('ComPtr&lt;', $collectiontype, 'Enumerator&gt; ', $enumerator, ';')" />
1007 <xsl:call-template name="emitNewlineIndent8" />
1008 <xsl:value-of select="concat('CHECK_ERROR_BREAK( comcall_', $callerprefix, $name, ', Enumerate(', $enumerator, '.asOutParam()) );')" />
1009 <xsl:call-template name="emitNewlineIndent8" />
1010 <xsl:value-of select="concat('BOOL comcall_', $callerprefix, $name, '_hasmore = FALSE;')" />
1011 <xsl:call-template name="emitNewlineIndent8" />
1012 <xsl:value-of select="'do {'" />
1013 <xsl:call-template name="emitNewlineIndent8" />
1014 <xsl:value-of select="concat(' CHECK_ERROR_BREAK( ', $enumerator, ', HasMore(&amp;comcall_', $callerprefix, $name, '_hasmore) );')" />
1015 <xsl:call-template name="emitNewlineIndent8" />
1016 <xsl:value-of select="concat(' if (!comcall_', $callerprefix, $name, '_hasmore) break;')" />
1017 <xsl:call-template name="emitNewlineIndent8" />
1018 <xsl:value-of select="concat(' ComPtr&lt;', $collectiontype, '&gt; arrayitem;')" />
1019 <xsl:call-template name="emitNewlineIndent8" />
1020 <xsl:value-of select="concat(' CHECK_ERROR_BREAK( ', $enumerator, ', GetNext(arrayitem.asOutParam()) );')" />
1021 <xsl:call-template name="emitNewlineIndent8" />
1022 <xsl:value-of select="concat(' // collection of &quot;', $collectiontype, '&quot;, target interface wsmap: &quot;', $targetwsmap, '&quot;')" />
1023 <xsl:call-template name="emitNewlineIndent8" />
1024 <xsl:value-of select="concat(' ', $G_responseElementVarName, '-&gt;', $G_result)" />
1025 <xsl:value-of select="'->array.push_back('" />
1026 <xsl:choose>
1027 <xsl:when test="($targetwsmap='managed')">
1028 <xsl:value-of select="concat('createOrFindRefFromComPtr(idThis, g_pcsz', $collectiontype, ', arrayitem));')" />
1029 </xsl:when>
1030 <xsl:when test="$targetwsmap='struct'">
1031 <xsl:value-of select="concat($G_funcPrefixOutputEnumConverter, $collectiontype, '(soap, idThis, rc, arrayitem));')" />
1032 </xsl:when>
1033 <xsl:otherwise>
1034 <xsl:call-template name="fatalError">
1035 <xsl:with-param name="msg" select="concat('emitOutputArgBackConverter2: Type &quot;', $collectiontype, '&quot; of collection &quot;', $type, '&quot;, used in method &quot;', $method, '&quot;, has unsupported wsmap &quot;', $targetwsmap, '&quot;.')" />
1036 </xsl:call-template>
1037 </xsl:otherwise>
1038 </xsl:choose>
1039 <xsl:call-template name="emitNewlineIndent8" />
1040 <xsl:value-of select="'} while (1)'" />
1041 </xsl:when>
1042 <xsl:otherwise>
1043 <xsl:call-template name="fatalError">
1044 <xsl:with-param name="msg" select="concat('emitOutputArgBackConverter2: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; is not supported.')" />
1045 </xsl:call-template>
1046 </xsl:otherwise>
1047 </xsl:choose>
1048
1049</xsl:template>
1050
1051<!--
1052 emitOutputArgBackConverter:
1053 another type converter (from COM type back to WSDL)
1054 which converts the output argument from the COM
1055 method call back to the WSDL type passed in by the
1056 caller.
1057-->
1058<xsl:template name="emitOutputArgBackConverter">
1059 <xsl:param name="ifname" />
1060 <xsl:param name="method" />
1061 <xsl:param name="name" />
1062 <xsl:param name="type" />
1063 <xsl:param name="safearray" />
1064 <xsl:param name="varprefix" /> <!-- only when called recursively from emitGetAttributeComCall -->
1065 <xsl:param name="callerprefix" /> <!-- only for out params or when called recursively from emitGetAttributeComCall -->
1066
1067 <xsl:variable name="topname" select="$name" />
1068 <xsl:variable name="varname" select="concat('comcall_', $varprefix, $name)" />
1069
1070 <xsl:call-template name="emitNewlineIndent8" />
1071 <xsl:value-of select="concat('WEBDEBUG((g_pcszConvertComOutputBack, &quot;', $name, '&quot;));')" />
1072 <xsl:call-template name="emitNewlineIndent8" />
1073
1074 <xsl:variable name="receiverVariable">
1075 <xsl:choose>
1076 <xsl:when test="(not($varprefix))">
1077 <xsl:choose>
1078 <xsl:when test="$callerprefix"> <!-- callerprefix set but varprefix not: then this is an out parameter :-) -->
1079 <xsl:value-of select="concat($G_responseElementVarName, '-&gt;', $name)" />
1080 </xsl:when>
1081 <xsl:otherwise>
1082 <xsl:value-of select="concat($G_responseElementVarName, '-&gt;', $G_result)" />
1083 </xsl:otherwise>
1084 </xsl:choose>
1085 </xsl:when>
1086 <xsl:otherwise>
1087 <xsl:value-of select="concat($callerprefix, $G_result, '-&gt;', $name)" />
1088 </xsl:otherwise>
1089 </xsl:choose>
1090 </xsl:variable>
1091
1092 <xsl:choose>
1093 <xsl:when test="$safearray='yes'">
1094 <xsl:value-of select="concat('for (size_t i = 0; i &lt; ', $varname, '.size(); ++i)')" />
1095 <xsl:call-template name="emitNewlineIndent8" />
1096 <xsl:value-of select="'{'" />
1097 <xsl:call-template name="emitNewlineIndent8" />
1098 <xsl:choose>
1099 <xsl:when test="//interface[@name=$type]">
1100 <xsl:value-of select="concat(' ComPtr&lt;', $type, '&gt; tmpObject(', $varname, '[i]);')" />
1101 </xsl:when>
1102 <xsl:when test="//enum[@name=$type]">
1103 <xsl:value-of select="concat(' ', $type, '_T tmpObject(', $varname, '[i]);')" />
1104 </xsl:when>
1105 <xsl:when test="$type='$unknown'">
1106 <xsl:value-of select="concat(' ComPtr&lt;IUnknown&gt; tmpObject(', $varname, '[i]);')" />
1107 </xsl:when>
1108 <xsl:when test="$type='wstring'">
1109 <xsl:value-of select="concat(' com::Bstr tmpObject(', $varname, '[i]);')" />
1110 </xsl:when>
1111 <xsl:when test="$type='uuid'">
1112 <xsl:value-of select="concat(' com::Guid tmpObject(', $varname, '[i]);')" />
1113 </xsl:when>
1114 <xsl:when test="$type='long'">
1115 <xsl:value-of select="concat(' long tmpObject(', $varname, '[i]);')" />
1116 </xsl:when>
1117 <xsl:when test="$type='unsigned long'">
1118 <xsl:value-of select="concat(' unsigned long tmpObject(', $varname, '[i]);')" />
1119 </xsl:when>
1120 <xsl:when test="$type='unsigned long long'">
1121 <xsl:value-of select="concat(' ULONG64 tmpObject(', $varname, '[i]);')" />
1122 </xsl:when>
1123 <xsl:otherwise>
1124 <xsl:call-template name="fatalError">
1125 <xsl:with-param name="msg" select="concat('emitOutputArgBackConverter (1): Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; is not yet supported in safearrays.')" />
1126 </xsl:call-template>
1127
1128 </xsl:otherwise>
1129 </xsl:choose>
1130 <xsl:call-template name="emitNewlineIndent8" />
1131 <xsl:value-of select="concat(' ', $receiverVariable, '.push_back(')" />
1132 <xsl:call-template name="emitOutputArgBackConverter2">
1133 <xsl:with-param name="name" select="$name"/>
1134 <xsl:with-param name="varname" select="'tmpObject'"/>
1135 <xsl:with-param name="type" select="$type"/>
1136 <xsl:with-param name="callerprefix" select="$callerprefix"/>
1137 </xsl:call-template>
1138 <xsl:value-of select="');'" />
1139 <xsl:call-template name="emitNewlineIndent8" />
1140 <xsl:value-of select="'}'" />
1141 <xsl:call-template name="emitNewline" />
1142 </xsl:when>
1143 <xsl:otherwise>
1144 <!-- emit variable name: "resp->retval = " -->
1145 <xsl:value-of select="$receiverVariable" />
1146
1147 <xsl:value-of select="' = '" />
1148 <xsl:call-template name="emitOutputArgBackConverter2">
1149 <xsl:with-param name="name" select="$name"/>
1150 <xsl:with-param name="varname" select="$varname"/>
1151 <xsl:with-param name="type" select="$type"/>
1152 <xsl:with-param name="callerprefix" select="$callerprefix"/>
1153 </xsl:call-template>
1154 <xsl:value-of select="';'" />
1155 <xsl:call-template name="emitNewline" />
1156
1157 </xsl:otherwise>
1158 </xsl:choose>
1159
1160 <xsl:value-of select="concat(' WEBDEBUG((g_pcszDoneConvertingComOutputBack, &quot;', $name, '&quot;));')" />
1161 <xsl:call-template name="emitNewline" />
1162</xsl:template>
1163
1164<!--
1165 emitGetAttributeComCall
1166 -->
1167<xsl:template name="emitGetAttributeComCall">
1168 <xsl:param name="ifname" />
1169 <xsl:param name="object" /> <!-- normally "pObj->" -->
1170 <xsl:param name="attrname" />
1171 <xsl:param name="attrtype" />
1172 <xsl:param name="attrsafearray" />
1173 <xsl:param name="varprefix" /> <!-- only when called recursively from emitOutputArgBackConverter-->
1174 <xsl:param name="callerprefix" /> <!-- only when called recursively from emitOutputArgBackConverter-->
1175
1176 <xsl:variable name="gettername"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
1177 <xsl:call-template name="emitOutputArgBuffer">
1178 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1179 <xsl:with-param name="method"><xsl:value-of select="$gettername" /></xsl:with-param>
1180 <xsl:with-param name="name" select="$attrname" />
1181 <xsl:with-param name="type" select="$attrtype" />
1182 <xsl:with-param name="safearray" select="$attrsafearray" />
1183 <xsl:with-param name="varprefix" select="$varprefix" />
1184 </xsl:call-template>
1185 <xsl:variable name="upperattrname"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$attrname" /></xsl:call-template></xsl:variable>
1186 <!-- actual COM method call -->
1187 <xsl:call-template name="emitComCall">
1188 <xsl:with-param name="methodname" select="concat('COMGETTER(', $upperattrname, ')')" />
1189 <xsl:with-param name="object" select="$object" />
1190 <xsl:with-param name="attrname" select="$attrname" />
1191 <xsl:with-param name="attrtype" select="$attrtype" />
1192 <xsl:with-param name="attrsafearray" select="$attrsafearray" />
1193 <xsl:with-param name="attrdir" select="'return'" />
1194 <xsl:with-param name="varprefix" select="$varprefix" />
1195 </xsl:call-template>
1196 <!-- convert back the output data -->
1197 <xsl:call-template name="emitOutputArgBackConverter">
1198 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1199 <xsl:with-param name="method"><xsl:value-of select="$gettername" /></xsl:with-param>
1200 <xsl:with-param name="name" select="$attrname" />
1201 <xsl:with-param name="type" select="$attrtype" />
1202 <xsl:with-param name="safearray" select="$attrsafearray" />
1203 <xsl:with-param name="varprefix" select="$varprefix" />
1204 <xsl:with-param name="callerprefix" select="$callerprefix" />
1205 </xsl:call-template>
1206</xsl:template>
1207
1208<!--
1209 emitSetAttributeComCall
1210 -->
1211<xsl:template name="emitSetAttributeComCall">
1212 <xsl:param name="ifname" />
1213 <xsl:param name="object" /> <!-- normally "pObj->" -->
1214 <xsl:param name="attrname" />
1215 <xsl:param name="attrtype" />
1216 <xsl:param name="attrsafearray" />
1217 <xsl:param name="callerprefix" /> <!-- only when called recursively from emitOutputArgBackConverter-->
1218
1219 <xsl:variable name="settername"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
1220 <xsl:variable name="upperattrname"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$attrname" /></xsl:call-template></xsl:variable>
1221
1222 <xsl:call-template name="emitInputArgConverter">
1223 <xsl:with-param name="method" select="concat($ifname, '::', $settername)" />
1224 <xsl:with-param name="name" select="$attrname" />
1225 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
1226 <xsl:with-param name="type" select="$attrtype" />
1227 <xsl:with-param name="safearray" select="$attrsafearray" />
1228 </xsl:call-template>
1229 <xsl:call-template name="emitComCall">
1230 <xsl:with-param name="methodname" select="concat('COMSETTER(', $upperattrname, ')')" />
1231 <xsl:with-param name="object" select="$object" />
1232 <xsl:with-param name="attrname" select="$attrname" />
1233 <xsl:with-param name="attrtype" select="$attrtype" />
1234 <xsl:with-param name="attrsafearray" select="$attrsafearray" />
1235 <xsl:with-param name="attrdir" select="'in'" />
1236 </xsl:call-template>
1237</xsl:template>
1238
1239<!--
1240 emitGetAttributeMapper
1241 -->
1242<xsl:template name="emitGetAttributeMapper">
1243 <xsl:param name="ifname" />
1244 <xsl:param name="wsmap" />
1245 <xsl:param name="attrname" />
1246 <xsl:param name="attrtype" />
1247 <xsl:param name="attrreadonly" />
1248 <xsl:param name="attrsafearray" />
1249
1250 <xsl:variable name="gettername"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
1251
1252 <xsl:call-template name="emitBeginOfFunctionHeader">
1253 <xsl:with-param name="ifname" select="$ifname" />
1254 <xsl:with-param name="method" select="$gettername" />
1255 </xsl:call-template>
1256
1257 <xsl:call-template name="emitDocumentStyleArgStructs">
1258 <xsl:with-param name="ifname" select="$ifname" />
1259 <xsl:with-param name="methodname" select="$gettername" />
1260 <xsl:with-param name="fOutputs" select="$attrtype" />
1261 </xsl:call-template>
1262
1263 <xsl:text>)</xsl:text>
1264 <xsl:call-template name="emitNewline" />
1265 <xsl:text>{</xsl:text>
1266 <xsl:call-template name="emitNewline" />
1267
1268 <xsl:value-of select="' HRESULT rc = S_OK;'" />
1269 <xsl:call-template name="emitNewline" />
1270
1271 <xsl:call-template name="emitPrologue" />
1272
1273 <!-- actual COM method call -->
1274 <!-- <xsl:choose>
1275 array attributes/parameters are not supported yet...
1276 <xsl:when test="@array or @safearray='yes'">
1277 <xsl:call-template name="warning"><xsl:with-param name="msg" select="concat('emitComCall: SKIPPING ATTRIBUTE IMPLEMENTATION for &quot;', $attrname, '&quot; because it has array type. THIS SOAP METHOD WILL NOT DO ANYTHING!')" /></xsl:call-template>
1278 </xsl:when>
1279 <xsl:otherwise> -->
1280 <xsl:call-template name="emitObjForMethod">
1281 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1282 <xsl:with-param name="wsmap"><xsl:value-of select="$wsmap" /></xsl:with-param>
1283 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
1284 </xsl:call-template>
1285
1286 <xsl:call-template name="emitGetAttributeComCall">
1287 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1288 <xsl:with-param name="object" select='"pObj"' />
1289 <xsl:with-param name="attrname"><xsl:value-of select="$attrname" /></xsl:with-param>
1290 <xsl:with-param name="attrtype"><xsl:value-of select="$attrtype" /></xsl:with-param>
1291 <xsl:with-param name="attrsafearray"><xsl:value-of select="$attrsafearray" /></xsl:with-param>
1292 </xsl:call-template>
1293 <!-- </xsl:otherwise>
1294 </xsl:choose> -->
1295
1296 <xsl:call-template name="emitEpilogue" />
1297</xsl:template>
1298
1299<!--
1300 emitSetAttributeMapper:
1301 -->
1302<xsl:template name="emitSetAttributeMapper">
1303 <xsl:param name="ifname" select="$ifname" />
1304 <xsl:param name="wsmap" select="$wsmap" />
1305 <xsl:param name="attrname" select="$attrname" />
1306 <xsl:param name="attrtype" select="$attrtype" />
1307 <xsl:param name="attrreadonly" select="$attrreadonly" />
1308
1309 <xsl:variable name="settername"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
1310
1311 <xsl:call-template name="emitBeginOfFunctionHeader">
1312 <xsl:with-param name="ifname" select="$ifname" />
1313 <xsl:with-param name="method" select="$settername" />
1314 </xsl:call-template>
1315
1316 <xsl:call-template name="emitDocumentStyleArgStructs">
1317 <xsl:with-param name="ifname" select="$ifname" />
1318 <xsl:with-param name="methodname" select="$settername" />
1319 <xsl:with-param name="fOutputs" select="1" />
1320 </xsl:call-template>
1321
1322 <xsl:text>)</xsl:text>
1323 <xsl:call-template name="emitNewline" />
1324 <xsl:text>{</xsl:text>
1325 <xsl:call-template name="emitNewline" />
1326 <xsl:value-of select="' HRESULT rc = S_OK;'" />
1327 <xsl:call-template name="emitNewline" />
1328 <xsl:call-template name="emitPrologue" />
1329
1330 <!-- actual COM method call -->
1331 <!-- <xsl:choose>
1332 array attributes/parameters are not supported yet...
1333 <xsl:when test="@array or @safearray='yes'">
1334 <xsl:call-template name="warning"><xsl:with-param name="msg" select="concat('emitComCall: SKIPPING ATTRIBUTE IMPLEMENTATION for &quot;', $attrname, '&quot; because it has array type. THIS SOAP METHOD WILL NOT DO ANYTHING!')" /></xsl:call-template>
1335 </xsl:when>
1336 <xsl:otherwise> -->
1337 <xsl:call-template name="emitObjForMethod">
1338 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1339 <xsl:with-param name="wsmap"><xsl:value-of select="$wsmap" /></xsl:with-param>
1340 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
1341 </xsl:call-template>
1342 <xsl:call-template name="emitSetAttributeComCall">
1343 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1344 <xsl:with-param name="object" select='"pObj"' />
1345 <xsl:with-param name="attrname"><xsl:value-of select="$attrname" /></xsl:with-param>
1346 <xsl:with-param name="attrtype"><xsl:value-of select="$attrtype" /></xsl:with-param>
1347 </xsl:call-template>
1348 <!-- </xsl:otherwise>
1349 </xsl:choose> -->
1350
1351 <xsl:call-template name="emitEpilogue" />
1352</xsl:template>
1353
1354<!-- - - - - - - - - - - - - - - - - - - - - - -
1355 interface
1356 - - - - - - - - - - - - - - - - - - - - - - -->
1357
1358<xsl:template match="interface">
1359 <!-- remember the interface name in local variables -->
1360 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
1361 <xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
1362 <xsl:variable name="wscpp"><xsl:value-of select="@wscpp" /></xsl:variable>
1363
1364 <!-- we can save ourselves verifying the interface here as it's already
1365 done in the WSDL converter -->
1366
1367 <xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") or ($wscpp="hardcoded") )'>
1368 <xsl:text>
1369/****************************************************************************
1370 *
1371 * interface </xsl:text>
1372<xsl:copy-of select="$ifname" />
1373<xsl:text>
1374 *
1375 ****************************************************************************/
1376</xsl:text>
1377
1378 <!--
1379 here come the attributes
1380 -->
1381 <xsl:for-each select="attribute">
1382 <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
1383 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
1384 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
1385 <xsl:variable name="attrsafearray"><xsl:value-of select="@safearray" /></xsl:variable>
1386 <xsl:call-template name="emitNewline" />
1387 <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
1388 <xsl:choose>
1389 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
1390 <xsl:value-of select="concat('// Skipping attribute ', $attrtype, ' for it is of suppressed type ', $attrtype)" />
1391 </xsl:when>
1392 <xsl:otherwise>
1393 <xsl:choose>
1394 <xsl:when test="@readonly='yes'">
1395 <xsl:value-of select="concat('// read-only attribute ', $ifname, '::', $attrname, ' of type ', $attrtype)" />
1396 </xsl:when>
1397 <xsl:otherwise>
1398 <xsl:value-of select="concat('// read/write attribute ', $ifname, '::', $attrname, ' of type ', $attrtype)" />
1399 </xsl:otherwise>
1400 </xsl:choose>
1401 <xsl:value-of select="concat(' (safearray: ', $attrsafearray, ')')" />
1402 <!-- emit getter method -->
1403 <xsl:call-template name="emitGetAttributeMapper">
1404 <xsl:with-param name="ifname" select="$ifname" />
1405 <xsl:with-param name="wsmap" select="$wsmap" />
1406 <xsl:with-param name="attrname" select="$attrname" />
1407 <xsl:with-param name="attrtype" select="$attrtype" />
1408 <xsl:with-param name="attrreadonly" select="$attrreadonly" />
1409 <xsl:with-param name="attrsafearray" select="$attrsafearray" />
1410 </xsl:call-template>
1411 <!-- for read-write attributes, emit setter method -->
1412 <xsl:if test="not(@readonly='yes')">
1413 <xsl:call-template name="emitSetAttributeMapper">
1414 <xsl:with-param name="ifname" select="$ifname" />
1415 <xsl:with-param name="wsmap" select="$wsmap" />
1416 <xsl:with-param name="attrname" select="$attrname" />
1417 <xsl:with-param name="attrtype" select="$attrtype" />
1418 <xsl:with-param name="attrreadonly" select="$attrreadonly" />
1419 </xsl:call-template>
1420 </xsl:if>
1421 </xsl:otherwise> <!-- not wsmap=suppress -->
1422 </xsl:choose>
1423 </xsl:for-each>
1424
1425 <!--
1426 here come the real methods
1427 -->
1428
1429 <xsl:for-each select="method">
1430 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
1431 <!-- method header: return value "int", method name, soap arguments -->
1432 <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
1433 <xsl:choose>
1434 <xsl:when test="param[@type=($G_setSuppressedInterfaces/@name)]">
1435 <xsl:comment><xsl:value-of select="concat('Skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
1436 </xsl:when>
1437 <xsl:otherwise>
1438 <xsl:variable name="fHasReturnParms" select="param[@dir='return']" />
1439 <xsl:variable name="fHasOutParms" select="param[@dir='out']" />
1440
1441 <xsl:call-template name="emitNewline" />
1442 <xsl:value-of select="concat('/* method ', $ifname, '::', $methodname, '(')" />
1443 <xsl:for-each select="param">
1444 <xsl:call-template name="emitNewline" />
1445 <xsl:value-of select="concat(' [', @dir, '] ', @type, ' ', @name)" />
1446 <xsl:if test="@safearray='yes'">
1447 <xsl:text>[]</xsl:text>
1448 </xsl:if>
1449 <xsl:if test="not(position()=last())">
1450 <xsl:text>,</xsl:text>
1451 </xsl:if>
1452 </xsl:for-each>
1453 <xsl:text>)</xsl:text>
1454 <xsl:call-template name="emitNewline" />
1455 <xsl:text> */</xsl:text>
1456
1457 <xsl:call-template name="emitBeginOfFunctionHeader">
1458 <xsl:with-param name="ifname" select="$ifname" />
1459 <xsl:with-param name="method" select="$methodname" />
1460 </xsl:call-template>
1461
1462 <xsl:call-template name="emitDocumentStyleArgStructs">
1463 <xsl:with-param name="ifname" select="$ifname" />
1464 <xsl:with-param name="methodname" select="$methodname" />
1465 <xsl:with-param name="fOutputs" select="1" />
1466 </xsl:call-template>
1467 <xsl:text>)</xsl:text>
1468 <xsl:call-template name="emitNewline" />
1469 <xsl:text>{</xsl:text>
1470 <xsl:call-template name="emitNewline" />
1471 <xsl:value-of select="' HRESULT rc = S_OK;'" />
1472 <xsl:call-template name="emitNewline" />
1473 <xsl:call-template name="emitPrologue" />
1474
1475 <xsl:choose>
1476 <xsl:when test="param[@array]">
1477 <xsl:call-template name="warning"><xsl:with-param name="msg" select="concat('emitComCall: SKIPPING METHOD IMPLEMENTATION for &quot;', $methodname, '&quot; because it has arguments with &quot;array&quot; types. THIS SOAP METHOD WILL NOT DO ANYTHING!')" /></xsl:call-template>
1478 </xsl:when>
1479 <xsl:otherwise>
1480 <!-- emit the object upon which to invoke the method -->
1481 <xsl:call-template name="emitObjForMethod">
1482 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1483 <xsl:with-param name="wsmap"><xsl:value-of select="$wsmap" /></xsl:with-param>
1484 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
1485 </xsl:call-template>
1486 <!-- next, emit storage variables to convert the SOAP/C++ arguments to COM types -->
1487 <xsl:for-each select="param">
1488 <xsl:variable name="dir" select="@dir" />
1489 <xsl:choose>
1490 <xsl:when test="$dir='in'">
1491 <xsl:call-template name="emitInputArgConverter">
1492 <xsl:with-param name="method" select="concat($ifname, '::', $methodname)" />
1493 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
1494 <xsl:with-param name="name" select="@name" />
1495 <xsl:with-param name="type" select="@type" />
1496 <xsl:with-param name="safearray" select="@safearray" />
1497 </xsl:call-template>
1498 </xsl:when>
1499 <xsl:when test="$dir='out'">
1500 <xsl:call-template name="emitOutputArgBuffer">
1501 <xsl:with-param name="method" select="concat($ifname, '::', $methodname)" />
1502 <xsl:with-param name="name" select="@name" />
1503 <xsl:with-param name="type" select="@type" />
1504 <xsl:with-param name="safearray" select="@safearray" />
1505 </xsl:call-template>
1506 </xsl:when>
1507 <xsl:when test="$dir='return'">
1508 <xsl:call-template name="emitOutputArgBuffer">
1509 <xsl:with-param name="method" select="concat($ifname, '::', $methodname)" />
1510 <xsl:with-param name="name" select="$G_result" />
1511 <xsl:with-param name="type" select="@type" />
1512 <xsl:with-param name="safearray" select="@safearray" />
1513 </xsl:call-template>
1514 </xsl:when>
1515 </xsl:choose>
1516 </xsl:for-each>
1517 <!-- actual COM method call -->
1518 <xsl:call-template name="emitComCall">
1519 <xsl:with-param name="object" select='"pObj"' />
1520 <xsl:with-param name="methodname">
1521 <xsl:call-template name="capitalize">
1522 <xsl:with-param name="str" select="$methodname" />
1523 </xsl:call-template>
1524 </xsl:with-param>
1525 </xsl:call-template>
1526 <!-- convert back the output data -->
1527 <xsl:for-each select="param">
1528 <xsl:variable name="dir" select="@dir" />
1529 <xsl:if test="$dir='out'">
1530 <xsl:call-template name="emitOutputArgBackConverter">
1531 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1532 <xsl:with-param name="method" select="$methodname" />
1533 <xsl:with-param name="name"><xsl:value-of select="@name" /></xsl:with-param>
1534 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
1535 <xsl:with-param name="safearray"><xsl:value-of select="@safearray" /></xsl:with-param>
1536 <xsl:with-param name="callerprefix" select="'outparms.'"/>
1537 </xsl:call-template>
1538 </xsl:if>
1539 <xsl:if test="$dir='return'">
1540 <!-- return values _normally_ should convert to the input arg from the function prototype,
1541 except when there are both return and out params; in that case gsoap squeezes them all
1542 into the output args structure and the return thing is called "retval" -->
1543 <xsl:choose>
1544 <xsl:when test="$fHasOutParms">
1545 <xsl:call-template name="emitOutputArgBackConverter">
1546 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1547 <xsl:with-param name="method" select="$methodname" />
1548 <xsl:with-param name="name"><xsl:value-of select="$G_result" /></xsl:with-param>
1549 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
1550 <xsl:with-param name="safearray"><xsl:value-of select="@safearray" /></xsl:with-param>
1551 <xsl:with-param name="callerprefix" select="'outparms.'"/>
1552 </xsl:call-template>
1553 </xsl:when>
1554 <xsl:otherwise>
1555 <xsl:call-template name="emitOutputArgBackConverter">
1556 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1557 <xsl:with-param name="method" select="$methodname" />
1558 <xsl:with-param name="name"><xsl:value-of select="$G_result" /></xsl:with-param>
1559 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
1560 <xsl:with-param name="safearray"><xsl:value-of select="@safearray" /></xsl:with-param>
1561 </xsl:call-template>
1562 </xsl:otherwise>
1563 </xsl:choose>
1564 </xsl:if>
1565 </xsl:for-each>
1566 </xsl:otherwise>
1567 </xsl:choose>
1568 <xsl:call-template name="emitEpilogue" />
1569 </xsl:otherwise>
1570 </xsl:choose>
1571 </xsl:for-each>
1572 </xsl:if>
1573
1574</xsl:template>
1575
1576
1577</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