VirtualBox

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

Last change on this file since 21496 was 20928, checked in by vboxsync, 16 years ago

API/others: Renamed IConsole::discardSavedState to IConsole::forgetSavedState, added parameter. Deleted old IConsole::powerDown, renamed IConsole::powerDownAsync to IConsole::powerDown (as promised for 2.1). Implemented perl sample code for registering a hard disk. Cleaned up constant formatting in the API docs. Updated SDK changelog. Renamed com/errorprint2.h to com/errorprint.h, added a few assertion variants. Eliminated com/errorprint_legacy.h. Adjusted all files using the affected headers and APIs. Renamed tstHeadless2 to tstHeadless.

  • Property svn:eol-style set to native
File size: 68.3 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// 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/errorprint.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 emitCppTypeForIDLType:
415 emits the C++ type that corresponds to the given WSDL type in $type.
416 -->
417<xsl:template name="emitCppTypeForIDLType">
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 <!-- look up C++ glue type from IDL type from table array in websrv-shared.inc.xsl -->
425 <xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename" />
426
427 <xsl:choose>
428 <xsl:when test="$type='uuid'">
429 <xsl:choose>
430 <xsl:when test="$safearray='yes'">
431 <xsl:value-of select="'com::SafeGUIDArray'" />
432 </xsl:when>
433 <xsl:otherwise>
434 <xsl:value-of select="'com::Guid'" />
435 </xsl:otherwise>
436 </xsl:choose>
437 </xsl:when>
438 <xsl:when test="$type='wstring'">
439 <xsl:choose>
440 <xsl:when test="$safearray='yes'">
441 <xsl:choose>
442 <xsl:when test="$inptr='yes'">
443 <xsl:value-of select="'com::SafeArray&lt;IN_BSTR&gt;'" /> <!-- input string arrays must use IN_BSTR (see com/array.h) -->
444 </xsl:when>
445 <xsl:otherwise>
446 <xsl:value-of select="'com::SafeArray&lt;BSTR&gt;'" /> <!-- output string arrays use raw BSTR -->
447 </xsl:otherwise>
448 </xsl:choose>
449 </xsl:when>
450 <xsl:otherwise>
451 <xsl:value-of select="'com::Bstr'" />
452 </xsl:otherwise>
453 </xsl:choose>
454 </xsl:when>
455 <!-- if above lookup in table succeeded, use that type -->
456 <xsl:when test="string-length($gluetypefield)">
457 <xsl:call-template name="emitTypeOrArray">
458 <xsl:with-param name="type" select="$gluetypefield"/>
459 <xsl:with-param name="safearray" select="$safearray"/>
460 </xsl:call-template>
461 </xsl:when>
462 <xsl:when test="//enum[@name=$type]">
463 <xsl:call-template name="emitTypeOrArray">
464 <xsl:with-param name="type" select="concat($type, '_T ')"/>
465 <xsl:with-param name="safearray" select="$safearray"/>
466 </xsl:call-template>
467 </xsl:when>
468 <xsl:when test="$type='$unknown'">
469 <xsl:choose>
470 <xsl:when test="$safearray='yes'">
471 <xsl:value-of select="'com::SafeIfaceArray&lt;IUnknown&gt;'" />
472 </xsl:when>
473 <xsl:otherwise>
474 <xsl:value-of select="'ComPtr&lt;IUnknown&gt;'" />
475 </xsl:otherwise>
476 </xsl:choose>
477 </xsl:when>
478 <xsl:when test="//interface[@name=$type]">
479 <xsl:variable name="thatif" select="//interface[@name=$type]" />
480 <xsl:variable name="thatifname" select="$thatif/@name" />
481 <xsl:choose>
482 <xsl:when test="$safearray='yes'">
483 <xsl:value-of select="concat('com::SafeIfaceArray&lt;', $thatifname, '&gt;')" />
484 </xsl:when>
485 <xsl:otherwise>
486 <xsl:value-of select="concat('ComPtr&lt;', $thatifname, '&gt;')" />
487 </xsl:otherwise>
488 </xsl:choose>
489 </xsl:when>
490 <xsl:when test="//collection[@name=$type]">
491 <xsl:variable name="thatif" select="//collection[@name=$type]" />
492 <xsl:variable name="thatifname" select="$thatif/@name" />
493 <xsl:value-of select="concat('ComPtr&lt;', $thatifname, '&gt;')" />
494 </xsl:when>
495 <xsl:otherwise>
496 <xsl:call-template name="fatalError">
497 <xsl:with-param name="msg" select="concat('emitCppTypeForIDLType: Type &quot;', $type, '&quot; in method &quot;', $method, '&quot; is not supported.')" />
498 </xsl:call-template>
499 </xsl:otherwise>
500 </xsl:choose>
501</xsl:template>
502
503
504<!--
505 emitDocumentStyleArgStructs:
506 with WSDL "document" style only, emits those lengthy structs for
507 the input and output argument in the function header.
508-->
509<xsl:template name="emitDocumentStyleArgStructs">
510 <xsl:param name="ifname" />
511 <xsl:param name="methodname" />
512 <xsl:param name="fOutputs" /> <!-- if 1, emit output struct as well -->
513
514 <xsl:text>,</xsl:text>
515 <xsl:call-template name="emitNewline" />
516 <xsl:value-of select="concat(' _vbox__', $ifname, '_USCORE', $methodname, $G_requestMessageElementSuffix, ' *', $G_requestElementVarName)" />
517 <xsl:if test="$fOutputs">
518 <xsl:text>,</xsl:text>
519 <xsl:call-template name="emitNewline" />
520 <xsl:value-of select="concat(' _vbox__', $ifname, '_USCORE', $methodname, $G_responseMessageElementSuffix, ' *', $G_responseElementVarName)" />
521 <!-- <xsl:value-of select="concat(' struct ', $ifname, '__', $methodname, 'Response &amp;', $G_result)" /> -->
522 </xsl:if>
523
524</xsl:template>
525
526<!--
527 emitPrologue:
528 emits the closing ")" for the parameter list and the beginning
529 of the function body.
530 -->
531<xsl:template name="emitPrologue">
532 <xsl:text> WEBDEBUG((g_pcszEntering, __FUNCTION__));
533
534 do {</xsl:text>
535 <xsl:call-template name="emitNewline" />
536</xsl:template>
537
538<!--
539 emitEpilogue
540 -->
541<xsl:template name="emitEpilogue">
542 <xsl:param name="fSkipHRESULT" />
543
544 <xsl:text> } while (0);</xsl:text>
545 <xsl:call-template name="emitNewline" />
546 <xsl:call-template name="emitNewline" />
547 <xsl:text> WEBDEBUG((g_pcszLeaving, __FUNCTION__, rc, rc));</xsl:text>
548 <xsl:call-template name="emitNewline" />
549 <xsl:if test="not($fSkipHRESULT)">
550 <xsl:text>
551 if (rc)
552 return SOAP_FAULT;
553 return SOAP_OK;</xsl:text>
554 </xsl:if>
555 <xsl:if test="$fSkipHRESULT">
556 <xsl:text> return resp;</xsl:text>
557 </xsl:if>
558 <xsl:call-template name="emitNewline" />
559 <xsl:text>}</xsl:text>
560 <xsl:call-template name="emitNewline" />
561</xsl:template>
562
563<!--
564 emitObjForMethod:
565 after the function prologue, emit a "pObj" object that
566 specifies the object upon which the method should be invoked.
567-->
568<xsl:template name="emitObjForMethod">
569 <xsl:param name="ifname" />
570 <xsl:param name="wsmap" />
571 <xsl:param name="structprefix" /> <!-- with WSDL document style: req element prefix, like "vbox__IVirtualBox_USCOREcreateMachineRequestElement->" -->
572
573 <xsl:choose>
574 <xsl:when test="$wsmap='global'">
575 <xsl:choose>
576 <xsl:when test="$ifname='IVirtualBox'">
577 <xsl:text> // invoke method on global IVirtualBox instance</xsl:text>
578 <xsl:call-template name="emitNewlineIndent8" />
579 <xsl:text>ComPtr&lt;IVirtualBox&gt; pObj = G_pVirtualBox;</xsl:text>
580 <xsl:call-template name="emitNewline" />
581 </xsl:when>
582 <xsl:otherwise>
583 <xsl:call-template name="fatalError">
584 <xsl:with-param name="msg" select="concat('emitObjForMethod: Unknown interface &quot;', $ifname, '&quot; with wsmap=global in XIDL.')" />
585 </xsl:call-template>
586 </xsl:otherwise>
587 </xsl:choose>
588 </xsl:when>
589 <xsl:when test="($wsmap='managed')">
590 <xsl:text> // look up managed object reference for method call&#10;</xsl:text>
591 <xsl:value-of select="concat(' ComPtr&lt;', $ifname, '&gt; pObj;&#10;')" />
592 <xsl:value-of select="concat(' if (!', $G_requestElementVarName, ')&#10;')" />
593 <xsl:text> {&#10;</xsl:text>
594 <xsl:text> RaiseSoapInvalidObjectFault(soap, "");&#10;</xsl:text>
595 <xsl:text> break;&#10;</xsl:text>
596 <xsl:text> }&#10;</xsl:text>
597 <xsl:value-of select="concat(' const WSDLT_ID &amp;idThis = ', $structprefix, $G_nameObjectRefEncoded, ';&#10;')" />
598 <xsl:value-of select="' if ((rc = findComPtrFromId(soap, idThis, pObj, false)))&#10;'" />
599 <xsl:text> break;&#10;</xsl:text>
600 </xsl:when>
601 </xsl:choose>
602</xsl:template>
603
604<!--
605 emitInputArgConverter:
606 another type converter (from wsdl type to COM types),
607 that generates temporary variables on the stack with
608 the WSDL input parameters converted to the COM types,
609 so we can then pass them to the actual COM method call.
610-->
611<xsl:template name="emitInputArgConverter">
612 <xsl:param name="method" />
613 <xsl:param name="structprefix" /> <!-- with WSDL document style: req element prefix, like "vbox__IVirtualBox_USCOREcreateMachineRequestElement->" -->
614 <xsl:param name="name" />
615 <xsl:param name="type" />
616 <xsl:param name="safearray" />
617
618 <xsl:value-of select="concat(' // convert input arg ', $name)" />
619 <xsl:call-template name="emitNewlineIndent8" />
620
621 <xsl:choose>
622 <xsl:when test="$safearray='yes'">
623 <xsl:value-of select="concat('size_t c', $name, ' = ', $structprefix, $name, '.size();')" />
624 <xsl:call-template name="emitNewlineIndent8" />
625 <xsl:call-template name="emitCppTypeForIDLType">
626 <xsl:with-param name="method" select="$method"/>
627 <xsl:with-param name="type" select="$type"/>
628 <xsl:with-param name="safearray" select="$safearray"/>
629 <xsl:with-param name="inptr" select="'yes'"/>
630 </xsl:call-template>
631 <xsl:value-of select="concat(' comcall_', $name, '(c', $name, ');')" />
632 <xsl:call-template name="emitNewlineIndent8" />
633 <xsl:value-of select="concat('for (size_t i = 0; i &lt; c', $name, '; ++i)')" />
634 <xsl:call-template name="emitNewlineIndent8" />
635 <xsl:value-of select="'{'" />
636 <xsl:call-template name="emitNewlineIndent8" />
637 <xsl:choose>
638 <xsl:when test="$type='$unknown'">
639 <xsl:value-of select="' ComPtr&lt;IUnknown&gt; tmpObject;'" />
640 <xsl:call-template name="emitNewlineIndent8" />
641 <xsl:value-of select="concat(' if ((rc = findComPtrFromId(soap, ', $structprefix, $name, '[i], tmpObject, true)))')" />
642 <xsl:call-template name="emitNewlineIndent8" />
643 <xsl:text> break;</xsl:text>
644 <xsl:call-template name="emitNewlineIndent8" />
645 <xsl:value-of select="concat(' IUnknown *tmpObject2(tmpObject); tmpObject2->AddRef(); comcall_', $name, '[i] = tmpObject;')" />
646 </xsl:when>
647 <xsl:when test="$type='wstring'">
648 <xsl:value-of select="concat(' com::Bstr tmpObject(', $structprefix, $name, '[i].c_str());')" />
649 <xsl:call-template name="emitNewlineIndent8" />
650 <xsl:value-of select="' BSTR tmpObjectB;'" />
651 <xsl:call-template name="emitNewlineIndent8" />
652 <xsl:value-of select="' tmpObject.detachTo(&amp;tmpObjectB);'" />
653 <xsl:call-template name="emitNewlineIndent8" />
654 <xsl:value-of select="concat(' comcall_', $name, '[i] = tmpObjectB;')" />
655 </xsl:when>
656 <xsl:when test="$type='long'">
657 <xsl:call-template name="emitNewlineIndent8" />
658 <xsl:value-of select="concat(' comcall_', $name, '[i] = ', $structprefix, $name, '[i];')" />
659 </xsl:when>
660 <xsl:when test="$type='boolean'">
661 <xsl:call-template name="emitNewlineIndent8" />
662 <xsl:value-of select="concat(' comcall_', $name, '[i] = ', $structprefix, $name, '[i];')" />
663 </xsl:when>
664 <xsl:otherwise>
665 <xsl:call-template name="fatalError">
666 <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.')" />
667 </xsl:call-template>
668 </xsl:otherwise>
669 </xsl:choose>
670 <xsl:call-template name="emitNewlineIndent8" />
671 <xsl:value-of select="'}'" />
672 <xsl:call-template name="emitNewline" />
673 </xsl:when>
674 <xsl:otherwise>
675 <xsl:call-template name="emitCppTypeForIDLType">
676 <xsl:with-param name="method" select="$method"/>
677 <xsl:with-param name="type" select="$type"/>
678 <xsl:with-param name="safearray" select="$safearray"/>
679 <xsl:with-param name="inptr" select="'yes'"/>
680 </xsl:call-template>
681 <xsl:choose>
682 <xsl:when test="$type='uuid'">
683 <xsl:value-of select="concat(' comcall_', $name, '(', $structprefix, $name, '.c_str())')" />
684 </xsl:when>
685 <xsl:when test="$type='wstring'">
686 <xsl:value-of select="concat(' comcall_', $name, '(', $structprefix, $name, '.c_str())')" />
687 </xsl:when>
688 <xsl:when test="//enum[@name=$type]">
689 <xsl:value-of select="concat(' comcall_', $name, ' = ', $G_funcPrefixInputEnumConverter, $type, '(', $structprefix, $name, ')')" />
690 </xsl:when>
691 <xsl:when test="$type='$unknown'">
692 <xsl:value-of select="concat(' comcall_', $name, ';')" />
693 <xsl:call-template name="emitNewlineIndent8" />
694 <xsl:value-of select="concat('if ((rc = findComPtrFromId(soap, ', $structprefix, $name, ', comcall_', $name,', true)))')" />
695 <xsl:call-template name="emitNewlineIndent8" />
696 <xsl:text> break</xsl:text>
697 </xsl:when>
698 <xsl:when test="(//interface[@name=$type]) or (//collection[@name=$type])">
699 <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
700 <xsl:variable name="thatif" select="(//interface[@name=$type]) | (//collection[@name=$type])" />
701 <xsl:variable name="wsmap" select="$thatif/@wsmap" />
702 <xsl:variable name="thatifname" select="$thatif/@name" />
703 <xsl:choose>
704 <xsl:when test="not($wsmap)">
705 <xsl:call-template name="fatalError">
706 <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.')" />
707 </xsl:call-template>
708 </xsl:when>
709 <xsl:when test="($wsmap='managed')">
710 <xsl:value-of select="concat(' comcall_', $name, ';')" />
711 <xsl:call-template name="emitNewlineIndent8" />
712 <xsl:value-of select="concat('if ((rc = findComPtrFromId(soap, ', $structprefix, $name, ', comcall_', $name,', true)))')" />
713 <xsl:call-template name="emitNewlineIndent8" />
714 <xsl:text> break</xsl:text>
715 </xsl:when>
716 <xsl:otherwise>
717 <xsl:call-template name="fatalError">
718 <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.')" />
719 </xsl:call-template>
720 </xsl:otherwise>
721 </xsl:choose>
722 </xsl:when>
723 <xsl:otherwise>
724 <xsl:value-of select="concat(' comcall_', $name, ' = ', $structprefix, $name)" />
725 </xsl:otherwise>
726 </xsl:choose>
727 <xsl:text>;
728</xsl:text>
729 </xsl:otherwise>
730 </xsl:choose>
731
732</xsl:template>
733
734<!--
735 emitTypeOrArray
736-->
737
738<xsl:template name="emitTypeOrArray">
739 <xsl:param name="type" />
740 <xsl:param name="safearray" />
741
742 <xsl:choose>
743 <xsl:when test="$safearray='yes'">
744 <xsl:value-of select="concat('com::SafeArray&lt;', $type, '&gt;')" />
745 </xsl:when>
746 <xsl:otherwise>
747 <xsl:value-of select="$type" />
748 </xsl:otherwise>
749 </xsl:choose>
750</xsl:template>
751
752<!--
753 emitOutputArgBuffer:
754 another type converter (from wsdl type to COM types)
755 that generates a buffer variable which receives the
756 data from 'out' and 'return' parameters of the COM method call.
757-->
758<xsl:template name="emitOutputArgBuffer">
759 <xsl:param name="method" />
760 <xsl:param name="name" />
761 <xsl:param name="type" />
762 <xsl:param name="safearray" />
763 <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
764
765 <xsl:text> // com output arg for </xsl:text><xsl:value-of select="concat($name, ' (safearray: ', $safearray, ')')" /><xsl:text>
766 </xsl:text>
767 <xsl:call-template name="emitCppTypeForIDLType">
768 <xsl:with-param name="method" select="$method" />
769 <xsl:with-param name="type" select="$type" />
770 <xsl:with-param name="safearray" select="$safearray" />
771 </xsl:call-template>
772 <xsl:value-of select="concat(' comcall_', $varprefix, $name, ';')" />
773 <xsl:call-template name="emitNewline" />
774</xsl:template>
775
776<!--
777 emitOutParam:
778-->
779<xsl:template name="emitOutParam">
780 <xsl:param name="name" />
781 <xsl:param name="type" />
782 <xsl:param name="safearray" />
783 <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
784
785 <xsl:variable name="varname" select="concat('comcall_', $varprefix, $name)" />
786
787 <xsl:choose>
788 <xsl:when test="$safearray='yes'">
789 <xsl:value-of select="concat('ComSafeArrayAsOutParam(', $varname, ')')" />
790 </xsl:when>
791 <xsl:otherwise>
792 <xsl:choose>
793 <xsl:when test=" ($type='boolean')
794 or ($type='short')
795 or ($type='unsigned short')
796 or ($type='long')
797 or ($type='unsigned long')
798 or ($type='long long')
799 or ($type='unsigned long long')
800 or ($type='result')
801 or (//enum[@name=$type])">
802 <xsl:text>&amp;</xsl:text><xsl:value-of select="$varname" />
803 </xsl:when>
804 <xsl:otherwise>
805 <xsl:value-of select="$varname" /><xsl:text>.asOutParam()</xsl:text>
806 </xsl:otherwise>
807 </xsl:choose>
808 </xsl:otherwise>
809 </xsl:choose>
810</xsl:template>
811
812<!--
813 emitComCall:
814 emits the actual method call with the arguments.
815-->
816<xsl:template name="emitComCall">
817 <xsl:param name="object" /> <!-- normally "pObj->" -->
818 <xsl:param name="methodname" />
819 <xsl:param name="attrname" /> <!-- with attributes only -->
820 <xsl:param name="attrtype" /> <!-- with attributes only -->
821 <xsl:param name="attrsafearray" /> <!-- with attributes only -->
822 <xsl:param name="attrdir" /> <!-- with attributes only: "in" or "return" -->
823 <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
824
825 <xsl:variable name="comMethodName">
826 <xsl:call-template name="capitalize"><xsl:with-param name="str" select="$methodname" /></xsl:call-template>
827 </xsl:variable>
828
829 <xsl:call-template name="emitNewlineIndent8" />
830 <xsl:value-of select="concat('WEBDEBUG((g_pcszCallingComMethod, &quot;', $comMethodName, '&quot;));')" />
831 <xsl:call-template name="emitNewlineIndent8" />
832 <xsl:value-of select="concat('rc = ', $object, '-&gt;', $comMethodName, '(')" />
833 <xsl:if test="$attrtype">
834 <xsl:choose>
835 <xsl:when test="$attrdir='in'">
836 <xsl:value-of select="concat('comcall_', $varprefix, @name)" />
837 </xsl:when>
838 <xsl:when test="$attrdir='return'">
839 <xsl:call-template name="emitOutParam">
840 <xsl:with-param name="name" select="$attrname" />
841 <xsl:with-param name="type" select="$attrtype" />
842 <xsl:with-param name="safearray" select="$attrsafearray" />
843 <xsl:with-param name="varprefix" select="$varprefix" />
844 </xsl:call-template>
845 </xsl:when>
846 </xsl:choose>
847 </xsl:if>
848 <xsl:for-each select="param">
849 <xsl:if test="position()=1">
850 <xsl:call-template name="emitNewline" />
851 </xsl:if>
852 <xsl:if test="position() > 1">
853 <xsl:text>,</xsl:text>
854 <xsl:call-template name="emitNewline" />
855 </xsl:if>
856 <xsl:text> </xsl:text>
857 <xsl:choose>
858 <xsl:when test="@dir='in'">
859 <xsl:choose>
860 <xsl:when test="@safearray='yes'">
861 <xsl:value-of select="concat('ComSafeArrayAsInParam(comcall_', $varprefix, @name, ')')" />
862 </xsl:when>
863 <xsl:otherwise>
864 <xsl:value-of select="concat('comcall_', $varprefix, @name)" />
865 </xsl:otherwise>
866 </xsl:choose>
867 </xsl:when>
868 <xsl:when test="@dir='out'">
869 <xsl:call-template name="emitOutParam">
870 <xsl:with-param name="name" select="@name" />
871 <xsl:with-param name="type" select="@type" />
872 <xsl:with-param name="safearray" select="@safearray" />
873 <xsl:with-param name="varprefix" select="$varprefix" />
874 </xsl:call-template>
875 </xsl:when>
876 <xsl:when test="@dir='return'">
877 <xsl:call-template name="emitOutParam">
878 <xsl:with-param name="name" select="$G_result" />
879 <xsl:with-param name="type" select="@type" />
880 <xsl:with-param name="safearray" select="@safearray" />
881 <xsl:with-param name="varprefix" select="$varprefix" />
882 </xsl:call-template>
883 </xsl:when>
884 </xsl:choose>
885 </xsl:for-each>
886 <xsl:text>);</xsl:text>
887 <xsl:call-template name="emitNewlineIndent8" />
888 <xsl:text>if (FAILED(rc))</xsl:text>
889 <xsl:call-template name="emitNewlineIndent8" />
890 <xsl:text>{</xsl:text>
891 <xsl:call-template name="emitNewlineIndent8" />
892 <xsl:value-of select="concat(' RaiseSoapRuntimeFault(soap, rc, ', $object, ');')" />
893 <xsl:call-template name="emitNewlineIndent8" />
894 <xsl:text> break;</xsl:text>
895 <xsl:call-template name="emitNewlineIndent8" />
896 <xsl:text>}</xsl:text>
897 <xsl:call-template name="emitNewlineIndent8" />
898 <xsl:text>WEBDEBUG((g_pcszDoneCallingComMethod));</xsl:text>
899 <xsl:call-template name="emitNewline" />
900</xsl:template>
901
902<!--
903 emitOutputArgBackConverter2: implementation details of emitOutputArgBackConverter.
904 -->
905
906<xsl:template name="emitOutputArgBackConverter2">
907 <xsl:param name="name" />
908 <xsl:param name="varname" />
909 <xsl:param name="type" />
910 <xsl:param name="callerprefix" />
911
912 <xsl:choose>
913 <xsl:when test="$type='wstring'">
914 <xsl:value-of select="concat('ConvertComString(', $varname, ')')" />
915 </xsl:when>
916 <xsl:when test="$type='boolean'">
917 <!-- the "!!" avoids a microsoft compiler warning -->
918 <xsl:value-of select="concat('!!', $varname)" />
919 </xsl:when>
920 <xsl:when test=" ($type='octet')
921 or ($type='short')
922 or ($type='unsigned short')
923 or ($type='long')
924 or ($type='unsigned long')
925 or ($type='long long')
926 or ($type='unsigned long long')
927 or ($type='result')">
928 <xsl:value-of select="$varname" />
929 </xsl:when>
930 <xsl:when test="$type='uuid'">
931 <xsl:value-of select="concat($varname, '.toString().raw()')" />
932 </xsl:when>
933 <xsl:when test="//enum[@name=$type]">
934 <xsl:value-of select="concat($G_funcPrefixOutputEnumConverter, $type, '(', $varname, ')')" />
935 </xsl:when>
936 <xsl:when test="$type='$unknown'">
937 <xsl:value-of select="concat('createOrFindRefFromComPtr(idThis, g_pcszIUnknown, ', $varname, ')')" />
938 </xsl:when>
939 <xsl:when test="//interface[@name=$type]">
940 <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
941 <xsl:variable name="thatif" select="//interface[@name=$type]" />
942 <xsl:variable name="wsmap" select="$thatif/@wsmap" />
943 <xsl:variable name="thatifname" select="$thatif/@name" />
944 <xsl:choose>
945 <xsl:when test=" ($wsmap='managed') or ($wsmap='global')">
946 <xsl:value-of select="concat('createOrFindRefFromComPtr(idThis, g_pcsz', $thatifname, ', ', $varname, ')')" />
947 </xsl:when>
948 <xsl:when test="$wsmap='struct'">
949 <!-- prevent infinite recursion -->
950 <!-- <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> -->
951 <xsl:if test="not($callerprefix)">
952 <xsl:value-of select="concat('/* convert COM interface to struct */ ', $G_funcPrefixOutputEnumConverter, $type, '(soap, idThis, rc, ', $varname, ')')" />
953 </xsl:if>
954 </xsl:when>
955 <xsl:otherwise>
956 <xsl:call-template name="fatalError">
957 <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.')" />
958 </xsl:call-template>
959 </xsl:otherwise>
960 </xsl:choose>
961 </xsl:when>
962 <xsl:when test="//collection[@name=$type]">
963 <!-- the type is a collection of our own types: then build an array from it -->
964 <xsl:variable name="collectiontype" select="//collection[@name=$type]/@type" />
965 <xsl:variable name="targetwsmap" select="//interface[@name=$collectiontype]/@wsmap" />
966 <xsl:value-of select="concat('soap_new_vbox__ArrayOf', $collectiontype, '(soap, 1);')" />
967 <xsl:call-template name="emitNewlineIndent8" />
968 <xsl:variable name="enumerator" select="concat('comcall_', $callerprefix, $name, '_enum')" />
969 <xsl:value-of select="concat('ComPtr&lt;', $collectiontype, 'Enumerator&gt; ', $enumerator, ';')" />
970 <xsl:call-template name="emitNewlineIndent8" />
971 <xsl:value-of select="concat('CHECK_ERROR_BREAK( comcall_', $callerprefix, $name, ', Enumerate(', $enumerator, '.asOutParam()) );')" />
972 <xsl:call-template name="emitNewlineIndent8" />
973 <xsl:value-of select="concat('BOOL comcall_', $callerprefix, $name, '_hasmore = FALSE;')" />
974 <xsl:call-template name="emitNewlineIndent8" />
975 <xsl:value-of select="'do {'" />
976 <xsl:call-template name="emitNewlineIndent8" />
977 <xsl:value-of select="concat(' CHECK_ERROR_BREAK( ', $enumerator, ', HasMore(&amp;comcall_', $callerprefix, $name, '_hasmore) );')" />
978 <xsl:call-template name="emitNewlineIndent8" />
979 <xsl:value-of select="concat(' if (!comcall_', $callerprefix, $name, '_hasmore) break;')" />
980 <xsl:call-template name="emitNewlineIndent8" />
981 <xsl:value-of select="concat(' ComPtr&lt;', $collectiontype, '&gt; arrayitem;')" />
982 <xsl:call-template name="emitNewlineIndent8" />
983 <xsl:value-of select="concat(' CHECK_ERROR_BREAK( ', $enumerator, ', GetNext(arrayitem.asOutParam()) );')" />
984 <xsl:call-template name="emitNewlineIndent8" />
985 <xsl:value-of select="concat(' // collection of &quot;', $collectiontype, '&quot;, target interface wsmap: &quot;', $targetwsmap, '&quot;')" />
986 <xsl:call-template name="emitNewlineIndent8" />
987 <xsl:value-of select="concat(' ', $G_responseElementVarName, '-&gt;', $G_result)" />
988 <xsl:value-of select="'->array.push_back('" />
989 <xsl:choose>
990 <xsl:when test="($targetwsmap='managed')">
991 <xsl:value-of select="concat('createOrFindRefFromComPtr(idThis, g_pcsz', $collectiontype, ', arrayitem));')" />
992 </xsl:when>
993 <xsl:when test="$targetwsmap='struct'">
994 <xsl:value-of select="concat($G_funcPrefixOutputEnumConverter, $collectiontype, '(soap, idThis, rc, arrayitem));')" />
995 </xsl:when>
996 <xsl:otherwise>
997 <xsl:call-template name="fatalError">
998 <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;.')" />
999 </xsl:call-template>
1000 </xsl:otherwise>
1001 </xsl:choose>
1002 <xsl:call-template name="emitNewlineIndent8" />
1003 <xsl:value-of select="'} while (1)'" />
1004 </xsl:when>
1005 <xsl:otherwise>
1006 <xsl:call-template name="fatalError">
1007 <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.')" />
1008 </xsl:call-template>
1009 </xsl:otherwise>
1010 </xsl:choose>
1011
1012</xsl:template>
1013
1014<!--
1015 emitOutputArgBackConverter:
1016 another type converter (from COM type back to WSDL)
1017 which converts the output argument from the COM
1018 method call back to the WSDL type passed in by the
1019 caller.
1020-->
1021<xsl:template name="emitOutputArgBackConverter">
1022 <xsl:param name="ifname" />
1023 <xsl:param name="method" />
1024 <xsl:param name="name" />
1025 <xsl:param name="type" />
1026 <xsl:param name="safearray" />
1027 <xsl:param name="varprefix" /> <!-- only when called recursively from emitGetAttributeComCall -->
1028 <xsl:param name="callerprefix" /> <!-- only for out params or when called recursively from emitGetAttributeComCall -->
1029
1030 <xsl:variable name="topname" select="$name" />
1031 <xsl:variable name="varname" select="concat('comcall_', $varprefix, $name)" />
1032
1033 <xsl:call-template name="emitNewlineIndent8" />
1034 <xsl:value-of select="concat('WEBDEBUG((g_pcszConvertComOutputBack, &quot;', $name, '&quot;));')" />
1035 <xsl:call-template name="emitNewlineIndent8" />
1036
1037 <xsl:variable name="receiverVariable">
1038 <xsl:choose>
1039 <xsl:when test="(not($varprefix))">
1040 <xsl:choose>
1041 <xsl:when test="$callerprefix"> <!-- callerprefix set but varprefix not: then this is an out parameter :-) -->
1042 <xsl:value-of select="concat($G_responseElementVarName, '-&gt;', $name)" />
1043 </xsl:when>
1044 <xsl:otherwise>
1045 <xsl:value-of select="concat($G_responseElementVarName, '-&gt;', $G_result)" />
1046 </xsl:otherwise>
1047 </xsl:choose>
1048 </xsl:when>
1049 <xsl:otherwise>
1050 <xsl:value-of select="concat($callerprefix, $G_result, '-&gt;', $name)" />
1051 </xsl:otherwise>
1052 </xsl:choose>
1053 </xsl:variable>
1054
1055 <xsl:choose>
1056 <xsl:when test="$safearray='yes'">
1057 <xsl:value-of select="concat('for (size_t i = 0; i &lt; ', $varname, '.size(); ++i)')" />
1058 <xsl:call-template name="emitNewlineIndent8" />
1059 <xsl:value-of select="'{'" />
1060 <xsl:call-template name="emitNewlineIndent8" />
1061 <!-- look up C++ glue type from IDL type from table array in websrv-shared.inc.xsl -->
1062 <xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename" />
1063 <xsl:choose>
1064 <xsl:when test="//interface[@name=$type]">
1065 <xsl:value-of select="concat(' ComPtr&lt;', $type, '&gt; tmpObject(', $varname, '[i]);')" />
1066 </xsl:when>
1067 <xsl:when test="//enum[@name=$type]">
1068 <xsl:value-of select="concat(' ', $type, '_T tmpObject(', $varname, '[i]);')" />
1069 </xsl:when>
1070 <xsl:when test="$type='$unknown'">
1071 <xsl:value-of select="concat(' ComPtr&lt;IUnknown&gt; tmpObject(', $varname, '[i]);')" />
1072 </xsl:when>
1073 <xsl:when test="$type='wstring'">
1074 <xsl:value-of select="concat(' com::Bstr tmpObject(', $varname, '[i]);')" />
1075 </xsl:when>
1076 <xsl:when test="$type='uuid'">
1077 <xsl:value-of select="concat(' com::Guid tmpObject(', $varname, '[i]);')" />
1078 </xsl:when>
1079 <xsl:when test="$gluetypefield">
1080 <xsl:value-of select="concat(' ', $gluetypefield, ' tmpObject(', $varname, '[i]);')" />
1081 </xsl:when>
1082 <xsl:otherwise>
1083 <xsl:call-template name="fatalError">
1084 <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.')" />
1085 </xsl:call-template>
1086
1087 </xsl:otherwise>
1088 </xsl:choose>
1089 <xsl:call-template name="emitNewlineIndent8" />
1090 <xsl:value-of select="concat(' ', $receiverVariable, '.push_back(')" />
1091 <xsl:call-template name="emitOutputArgBackConverter2">
1092 <xsl:with-param name="name" select="$name"/>
1093 <xsl:with-param name="varname" select="'tmpObject'"/>
1094 <xsl:with-param name="type" select="$type"/>
1095 <xsl:with-param name="callerprefix" select="$callerprefix"/>
1096 </xsl:call-template>
1097 <xsl:value-of select="');'" />
1098 <xsl:call-template name="emitNewlineIndent8" />
1099 <xsl:value-of select="'}'" />
1100 <xsl:call-template name="emitNewline" />
1101 </xsl:when>
1102 <xsl:otherwise>
1103 <!-- emit variable name: "resp->retval = " -->
1104 <xsl:value-of select="$receiverVariable" />
1105
1106 <xsl:value-of select="' = '" />
1107 <xsl:call-template name="emitOutputArgBackConverter2">
1108 <xsl:with-param name="name" select="$name"/>
1109 <xsl:with-param name="varname" select="$varname"/>
1110 <xsl:with-param name="type" select="$type"/>
1111 <xsl:with-param name="callerprefix" select="$callerprefix"/>
1112 </xsl:call-template>
1113 <xsl:value-of select="';'" />
1114 <xsl:call-template name="emitNewline" />
1115
1116 </xsl:otherwise>
1117 </xsl:choose>
1118
1119 <xsl:value-of select="concat(' WEBDEBUG((g_pcszDoneConvertingComOutputBack, &quot;', $name, '&quot;));')" />
1120 <xsl:call-template name="emitNewline" />
1121</xsl:template>
1122
1123<!--
1124 emitGetAttributeComCall
1125 -->
1126<xsl:template name="emitGetAttributeComCall">
1127 <xsl:param name="ifname" />
1128 <xsl:param name="object" /> <!-- normally "pObj->" -->
1129 <xsl:param name="attrname" />
1130 <xsl:param name="attrtype" />
1131 <xsl:param name="attrsafearray" />
1132 <xsl:param name="varprefix" /> <!-- only when called recursively from emitOutputArgBackConverter-->
1133 <xsl:param name="callerprefix" /> <!-- only when called recursively from emitOutputArgBackConverter-->
1134
1135 <xsl:variable name="gettername"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
1136 <xsl:call-template name="emitOutputArgBuffer">
1137 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1138 <xsl:with-param name="method"><xsl:value-of select="$gettername" /></xsl:with-param>
1139 <xsl:with-param name="name" select="$attrname" />
1140 <xsl:with-param name="type" select="$attrtype" />
1141 <xsl:with-param name="safearray" select="$attrsafearray" />
1142 <xsl:with-param name="varprefix" select="$varprefix" />
1143 </xsl:call-template>
1144 <xsl:variable name="upperattrname"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$attrname" /></xsl:call-template></xsl:variable>
1145 <!-- actual COM method call -->
1146 <xsl:call-template name="emitComCall">
1147 <xsl:with-param name="methodname" select="concat('COMGETTER(', $upperattrname, ')')" />
1148 <xsl:with-param name="object" select="$object" />
1149 <xsl:with-param name="attrname" select="$attrname" />
1150 <xsl:with-param name="attrtype" select="$attrtype" />
1151 <xsl:with-param name="attrsafearray" select="$attrsafearray" />
1152 <xsl:with-param name="attrdir" select="'return'" />
1153 <xsl:with-param name="varprefix" select="$varprefix" />
1154 </xsl:call-template>
1155 <!-- convert back the output data -->
1156 <xsl:call-template name="emitOutputArgBackConverter">
1157 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1158 <xsl:with-param name="method"><xsl:value-of select="$gettername" /></xsl:with-param>
1159 <xsl:with-param name="name" select="$attrname" />
1160 <xsl:with-param name="type" select="$attrtype" />
1161 <xsl:with-param name="safearray" select="$attrsafearray" />
1162 <xsl:with-param name="varprefix" select="$varprefix" />
1163 <xsl:with-param name="callerprefix" select="$callerprefix" />
1164 </xsl:call-template>
1165</xsl:template>
1166
1167<!--
1168 emitSetAttributeComCall
1169 -->
1170<xsl:template name="emitSetAttributeComCall">
1171 <xsl:param name="ifname" />
1172 <xsl:param name="object" /> <!-- normally "pObj->" -->
1173 <xsl:param name="attrname" />
1174 <xsl:param name="attrtype" />
1175 <xsl:param name="attrsafearray" />
1176 <xsl:param name="callerprefix" /> <!-- only when called recursively from emitOutputArgBackConverter-->
1177
1178 <xsl:variable name="settername"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
1179 <xsl:variable name="upperattrname"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$attrname" /></xsl:call-template></xsl:variable>
1180
1181 <xsl:call-template name="emitInputArgConverter">
1182 <xsl:with-param name="method" select="concat($ifname, '::', $settername)" />
1183 <xsl:with-param name="name" select="$attrname" />
1184 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
1185 <xsl:with-param name="type" select="$attrtype" />
1186 <xsl:with-param name="safearray" select="$attrsafearray" />
1187 </xsl:call-template>
1188 <xsl:call-template name="emitComCall">
1189 <xsl:with-param name="methodname" select="concat('COMSETTER(', $upperattrname, ')')" />
1190 <xsl:with-param name="object" select="$object" />
1191 <xsl:with-param name="attrname" select="$attrname" />
1192 <xsl:with-param name="attrtype" select="$attrtype" />
1193 <xsl:with-param name="attrsafearray" select="$attrsafearray" />
1194 <xsl:with-param name="attrdir" select="'in'" />
1195 </xsl:call-template>
1196</xsl:template>
1197
1198<!--
1199 emitGetAttributeMapper
1200 -->
1201<xsl:template name="emitGetAttributeMapper">
1202 <xsl:param name="ifname" />
1203 <xsl:param name="wsmap" />
1204 <xsl:param name="attrname" />
1205 <xsl:param name="attrtype" />
1206 <xsl:param name="attrreadonly" />
1207 <xsl:param name="attrsafearray" />
1208
1209 <xsl:variable name="gettername"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
1210
1211 <xsl:call-template name="emitBeginOfFunctionHeader">
1212 <xsl:with-param name="ifname" select="$ifname" />
1213 <xsl:with-param name="method" select="$gettername" />
1214 </xsl:call-template>
1215
1216 <xsl:call-template name="emitDocumentStyleArgStructs">
1217 <xsl:with-param name="ifname" select="$ifname" />
1218 <xsl:with-param name="methodname" select="$gettername" />
1219 <xsl:with-param name="fOutputs" select="$attrtype" />
1220 </xsl:call-template>
1221
1222 <xsl:text>)</xsl:text>
1223 <xsl:call-template name="emitNewline" />
1224 <xsl:text>{</xsl:text>
1225 <xsl:call-template name="emitNewline" />
1226
1227 <xsl:value-of select="' HRESULT rc = S_OK;'" />
1228 <xsl:call-template name="emitNewline" />
1229
1230 <xsl:call-template name="emitPrologue" />
1231
1232 <!-- actual COM method call -->
1233 <!-- <xsl:choose>
1234 array attributes/parameters are not supported yet...
1235 <xsl:when test="@array or @safearray='yes'">
1236 <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>
1237 </xsl:when>
1238 <xsl:otherwise> -->
1239 <xsl:call-template name="emitObjForMethod">
1240 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1241 <xsl:with-param name="wsmap"><xsl:value-of select="$wsmap" /></xsl:with-param>
1242 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
1243 </xsl:call-template>
1244
1245 <xsl:call-template name="emitGetAttributeComCall">
1246 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1247 <xsl:with-param name="object" select='"pObj"' />
1248 <xsl:with-param name="attrname"><xsl:value-of select="$attrname" /></xsl:with-param>
1249 <xsl:with-param name="attrtype"><xsl:value-of select="$attrtype" /></xsl:with-param>
1250 <xsl:with-param name="attrsafearray"><xsl:value-of select="$attrsafearray" /></xsl:with-param>
1251 </xsl:call-template>
1252 <!-- </xsl:otherwise>
1253 </xsl:choose> -->
1254
1255 <xsl:call-template name="emitEpilogue" />
1256</xsl:template>
1257
1258<!--
1259 emitSetAttributeMapper:
1260 -->
1261<xsl:template name="emitSetAttributeMapper">
1262 <xsl:param name="ifname" select="$ifname" />
1263 <xsl:param name="wsmap" select="$wsmap" />
1264 <xsl:param name="attrname" select="$attrname" />
1265 <xsl:param name="attrtype" select="$attrtype" />
1266 <xsl:param name="attrreadonly" select="$attrreadonly" />
1267
1268 <xsl:variable name="settername"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
1269
1270 <xsl:call-template name="emitBeginOfFunctionHeader">
1271 <xsl:with-param name="ifname" select="$ifname" />
1272 <xsl:with-param name="method" select="$settername" />
1273 </xsl:call-template>
1274
1275 <xsl:call-template name="emitDocumentStyleArgStructs">
1276 <xsl:with-param name="ifname" select="$ifname" />
1277 <xsl:with-param name="methodname" select="$settername" />
1278 <xsl:with-param name="fOutputs" select="1" />
1279 </xsl:call-template>
1280
1281 <xsl:text>)</xsl:text>
1282 <xsl:call-template name="emitNewline" />
1283 <xsl:text>{</xsl:text>
1284 <xsl:call-template name="emitNewline" />
1285 <xsl:value-of select="' HRESULT rc = S_OK;'" />
1286 <xsl:call-template name="emitNewline" />
1287 <xsl:call-template name="emitPrologue" />
1288
1289 <!-- actual COM method call -->
1290 <!-- <xsl:choose>
1291 array attributes/parameters are not supported yet...
1292 <xsl:when test="@array or @safearray='yes'">
1293 <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>
1294 </xsl:when>
1295 <xsl:otherwise> -->
1296 <xsl:call-template name="emitObjForMethod">
1297 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1298 <xsl:with-param name="wsmap"><xsl:value-of select="$wsmap" /></xsl:with-param>
1299 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
1300 </xsl:call-template>
1301 <xsl:call-template name="emitSetAttributeComCall">
1302 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1303 <xsl:with-param name="object" select='"pObj"' />
1304 <xsl:with-param name="attrname"><xsl:value-of select="$attrname" /></xsl:with-param>
1305 <xsl:with-param name="attrtype"><xsl:value-of select="$attrtype" /></xsl:with-param>
1306 </xsl:call-template>
1307 <!-- </xsl:otherwise>
1308 </xsl:choose> -->
1309
1310 <xsl:call-template name="emitEpilogue" />
1311</xsl:template>
1312
1313<!-- - - - - - - - - - - - - - - - - - - - - - -
1314 interface
1315 - - - - - - - - - - - - - - - - - - - - - - -->
1316
1317<xsl:template match="interface">
1318 <!-- remember the interface name in local variables -->
1319 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
1320 <xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
1321 <xsl:variable name="wscpp"><xsl:value-of select="@wscpp" /></xsl:variable>
1322
1323 <!-- we can save ourselves verifying the interface here as it's already
1324 done in the WSDL converter -->
1325
1326 <xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") or ($wscpp="hardcoded") )'>
1327 <xsl:text>
1328/****************************************************************************
1329 *
1330 * interface </xsl:text>
1331<xsl:copy-of select="$ifname" />
1332<xsl:text>
1333 *
1334 ****************************************************************************/
1335</xsl:text>
1336
1337 <!--
1338 here come the attributes
1339 -->
1340 <xsl:for-each select="attribute">
1341 <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
1342 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
1343 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
1344 <xsl:variable name="attrsafearray"><xsl:value-of select="@safearray" /></xsl:variable>
1345 <xsl:call-template name="emitNewline" />
1346 <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
1347 <xsl:choose>
1348 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
1349 <xsl:value-of select="concat('// Skipping attribute ', $attrtype, ' for it is of suppressed type ', $attrtype)" />
1350 </xsl:when>
1351 <xsl:otherwise>
1352 <xsl:choose>
1353 <xsl:when test="@readonly='yes'">
1354 <xsl:value-of select="concat('// read-only attribute ', $ifname, '::', $attrname, ' of type ', $attrtype)" />
1355 </xsl:when>
1356 <xsl:otherwise>
1357 <xsl:value-of select="concat('// read/write attribute ', $ifname, '::', $attrname, ' of type ', $attrtype)" />
1358 </xsl:otherwise>
1359 </xsl:choose>
1360 <xsl:value-of select="concat(' (safearray: ', $attrsafearray, ')')" />
1361 <!-- emit getter method -->
1362 <xsl:call-template name="emitGetAttributeMapper">
1363 <xsl:with-param name="ifname" select="$ifname" />
1364 <xsl:with-param name="wsmap" select="$wsmap" />
1365 <xsl:with-param name="attrname" select="$attrname" />
1366 <xsl:with-param name="attrtype" select="$attrtype" />
1367 <xsl:with-param name="attrreadonly" select="$attrreadonly" />
1368 <xsl:with-param name="attrsafearray" select="$attrsafearray" />
1369 </xsl:call-template>
1370 <!-- for read-write attributes, emit setter method -->
1371 <xsl:if test="not(@readonly='yes')">
1372 <xsl:call-template name="emitSetAttributeMapper">
1373 <xsl:with-param name="ifname" select="$ifname" />
1374 <xsl:with-param name="wsmap" select="$wsmap" />
1375 <xsl:with-param name="attrname" select="$attrname" />
1376 <xsl:with-param name="attrtype" select="$attrtype" />
1377 <xsl:with-param name="attrreadonly" select="$attrreadonly" />
1378 </xsl:call-template>
1379 </xsl:if>
1380 </xsl:otherwise> <!-- not wsmap=suppress -->
1381 </xsl:choose>
1382 </xsl:for-each>
1383
1384 <!--
1385 here come the real methods
1386 -->
1387
1388 <xsl:for-each select="method">
1389 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
1390 <!-- method header: return value "int", method name, soap arguments -->
1391 <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
1392 <xsl:choose>
1393 <xsl:when test=" (param[@type=($G_setSuppressedInterfaces/@name)])
1394 or (param[@mod='ptr'])" >
1395 <xsl:comment><xsl:value-of select="concat('Skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
1396 </xsl:when>
1397 <xsl:otherwise>
1398 <xsl:variable name="fHasReturnParms" select="param[@dir='return']" />
1399 <xsl:variable name="fHasOutParms" select="param[@dir='out']" />
1400
1401 <xsl:call-template name="emitNewline" />
1402 <xsl:value-of select="concat('/* method ', $ifname, '::', $methodname, '(')" />
1403 <xsl:for-each select="param">
1404 <xsl:call-template name="emitNewline" />
1405 <xsl:value-of select="concat(' [', @dir, '] ', @type, ' ', @name)" />
1406 <xsl:if test="@safearray='yes'">
1407 <xsl:text>[]</xsl:text>
1408 </xsl:if>
1409 <xsl:if test="not(position()=last())">
1410 <xsl:text>,</xsl:text>
1411 </xsl:if>
1412 </xsl:for-each>
1413 <xsl:text>)</xsl:text>
1414 <xsl:call-template name="emitNewline" />
1415 <xsl:text> */</xsl:text>
1416
1417 <xsl:call-template name="emitBeginOfFunctionHeader">
1418 <xsl:with-param name="ifname" select="$ifname" />
1419 <xsl:with-param name="method" select="$methodname" />
1420 </xsl:call-template>
1421
1422 <xsl:call-template name="emitDocumentStyleArgStructs">
1423 <xsl:with-param name="ifname" select="$ifname" />
1424 <xsl:with-param name="methodname" select="$methodname" />
1425 <xsl:with-param name="fOutputs" select="1" />
1426 </xsl:call-template>
1427 <xsl:text>)</xsl:text>
1428 <xsl:call-template name="emitNewline" />
1429 <xsl:text>{</xsl:text>
1430 <xsl:call-template name="emitNewline" />
1431 <xsl:value-of select="' HRESULT rc = S_OK;'" />
1432 <xsl:call-template name="emitNewline" />
1433 <xsl:call-template name="emitPrologue" />
1434
1435 <xsl:choose>
1436 <xsl:when test="param[@array]">
1437 <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>
1438 </xsl:when>
1439 <xsl:otherwise>
1440 <!-- emit the object upon which to invoke the method -->
1441 <xsl:call-template name="emitObjForMethod">
1442 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1443 <xsl:with-param name="wsmap"><xsl:value-of select="$wsmap" /></xsl:with-param>
1444 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
1445 </xsl:call-template>
1446 <!-- next, emit storage variables to convert the SOAP/C++ arguments to COM types -->
1447 <xsl:for-each select="param">
1448 <xsl:variable name="dir" select="@dir" />
1449 <xsl:choose>
1450 <xsl:when test="$dir='in'">
1451 <xsl:call-template name="emitInputArgConverter">
1452 <xsl:with-param name="method" select="concat($ifname, '::', $methodname)" />
1453 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
1454 <xsl:with-param name="name" select="@name" />
1455 <xsl:with-param name="type" select="@type" />
1456 <xsl:with-param name="safearray" select="@safearray" />
1457 </xsl:call-template>
1458 </xsl:when>
1459 <xsl:when test="$dir='out'">
1460 <xsl:call-template name="emitOutputArgBuffer">
1461 <xsl:with-param name="method" select="concat($ifname, '::', $methodname)" />
1462 <xsl:with-param name="name" select="@name" />
1463 <xsl:with-param name="type" select="@type" />
1464 <xsl:with-param name="safearray" select="@safearray" />
1465 </xsl:call-template>
1466 </xsl:when>
1467 <xsl:when test="$dir='return'">
1468 <xsl:call-template name="emitOutputArgBuffer">
1469 <xsl:with-param name="method" select="concat($ifname, '::', $methodname)" />
1470 <xsl:with-param name="name" select="$G_result" />
1471 <xsl:with-param name="type" select="@type" />
1472 <xsl:with-param name="safearray" select="@safearray" />
1473 </xsl:call-template>
1474 </xsl:when>
1475 </xsl:choose>
1476 </xsl:for-each>
1477 <!-- actual COM method call -->
1478 <xsl:call-template name="emitComCall">
1479 <xsl:with-param name="object" select='"pObj"' />
1480 <xsl:with-param name="methodname">
1481 <xsl:call-template name="capitalize">
1482 <xsl:with-param name="str" select="$methodname" />
1483 </xsl:call-template>
1484 </xsl:with-param>
1485 </xsl:call-template>
1486 <!-- convert back the output data -->
1487 <xsl:for-each select="param">
1488 <xsl:variable name="dir" select="@dir" />
1489 <xsl:if test="$dir='out'">
1490 <xsl:call-template name="emitOutputArgBackConverter">
1491 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1492 <xsl:with-param name="method" select="$methodname" />
1493 <xsl:with-param name="name"><xsl:value-of select="@name" /></xsl:with-param>
1494 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
1495 <xsl:with-param name="safearray"><xsl:value-of select="@safearray" /></xsl:with-param>
1496 <xsl:with-param name="callerprefix" select="'outparms.'"/>
1497 </xsl:call-template>
1498 </xsl:if>
1499 <xsl:if test="$dir='return'">
1500 <!-- return values _normally_ should convert to the input arg from the function prototype,
1501 except when there are both return and out params; in that case gsoap squeezes them all
1502 into the output args structure and the return thing is called "retval" -->
1503 <xsl:choose>
1504 <xsl:when test="$fHasOutParms">
1505 <xsl:call-template name="emitOutputArgBackConverter">
1506 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1507 <xsl:with-param name="method" select="$methodname" />
1508 <xsl:with-param name="name"><xsl:value-of select="$G_result" /></xsl:with-param>
1509 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
1510 <xsl:with-param name="safearray"><xsl:value-of select="@safearray" /></xsl:with-param>
1511 <xsl:with-param name="callerprefix" select="'outparms.'"/>
1512 </xsl:call-template>
1513 </xsl:when>
1514 <xsl:otherwise>
1515 <xsl:call-template name="emitOutputArgBackConverter">
1516 <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
1517 <xsl:with-param name="method" select="$methodname" />
1518 <xsl:with-param name="name"><xsl:value-of select="$G_result" /></xsl:with-param>
1519 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
1520 <xsl:with-param name="safearray"><xsl:value-of select="@safearray" /></xsl:with-param>
1521 </xsl:call-template>
1522 </xsl:otherwise>
1523 </xsl:choose>
1524 </xsl:if>
1525 </xsl:for-each>
1526 </xsl:otherwise>
1527 </xsl:choose>
1528 <xsl:call-template name="emitEpilogue" />
1529 </xsl:otherwise>
1530 </xsl:choose>
1531 </xsl:for-each>
1532 </xsl:if>
1533
1534</xsl:template>
1535
1536
1537</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