VirtualBox

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

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

Main: comptr+webservice logging

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