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