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