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='boolean'">
|
---|
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="//enum[@name=$type]">
|
---|
609 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
610 | <xsl:value-of select="concat(' comcall_', $name, '[i] = ', $G_funcPrefixInputEnumConverter, $type, '(', $structprefix, $name, '[i]);')" />
|
---|
611 | </xsl:when>
|
---|
612 | <xsl:otherwise>
|
---|
613 | <xsl:call-template name="fatalError">
|
---|
614 | <xsl:with-param name="msg" select="concat('emitInputArgConverter Type "', $type, '" in arg "', $name, '" of method "', $method, '" is not yet supported in safearrays.')" />
|
---|
615 | </xsl:call-template>
|
---|
616 | </xsl:otherwise>
|
---|
617 | </xsl:choose>
|
---|
618 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
619 | <xsl:value-of select="'}'" />
|
---|
620 | <xsl:call-template name="emitNewline" />
|
---|
621 | </xsl:when>
|
---|
622 | <xsl:otherwise>
|
---|
623 | <xsl:call-template name="emitCppTypeForIDLType">
|
---|
624 | <xsl:with-param name="method" select="$method"/>
|
---|
625 | <xsl:with-param name="type" select="$type"/>
|
---|
626 | <xsl:with-param name="safearray" select="$safearray"/>
|
---|
627 | <xsl:with-param name="inptr" select="'yes'"/>
|
---|
628 | </xsl:call-template>
|
---|
629 | <xsl:choose>
|
---|
630 | <xsl:when test="$type='wstring' or $type='uuid'">
|
---|
631 | <xsl:value-of select="concat(' comcall_', $name, '(', $structprefix, $name, '.c_str())')" />
|
---|
632 | </xsl:when>
|
---|
633 | <xsl:when test="//enum[@name=$type]">
|
---|
634 | <xsl:value-of select="concat(' comcall_', $name, ' = ', $G_funcPrefixInputEnumConverter, $type, '(', $structprefix, $name, ')')" />
|
---|
635 | </xsl:when>
|
---|
636 | <xsl:when test="$type='$unknown'">
|
---|
637 | <xsl:value-of select="concat(' comcall_', $name, ';')" />
|
---|
638 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
639 | <xsl:value-of select="concat('if ((rc = findComPtrFromId(soap, ', $structprefix, $name, ', comcall_', $name,', true)))')" />
|
---|
640 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
641 | <xsl:text> break</xsl:text>
|
---|
642 | </xsl:when>
|
---|
643 | <xsl:when test="//interface[@name=$type]">
|
---|
644 | <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
|
---|
645 | <xsl:variable name="thatif" select="//interface[@name=$type]" />
|
---|
646 | <xsl:variable name="wsmap" select="$thatif/@wsmap" />
|
---|
647 | <xsl:variable name="thatifname" select="$thatif/@name" />
|
---|
648 | <xsl:choose>
|
---|
649 | <xsl:when test="not($wsmap)">
|
---|
650 | <xsl:call-template name="fatalError">
|
---|
651 | <xsl:with-param name="msg" select="concat('emitInputArgConverter: Type "', $type, '" in arg "', $name, '" of method "', $method, '" lacks wsmap attribute in XIDL.')" />
|
---|
652 | </xsl:call-template>
|
---|
653 | </xsl:when>
|
---|
654 | <xsl:when test="($wsmap='managed')">
|
---|
655 | <xsl:value-of select="concat(' comcall_', $name, ';')" />
|
---|
656 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
657 | <xsl:value-of select="concat('if ((rc = findComPtrFromId(soap, ', $structprefix, $name, ', comcall_', $name,', true)))')" />
|
---|
658 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
659 | <xsl:text> break</xsl:text>
|
---|
660 | </xsl:when>
|
---|
661 | <xsl:otherwise>
|
---|
662 | <xsl:call-template name="fatalError">
|
---|
663 | <xsl:with-param name="msg" select="concat('emitInputArgConverter: Type "', $type, '" in arg "', $name, '" of method "', $method, '" has unsupported wsmap attribute value "', $wsmap, '" in XIDL.')" />
|
---|
664 | </xsl:call-template>
|
---|
665 | </xsl:otherwise>
|
---|
666 | </xsl:choose>
|
---|
667 | </xsl:when>
|
---|
668 | <xsl:otherwise>
|
---|
669 | <xsl:value-of select="concat(' comcall_', $name, ' = ', $structprefix, $name)" />
|
---|
670 | </xsl:otherwise>
|
---|
671 | </xsl:choose>
|
---|
672 | <xsl:text>;
|
---|
673 | </xsl:text>
|
---|
674 | </xsl:otherwise>
|
---|
675 | </xsl:choose>
|
---|
676 |
|
---|
677 | </xsl:template>
|
---|
678 |
|
---|
679 | <!--
|
---|
680 | emitTypeOrArray
|
---|
681 | -->
|
---|
682 |
|
---|
683 | <xsl:template name="emitTypeOrArray">
|
---|
684 | <xsl:param name="type" />
|
---|
685 | <xsl:param name="safearray" />
|
---|
686 |
|
---|
687 | <xsl:choose>
|
---|
688 | <xsl:when test="$safearray='yes'">
|
---|
689 | <xsl:value-of select="concat('com::SafeArray<', $type, '>')" />
|
---|
690 | </xsl:when>
|
---|
691 | <xsl:otherwise>
|
---|
692 | <xsl:value-of select="$type" />
|
---|
693 | </xsl:otherwise>
|
---|
694 | </xsl:choose>
|
---|
695 | </xsl:template>
|
---|
696 |
|
---|
697 | <!--
|
---|
698 | emitOutputArgBuffer:
|
---|
699 | another type converter (from wsdl type to COM types)
|
---|
700 | that generates a buffer variable which receives the
|
---|
701 | data from 'out' and 'return' parameters of the COM method call.
|
---|
702 | -->
|
---|
703 | <xsl:template name="emitOutputArgBuffer">
|
---|
704 | <xsl:param name="method" />
|
---|
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:text> // com output arg for </xsl:text><xsl:value-of select="concat($name, ' (safearray: ', $safearray, ')')" /><xsl:text>
|
---|
711 | </xsl:text>
|
---|
712 | <xsl:call-template name="emitCppTypeForIDLType">
|
---|
713 | <xsl:with-param name="method" select="$method" />
|
---|
714 | <xsl:with-param name="type" select="$type" />
|
---|
715 | <xsl:with-param name="safearray" select="$safearray" />
|
---|
716 | </xsl:call-template>
|
---|
717 | <xsl:value-of select="concat(' comcall_', $varprefix, $name, ';')" />
|
---|
718 | <xsl:call-template name="emitNewline" />
|
---|
719 | </xsl:template>
|
---|
720 |
|
---|
721 | <!--
|
---|
722 | emitInParam:
|
---|
723 | -->
|
---|
724 | <xsl:template name="emitInParam">
|
---|
725 | <xsl:param name="name" />
|
---|
726 | <xsl:param name="type" />
|
---|
727 | <xsl:param name="safearray" />
|
---|
728 | <xsl:param name="varprefix" /> <!-- only with nested set-attribute calls -->
|
---|
729 |
|
---|
730 | <xsl:variable name="varname" select="concat('comcall_', $varprefix, $name)" />
|
---|
731 |
|
---|
732 | <xsl:choose>
|
---|
733 | <xsl:when test="@safearray='yes'">
|
---|
734 | <xsl:value-of select="concat('ComSafeArrayAsInParam(', $varname, ')')" />
|
---|
735 | </xsl:when>
|
---|
736 | <xsl:otherwise>
|
---|
737 | <xsl:value-of select="$varname" />
|
---|
738 | <xsl:if test="@type='wstring' or @type='uuid'">
|
---|
739 | <xsl:text>.raw()</xsl:text>
|
---|
740 | </xsl:if>
|
---|
741 | </xsl:otherwise>
|
---|
742 | </xsl:choose>
|
---|
743 | </xsl:template>
|
---|
744 |
|
---|
745 | <!--
|
---|
746 | emitOutParam:
|
---|
747 | -->
|
---|
748 | <xsl:template name="emitOutParam">
|
---|
749 | <xsl:param name="name" />
|
---|
750 | <xsl:param name="type" />
|
---|
751 | <xsl:param name="safearray" />
|
---|
752 | <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
|
---|
753 |
|
---|
754 | <xsl:variable name="varname" select="concat('comcall_', $varprefix, $name)" />
|
---|
755 |
|
---|
756 | <xsl:choose>
|
---|
757 | <xsl:when test="$safearray='yes'">
|
---|
758 | <xsl:value-of select="concat('ComSafeArrayAsOutParam(', $varname, ')')" />
|
---|
759 | </xsl:when>
|
---|
760 | <xsl:otherwise>
|
---|
761 | <xsl:choose>
|
---|
762 | <xsl:when test=" ($type='boolean')
|
---|
763 | or ($type='short')
|
---|
764 | or ($type='unsigned short')
|
---|
765 | or ($type='long')
|
---|
766 | or ($type='unsigned long')
|
---|
767 | or ($type='long long')
|
---|
768 | or ($type='unsigned long long')
|
---|
769 | or ($type='result')
|
---|
770 | or (//enum[@name=$type])">
|
---|
771 | <xsl:text>&</xsl:text><xsl:value-of select="$varname" />
|
---|
772 | </xsl:when>
|
---|
773 | <xsl:otherwise>
|
---|
774 | <xsl:value-of select="$varname" /><xsl:text>.asOutParam()</xsl:text>
|
---|
775 | </xsl:otherwise>
|
---|
776 | </xsl:choose>
|
---|
777 | </xsl:otherwise>
|
---|
778 | </xsl:choose>
|
---|
779 | </xsl:template>
|
---|
780 |
|
---|
781 | <!--
|
---|
782 | emitComCall:
|
---|
783 | emits the actual method call with the arguments.
|
---|
784 | -->
|
---|
785 | <xsl:template name="emitComCall">
|
---|
786 | <xsl:param name="ifname" />
|
---|
787 | <xsl:param name="object" /> <!-- normally "pObj" -->
|
---|
788 | <xsl:param name="methodname" />
|
---|
789 | <xsl:param name="attrname" /> <!-- with attributes only -->
|
---|
790 | <xsl:param name="attrtype" /> <!-- with attributes only -->
|
---|
791 | <xsl:param name="attrsafearray" /> <!-- with attributes only -->
|
---|
792 | <xsl:param name="attrdir" /> <!-- with attributes only: "in" or "return" -->
|
---|
793 | <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
|
---|
794 |
|
---|
795 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
796 | <xsl:value-of select="concat('WEBDEBUG((g_pcszCallingComMethod, "', $methodname, '"));')" />
|
---|
797 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
798 | <xsl:value-of select="concat('rc = ', $object, '->', $methodname, '(')" />
|
---|
799 | <xsl:if test="$attrtype">
|
---|
800 | <xsl:choose>
|
---|
801 | <xsl:when test="$attrdir='in'">
|
---|
802 | <xsl:call-template name="emitInParam">
|
---|
803 | <xsl:with-param name="name" select="$attrname" />
|
---|
804 | <xsl:with-param name="type" select="$attrtype" />
|
---|
805 | <xsl:with-param name="safearray" select="$attrsafearray" />
|
---|
806 | <xsl:with-param name="varprefix" select="$varprefix" />
|
---|
807 | </xsl:call-template>
|
---|
808 | </xsl:when>
|
---|
809 | <xsl:when test="$attrdir='return'">
|
---|
810 | <xsl:call-template name="emitOutParam">
|
---|
811 | <xsl:with-param name="name" select="$attrname" />
|
---|
812 | <xsl:with-param name="type" select="$attrtype" />
|
---|
813 | <xsl:with-param name="safearray" select="$attrsafearray" />
|
---|
814 | <xsl:with-param name="varprefix" select="$varprefix" />
|
---|
815 | </xsl:call-template>
|
---|
816 | </xsl:when>
|
---|
817 | </xsl:choose>
|
---|
818 | </xsl:if>
|
---|
819 | <xsl:for-each select="param">
|
---|
820 | <xsl:if test="position()=1">
|
---|
821 | <xsl:call-template name="emitNewline" />
|
---|
822 | </xsl:if>
|
---|
823 | <xsl:if test="position() > 1">
|
---|
824 | <xsl:text>,</xsl:text>
|
---|
825 | <xsl:call-template name="emitNewline" />
|
---|
826 | </xsl:if>
|
---|
827 | <xsl:text> </xsl:text>
|
---|
828 | <xsl:choose>
|
---|
829 | <xsl:when test="@dir='in'">
|
---|
830 | <xsl:call-template name="emitInParam">
|
---|
831 | <xsl:with-param name="name" select="@name" />
|
---|
832 | <xsl:with-param name="type" select="@type" />
|
---|
833 | <xsl:with-param name="safearray" select="@safearray" />
|
---|
834 | <xsl:with-param name="varprefix" select="$varprefix" />
|
---|
835 | </xsl:call-template>
|
---|
836 | </xsl:when>
|
---|
837 | <xsl:when test="@dir='out'">
|
---|
838 | <xsl:call-template name="emitOutParam">
|
---|
839 | <xsl:with-param name="name" select="@name" />
|
---|
840 | <xsl:with-param name="type" select="@type" />
|
---|
841 | <xsl:with-param name="safearray" select="@safearray" />
|
---|
842 | <xsl:with-param name="varprefix" select="$varprefix" />
|
---|
843 | </xsl:call-template>
|
---|
844 | </xsl:when>
|
---|
845 | <xsl:when test="@dir='return'">
|
---|
846 | <xsl:call-template name="emitOutParam">
|
---|
847 | <xsl:with-param name="name" select="$G_result" />
|
---|
848 | <xsl:with-param name="type" select="@type" />
|
---|
849 | <xsl:with-param name="safearray" select="@safearray" />
|
---|
850 | <xsl:with-param name="varprefix" select="$varprefix" />
|
---|
851 | </xsl:call-template>
|
---|
852 | </xsl:when>
|
---|
853 | </xsl:choose>
|
---|
854 | </xsl:for-each>
|
---|
855 | <xsl:text>);</xsl:text>
|
---|
856 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
857 | <xsl:text>if (FAILED(rc))</xsl:text>
|
---|
858 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
859 | <xsl:text>{</xsl:text>
|
---|
860 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
861 | <xsl:value-of select="concat(' RaiseSoapRuntimeFault(soap, idThis, "', $ifname, '::', $methodname,'", rc, ', $object, ', COM_IIDOF(', $ifname, '));')" />
|
---|
862 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
863 | <xsl:text> break;</xsl:text>
|
---|
864 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
865 | <xsl:text>}</xsl:text>
|
---|
866 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
867 | <xsl:text>WEBDEBUG((g_pcszDoneCallingComMethod));</xsl:text>
|
---|
868 | <xsl:call-template name="emitNewline" />
|
---|
869 | </xsl:template>
|
---|
870 |
|
---|
871 | <!--
|
---|
872 | emitOutputArgBackConverter2: implementation details of emitOutputArgBackConverter.
|
---|
873 | -->
|
---|
874 |
|
---|
875 | <xsl:template name="emitOutputArgBackConverter2">
|
---|
876 | <xsl:param name="name" />
|
---|
877 | <xsl:param name="varname" />
|
---|
878 | <xsl:param name="type" />
|
---|
879 | <xsl:param name="callerprefix" />
|
---|
880 |
|
---|
881 | <xsl:choose>
|
---|
882 | <xsl:when test="$type='wstring' or $type='uuid'">
|
---|
883 | <xsl:value-of select="concat('ConvertComString(', $varname, ')')" />
|
---|
884 | </xsl:when>
|
---|
885 | <xsl:when test="$type='boolean'">
|
---|
886 | <!-- the "!!" avoids a microsoft compiler warning -->
|
---|
887 | <xsl:value-of select="concat('!!', $varname)" />
|
---|
888 | </xsl:when>
|
---|
889 | <xsl:when test=" ($type='octet')
|
---|
890 | or ($type='short')
|
---|
891 | or ($type='unsigned short')
|
---|
892 | or ($type='long')
|
---|
893 | or ($type='unsigned long')
|
---|
894 | or ($type='long long')
|
---|
895 | or ($type='unsigned long long')
|
---|
896 | or ($type='result')">
|
---|
897 | <xsl:value-of select="$varname" />
|
---|
898 | </xsl:when>
|
---|
899 | <xsl:when test="//enum[@name=$type]">
|
---|
900 | <xsl:value-of select="concat($G_funcPrefixOutputEnumConverter, $type, '(', $varname, ')')" />
|
---|
901 | </xsl:when>
|
---|
902 | <xsl:when test="$type='$unknown'">
|
---|
903 | <xsl:value-of select="concat('createOrFindRefFromComPtr(idThis, g_pcszIUnknown, ', $varname, ')')" />
|
---|
904 | </xsl:when>
|
---|
905 | <xsl:when test="//interface[@name=$type]">
|
---|
906 | <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
|
---|
907 | <xsl:variable name="thatif" select="//interface[@name=$type]" />
|
---|
908 | <xsl:variable name="wsmap" select="$thatif/@wsmap" />
|
---|
909 | <xsl:variable name="thatifname" select="$thatif/@name" />
|
---|
910 | <xsl:choose>
|
---|
911 | <xsl:when test=" ($wsmap='managed') or ($wsmap='global')">
|
---|
912 | <xsl:value-of select="concat('createOrFindRefFromComPtr(idThis, g_pcsz', $thatifname, ', ', $varname, ')')" />
|
---|
913 | </xsl:when>
|
---|
914 | <xsl:when test="$wsmap='struct'">
|
---|
915 | <!-- prevent infinite recursion -->
|
---|
916 | <!-- <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> -->
|
---|
917 | <xsl:if test="not($callerprefix)">
|
---|
918 | <xsl:value-of select="concat('/* convert COM interface to struct */ ', $G_funcPrefixOutputStructConverter, $type, '(soap, idThis, rc, ', $varname, ')')" />
|
---|
919 | </xsl:if>
|
---|
920 | </xsl:when>
|
---|
921 | <xsl:otherwise>
|
---|
922 | <xsl:call-template name="fatalError">
|
---|
923 | <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.')" />
|
---|
924 | </xsl:call-template>
|
---|
925 | </xsl:otherwise>
|
---|
926 | </xsl:choose>
|
---|
927 | </xsl:when>
|
---|
928 | <xsl:otherwise>
|
---|
929 | <xsl:call-template name="fatalError">
|
---|
930 | <xsl:with-param name="msg" select="concat('emitOutputArgBackConverter2: Type "', $type, '" in arg "', $name, '" of method "', $method, '" is not supported.')" />
|
---|
931 | </xsl:call-template>
|
---|
932 | </xsl:otherwise>
|
---|
933 | </xsl:choose>
|
---|
934 |
|
---|
935 | </xsl:template>
|
---|
936 |
|
---|
937 | <!--
|
---|
938 | emitOutputArgBackConverter:
|
---|
939 | another type converter (from COM type back to WSDL)
|
---|
940 | which converts the output argument from the COM
|
---|
941 | method call back to the WSDL type passed in by the
|
---|
942 | caller.
|
---|
943 | -->
|
---|
944 | <xsl:template name="emitOutputArgBackConverter">
|
---|
945 | <xsl:param name="ifname" />
|
---|
946 | <xsl:param name="method" />
|
---|
947 | <xsl:param name="name" />
|
---|
948 | <xsl:param name="type" />
|
---|
949 | <xsl:param name="safearray" />
|
---|
950 | <xsl:param name="varprefix" /> <!-- only when called recursively from emitGetAttributeComCall -->
|
---|
951 | <xsl:param name="callerprefix" /> <!-- only for out params or when called recursively from emitGetAttributeComCall -->
|
---|
952 |
|
---|
953 | <xsl:variable name="topname" select="$name" />
|
---|
954 | <xsl:variable name="varname" select="concat('comcall_', $varprefix, $name)" />
|
---|
955 |
|
---|
956 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
957 | <xsl:value-of select="concat('WEBDEBUG((g_pcszConvertComOutputBack, "', $name, '"));')" />
|
---|
958 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
959 |
|
---|
960 | <xsl:variable name="receiverVariable">
|
---|
961 | <xsl:choose>
|
---|
962 | <xsl:when test="(not($varprefix))">
|
---|
963 | <xsl:choose>
|
---|
964 | <xsl:when test="$callerprefix"> <!-- callerprefix set but varprefix not: then this is an out parameter :-) -->
|
---|
965 | <xsl:value-of select="concat($G_responseElementVarName, '->', $name)" />
|
---|
966 | </xsl:when>
|
---|
967 | <xsl:otherwise>
|
---|
968 | <xsl:value-of select="concat($G_responseElementVarName, '->', $G_result)" />
|
---|
969 | </xsl:otherwise>
|
---|
970 | </xsl:choose>
|
---|
971 | </xsl:when>
|
---|
972 | <xsl:otherwise>
|
---|
973 | <xsl:value-of select="concat($callerprefix, $G_result, '->', $name)" />
|
---|
974 | </xsl:otherwise>
|
---|
975 | </xsl:choose>
|
---|
976 | </xsl:variable>
|
---|
977 |
|
---|
978 | <xsl:choose>
|
---|
979 | <xsl:when test="$safearray='yes' and $type='octet'">
|
---|
980 | <xsl:value-of select="concat($receiverVariable, ' = Base64EncodeByteArray(ComSafeArrayAsInParam(', $varname,'));')" />
|
---|
981 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
982 | </xsl:when>
|
---|
983 |
|
---|
984 | <xsl:when test="$safearray='yes'">
|
---|
985 | <xsl:value-of select="concat('for (size_t i = 0; i < ', $varname, '.size(); ++i)')" />
|
---|
986 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
987 | <xsl:value-of select="'{'" />
|
---|
988 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
989 | <!-- look up C++ glue type from IDL type from table array in typemap-shared.inc.xsl -->
|
---|
990 | <xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename" />
|
---|
991 | <xsl:choose>
|
---|
992 | <xsl:when test="//interface[@name=$type]">
|
---|
993 | <xsl:value-of select="concat(' ComPtr<', $type, '> tmpObject(', $varname, '[i]);')" />
|
---|
994 | </xsl:when>
|
---|
995 | <xsl:when test="//enum[@name=$type]">
|
---|
996 | <xsl:value-of select="concat(' ', $type, '_T tmpObject(', $varname, '[i]);')" />
|
---|
997 | </xsl:when>
|
---|
998 | <xsl:when test="$type='$unknown'">
|
---|
999 | <xsl:value-of select="concat(' ComPtr<IUnknown> tmpObject(', $varname, '[i]);')" />
|
---|
1000 | </xsl:when>
|
---|
1001 | <xsl:when test="$type='wstring' or $type='uuid'">
|
---|
1002 | <xsl:value-of select="concat(' com::Bstr tmpObject(', $varname, '[i]);')" />
|
---|
1003 | </xsl:when>
|
---|
1004 | <xsl:when test="$gluetypefield">
|
---|
1005 | <xsl:value-of select="concat(' ', $gluetypefield, ' tmpObject(', $varname, '[i]);')" />
|
---|
1006 | </xsl:when>
|
---|
1007 | <xsl:otherwise>
|
---|
1008 | <xsl:call-template name="fatalError">
|
---|
1009 | <xsl:with-param name="msg" select="concat('emitOutputArgBackConverter (1): Type "', $type, '" in arg "', $name, '" of method "', $method, '" is not yet supported in safearrays.')" />
|
---|
1010 | </xsl:call-template>
|
---|
1011 |
|
---|
1012 | </xsl:otherwise>
|
---|
1013 | </xsl:choose>
|
---|
1014 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
1015 | <xsl:value-of select="concat(' ', $receiverVariable, '.push_back(')" />
|
---|
1016 | <xsl:call-template name="emitOutputArgBackConverter2">
|
---|
1017 | <xsl:with-param name="name" select="$name"/>
|
---|
1018 | <xsl:with-param name="varname" select="'tmpObject'"/>
|
---|
1019 | <xsl:with-param name="type" select="$type"/>
|
---|
1020 | <xsl:with-param name="callerprefix" select="$callerprefix"/>
|
---|
1021 | </xsl:call-template>
|
---|
1022 | <xsl:value-of select="');'" />
|
---|
1023 | <xsl:call-template name="emitNewlineIndent8" />
|
---|
1024 | <xsl:value-of select="'}'" />
|
---|
1025 | <xsl:call-template name="emitNewline" />
|
---|
1026 | </xsl:when>
|
---|
1027 | <xsl:otherwise>
|
---|
1028 | <!-- emit variable name: "resp->retval = " -->
|
---|
1029 | <xsl:value-of select="$receiverVariable" />
|
---|
1030 |
|
---|
1031 | <xsl:value-of select="' = '" />
|
---|
1032 | <xsl:call-template name="emitOutputArgBackConverter2">
|
---|
1033 | <xsl:with-param name="name" select="$name"/>
|
---|
1034 | <xsl:with-param name="varname" select="$varname"/>
|
---|
1035 | <xsl:with-param name="type" select="$type"/>
|
---|
1036 | <xsl:with-param name="callerprefix" select="$callerprefix"/>
|
---|
1037 | </xsl:call-template>
|
---|
1038 | <xsl:value-of select="';'" />
|
---|
1039 | <xsl:call-template name="emitNewline" />
|
---|
1040 |
|
---|
1041 | </xsl:otherwise>
|
---|
1042 | </xsl:choose>
|
---|
1043 |
|
---|
1044 | <xsl:value-of select="concat(' WEBDEBUG((g_pcszDoneConvertingComOutputBack, "', $name, '"));')" />
|
---|
1045 | <xsl:call-template name="emitNewline" />
|
---|
1046 | </xsl:template>
|
---|
1047 |
|
---|
1048 | <!--
|
---|
1049 | emitGetAttributeComCall
|
---|
1050 | -->
|
---|
1051 | <xsl:template name="emitGetAttributeComCall">
|
---|
1052 | <xsl:param name="ifname" />
|
---|
1053 | <xsl:param name="object" /> <!-- normally "pObj->" -->
|
---|
1054 | <xsl:param name="attrname" />
|
---|
1055 | <xsl:param name="attrtype" />
|
---|
1056 | <xsl:param name="attrsafearray" />
|
---|
1057 | <xsl:param name="varprefix" /> <!-- only when called recursively from emitOutputArgBackConverter-->
|
---|
1058 | <xsl:param name="callerprefix" /> <!-- only when called recursively from emitOutputArgBackConverter-->
|
---|
1059 |
|
---|
1060 | <xsl:variable name="gettername"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
|
---|
1061 | <xsl:call-template name="emitOutputArgBuffer">
|
---|
1062 | <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
|
---|
1063 | <xsl:with-param name="method"><xsl:value-of select="$gettername" /></xsl:with-param>
|
---|
1064 | <xsl:with-param name="name" select="$attrname" />
|
---|
1065 | <xsl:with-param name="type" select="$attrtype" />
|
---|
1066 | <xsl:with-param name="safearray" select="$attrsafearray" />
|
---|
1067 | <xsl:with-param name="varprefix" select="$varprefix" />
|
---|
1068 | </xsl:call-template>
|
---|
1069 | <xsl:variable name="upperattrname"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$attrname" /></xsl:call-template></xsl:variable>
|
---|
1070 | <!-- actual COM method call -->
|
---|
1071 | <xsl:call-template name="emitComCall">
|
---|
1072 | <xsl:with-param name="ifname" select="$ifname" />
|
---|
1073 | <xsl:with-param name="methodname" select="concat('COMGETTER(', $upperattrname, ')')" />
|
---|
1074 | <xsl:with-param name="object" select="$object" />
|
---|
1075 | <xsl:with-param name="attrname" select="$attrname" />
|
---|
1076 | <xsl:with-param name="attrtype" select="$attrtype" />
|
---|
1077 | <xsl:with-param name="attrsafearray" select="$attrsafearray" />
|
---|
1078 | <xsl:with-param name="attrdir" select="'return'" />
|
---|
1079 | <xsl:with-param name="varprefix" select="$varprefix" />
|
---|
1080 | </xsl:call-template>
|
---|
1081 | <!-- convert back the output data -->
|
---|
1082 | <xsl:call-template name="emitOutputArgBackConverter">
|
---|
1083 | <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
|
---|
1084 | <xsl:with-param name="method"><xsl:value-of select="$gettername" /></xsl:with-param>
|
---|
1085 | <xsl:with-param name="name" select="$attrname" />
|
---|
1086 | <xsl:with-param name="type" select="$attrtype" />
|
---|
1087 | <xsl:with-param name="safearray" select="$attrsafearray" />
|
---|
1088 | <xsl:with-param name="varprefix" select="$varprefix" />
|
---|
1089 | <xsl:with-param name="callerprefix" select="$callerprefix" />
|
---|
1090 | </xsl:call-template>
|
---|
1091 | </xsl:template>
|
---|
1092 |
|
---|
1093 | <!--
|
---|
1094 | emitSetAttributeComCall
|
---|
1095 | -->
|
---|
1096 | <xsl:template name="emitSetAttributeComCall">
|
---|
1097 | <xsl:param name="ifname" />
|
---|
1098 | <xsl:param name="object" /> <!-- normally "pObj->" -->
|
---|
1099 | <xsl:param name="attrname" />
|
---|
1100 | <xsl:param name="attrtype" />
|
---|
1101 | <xsl:param name="attrsafearray" />
|
---|
1102 | <xsl:param name="callerprefix" /> <!-- only when called recursively from emitOutputArgBackConverter-->
|
---|
1103 |
|
---|
1104 | <xsl:variable name="settername"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
|
---|
1105 | <xsl:variable name="upperattrname"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$attrname" /></xsl:call-template></xsl:variable>
|
---|
1106 |
|
---|
1107 | <xsl:call-template name="emitInputArgConverter">
|
---|
1108 | <xsl:with-param name="ifname" select="$ifname" />
|
---|
1109 | <xsl:with-param name="method" select="concat($ifname, '::', $settername)" />
|
---|
1110 | <xsl:with-param name="methodname" select="concat('COMSETTER(', $upperattrname, ')')" />
|
---|
1111 | <xsl:with-param name="object" select="$object" />
|
---|
1112 | <xsl:with-param name="name" select="$attrname" />
|
---|
1113 | <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '->')" />
|
---|
1114 | <xsl:with-param name="type" select="$attrtype" />
|
---|
1115 | <xsl:with-param name="safearray" select="$attrsafearray" />
|
---|
1116 | </xsl:call-template>
|
---|
1117 | <xsl:call-template name="emitComCall">
|
---|
1118 | <xsl:with-param name="ifname" select="$ifname" />
|
---|
1119 | <xsl:with-param name="methodname" select="concat('COMSETTER(', $upperattrname, ')')" />
|
---|
1120 | <xsl:with-param name="object" select="$object" />
|
---|
1121 | <xsl:with-param name="attrname" select="$attrname" />
|
---|
1122 | <xsl:with-param name="attrtype" select="$attrtype" />
|
---|
1123 | <xsl:with-param name="attrsafearray" select="$attrsafearray" />
|
---|
1124 | <xsl:with-param name="attrdir" select="'in'" />
|
---|
1125 | </xsl:call-template>
|
---|
1126 | </xsl:template>
|
---|
1127 |
|
---|
1128 | <!--
|
---|
1129 | emitGetAttributeMapper
|
---|
1130 | -->
|
---|
1131 | <xsl:template name="emitGetAttributeMapper">
|
---|
1132 | <xsl:param name="ifname" />
|
---|
1133 | <xsl:param name="wsmap" />
|
---|
1134 | <xsl:param name="attrname" />
|
---|
1135 | <xsl:param name="attrtype" />
|
---|
1136 | <xsl:param name="attrreadonly" />
|
---|
1137 | <xsl:param name="attrsafearray" />
|
---|
1138 |
|
---|
1139 | <xsl:variable name="gettername"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
|
---|
1140 |
|
---|
1141 | <xsl:call-template name="emitBeginOfFunctionHeader">
|
---|
1142 | <xsl:with-param name="ifname" select="$ifname" />
|
---|
1143 | <xsl:with-param name="method" select="$gettername" />
|
---|
1144 | </xsl:call-template>
|
---|
1145 |
|
---|
1146 | <xsl:call-template name="emitDocumentStyleArgStructs">
|
---|
1147 | <xsl:with-param name="ifname" select="$ifname" />
|
---|
1148 | <xsl:with-param name="methodname" select="$gettername" />
|
---|
1149 | <xsl:with-param name="fOutputs" select="$attrtype" />
|
---|
1150 | </xsl:call-template>
|
---|
1151 |
|
---|
1152 | <xsl:text>)</xsl:text>
|
---|
1153 | <xsl:call-template name="emitNewline" />
|
---|
1154 | <xsl:text>{</xsl:text>
|
---|
1155 | <xsl:call-template name="emitNewline" />
|
---|
1156 |
|
---|
1157 | <xsl:value-of select="' HRESULT rc = S_OK;'" />
|
---|
1158 | <xsl:call-template name="emitNewline" />
|
---|
1159 |
|
---|
1160 | <xsl:call-template name="emitPrologue" />
|
---|
1161 |
|
---|
1162 | <!-- actual COM method call -->
|
---|
1163 | <!-- <xsl:choose>
|
---|
1164 | array attributes/parameters are not supported yet...
|
---|
1165 | <xsl:when test="@array or @safearray='yes'">
|
---|
1166 | <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>
|
---|
1167 | </xsl:when>
|
---|
1168 | <xsl:otherwise> -->
|
---|
1169 | <xsl:call-template name="emitObjForMethod">
|
---|
1170 | <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
|
---|
1171 | <xsl:with-param name="wsmap"><xsl:value-of select="$wsmap" /></xsl:with-param>
|
---|
1172 | <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '->')" />
|
---|
1173 | </xsl:call-template>
|
---|
1174 |
|
---|
1175 | <xsl:call-template name="emitGetAttributeComCall">
|
---|
1176 | <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
|
---|
1177 | <xsl:with-param name="object" select='"pObj"' />
|
---|
1178 | <xsl:with-param name="attrname"><xsl:value-of select="$attrname" /></xsl:with-param>
|
---|
1179 | <xsl:with-param name="attrtype"><xsl:value-of select="$attrtype" /></xsl:with-param>
|
---|
1180 | <xsl:with-param name="attrsafearray"><xsl:value-of select="$attrsafearray" /></xsl:with-param>
|
---|
1181 | </xsl:call-template>
|
---|
1182 | <!-- </xsl:otherwise>
|
---|
1183 | </xsl:choose> -->
|
---|
1184 |
|
---|
1185 | <xsl:call-template name="emitEpilogue" />
|
---|
1186 | </xsl:template>
|
---|
1187 |
|
---|
1188 | <!--
|
---|
1189 | emitSetAttributeMapper:
|
---|
1190 | -->
|
---|
1191 | <xsl:template name="emitSetAttributeMapper">
|
---|
1192 | <xsl:param name="ifname" select="$ifname" />
|
---|
1193 | <xsl:param name="wsmap" select="$wsmap" />
|
---|
1194 | <xsl:param name="attrname" select="$attrname" />
|
---|
1195 | <xsl:param name="attrtype" select="$attrtype" />
|
---|
1196 | <xsl:param name="attrreadonly" select="$attrreadonly" />
|
---|
1197 | <xsl:param name="attrsafearray" select="$attrsafearray" />
|
---|
1198 |
|
---|
1199 | <xsl:variable name="settername"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
|
---|
1200 |
|
---|
1201 | <xsl:call-template name="emitBeginOfFunctionHeader">
|
---|
1202 | <xsl:with-param name="ifname" select="$ifname" />
|
---|
1203 | <xsl:with-param name="method" select="$settername" />
|
---|
1204 | </xsl:call-template>
|
---|
1205 |
|
---|
1206 | <xsl:call-template name="emitDocumentStyleArgStructs">
|
---|
1207 | <xsl:with-param name="ifname" select="$ifname" />
|
---|
1208 | <xsl:with-param name="methodname" select="$settername" />
|
---|
1209 | <xsl:with-param name="fOutputs" select="1" />
|
---|
1210 | </xsl:call-template>
|
---|
1211 |
|
---|
1212 | <xsl:text>)</xsl:text>
|
---|
1213 | <xsl:call-template name="emitNewline" />
|
---|
1214 | <xsl:text>{</xsl:text>
|
---|
1215 | <xsl:call-template name="emitNewline" />
|
---|
1216 | <xsl:value-of select="' HRESULT rc = S_OK;'" />
|
---|
1217 | <xsl:value-of select="concat(concat(' NOREF(', $G_responseElementVarName),');')" />
|
---|
1218 | <xsl:call-template name="emitNewline" />
|
---|
1219 | <xsl:call-template name="emitPrologue" />
|
---|
1220 |
|
---|
1221 | <!-- actual COM method call -->
|
---|
1222 | <!-- <xsl:choose>
|
---|
1223 | array attributes/parameters are not supported yet...
|
---|
1224 | <xsl:when test="@array or @safearray='yes'">
|
---|
1225 | <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>
|
---|
1226 | </xsl:when>
|
---|
1227 | <xsl:otherwise> -->
|
---|
1228 | <xsl:call-template name="emitObjForMethod">
|
---|
1229 | <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
|
---|
1230 | <xsl:with-param name="wsmap"><xsl:value-of select="$wsmap" /></xsl:with-param>
|
---|
1231 | <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '->')" />
|
---|
1232 | </xsl:call-template>
|
---|
1233 | <xsl:call-template name="emitSetAttributeComCall">
|
---|
1234 | <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
|
---|
1235 | <xsl:with-param name="object" select='"pObj"' />
|
---|
1236 | <xsl:with-param name="attrname"><xsl:value-of select="$attrname" /></xsl:with-param>
|
---|
1237 | <xsl:with-param name="attrtype"><xsl:value-of select="$attrtype" /></xsl:with-param>
|
---|
1238 | <xsl:with-param name="attrsafearray"><xsl:value-of select="$attrsafearray" /></xsl:with-param>
|
---|
1239 | </xsl:call-template>
|
---|
1240 | <!-- </xsl:otherwise>
|
---|
1241 | </xsl:choose> -->
|
---|
1242 |
|
---|
1243 | <xsl:call-template name="emitEpilogue" />
|
---|
1244 | </xsl:template>
|
---|
1245 |
|
---|
1246 | <!-- - - - - - - - - - - - - - - - - - - - - - -
|
---|
1247 | interface
|
---|
1248 | - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
1249 |
|
---|
1250 | <xsl:template match="interface">
|
---|
1251 | <!-- remember the interface name in local variables -->
|
---|
1252 | <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
|
---|
1253 | <xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
|
---|
1254 | <xsl:variable name="wscpp"><xsl:value-of select="@wscpp" /></xsl:variable>
|
---|
1255 |
|
---|
1256 | <!-- we can save ourselves verifying the interface here as it's already
|
---|
1257 | done in the WSDL converter -->
|
---|
1258 |
|
---|
1259 | <xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") or ($wscpp="hardcoded") )'>
|
---|
1260 | <xsl:text>
|
---|
1261 | /****************************************************************************
|
---|
1262 | *
|
---|
1263 | * interface </xsl:text>
|
---|
1264 | <xsl:copy-of select="$ifname" />
|
---|
1265 | <xsl:text>
|
---|
1266 | *
|
---|
1267 | ****************************************************************************/
|
---|
1268 | </xsl:text>
|
---|
1269 |
|
---|
1270 | <!--
|
---|
1271 | here come the attributes
|
---|
1272 | -->
|
---|
1273 | <xsl:for-each select="attribute">
|
---|
1274 | <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
|
---|
1275 | <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
|
---|
1276 | <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
|
---|
1277 | <xsl:variable name="attrsafearray"><xsl:value-of select="@safearray" /></xsl:variable>
|
---|
1278 | <xsl:call-template name="emitNewline" />
|
---|
1279 | <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
|
---|
1280 | <xsl:choose>
|
---|
1281 | <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
|
---|
1282 | <xsl:value-of select="concat('// Skipping attribute ', $attrname, ' for it is of suppressed type ', $attrtype)" />
|
---|
1283 | </xsl:when>
|
---|
1284 | <xsl:when test="@wsmap = 'suppress'">
|
---|
1285 | <xsl:value-of select="concat('// Skipping attribute ', $attrname, ' for it is suppressed')" />
|
---|
1286 | </xsl:when>
|
---|
1287 | <xsl:otherwise>
|
---|
1288 | <xsl:choose>
|
---|
1289 | <xsl:when test="@readonly='yes'">
|
---|
1290 | <xsl:value-of select="concat('// read-only attribute ', $ifname, '::', $attrname, ' of type ', $attrtype)" />
|
---|
1291 | </xsl:when>
|
---|
1292 | <xsl:otherwise>
|
---|
1293 | <xsl:value-of select="concat('// read/write attribute ', $ifname, '::', $attrname, ' of type ', $attrtype)" />
|
---|
1294 | </xsl:otherwise>
|
---|
1295 | </xsl:choose>
|
---|
1296 | <xsl:value-of select="concat(' (safearray: ', $attrsafearray, ')')" />
|
---|
1297 | <!-- emit getter method -->
|
---|
1298 | <xsl:call-template name="emitGetAttributeMapper">
|
---|
1299 | <xsl:with-param name="ifname" select="$ifname" />
|
---|
1300 | <xsl:with-param name="wsmap" select="$wsmap" />
|
---|
1301 | <xsl:with-param name="attrname" select="$attrname" />
|
---|
1302 | <xsl:with-param name="attrtype" select="$attrtype" />
|
---|
1303 | <xsl:with-param name="attrreadonly" select="$attrreadonly" />
|
---|
1304 | <xsl:with-param name="attrsafearray" select="$attrsafearray" />
|
---|
1305 | </xsl:call-template>
|
---|
1306 | <!-- for read-write attributes, emit setter method -->
|
---|
1307 | <xsl:if test="not(@readonly='yes')">
|
---|
1308 | <xsl:call-template name="emitSetAttributeMapper">
|
---|
1309 | <xsl:with-param name="ifname" select="$ifname" />
|
---|
1310 | <xsl:with-param name="wsmap" select="$wsmap" />
|
---|
1311 | <xsl:with-param name="attrname" select="$attrname" />
|
---|
1312 | <xsl:with-param name="attrtype" select="$attrtype" />
|
---|
1313 | <xsl:with-param name="attrreadonly" select="$attrreadonly" />
|
---|
1314 | <xsl:with-param name="attrsafearray" select="$attrsafearray" />
|
---|
1315 | </xsl:call-template>
|
---|
1316 | </xsl:if>
|
---|
1317 | </xsl:otherwise> <!-- not wsmap=suppress -->
|
---|
1318 | </xsl:choose>
|
---|
1319 | </xsl:for-each>
|
---|
1320 |
|
---|
1321 | <!--
|
---|
1322 | here come the real methods
|
---|
1323 | -->
|
---|
1324 |
|
---|
1325 | <xsl:for-each select="method">
|
---|
1326 | <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
|
---|
1327 | <!-- method header: return value "int", method name, soap arguments -->
|
---|
1328 | <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
|
---|
1329 | <xsl:choose>
|
---|
1330 | <xsl:when test=" (param[@type=($G_setSuppressedInterfaces/@name)])
|
---|
1331 | or (param[@mod='ptr'])" >
|
---|
1332 | <xsl:comment><xsl:value-of select="concat('Skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
|
---|
1333 | </xsl:when>
|
---|
1334 | <xsl:when test="@wsmap = 'suppress'">
|
---|
1335 | <xsl:comment><xsl:value-of select="concat('Skipping method ', $methodname, ' for it is suppressed')" /></xsl:comment>
|
---|
1336 | </xsl:when>
|
---|
1337 | <xsl:otherwise>
|
---|
1338 | <xsl:variable name="fHasReturnParms" select="param[@dir='return']" />
|
---|
1339 | <xsl:variable name="fHasOutParms" select="param[@dir='out']" />
|
---|
1340 |
|
---|
1341 | <xsl:call-template name="emitNewline" />
|
---|
1342 | <xsl:value-of select="concat('/* method ', $ifname, '::', $methodname, '(')" />
|
---|
1343 | <xsl:for-each select="param">
|
---|
1344 | <xsl:call-template name="emitNewline" />
|
---|
1345 | <xsl:value-of select="concat(' [', @dir, '] ', @type, ' ', @name)" />
|
---|
1346 | <xsl:if test="@safearray='yes'">
|
---|
1347 | <xsl:text>[]</xsl:text>
|
---|
1348 | </xsl:if>
|
---|
1349 | <xsl:if test="not(position()=last())">
|
---|
1350 | <xsl:text>,</xsl:text>
|
---|
1351 | </xsl:if>
|
---|
1352 | </xsl:for-each>
|
---|
1353 | <xsl:text>)</xsl:text>
|
---|
1354 | <xsl:call-template name="emitNewline" />
|
---|
1355 | <xsl:text> */</xsl:text>
|
---|
1356 |
|
---|
1357 | <xsl:call-template name="emitBeginOfFunctionHeader">
|
---|
1358 | <xsl:with-param name="ifname" select="$ifname" />
|
---|
1359 | <xsl:with-param name="method" select="$methodname" />
|
---|
1360 | </xsl:call-template>
|
---|
1361 |
|
---|
1362 | <xsl:call-template name="emitDocumentStyleArgStructs">
|
---|
1363 | <xsl:with-param name="ifname" select="$ifname" />
|
---|
1364 | <xsl:with-param name="methodname" select="$methodname" />
|
---|
1365 | <xsl:with-param name="fOutputs" select="1" />
|
---|
1366 | </xsl:call-template>
|
---|
1367 | <xsl:text>)</xsl:text>
|
---|
1368 | <xsl:call-template name="emitNewline" />
|
---|
1369 | <xsl:text>{</xsl:text>
|
---|
1370 | <xsl:call-template name="emitNewline" />
|
---|
1371 | <xsl:value-of select="' HRESULT rc = S_OK;'" />
|
---|
1372 | <xsl:value-of select="concat(concat(' NOREF(', $G_responseElementVarName),');')" />
|
---|
1373 | <xsl:call-template name="emitNewline" />
|
---|
1374 | <xsl:call-template name="emitPrologue" />
|
---|
1375 |
|
---|
1376 | <xsl:choose>
|
---|
1377 | <xsl:when test="param[@array]">
|
---|
1378 | <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>
|
---|
1379 | </xsl:when>
|
---|
1380 | <xsl:otherwise>
|
---|
1381 | <!-- emit the object upon which to invoke the method -->
|
---|
1382 | <xsl:call-template name="emitObjForMethod">
|
---|
1383 | <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
|
---|
1384 | <xsl:with-param name="wsmap"><xsl:value-of select="$wsmap" /></xsl:with-param>
|
---|
1385 | <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '->')" />
|
---|
1386 | </xsl:call-template>
|
---|
1387 | <!-- next, emit storage variables to convert the SOAP/C++ arguments to COM types -->
|
---|
1388 | <xsl:for-each select="param">
|
---|
1389 | <xsl:variable name="dir" select="@dir" />
|
---|
1390 | <xsl:choose>
|
---|
1391 | <xsl:when test="$dir='in'">
|
---|
1392 | <xsl:call-template name="emitInputArgConverter">
|
---|
1393 | <xsl:with-param name="ifname" select="$ifname" />
|
---|
1394 | <xsl:with-param name="method" select="concat($ifname, '::', $methodname)" />
|
---|
1395 | <xsl:with-param name="methodname">
|
---|
1396 | <xsl:call-template name="capitalize">
|
---|
1397 | <xsl:with-param name="str" select="$methodname" />
|
---|
1398 | </xsl:call-template>
|
---|
1399 | </xsl:with-param>
|
---|
1400 | <xsl:with-param name="object" select='"pObj"' />
|
---|
1401 | <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '->')" />
|
---|
1402 | <xsl:with-param name="name" select="@name" />
|
---|
1403 | <xsl:with-param name="type" select="@type" />
|
---|
1404 | <xsl:with-param name="safearray" select="@safearray" />
|
---|
1405 | </xsl:call-template>
|
---|
1406 | </xsl:when>
|
---|
1407 | <xsl:when test="$dir='out'">
|
---|
1408 | <xsl:call-template name="emitOutputArgBuffer">
|
---|
1409 | <xsl:with-param name="method" select="concat($ifname, '::', $methodname)" />
|
---|
1410 | <xsl:with-param name="name" select="@name" />
|
---|
1411 | <xsl:with-param name="type" select="@type" />
|
---|
1412 | <xsl:with-param name="safearray" select="@safearray" />
|
---|
1413 | </xsl:call-template>
|
---|
1414 | </xsl:when>
|
---|
1415 | <xsl:when test="$dir='return'">
|
---|
1416 | <xsl:call-template name="emitOutputArgBuffer">
|
---|
1417 | <xsl:with-param name="method" select="concat($ifname, '::', $methodname)" />
|
---|
1418 | <xsl:with-param name="name" select="$G_result" />
|
---|
1419 | <xsl:with-param name="type" select="@type" />
|
---|
1420 | <xsl:with-param name="safearray" select="@safearray" />
|
---|
1421 | </xsl:call-template>
|
---|
1422 | </xsl:when>
|
---|
1423 | </xsl:choose>
|
---|
1424 | </xsl:for-each>
|
---|
1425 | <!-- actual COM method call -->
|
---|
1426 | <xsl:call-template name="emitComCall">
|
---|
1427 | <xsl:with-param name="ifname" select="$ifname" />
|
---|
1428 | <xsl:with-param name="object" select='"pObj"' />
|
---|
1429 | <xsl:with-param name="methodname">
|
---|
1430 | <xsl:call-template name="capitalize">
|
---|
1431 | <xsl:with-param name="str" select="$methodname" />
|
---|
1432 | </xsl:call-template>
|
---|
1433 | </xsl:with-param>
|
---|
1434 | </xsl:call-template>
|
---|
1435 | <!-- convert back the output data -->
|
---|
1436 | <xsl:for-each select="param">
|
---|
1437 | <xsl:variable name="dir" select="@dir" />
|
---|
1438 | <xsl:if test="$dir='out'">
|
---|
1439 | <xsl:call-template name="emitOutputArgBackConverter">
|
---|
1440 | <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
|
---|
1441 | <xsl:with-param name="method" select="$methodname" />
|
---|
1442 | <xsl:with-param name="name"><xsl:value-of select="@name" /></xsl:with-param>
|
---|
1443 | <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
|
---|
1444 | <xsl:with-param name="safearray"><xsl:value-of select="@safearray" /></xsl:with-param>
|
---|
1445 | <xsl:with-param name="callerprefix" select="'outparms.'"/>
|
---|
1446 | </xsl:call-template>
|
---|
1447 | </xsl:if>
|
---|
1448 | <xsl:if test="$dir='return'">
|
---|
1449 | <!-- return values _normally_ should convert to the input arg from the function prototype,
|
---|
1450 | except when there are both return and out params; in that case gsoap squeezes them all
|
---|
1451 | into the output args structure and the return thing is called "retval" -->
|
---|
1452 | <xsl:choose>
|
---|
1453 | <xsl:when test="$fHasOutParms">
|
---|
1454 | <xsl:call-template name="emitOutputArgBackConverter">
|
---|
1455 | <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
|
---|
1456 | <xsl:with-param name="method" select="$methodname" />
|
---|
1457 | <xsl:with-param name="name"><xsl:value-of select="$G_result" /></xsl:with-param>
|
---|
1458 | <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
|
---|
1459 | <xsl:with-param name="safearray"><xsl:value-of select="@safearray" /></xsl:with-param>
|
---|
1460 | <xsl:with-param name="callerprefix" select="'outparms.'"/>
|
---|
1461 | </xsl:call-template>
|
---|
1462 | </xsl:when>
|
---|
1463 | <xsl:otherwise>
|
---|
1464 | <xsl:call-template name="emitOutputArgBackConverter">
|
---|
1465 | <xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
|
---|
1466 | <xsl:with-param name="method" select="$methodname" />
|
---|
1467 | <xsl:with-param name="name"><xsl:value-of select="$G_result" /></xsl:with-param>
|
---|
1468 | <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
|
---|
1469 | <xsl:with-param name="safearray"><xsl:value-of select="@safearray" /></xsl:with-param>
|
---|
1470 | </xsl:call-template>
|
---|
1471 | </xsl:otherwise>
|
---|
1472 | </xsl:choose>
|
---|
1473 | </xsl:if>
|
---|
1474 | </xsl:for-each>
|
---|
1475 | </xsl:otherwise>
|
---|
1476 | </xsl:choose>
|
---|
1477 | <xsl:call-template name="emitEpilogue" />
|
---|
1478 | </xsl:otherwise>
|
---|
1479 | </xsl:choose>
|
---|
1480 | </xsl:for-each>
|
---|
1481 | </xsl:if>
|
---|
1482 |
|
---|
1483 | </xsl:template>
|
---|
1484 |
|
---|
1485 |
|
---|
1486 | </xsl:stylesheet>
|
---|