VirtualBox

source: vbox/trunk/src/VBox/Main/idl/apiwrap-server.xsl@ 53354

Last change on this file since 53354 was 52248, checked in by vboxsync, 10 years ago

Main: ISession fully converted to use API wrappers

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 68.3 KB
Line 
1<?xml version="1.0"?>
2
3<!--
4 apiwrap-server.xsl:
5 XSLT stylesheet that generates C++ API wrappers (server side) from
6 VirtualBox.xidl.
7
8 Copyright (C) 2010-2014 Oracle Corporation
9
10 This file is part of VirtualBox Open Source Edition (OSE), as
11 available from http://www.virtualbox.org. This file is free software;
12 you can redistribute it and/or modify it under the terms of the GNU
13 General Public License (GPL) as published by the Free Software
14 Foundation, in version 2 as it comes in the "COPYING" file of the
15 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17-->
18
19<xsl:stylesheet
20 version="1.0"
21 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
22 xmlns:exsl="http://exslt.org/common"
23 extension-element-prefixes="exsl">
24
25<xsl:output method="text"/>
26
27<xsl:strip-space elements="*"/>
28
29<!-- - - - - - - - - - - - - - - - - - - - - - -
30 global XSLT variables
31 - - - - - - - - - - - - - - - - - - - - - - -->
32
33<xsl:variable name="G_xsltFilename" select="'apiwrap-server.xsl'"/>
34
35<xsl:variable name="G_root" select="/"/>
36
37<xsl:include href="typemap-shared.inc.xsl"/>
38
39<!-- - - - - - - - - - - - - - - - - - - - - - -
40templates for file separation
41 - - - - - - - - - - - - - - - - - - - - - - -->
42
43<xsl:template match="interface" mode="listfile">
44 <xsl:param name="file"/>
45
46 <xsl:value-of select="concat('&#9;', $file, ' \&#10;')"/>
47</xsl:template>
48
49<xsl:template match="interface" mode="startfile">
50 <xsl:param name="file"/>
51
52 <xsl:value-of select="concat('&#10;// ##### BEGINFILE &quot;', $file, '&quot;&#10;')"/>
53</xsl:template>
54
55<xsl:template match="interface" mode="endfile">
56 <xsl:param name="file"/>
57
58 <xsl:value-of select="concat('&#10;// ##### ENDFILE &quot;', $file, '&quot;&#10;')"/>
59</xsl:template>
60
61<!-- - - - - - - - - - - - - - - - - - - - - - -
62templates for file headers/footers
63 - - - - - - - - - - - - - - - - - - - - - - -->
64
65<xsl:template name="fileheader">
66 <xsl:param name="class"/>
67 <xsl:param name="name"/>
68 <xsl:param name="type"/>
69
70 <xsl:text>/** @file
71 *
72</xsl:text>
73 <xsl:value-of select="concat(' * VirtualBox API class wrapper ', $type, ' for I', $class, '.')"/>
74 <xsl:text>
75 *
76 * DO NOT EDIT! This is a generated file.
77 * Generated from: src/VBox/Main/idl/VirtualBox.xidl
78 * Generator: src/VBox/Main/idl/apiwrap-server.xsl
79 */
80
81/**
82 * Copyright (C) 2010-2014 Oracle Corporation
83 *
84 * This file is part of VirtualBox Open Source Edition (OSE), as
85 * available from http://www.virtualbox.org. This file is free software;
86 * you can redistribute it and/or modify it under the terms of the GNU
87 * General Public License (GPL) as published by the Free Software
88 * Foundation, in version 2 as it comes in the "COPYING" file of the
89 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
90 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
91 */
92
93</xsl:text>
94</xsl:template>
95
96<xsl:template name="emitCOMInterfaces">
97 <xsl:param name="iface"/>
98
99 <xsl:value-of select="concat(' COM_INTERFACE_ENTRY(', $iface/@name, ')&#10;')"/>
100 <!-- now recurse to emit all base interfaces -->
101 <xsl:variable name="extends" select="$iface/@extends"/>
102 <xsl:if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
103 <xsl:call-template name="emitCOMInterfaces">
104 <xsl:with-param name="iface" select="//interface[@name=$extends]"/>
105 </xsl:call-template>
106 </xsl:if>
107</xsl:template>
108
109<xsl:template match="interface" mode="classheader">
110 <xsl:param name="addinterfaces"/>
111 <xsl:value-of select="concat('#ifndef ', substring(@name, 2), 'Wrap_H_&#10;')"/>
112 <xsl:value-of select="concat('#define ', substring(@name, 2), 'Wrap_H_')"/>
113 <xsl:text>
114
115#include "VirtualBoxBase.h"
116#include "Wrapper.h"
117
118</xsl:text>
119 <xsl:value-of select="concat('class ATL_NO_VTABLE ', substring(@name, 2), 'Wrap:')"/>
120 <xsl:text>
121 public VirtualBoxBase,
122</xsl:text>
123 <xsl:value-of select="concat(' VBOX_SCRIPTABLE_IMPL(', @name, ')')"/>
124 <xsl:if test="count(exsl:node-set($addinterfaces)/token) > 0">
125 <xsl:text>,</xsl:text>
126 </xsl:if>
127 <xsl:text>&#10;</xsl:text>
128 <xsl:for-each select="exsl:node-set($addinterfaces)/token">
129 <xsl:value-of select="concat(' VBOX_SCRIPTABLE_IMPL(', text(), ')')"/>
130 <xsl:if test="not(position()=last())">
131 <xsl:text>,</xsl:text>
132 </xsl:if>
133 <xsl:text>&#10;</xsl:text>
134 </xsl:for-each>
135 <xsl:text>{
136 Q_OBJECT
137
138public:
139</xsl:text>
140 <xsl:value-of select="concat(' VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(', substring(@name, 2), 'Wrap, ', @name, ')&#10;')"/>
141 <xsl:value-of select="concat(' DECLARE_NOT_AGGREGATABLE(', substring(@name, 2), 'Wrap)&#10;')"/>
142 <xsl:text> DECLARE_PROTECT_FINAL_CONSTRUCT()
143
144</xsl:text>
145 <xsl:value-of select="concat(' BEGIN_COM_MAP(', substring(@name, 2), 'Wrap)&#10;')"/>
146 <xsl:text> COM_INTERFACE_ENTRY(ISupportErrorInfo)
147</xsl:text>
148 <xsl:call-template name="emitCOMInterfaces">
149 <xsl:with-param name="iface" select="."/>
150 </xsl:call-template>
151 <xsl:value-of select="concat(' COM_INTERFACE_ENTRY2(IDispatch, ', @name, ')&#10;')"/>
152 <xsl:variable name="manualAddInterfaces">
153 <xsl:call-template name="checkoption">
154 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
155 <xsl:with-param name="option" select="'manualaddinterfaces'"/>
156 </xsl:call-template>
157 </xsl:variable>
158 <xsl:if test="not($manualAddInterfaces = 'true')">
159 <xsl:for-each select="exsl:node-set($addinterfaces)/token">
160 <!-- This is super tricky, as the for-each switches to the node
161 set, which means the normal document isn't available any more.
162 So need to use the global root node to get back into the
163 documemt to find corresponding interface data. -->
164 <xsl:variable name="addifname">
165 <xsl:value-of select="string(.)"/>
166 </xsl:variable>
167 <xsl:call-template name="emitCOMInterfaces">
168 <xsl:with-param name="iface" select="$G_root//interface[@name=$addifname]"/>
169 </xsl:call-template>
170 </xsl:for-each>
171 </xsl:if>
172 <xsl:text> COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
173 END_COM_MAP()
174
175</xsl:text>
176 <xsl:value-of select="concat(' DECLARE_EMPTY_CTOR_DTOR(', substring(@name, 2), 'Wrap)&#10;')"/>
177</xsl:template>
178
179<xsl:template match="interface" mode="classfooter">
180 <xsl:param name="addinterfaces"/>
181 <xsl:text>};
182
183</xsl:text>
184 <xsl:value-of select="concat('#endif // !', substring(@name, 2), 'Wrap_H_&#10;')"/>
185</xsl:template>
186
187<xsl:template match="interface" mode="codeheader">
188 <xsl:param name="addinterfaces"/>
189 <xsl:value-of select="concat('#define LOG_GROUP_MAIN_OVERRIDE LOG_GROUP_MAIN_', translate(substring(@name, 2), $G_lowerCase, $G_upperCase), '&#10;&#10;')"/>
190 <xsl:value-of select="concat('#include &quot;', substring(@name, 2), 'Wrap.h&quot;&#10;')"/>
191 <xsl:text>#include "Logging.h"
192
193</xsl:text>
194</xsl:template>
195
196<xsl:template name="emitISupports">
197 <xsl:param name="classname"/>
198 <xsl:param name="extends"/>
199 <xsl:param name="addinterfaces"/>
200 <xsl:param name="depth"/>
201 <xsl:param name="interfacelist"/>
202
203 <xsl:choose>
204 <xsl:when test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
205 <xsl:variable name="newextends" select="//interface[@name=$extends]/@extends"/>
206 <xsl:variable name="newiflist" select="concat($interfacelist, ', ', $extends)"/>
207 <xsl:call-template name="emitISupports">
208 <xsl:with-param name="classname" select="$classname"/>
209 <xsl:with-param name="extends" select="$newextends"/>
210 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
211 <xsl:with-param name="depth" select="$depth + 1"/>
212 <xsl:with-param name="interfacelist" select="$newiflist"/>
213 </xsl:call-template>
214 </xsl:when>
215 <xsl:otherwise>
216 <xsl:variable name="addinterfaces_ns" select="exsl:node-set($addinterfaces)"/>
217 <xsl:choose>
218 <xsl:when test="count($addinterfaces_ns/token) > 0">
219 <xsl:variable name="addifname" select="$addinterfaces_ns/token[1]"/>
220 <xsl:variable name="addif" select="//interface[@name=$addifname]/@extends"/>
221 <xsl:variable name="newextends" select="$addif/@extends"/>
222 <xsl:variable name="newaddinterfaces" select="$addinterfaces_ns/token[position() > 1]"/>
223 <xsl:variable name="newiflist" select="concat($interfacelist, ', ', $addifname)"/>
224 <xsl:call-template name="emitISupports">
225 <xsl:with-param name="classname" select="$classname"/>
226 <xsl:with-param name="extends" select="$newextends"/>
227 <xsl:with-param name="addinterfaces" select="$newaddinterfaces"/>
228 <xsl:with-param name="depth" select="$depth + 1"/>
229 <xsl:with-param name="interfacelist" select="$newiflist"/>
230 </xsl:call-template>
231 </xsl:when>
232 <xsl:otherwise>
233 <xsl:value-of select="concat('NS_IMPL_THREADSAFE_ISUPPORTS', $depth, '_CI(', $classname, ', ', $interfacelist, ')&#10;')"/>
234 </xsl:otherwise>
235 </xsl:choose>
236 </xsl:otherwise>
237 </xsl:choose>
238</xsl:template>
239
240<xsl:template match="interface" mode="codefooter">
241 <xsl:param name="addinterfaces"/>
242 <xsl:text>#ifdef VBOX_WITH_XPCOM
243</xsl:text>
244 <xsl:value-of select="concat('NS_DECL_CLASSINFO(', substring(@name, 2), 'Wrap)&#10;')"/>
245
246 <xsl:variable name="manualAddInterfaces">
247 <xsl:call-template name="checkoption">
248 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
249 <xsl:with-param name="option" select="'manualaddinterfaces'"/>
250 </xsl:call-template>
251 </xsl:variable>
252 <xsl:choose>
253 <xsl:when test="$manualAddInterfaces = 'true'">
254 <xsl:variable name="nulladdinterfaces"></xsl:variable>
255 <xsl:call-template name="emitISupports">
256 <xsl:with-param name="classname" select="concat(substring(@name, 2), 'Wrap')"/>
257 <xsl:with-param name="extends" select="@extends"/>
258 <xsl:with-param name="addinterfaces" select="$nulladdinterfaces"/>
259 <xsl:with-param name="depth" select="1"/>
260 <xsl:with-param name="interfacelist" select="@name"/>
261 </xsl:call-template>
262 </xsl:when>
263 <xsl:otherwise>
264 <xsl:call-template name="emitISupports">
265 <xsl:with-param name="classname" select="concat(substring(@name, 2), 'Wrap')"/>
266 <xsl:with-param name="extends" select="@extends"/>
267 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
268 <xsl:with-param name="depth" select="1"/>
269 <xsl:with-param name="interfacelist" select="@name"/>
270 </xsl:call-template>
271 </xsl:otherwise>
272 </xsl:choose>
273 <xsl:text>#endif // VBOX_WITH_XPCOM
274</xsl:text>
275</xsl:template>
276
277
278<!-- - - - - - - - - - - - - - - - - - - - - - -
279 templates for dealing with names and parameters
280 - - - - - - - - - - - - - - - - - - - - - - -->
281
282<xsl:template name="tospace">
283 <xsl:param name="str"/>
284 <xsl:value-of select="translate($str, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_', ' ')"/>
285</xsl:template>
286
287<xsl:template name="checkoption">
288 <xsl:param name="optionlist"/>
289 <xsl:param name="option"/>
290 <xsl:value-of select="string-length($option) > 0 and contains(concat(',', translate($optionlist, ' ', ''), ','), concat(',', $option, ','))"/>
291</xsl:template>
292
293<xsl:template name="getattrlist">
294 <xsl:param name="val"/>
295 <xsl:param name="separator" select="','"/>
296
297 <xsl:if test="$val and $val != ''">
298 <xsl:choose>
299 <xsl:when test="contains($val,$separator)">
300 <token>
301 <xsl:value-of select="substring-before($val,$separator)"/>
302 </token>
303 <xsl:call-template name="getattrlist">
304 <xsl:with-param name="val" select="substring-after($val,$separator)"/>
305 <xsl:with-param name="separator" select="$separator"/>
306 </xsl:call-template>
307 </xsl:when>
308 <xsl:otherwise>
309 <token><xsl:value-of select="$val"/></token>
310 </xsl:otherwise>
311 </xsl:choose>
312 </xsl:if>
313</xsl:template>
314
315<xsl:template name="translatepublictype">
316 <xsl:param name="type"/>
317 <xsl:param name="dir"/>
318 <xsl:param name="mod"/>
319
320 <!-- get C++ glue type from IDL type from table in typemap-shared.inc.xsl -->
321 <xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
322 <xsl:choose>
323 <xsl:when test="$type='wstring' or $type='uuid'">
324 <xsl:choose>
325 <xsl:when test="$dir='in'">
326 <xsl:text>IN_BSTR</xsl:text>
327 </xsl:when>
328 <xsl:otherwise>
329 <xsl:text>BSTR</xsl:text>
330 </xsl:otherwise>
331 </xsl:choose>
332 </xsl:when>
333 <xsl:when test="string-length($gluetypefield)">
334 <xsl:value-of select="$gluetypefield"/>
335 </xsl:when>
336 <xsl:when test="//enum[@name=$type]">
337 <xsl:value-of select="concat($type, '_T')"/>
338 </xsl:when>
339 <xsl:when test="$type='$unknown'">
340 <xsl:text>IUnknown *</xsl:text>
341 </xsl:when>
342 <xsl:when test="//interface[@name=$type]">
343 <xsl:variable name="thatif" select="//interface[@name=$type]"/>
344 <xsl:variable name="thatifname" select="$thatif/@name"/>
345 <xsl:value-of select="concat($thatifname, ' *')"/>
346 </xsl:when>
347 <xsl:otherwise>
348 <xsl:call-template name="fatalError">
349 <xsl:with-param name="msg" select="concat('translatepublictype: Type &quot;', $type, '&quot; is not supported.')"/>
350 </xsl:call-template>
351 </xsl:otherwise>
352 </xsl:choose>
353 <xsl:if test="$mod='ptr'">
354 <xsl:text> *</xsl:text>
355 </xsl:if>
356</xsl:template>
357
358<xsl:template name="translatewrappedtype">
359 <xsl:param name="type"/>
360 <xsl:param name="dir"/>
361 <xsl:param name="mod"/>
362 <xsl:param name="safearray"/>
363
364 <!-- get C++ wrap type from IDL type from table in typemap-shared.inc.xsl -->
365 <xsl:variable name="wraptypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
366 <xsl:choose>
367 <xsl:when test="$type='wstring'">
368 <xsl:if test="$dir='in' and not($safearray='yes')">
369 <xsl:text>const </xsl:text>
370 </xsl:if>
371 <xsl:text>com::Utf8Str &amp;</xsl:text>
372 </xsl:when>
373 <xsl:when test="$type='uuid'">
374 <xsl:if test="$dir='in'">
375 <xsl:text>const </xsl:text>
376 </xsl:if>
377 <xsl:text>com::Guid &amp;</xsl:text>
378 </xsl:when>
379 <xsl:when test="string-length($wraptypefield)">
380 <xsl:value-of select="$wraptypefield"/>
381 </xsl:when>
382 <xsl:when test="//enum[@name=$type]">
383 <xsl:value-of select="concat($type, '_T')"/>
384 </xsl:when>
385 <xsl:when test="$type='$unknown'">
386 <xsl:if test="$dir='in' and not($safearray='yes')">
387 <xsl:text>const </xsl:text>
388 </xsl:if>
389 <xsl:text>ComPtr&lt;IUnknown&gt; &amp;</xsl:text>
390 </xsl:when>
391 <xsl:when test="//interface[@name=$type]">
392 <xsl:variable name="thatif" select="//interface[@name=$type]"/>
393 <xsl:variable name="thatifname" select="$thatif/@name"/>
394 <xsl:if test="$dir='in' and not($safearray='yes')">
395 <xsl:text>const </xsl:text>
396 </xsl:if>
397 <xsl:value-of select="concat('ComPtr&lt;', $thatifname, '&gt; &amp;')"/>
398 </xsl:when>
399 <xsl:otherwise>
400 <xsl:call-template name="fatalError">
401 <xsl:with-param name="msg" select="concat('translatewrappedtype: Type &quot;', $type, '&quot; is not supported.')"/>
402 </xsl:call-template>
403 </xsl:otherwise>
404 </xsl:choose>
405 <xsl:if test="$mod='ptr'">
406 <xsl:text> *</xsl:text>
407 </xsl:if>
408</xsl:template>
409
410<xsl:template name="translatefmtspectype">
411 <xsl:param name="type"/>
412 <xsl:param name="dir"/>
413 <xsl:param name="mod"/>
414 <xsl:param name="safearray"/>
415 <xsl:param name="isref"/>
416
417 <!-- get C format string for IDL type from table in typemap-shared.inc.xsl -->
418 <xsl:variable name="wrapfmt" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluefmt"/>
419 <xsl:choose>
420 <xsl:when test="$mod='ptr' or ($isref='yes' and $dir!='in')">
421 <xsl:text>%p</xsl:text>
422 </xsl:when>
423 <xsl:when test="$safearray='yes'">
424 <xsl:text>%zu</xsl:text>
425 </xsl:when>
426 <xsl:when test="string-length($wrapfmt)">
427 <xsl:value-of select="$wrapfmt"/>
428 </xsl:when>
429 <xsl:when test="//enum[@name=$type]">
430 <xsl:text>%RU32</xsl:text>
431 </xsl:when>
432 <xsl:when test="$type='$unknown'">
433 <xsl:text>%p</xsl:text>
434 </xsl:when>
435 <xsl:when test="//interface[@name=$type]">
436 <xsl:text>%p</xsl:text>
437 </xsl:when>
438 <xsl:otherwise>
439 <xsl:call-template name="fatalError">
440 <xsl:with-param name="msg" select="concat('translatefmtcpectype: Type &quot;', $type, '&quot; is not supported.')"/>
441 </xsl:call-template>
442 </xsl:otherwise>
443 </xsl:choose>
444</xsl:template>
445
446<!-- - - - - - - - - - - - - - - - - - - - - - -
447 templates for handling entire interfaces and their contents
448 - - - - - - - - - - - - - - - - - - - - - - -->
449
450<xsl:template name="emitInterface">
451 <xsl:param name="iface"/>
452
453 <xsl:variable name="addinterfaces">
454 <xsl:call-template name="getattrlist">
455 <xsl:with-param name="val" select="$iface/@wrap-hint-server-addinterfaces"/>
456 </xsl:call-template>
457 </xsl:variable>
458
459 <xsl:call-template name="emitHeader">
460 <xsl:with-param name="iface" select="$iface"/>
461 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
462 </xsl:call-template>
463
464 <xsl:call-template name="emitCode">
465 <xsl:with-param name="iface" select="$iface"/>
466 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
467 </xsl:call-template>
468</xsl:template>
469
470<xsl:template match="attribute/@type | param/@type" mode="public">
471 <xsl:param name="dir"/>
472
473 <xsl:variable name="gluetype">
474 <xsl:call-template name="translatepublictype">
475 <xsl:with-param name="type" select="."/>
476 <xsl:with-param name="dir" select="$dir"/>
477 <xsl:with-param name="mod" select="../@mod"/>
478 </xsl:call-template>
479 </xsl:variable>
480
481 <xsl:if test="../@safearray='yes'">
482 <xsl:choose>
483 <xsl:when test="$dir='in'">
484 <xsl:text>ComSafeArrayIn(</xsl:text>
485 </xsl:when>
486 <xsl:otherwise>
487 <xsl:text>ComSafeArrayOut(</xsl:text>
488 </xsl:otherwise>
489 </xsl:choose>
490 </xsl:if>
491 <xsl:value-of select="$gluetype"/>
492 <xsl:choose>
493 <xsl:when test="../@safearray='yes'">
494 <xsl:text>, </xsl:text>
495 </xsl:when>
496 <xsl:otherwise>
497 <xsl:if test="substring($gluetype,string-length($gluetype))!='*'">
498 <xsl:text> </xsl:text>
499 </xsl:if>
500 <xsl:choose>
501 <xsl:when test="$dir='in'">
502 </xsl:when>
503 <xsl:otherwise>
504 <xsl:value-of select="'*'"/>
505 </xsl:otherwise>
506 </xsl:choose>
507 </xsl:otherwise>
508 </xsl:choose>
509 <xsl:text>a</xsl:text>
510 <xsl:call-template name="capitalize">
511 <xsl:with-param name="str" select="../@name"/>
512 </xsl:call-template>
513 <xsl:if test="../@safearray='yes'">
514 <xsl:value-of select="')'"/>
515 </xsl:if>
516</xsl:template>
517
518<xsl:template match="attribute/@type | param/@type" mode="wrapped">
519 <xsl:param name="dir"/>
520
521 <xsl:variable name="wraptype">
522 <xsl:call-template name="translatewrappedtype">
523 <xsl:with-param name="type" select="."/>
524 <xsl:with-param name="dir" select="$dir"/>
525 <xsl:with-param name="mod" select="../@mod"/>
526 <xsl:with-param name="safearray" select="../@safearray"/>
527 </xsl:call-template>
528 </xsl:variable>
529
530 <xsl:choose>
531 <xsl:when test="../@safearray='yes'">
532 <xsl:if test="$dir='in'">
533 <xsl:text>const </xsl:text>
534 </xsl:if>
535 <xsl:text>std::vector&lt;</xsl:text>
536 <xsl:choose>
537 <xsl:when test="substring($wraptype,string-length($wraptype))='&amp;'">
538 <xsl:variable name="wraptype2">
539 <xsl:value-of select="substring($wraptype,1,string-length($wraptype)-2)"/>
540 </xsl:variable>
541
542 <xsl:choose>
543 <xsl:when test="substring($wraptype2,string-length($wraptype2))='&gt;'">
544 <xsl:value-of select="concat($wraptype2, ' ')"/>
545 </xsl:when>
546 <xsl:otherwise>
547 <xsl:value-of select="$wraptype2"/>
548 </xsl:otherwise>
549 </xsl:choose>
550 </xsl:when>
551 <xsl:when test="substring($wraptype,string-length($wraptype))='&gt;'">
552 <xsl:value-of select="concat($wraptype, ' ')"/>
553 </xsl:when>
554 <xsl:otherwise>
555 <xsl:value-of select="$wraptype"/>
556 </xsl:otherwise>
557 </xsl:choose>
558 <xsl:text>&gt; &amp;</xsl:text>
559 </xsl:when>
560 <xsl:otherwise>
561 <xsl:value-of select="$wraptype"/>
562 <xsl:if test="substring($wraptype,string-length($wraptype))!='&amp;'">
563 <xsl:if test="substring($wraptype,string-length($wraptype))!='*'">
564 <xsl:text> </xsl:text>
565 </xsl:if>
566 <xsl:choose>
567 <xsl:when test="$dir='in'">
568 </xsl:when>
569 <xsl:otherwise>
570 <xsl:value-of select="'*'"/>
571 </xsl:otherwise>
572 </xsl:choose>
573 </xsl:if>
574 </xsl:otherwise>
575 </xsl:choose>
576 <xsl:text>a</xsl:text>
577 <xsl:call-template name="capitalize">
578 <xsl:with-param name="str" select="../@name"/>
579 </xsl:call-template>
580</xsl:template>
581
582<xsl:template match="attribute/@type | param/@type" mode="logparamtext">
583 <xsl:param name="dir"/>
584 <xsl:param name="isref"/>
585
586 <xsl:if test="$isref!='yes' and ($dir='out' or $dir='ret')">
587 <xsl:text>*</xsl:text>
588 </xsl:if>
589 <xsl:text>a</xsl:text>
590 <xsl:call-template name="capitalize">
591 <xsl:with-param name="str" select="../@name"/>
592 </xsl:call-template>
593 <xsl:text>=</xsl:text>
594 <xsl:call-template name="translatefmtspectype">
595 <xsl:with-param name="type" select="."/>
596 <xsl:with-param name="dir" select="$dir"/>
597 <xsl:with-param name="mod" select="../@mod"/>
598 <xsl:with-param name="safearray" select="../@safearray"/>
599 <xsl:with-param name="isref" select="$isref"/>
600 </xsl:call-template>
601</xsl:template>
602
603<xsl:template match="attribute/@type | param/@type" mode="logparamval">
604 <xsl:param name="dir"/>
605 <xsl:param name="isref"/>
606
607 <xsl:choose>
608 <xsl:when test="../@safearray='yes' and $isref!='yes'">
609 <xsl:text>ComSafeArraySize(</xsl:text>
610 <xsl:if test="$isref!='yes' and $dir!='in'">
611 <xsl:text>*</xsl:text>
612 </xsl:if>
613 </xsl:when>
614 <xsl:when test="$isref!='yes' and $dir!='in'">
615 <xsl:text>*</xsl:text>
616 </xsl:when>
617 </xsl:choose>
618 <xsl:text>a</xsl:text>
619 <xsl:call-template name="capitalize">
620 <xsl:with-param name="str" select="../@name"/>
621 </xsl:call-template>
622 <xsl:choose>
623 <xsl:when test="../@safearray='yes' and $isref!='yes'">
624 <xsl:text>)</xsl:text>
625 </xsl:when>
626 </xsl:choose>
627</xsl:template>
628
629<xsl:template match="attribute/@type | param/@type" mode="paramvalconversion">
630 <xsl:param name="dir"/>
631
632 <xsl:variable name="gluetype">
633 <xsl:call-template name="translatepublictype">
634 <xsl:with-param name="type" select="."/>
635 <xsl:with-param name="dir" select="$dir"/>
636 <xsl:with-param name="mod" select="../@mod"/>
637 </xsl:call-template>
638 </xsl:variable>
639 <xsl:variable name="type" select="."/>
640 <xsl:variable name="thatif" select="//interface[@name=$type]"/>
641 <xsl:choose>
642 <xsl:when test="$type='$unknown'">
643 <xsl:if test="../@safearray='yes'">
644 <xsl:text>Array</xsl:text>
645 </xsl:if>
646 <xsl:choose>
647 <xsl:when test="$dir='in'">
648 <xsl:text>ComTypeInConverter&lt;IUnknown&gt;(</xsl:text>
649 </xsl:when>
650 <xsl:otherwise>
651 <xsl:text>ComTypeOutConverter&lt;IUnknown&gt;(</xsl:text>
652 </xsl:otherwise>
653 </xsl:choose>
654 <xsl:if test="../@safearray='yes'">
655 <xsl:choose>
656 <xsl:when test="$dir='in'">
657 <xsl:text>ComSafeArrayInArg(</xsl:text>
658 </xsl:when>
659 <xsl:otherwise>
660 <xsl:text>ComSafeArrayOutArg(</xsl:text>
661 </xsl:otherwise>
662 </xsl:choose>
663 </xsl:if>
664 </xsl:when>
665 <xsl:when test="$thatif">
666 <xsl:if test="../@safearray='yes'">
667 <xsl:text>Array</xsl:text>
668 </xsl:if>
669 <xsl:variable name="thatifname" select="$thatif/@name"/>
670 <xsl:choose>
671 <xsl:when test="$dir='in'">
672 <xsl:text>ComTypeInConverter</xsl:text>
673 </xsl:when>
674 <xsl:otherwise>
675 <xsl:text>ComTypeOutConverter</xsl:text>
676 </xsl:otherwise>
677 </xsl:choose>
678 <xsl:value-of select="concat('&lt;', $thatifname, '&gt;(')"/>
679 <xsl:if test="../@safearray='yes'">
680 <xsl:choose>
681 <xsl:when test="$dir='in'">
682 <xsl:text>ComSafeArrayInArg(</xsl:text>
683 </xsl:when>
684 <xsl:otherwise>
685 <xsl:text>ComSafeArrayOutArg(</xsl:text>
686 </xsl:otherwise>
687 </xsl:choose>
688 </xsl:if>
689 </xsl:when>
690 <xsl:when test="$type='wstring'">
691 <xsl:if test="../@safearray='yes'">
692 <xsl:text>Array</xsl:text>
693 </xsl:if>
694 <xsl:choose>
695 <xsl:when test="$dir='in'">
696 <xsl:text>BSTRInConverter(</xsl:text>
697 </xsl:when>
698 <xsl:otherwise>
699 <xsl:text>BSTROutConverter(</xsl:text>
700 </xsl:otherwise>
701 </xsl:choose>
702 <xsl:if test="../@safearray='yes'">
703 <xsl:choose>
704 <xsl:when test="$dir='in'">
705 <xsl:text>ComSafeArrayInArg(</xsl:text>
706 </xsl:when>
707 <xsl:otherwise>
708 <xsl:text>ComSafeArrayOutArg(</xsl:text>
709 </xsl:otherwise>
710 </xsl:choose>
711 </xsl:if>
712 </xsl:when>
713 <xsl:when test="$type='uuid'">
714 <xsl:if test="../@safearray='yes'">
715 <xsl:text>Array</xsl:text>
716 </xsl:if>
717 <xsl:choose>
718 <xsl:when test="$dir='in'">
719 <xsl:text>UuidInConverter(</xsl:text>
720 </xsl:when>
721 <xsl:otherwise>
722 <xsl:text>UuidOutConverter(</xsl:text>
723 </xsl:otherwise>
724 </xsl:choose>
725 <xsl:if test="../@safearray='yes'">
726 <xsl:choose>
727 <xsl:when test="$dir='in'">
728 <xsl:text>ComSafeArrayInArg(</xsl:text>
729 </xsl:when>
730 <xsl:otherwise>
731 <xsl:text>ComSafeArrayOutArg(</xsl:text>
732 </xsl:otherwise>
733 </xsl:choose>
734 </xsl:if>
735 </xsl:when>
736 <xsl:otherwise>
737 <xsl:if test="../@safearray='yes'">
738 <xsl:text>Array</xsl:text>
739 <xsl:choose>
740 <xsl:when test="$dir='in'">
741 <xsl:text>InConverter</xsl:text>
742 </xsl:when>
743 <xsl:otherwise>
744 <xsl:text>OutConverter</xsl:text>
745 </xsl:otherwise>
746 </xsl:choose>
747 <xsl:value-of select="concat('&lt;', $gluetype, '&gt;(')"/>
748 <xsl:choose>
749 <xsl:when test="$dir='in'">
750 <xsl:text>ComSafeArrayInArg(</xsl:text>
751 </xsl:when>
752 <xsl:otherwise>
753 <xsl:text>ComSafeArrayOutArg(</xsl:text>
754 </xsl:otherwise>
755 </xsl:choose>
756 </xsl:if>
757 </xsl:otherwise>
758 </xsl:choose>
759 <xsl:text>a</xsl:text>
760 <xsl:call-template name="capitalize">
761 <xsl:with-param name="str" select="../@name"/>
762 </xsl:call-template>
763 <xsl:choose>
764 <xsl:when test="$type='$unknown' or $thatif">
765 <xsl:choose>
766 <xsl:when test="../@safearray='yes'">
767 <xsl:text>)).array()</xsl:text>
768 </xsl:when>
769 <xsl:otherwise>
770 <xsl:text>).ptr()</xsl:text>
771 </xsl:otherwise>
772 </xsl:choose>
773 </xsl:when>
774 <xsl:when test="$type='wstring'">
775 <xsl:choose>
776 <xsl:when test="../@safearray='yes'">
777 <xsl:text>)).array()</xsl:text>
778 </xsl:when>
779 <xsl:otherwise>
780 <xsl:text>).str()</xsl:text>
781 </xsl:otherwise>
782 </xsl:choose>
783 </xsl:when>
784 <xsl:when test="$type='uuid'">
785 <xsl:choose>
786 <xsl:when test="../@safearray='yes'">
787 <xsl:text>)).array()</xsl:text>
788 </xsl:when>
789 <xsl:otherwise>
790 <xsl:text>).uuid()</xsl:text>
791 </xsl:otherwise>
792 </xsl:choose>
793 </xsl:when>
794 <xsl:otherwise>
795 <xsl:if test="../@safearray='yes'">
796 <xsl:text>)).array()</xsl:text>
797 </xsl:if>
798 </xsl:otherwise>
799 </xsl:choose>
800</xsl:template>
801
802<!-- - - - - - - - - - - - - - - - - - - - - - -
803 emit attribute
804 - - - - - - - - - - - - - - - - - - - - - - -->
805
806<xsl:template match="attribute" mode="public">
807 <xsl:param name="target"/>
808
809 <xsl:call-template name="emitTargetBegin">
810 <xsl:with-param name="target" select="$target"/>
811 </xsl:call-template>
812
813 <xsl:variable name="attrbasename">
814 <xsl:call-template name="capitalize">
815 <xsl:with-param name="str" select="@name"/>
816 </xsl:call-template>
817 </xsl:variable>
818
819 <xsl:value-of select="concat(' STDMETHOD(COMGETTER(', $attrbasename, '))(')"/>
820 <xsl:apply-templates select="@type" mode="public">
821 <xsl:with-param name="dir" select="'out'"/>
822 </xsl:apply-templates>
823 <xsl:text>);
824</xsl:text>
825
826 <xsl:if test="not(@readonly) or @readonly!='yes'">
827 <xsl:value-of select="concat(' STDMETHOD(COMSETTER(', $attrbasename, '))(')"/>
828 <xsl:apply-templates select="@type" mode="public">
829 <xsl:with-param name="dir" select="'in'"/>
830 </xsl:apply-templates>
831 <xsl:text>);
832</xsl:text>
833 </xsl:if>
834
835 <xsl:call-template name="emitTargetEnd">
836 <xsl:with-param name="target" select="$target"/>
837 </xsl:call-template>
838</xsl:template>
839
840<xsl:template match="attribute" mode="wrapped">
841 <xsl:param name="target"/>
842
843 <xsl:call-template name="emitTargetBegin">
844 <xsl:with-param name="target" select="$target"/>
845 </xsl:call-template>
846
847 <xsl:variable name="attrbasename">
848 <xsl:call-template name="capitalize">
849 <xsl:with-param name="str" select="@name"/>
850 </xsl:call-template>
851 </xsl:variable>
852
853 <xsl:value-of select="concat(' virtual HRESULT get', $attrbasename, '(')"/>
854 <xsl:variable name="passAutoCaller">
855 <xsl:call-template name="checkoption">
856 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
857 <xsl:with-param name="option" select="'passcaller'"/>
858 </xsl:call-template>
859 </xsl:variable>
860 <xsl:if test="$passAutoCaller = 'true'">
861 <xsl:text>AutoCaller &amp;aAutoCaller, </xsl:text>
862 </xsl:if>
863 <xsl:apply-templates select="@type" mode="wrapped">
864 <xsl:with-param name="dir" select="'out'"/>
865 </xsl:apply-templates>
866 <xsl:text>) = 0;
867</xsl:text>
868
869 <xsl:if test="not(@readonly) or @readonly!='yes'">
870 <xsl:value-of select="concat(' virtual HRESULT set', $attrbasename, '(')"/>
871 <xsl:if test="$passAutoCaller = 'true'">
872 <xsl:text>AutoCaller &amp;aAutoCaller, </xsl:text>
873 </xsl:if>
874 <xsl:apply-templates select="@type" mode="wrapped">
875 <xsl:with-param name="dir" select="'in'"/>
876 </xsl:apply-templates>
877 <xsl:text>) = 0;
878</xsl:text>
879 </xsl:if>
880
881 <xsl:call-template name="emitTargetEnd">
882 <xsl:with-param name="target" select="$target"/>
883 </xsl:call-template>
884</xsl:template>
885
886<xsl:template match="attribute" mode="code">
887 <xsl:param name="topclass"/>
888 <xsl:param name="target"/>
889
890 <xsl:call-template name="emitTargetBegin">
891 <xsl:with-param name="target" select="$target"/>
892 </xsl:call-template>
893
894 <xsl:variable name="attrbasename">
895 <xsl:call-template name="capitalize">
896 <xsl:with-param name="str" select="@name"/>
897 </xsl:call-template>
898 </xsl:variable>
899 <xsl:variable name="limitedAutoCaller">
900 <xsl:call-template name="checkoption">
901 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
902 <xsl:with-param name="option" select="'limitedcaller'"/>
903 </xsl:call-template>
904 </xsl:variable>
905
906 <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMGETTER(', $attrbasename, ')(')"/>
907 <xsl:apply-templates select="@type" mode="public">
908 <xsl:with-param name="dir" select="'out'"/>
909 </xsl:apply-templates>
910 <xsl:text>)
911{
912 LogRelFlow(("{%p} %s: enter </xsl:text>
913 <xsl:apply-templates select="@type" mode="logparamtext">
914 <xsl:with-param name="dir" select="'out'"/>
915 <xsl:with-param name="isref" select="'yes'"/>
916 </xsl:apply-templates>
917 <xsl:text>\n", this, </xsl:text>
918 <xsl:value-of select="concat('&quot;', $topclass, '::get', $attrbasename, '&quot;, ')"/>
919 <xsl:apply-templates select="@type" mode="logparamval">
920 <xsl:with-param name="dir" select="'out'"/>
921 <xsl:with-param name="isref" select="'yes'"/>
922 </xsl:apply-templates>
923 <xsl:text>));
924
925 VirtualBoxBase::clearError();
926
927 HRESULT hrc;
928
929 try
930 {
931 CheckComArgOutPointerValidThrow(a</xsl:text>
932 <xsl:value-of select="$attrbasename"/>
933 <xsl:text>);
934
935 </xsl:text>
936 <xsl:choose>
937 <xsl:when test="$limitedAutoCaller = 'true'">
938 <xsl:text>AutoLimitedCaller</xsl:text>
939 </xsl:when>
940 <xsl:otherwise>
941 <xsl:text>AutoCaller</xsl:text>
942 </xsl:otherwise>
943 </xsl:choose>
944 <xsl:text> autoCaller(this);
945 if (FAILED(autoCaller.rc()))
946 throw autoCaller.rc();
947
948</xsl:text>
949 <xsl:value-of select="concat(' hrc = get', $attrbasename, '(')"/>
950 <xsl:variable name="passAutoCaller">
951 <xsl:call-template name="checkoption">
952 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
953 <xsl:with-param name="option" select="'passcaller'"/>
954 </xsl:call-template>
955 </xsl:variable>
956 <xsl:if test="$passAutoCaller = 'true'">
957 <xsl:text>autoCaller, </xsl:text>
958 </xsl:if>
959 <xsl:apply-templates select="@type" mode="paramvalconversion">
960 <xsl:with-param name="dir" select="'out'"/>
961 </xsl:apply-templates>
962 <xsl:text>);
963 }
964 catch (HRESULT hrc2)
965 {
966 hrc = hrc2;
967 }
968 catch (...)
969 {
970 hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
971 }
972
973 LogRelFlow(("{%p} %s: leave </xsl:text>
974 <xsl:apply-templates select="@type" mode="logparamtext">
975 <xsl:with-param name="dir" select="'out'"/>
976 <xsl:with-param name="isref" select="''"/>
977 </xsl:apply-templates>
978 <xsl:text> hrc=%Rhrc\n", this, </xsl:text>
979 <xsl:value-of select="concat('&quot;', $topclass, '::get', $attrbasename, '&quot;, ')"/>
980 <xsl:apply-templates select="@type" mode="logparamval">
981 <xsl:with-param name="dir" select="'out'"/>
982 <xsl:with-param name="isref" select="''"/>
983 </xsl:apply-templates>
984 <xsl:text>, hrc));
985 return hrc;
986}
987</xsl:text>
988 <xsl:if test="not(@readonly) or @readonly!='yes'">
989 <xsl:text>
990</xsl:text>
991 <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMSETTER(', $attrbasename, ')(')"/>
992 <xsl:apply-templates select="@type" mode="public">
993 <xsl:with-param name="dir" select="'in'"/>
994 </xsl:apply-templates>
995 <!-- @todo check in parameters if possible -->
996 <xsl:text>)
997{
998 LogRelFlow(("{%p} %s: enter </xsl:text>
999 <xsl:apply-templates select="@type" mode="logparamtext">
1000 <xsl:with-param name="dir" select="'in'"/>
1001 <xsl:with-param name="isref" select="''"/>
1002 </xsl:apply-templates>
1003 <xsl:text>\n", this, </xsl:text>
1004 <xsl:value-of select="concat('&quot;', $topclass, '::set', $attrbasename, '&quot;, ')"/>
1005 <xsl:apply-templates select="@type" mode="logparamval">
1006 <xsl:with-param name="dir" select="'in'"/>
1007 <xsl:with-param name="isref" select="''"/>
1008 </xsl:apply-templates>
1009 <xsl:text>));
1010
1011 VirtualBoxBase::clearError();
1012
1013 HRESULT hrc;
1014
1015 try
1016 {
1017 </xsl:text>
1018 <xsl:choose>
1019 <xsl:when test="$limitedAutoCaller = 'true'">
1020 <xsl:text>AutoLimitedCaller</xsl:text>
1021 </xsl:when>
1022 <xsl:otherwise>
1023 <xsl:text>AutoCaller</xsl:text>
1024 </xsl:otherwise>
1025 </xsl:choose>
1026 <xsl:text> autoCaller(this);
1027 if (FAILED(autoCaller.rc()))
1028 throw autoCaller.rc();
1029
1030</xsl:text>
1031 <xsl:value-of select="concat(' hrc = set', $attrbasename, '(')"/>
1032 <xsl:if test="$passAutoCaller = 'true'">
1033 <xsl:text>autoCaller, </xsl:text>
1034 </xsl:if>
1035 <xsl:apply-templates select="@type" mode="paramvalconversion">
1036 <xsl:with-param name="dir" select="'in'"/>
1037 </xsl:apply-templates>
1038 <xsl:text>);
1039 }
1040 catch (HRESULT hrc2)
1041 {
1042 hrc = hrc2;
1043 }
1044 catch (...)
1045 {
1046 hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
1047 }
1048
1049 LogRelFlow(("{%p} %s: leave hrc=%Rhrc\n", this, </xsl:text>
1050 <xsl:value-of select="concat('&quot;', $topclass, '::set', $attrbasename, '&quot;, ')"/>
1051 <xsl:text>hrc));
1052 return hrc;
1053}
1054</xsl:text>
1055 </xsl:if>
1056
1057 <xsl:call-template name="emitTargetEnd">
1058 <xsl:with-param name="target" select="$target"/>
1059 </xsl:call-template>
1060
1061 <xsl:text>
1062</xsl:text>
1063</xsl:template>
1064
1065<!-- - - - - - - - - - - - - - - - - - - - - - -
1066 emit all attributes of an interface
1067 - - - - - - - - - - - - - - - - - - - - - - -->
1068<xsl:template name="emitAttributes">
1069 <xsl:param name="iface"/>
1070 <xsl:param name="topclass"/>
1071 <xsl:param name="pmode"/>
1072
1073 <!-- first recurse to emit all base interfaces -->
1074 <xsl:variable name="extends" select="$iface/@extends"/>
1075 <xsl:if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
1076 <xsl:call-template name="emitAttributes">
1077 <xsl:with-param name="iface" select="//interface[@name=$extends]"/>
1078 <xsl:with-param name="topclass" select="$topclass"/>
1079 <xsl:with-param name="pmode" select="$pmode"/>
1080 </xsl:call-template>
1081 </xsl:if>
1082
1083 <xsl:choose>
1084 <xsl:when test="$pmode='code'">
1085 <xsl:text>//
1086</xsl:text>
1087 <xsl:value-of select="concat('// ', $iface/@name, ' properties')"/>
1088 <xsl:text>
1089//
1090
1091</xsl:text>
1092 </xsl:when>
1093 <xsl:otherwise>
1094 <xsl:value-of select="concat('&#10; // ', $pmode, ' ', $iface/@name, ' properties&#10;')"/>
1095 </xsl:otherwise>
1096 </xsl:choose>
1097 <xsl:choose>
1098 <xsl:when test="$pmode='public'">
1099 <xsl:apply-templates select="$iface/attribute | $iface/if" mode="public">
1100 <xsl:with-param name="emitmode" select="'attribute'"/>
1101 </xsl:apply-templates>
1102 </xsl:when>
1103 <xsl:when test="$pmode='wrapped'">
1104 <xsl:apply-templates select="$iface/attribute | $iface/if" mode="wrapped">
1105 <xsl:with-param name="emitmode" select="'attribute'"/>
1106 </xsl:apply-templates>
1107 </xsl:when>
1108 <xsl:when test="$pmode='code'">
1109 <xsl:apply-templates select="$iface/attribute | $iface/if" mode="code">
1110 <xsl:with-param name="topclass" select="$topclass"/>
1111 <xsl:with-param name="emitmode" select="'attribute'"/>
1112 </xsl:apply-templates>
1113 </xsl:when>
1114 <xsl:otherwise/>
1115 </xsl:choose>
1116</xsl:template>
1117
1118<xsl:template name="emitTargetBegin">
1119 <xsl:param name="target"/>
1120
1121 <xsl:choose>
1122 <xsl:when test="$target = 'xpidl'">
1123 <xsl:text>#ifdef VBOX_WITH_XPCOM
1124</xsl:text>
1125 </xsl:when>
1126 <xsl:when test="$target = 'midl'">
1127 <xsl:text>#ifndef VBOX_WITH_XPCOM
1128</xsl:text>
1129 </xsl:when>
1130 <xsl:otherwise/>
1131 </xsl:choose>
1132</xsl:template>
1133
1134<xsl:template name="emitTargetEnd">
1135 <xsl:param name="target"/>
1136
1137 <xsl:choose>
1138 <xsl:when test="$target = 'xpidl'">
1139 <xsl:text>#endif /* VBOX_WITH_XPCOM */
1140</xsl:text>
1141 </xsl:when>
1142 <xsl:when test="$target = 'midl'">
1143 <xsl:text>#endif /* !VBOX_WITH_XPCOM */
1144</xsl:text>
1145 </xsl:when>
1146 <xsl:otherwise/>
1147 </xsl:choose>
1148</xsl:template>
1149
1150
1151<!-- - - - - - - - - - - - - - - - - - - - - - -
1152 emit method
1153 - - - - - - - - - - - - - - - - - - - - - - -->
1154
1155<xsl:template match="method" mode="public">
1156 <xsl:param name="target"/>
1157
1158 <xsl:call-template name="emitTargetBegin">
1159 <xsl:with-param name="target" select="$target"/>
1160 </xsl:call-template>
1161
1162 <xsl:variable name="methodindent">
1163 <xsl:call-template name="tospace">
1164 <xsl:with-param name="str" select="@name"/>
1165 </xsl:call-template>
1166 </xsl:variable>
1167
1168 <xsl:text> STDMETHOD(</xsl:text>
1169 <xsl:call-template name="capitalize">
1170 <xsl:with-param name="str" select="@name"/>
1171 </xsl:call-template>
1172 <xsl:text>)(</xsl:text>
1173 <xsl:for-each select="param">
1174 <xsl:apply-templates select="@type" mode="public">
1175 <xsl:with-param name="dir" select="@dir"/>
1176 </xsl:apply-templates>
1177 <xsl:if test="not(position()=last())">
1178 <xsl:text>,
1179 </xsl:text>
1180 <xsl:value-of select="$methodindent"/>
1181 </xsl:if>
1182 </xsl:for-each>
1183 <xsl:text>);
1184</xsl:text>
1185
1186 <xsl:call-template name="emitTargetEnd">
1187 <xsl:with-param name="target" select="$target"/>
1188 </xsl:call-template>
1189</xsl:template>
1190
1191<xsl:template match="method" mode="wrapped">
1192 <xsl:param name="target"/>
1193
1194 <xsl:call-template name="emitTargetBegin">
1195 <xsl:with-param name="target" select="$target"/>
1196 </xsl:call-template>
1197
1198 <xsl:variable name="methodindent">
1199 <xsl:call-template name="tospace">
1200 <xsl:with-param name="str" select="@name"/>
1201 </xsl:call-template>
1202 </xsl:variable>
1203
1204 <xsl:text> virtual HRESULT </xsl:text>
1205 <xsl:call-template name="uncapitalize">
1206 <xsl:with-param name="str" select="@name"/>
1207 </xsl:call-template>
1208 <xsl:text>(</xsl:text>
1209 <xsl:variable name="passAutoCaller">
1210 <xsl:call-template name="checkoption">
1211 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
1212 <xsl:with-param name="option" select="'passcaller'"/>
1213 </xsl:call-template>
1214 </xsl:variable>
1215 <xsl:if test="$passAutoCaller = 'true'">
1216 <xsl:text>AutoCaller &amp;aAutoCaller</xsl:text>
1217 <xsl:if test="count(param) > 0">
1218 <xsl:text>,
1219 </xsl:text>
1220 <xsl:value-of select="$methodindent"/>
1221 </xsl:if>
1222 </xsl:if>
1223 <xsl:for-each select="param">
1224 <xsl:apply-templates select="@type" mode="wrapped">
1225 <xsl:with-param name="dir" select="@dir"/>
1226 </xsl:apply-templates>
1227 <xsl:if test="not(position()=last())">
1228 <xsl:text>,
1229 </xsl:text>
1230 <xsl:value-of select="$methodindent"/>
1231 </xsl:if>
1232 </xsl:for-each>
1233 <xsl:text>) = 0;
1234</xsl:text>
1235
1236 <xsl:call-template name="emitTargetEnd">
1237 <xsl:with-param name="target" select="$target"/>
1238 </xsl:call-template>
1239</xsl:template>
1240
1241<xsl:template match="method" mode="code">
1242 <xsl:param name="topclass"/>
1243 <xsl:param name="target"/>
1244
1245 <xsl:call-template name="emitTargetBegin">
1246 <xsl:with-param name="target" select="$target"/>
1247 </xsl:call-template>
1248
1249 <xsl:variable name="methodindent">
1250 <xsl:call-template name="tospace">
1251 <xsl:with-param name="str" select="@name"/>
1252 </xsl:call-template>
1253 </xsl:variable>
1254 <xsl:variable name="methodclassindent">
1255 <xsl:call-template name="tospace">
1256 <xsl:with-param name="str" select="concat($topclass, @name)"/>
1257 </xsl:call-template>
1258 </xsl:variable>
1259 <xsl:variable name="methodbasename">
1260 <xsl:call-template name="capitalize">
1261 <xsl:with-param name="str" select="@name"/>
1262 </xsl:call-template>
1263 </xsl:variable>
1264 <xsl:variable name="limitedAutoCaller">
1265 <xsl:call-template name="checkoption">
1266 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
1267 <xsl:with-param name="option" select="'limitedcaller'"/>
1268 </xsl:call-template>
1269 </xsl:variable>
1270
1271 <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::', $methodbasename, '(')"/>
1272 <xsl:for-each select="param">
1273 <xsl:apply-templates select="@type" mode="public">
1274 <xsl:with-param name="dir" select="@dir"/>
1275 </xsl:apply-templates>
1276 <xsl:if test="not(position()=last())">
1277 <xsl:text>,
1278 </xsl:text>
1279 <xsl:value-of select="$methodclassindent"/>
1280 </xsl:if>
1281 </xsl:for-each>
1282 <xsl:text>)
1283{
1284 LogRelFlow(("{%p} %s:enter</xsl:text>
1285 <xsl:for-each select="param">
1286 <xsl:text> </xsl:text>
1287 <xsl:apply-templates select="@type" mode="logparamtext">
1288 <xsl:with-param name="dir" select="@dir"/>
1289 <xsl:with-param name="isref" select="'yes'"/>
1290 </xsl:apply-templates>
1291 </xsl:for-each>
1292 <xsl:text>\n", this</xsl:text>
1293 <xsl:value-of select="concat(', &quot;', $topclass, '::', @name, '&quot;')"/>
1294 <xsl:for-each select="param">
1295 <xsl:text>, </xsl:text>
1296 <xsl:apply-templates select="@type" mode="logparamval">
1297 <xsl:with-param name="dir" select="@dir"/>
1298 <xsl:with-param name="isref" select="'yes'"/>
1299 </xsl:apply-templates>
1300 </xsl:for-each>
1301 <xsl:text>));
1302
1303 VirtualBoxBase::clearError();
1304
1305 HRESULT hrc;
1306
1307 try
1308 {
1309</xsl:text>
1310 <!-- @todo check in parameters if possible -->
1311 <xsl:for-each select="param">
1312 <xsl:if test="@dir!='in'">
1313 <xsl:text> CheckComArgOutPointerValidThrow(a</xsl:text>
1314 <xsl:call-template name="capitalize">
1315 <xsl:with-param name="str" select="@name"/>
1316 </xsl:call-template>
1317 <xsl:text>);
1318</xsl:text>
1319 </xsl:if>
1320 </xsl:for-each>
1321 <xsl:text>
1322 </xsl:text>
1323 <xsl:choose>
1324 <xsl:when test="$limitedAutoCaller = 'true'">
1325 <xsl:text>AutoLimitedCaller</xsl:text>
1326 </xsl:when>
1327 <xsl:otherwise>
1328 <xsl:text>AutoCaller</xsl:text>
1329 </xsl:otherwise>
1330 </xsl:choose>
1331 <xsl:text> autoCaller(this);
1332 if (FAILED(autoCaller.rc()))
1333 throw autoCaller.rc();
1334
1335</xsl:text>
1336 <xsl:value-of select="concat(' hrc = ', @name, '(')"/>
1337 <xsl:variable name="passAutoCaller">
1338 <xsl:call-template name="checkoption">
1339 <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
1340 <xsl:with-param name="option" select="'passcaller'"/>
1341 </xsl:call-template>
1342 </xsl:variable>
1343 <xsl:if test="$passAutoCaller = 'true'">
1344 <xsl:text>autoCaller</xsl:text>
1345 <xsl:if test="count(param) > 0">
1346 <xsl:text>,
1347 </xsl:text>
1348 <xsl:value-of select="$methodindent"/>
1349 </xsl:if>
1350 </xsl:if>
1351 <xsl:for-each select="param">
1352 <xsl:apply-templates select="@type" mode="paramvalconversion">
1353 <xsl:with-param name="dir" select="@dir"/>
1354 </xsl:apply-templates>
1355 <xsl:if test="not(position()=last())">
1356 <xsl:text>,
1357 </xsl:text>
1358 <xsl:value-of select="$methodindent"/>
1359 </xsl:if>
1360 </xsl:for-each>
1361 <xsl:text>);
1362 }
1363 catch (HRESULT hrc2)
1364 {
1365 hrc = hrc2;
1366 }
1367 catch (...)
1368 {
1369 hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
1370 }
1371
1372 LogRelFlow(("{%p} %s: leave</xsl:text>
1373 <xsl:for-each select="param">
1374 <xsl:if test="@dir!='in'">
1375 <xsl:text> </xsl:text>
1376 <xsl:apply-templates select="@type" mode="logparamtext">
1377 <xsl:with-param name="dir" select="@dir"/>
1378 <xsl:with-param name="isref" select="''"/>
1379 </xsl:apply-templates>
1380 </xsl:if>
1381 </xsl:for-each>
1382 <xsl:text> hrc=%Rhrc\n", this</xsl:text>
1383 <xsl:value-of select="concat(', &quot;', $topclass, '::', @name, '&quot;')"/>
1384 <xsl:for-each select="param">
1385 <xsl:if test="@dir!='in'">
1386 <xsl:text>, </xsl:text>
1387 <xsl:apply-templates select="@type" mode="logparamval">
1388 <xsl:with-param name="dir" select="@dir"/>
1389 <xsl:with-param name="isref" select="''"/>
1390 </xsl:apply-templates>
1391 </xsl:if>
1392 </xsl:for-each>
1393 <xsl:text>, hrc));
1394 return hrc;
1395}
1396</xsl:text>
1397
1398 <xsl:call-template name="emitTargetEnd">
1399 <xsl:with-param name="target" select="$target"/>
1400 </xsl:call-template>
1401
1402 <xsl:text>
1403</xsl:text>
1404</xsl:template>
1405
1406<xsl:template name="emitIf">
1407 <xsl:param name="passmode"/>
1408 <xsl:param name="target"/>
1409 <xsl:param name="topclass"/>
1410 <xsl:param name="emitmode"/>
1411
1412 <xsl:if test="($target = 'xpidl') or ($target = 'midl')">
1413 <xsl:choose>
1414 <xsl:when test="$filelistonly=''">
1415 <xsl:choose>
1416 <xsl:when test="$passmode='public'">
1417 <xsl:choose>
1418 <xsl:when test="$emitmode='method'">
1419 <xsl:apply-templates select="method" mode="public">
1420 <xsl:with-param name="target" select="$target"/>
1421 </xsl:apply-templates>
1422 </xsl:when>
1423 <xsl:when test="$emitmode='attribute'">
1424 <xsl:apply-templates select="attribute" mode="public">
1425 <xsl:with-param name="target" select="$target"/>
1426 </xsl:apply-templates>
1427 </xsl:when>
1428 <xsl:otherwise/>
1429 </xsl:choose>
1430 </xsl:when>
1431 <xsl:when test="$passmode='wrapped'">
1432 <xsl:choose>
1433 <xsl:when test="$emitmode='method'">
1434 <xsl:apply-templates select="method" mode="wrapped">
1435 <xsl:with-param name="target" select="$target"/>
1436 </xsl:apply-templates>
1437 </xsl:when>
1438 <xsl:when test="$emitmode='attribute'">
1439 <xsl:apply-templates select="attribute" mode="wrapped">
1440 <xsl:with-param name="target" select="$target"/>
1441 </xsl:apply-templates>
1442 </xsl:when>
1443 <xsl:otherwise/>
1444 </xsl:choose>
1445 </xsl:when>
1446 <xsl:when test="$passmode='code'">
1447 <xsl:choose>
1448 <xsl:when test="$emitmode='method'">
1449 <xsl:apply-templates select="method" mode="code">
1450 <xsl:with-param name="target" select="$target"/>
1451 <xsl:with-param name="topclass" select="$topclass"/>
1452 </xsl:apply-templates>
1453 </xsl:when>
1454 <xsl:when test="$emitmode='attribute'">
1455 <xsl:apply-templates select="attribute" mode="code">
1456 <xsl:with-param name="target" select="$target"/>
1457 <xsl:with-param name="topclass" select="$topclass"/>
1458 </xsl:apply-templates>
1459 </xsl:when>
1460 <xsl:otherwise/>
1461 </xsl:choose>
1462 </xsl:when>
1463 <xsl:otherwise/>
1464 </xsl:choose>
1465 </xsl:when>
1466 <xsl:otherwise>
1467 <xsl:apply-templates/>
1468 </xsl:otherwise>
1469 </xsl:choose>
1470 </xsl:if>
1471</xsl:template>
1472
1473<xsl:template match="if" mode="public">
1474 <xsl:param name="emitmode"/>
1475
1476 <xsl:call-template name="emitIf">
1477 <xsl:with-param name="passmode" select="'public'"/>
1478 <xsl:with-param name="target" select="@target"/>
1479 <xsl:with-param name="emitmode" select="$emitmode"/>
1480 </xsl:call-template>
1481</xsl:template>
1482
1483<xsl:template match="if" mode="wrapped">
1484 <xsl:param name="emitmode"/>
1485
1486 <xsl:call-template name="emitIf">
1487 <xsl:with-param name="passmode" select="'wrapped'"/>
1488 <xsl:with-param name="target" select="@target"/>
1489 <xsl:with-param name="emitmode" select="$emitmode"/>
1490 </xsl:call-template>
1491</xsl:template>
1492
1493<xsl:template match="if" mode="code">
1494 <xsl:param name="topclass"/>
1495 <xsl:param name="emitmode"/>
1496
1497 <xsl:call-template name="emitIf">
1498 <xsl:with-param name="passmode" select="'code'"/>
1499 <xsl:with-param name="target" select="@target"/>
1500 <xsl:with-param name="emitmode" select="$emitmode"/>
1501 <xsl:with-param name="topclass" select="$topclass"/>
1502 </xsl:call-template>
1503</xsl:template>
1504
1505<!-- - - - - - - - - - - - - - - - - - - - - - -
1506 emit all methods of an interface
1507 - - - - - - - - - - - - - - - - - - - - - - -->
1508<xsl:template name="emitMethods">
1509 <xsl:param name="iface"/>
1510 <xsl:param name="topclass"/>
1511 <xsl:param name="pmode"/>
1512
1513 <!-- first recurse to emit all base interfaces -->
1514 <xsl:variable name="extends" select="$iface/@extends"/>
1515 <xsl:if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
1516 <xsl:call-template name="emitMethods">
1517 <xsl:with-param name="iface" select="//interface[@name=$extends]"/>
1518 <xsl:with-param name="topclass" select="$topclass"/>
1519 <xsl:with-param name="pmode" select="$pmode"/>
1520 </xsl:call-template>
1521 </xsl:if>
1522
1523 <xsl:choose>
1524 <xsl:when test="$pmode='code'">
1525 <xsl:text>//
1526</xsl:text>
1527 <xsl:value-of select="concat('// ', $iface/@name, ' methods')"/>
1528 <xsl:text>
1529//
1530
1531</xsl:text>
1532 </xsl:when>
1533 <xsl:otherwise>
1534 <xsl:value-of select="concat('&#10; // ', $pmode, ' ', $iface/@name, ' methods&#10;')"/>
1535 </xsl:otherwise>
1536 </xsl:choose>
1537 <xsl:choose>
1538 <xsl:when test="$pmode='public'">
1539 <xsl:apply-templates select="$iface/method | $iface/if" mode="public">
1540 <xsl:with-param name="emitmode" select="'method'"/>
1541 </xsl:apply-templates>
1542 </xsl:when>
1543 <xsl:when test="$pmode='wrapped'">
1544 <xsl:apply-templates select="$iface/method | $iface/if" mode="wrapped">
1545 <xsl:with-param name="emitmode" select="'method'"/>
1546 </xsl:apply-templates>
1547 </xsl:when>
1548 <xsl:when test="$pmode='code'">
1549 <xsl:apply-templates select="$iface/method | $iface/if" mode="code">
1550 <xsl:with-param name="topclass" select="$topclass"/>
1551 <xsl:with-param name="emitmode" select="'method'"/>
1552 </xsl:apply-templates>
1553 </xsl:when>
1554 <xsl:otherwise/>
1555 </xsl:choose>
1556</xsl:template>
1557
1558<!-- - - - - - - - - - - - - - - - - - - - - - -
1559 emit all attributes and methods declarations of an interface
1560 - - - - - - - - - - - - - - - - - - - - - - -->
1561<xsl:template name="emitInterfaceDecls">
1562 <xsl:param name="iface"/>
1563 <xsl:param name="pmode"/>
1564
1565 <!-- attributes -->
1566 <xsl:call-template name="emitAttributes">
1567 <xsl:with-param name="iface" select="$iface"/>
1568 <xsl:with-param name="pmode" select="$pmode"/>
1569 </xsl:call-template>
1570
1571 <!-- methods -->
1572 <xsl:call-template name="emitMethods">
1573 <xsl:with-param name="iface" select="$iface"/>
1574 <xsl:with-param name="pmode" select="$pmode"/>
1575 </xsl:call-template>
1576</xsl:template>
1577
1578<!-- - - - - - - - - - - - - - - - - - - - - - -
1579 emit auxiliary method declarations of an interface
1580 - - - - - - - - - - - - - - - - - - - - - - -->
1581<xsl:template name="emitAuxMethodDecls">
1582 <xsl:param name="iface"/>
1583 <!-- currently nothing, maybe later some generic FinalConstruct/... helper declaration for ComObjPtr -->
1584</xsl:template>
1585
1586<!-- - - - - - - - - - - - - - - - - - - - - - -
1587 emit the header file of an interface
1588 - - - - - - - - - - - - - - - - - - - - - - -->
1589<xsl:template name="emitHeader">
1590 <xsl:param name="iface"/>
1591 <xsl:param name="addinterfaces"/>
1592
1593 <xsl:variable name="filename" select="concat(substring(@name, 2), 'Wrap.h')"/>
1594
1595 <xsl:choose>
1596 <xsl:when test="$filelistonly=''">
1597 <xsl:apply-templates select="$iface" mode="startfile">
1598 <xsl:with-param name="file" select="$filename"/>
1599 </xsl:apply-templates>
1600 <xsl:call-template name="fileheader">
1601 <xsl:with-param name="name" select="$filename"/>
1602 <xsl:with-param name="class" select="substring(@name, 2)"/>
1603 <xsl:with-param name="type" select="'header'"/>
1604 </xsl:call-template>
1605 <xsl:apply-templates select="$iface" mode="classheader">
1606 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
1607 </xsl:apply-templates>
1608
1609 <!-- interface attributes/methods (public) -->
1610 <xsl:call-template name="emitInterfaceDecls">
1611 <xsl:with-param name="iface" select="$iface"/>
1612 <xsl:with-param name="pmode" select="'public'"/>
1613 </xsl:call-template>
1614
1615 <xsl:for-each select="exsl:node-set($addinterfaces)/token">
1616 <!-- This is super tricky, as the for-each switches to the node
1617 set, which means the normal document isn't available any
1618 more. So need to use the global root node to get back into
1619 the documemt to find corresponding interface data. -->
1620 <xsl:variable name="addifname">
1621 <xsl:value-of select="string(.)"/>
1622 </xsl:variable>
1623 <xsl:call-template name="emitInterfaceDecls">
1624 <xsl:with-param name="iface" select="$G_root//interface[@name=$addifname]"/>
1625 <xsl:with-param name="pmode" select="'public'"/>
1626 </xsl:call-template>
1627 </xsl:for-each>
1628
1629 <!-- auxiliary methods (public) -->
1630 <xsl:call-template name="emitAuxMethodDecls">
1631 <xsl:with-param name="iface" select="$iface"/>
1632 </xsl:call-template>
1633
1634 <!-- switch to private -->
1635 <xsl:text>
1636private:</xsl:text>
1637
1638 <!-- wrapped interface attributes/methods (private) -->
1639 <xsl:call-template name="emitInterfaceDecls">
1640 <xsl:with-param name="iface" select="$iface"/>
1641 <xsl:with-param name="pmode" select="'wrapped'"/>
1642 </xsl:call-template>
1643
1644 <xsl:for-each select="exsl:node-set($addinterfaces)/token">
1645 <!-- This is super tricky, as the for-each switches to the node
1646 set, which means the normal document isn't available any
1647 more. So need to use the global root node to get back into
1648 the documemt to find corresponding interface data. -->
1649 <xsl:variable name="addifname">
1650 <xsl:value-of select="string(.)"/>
1651 </xsl:variable>
1652 <xsl:call-template name="emitInterfaceDecls">
1653 <xsl:with-param name="iface" select="$G_root//interface[@name=$addifname]"/>
1654 <xsl:with-param name="pmode" select="'wrapped'"/>
1655 </xsl:call-template>
1656 </xsl:for-each>
1657
1658 <xsl:apply-templates select="$iface" mode="classfooter"/>
1659 <xsl:apply-templates select="$iface" mode="endfile">
1660 <xsl:with-param name="file" select="$filename"/>
1661 </xsl:apply-templates>
1662 </xsl:when>
1663 <xsl:otherwise>
1664 <xsl:apply-templates select="$iface" mode="listfile">
1665 <xsl:with-param name="file" select="$filename"/>
1666 </xsl:apply-templates>
1667 </xsl:otherwise>
1668 </xsl:choose>
1669</xsl:template>
1670
1671<!-- - - - - - - - - - - - - - - - - - - - - - -
1672 emit all attributes and methods definitions of an interface
1673 - - - - - - - - - - - - - - - - - - - - - - -->
1674<xsl:template name="emitInterfaceDefs">
1675 <xsl:param name="iface"/>
1676 <xsl:param name="addinterfaces"/>
1677
1678 <xsl:value-of select="concat('DEFINE_EMPTY_CTOR_DTOR(', substring($iface/@name, 2), 'Wrap)&#10;&#10;')"/>
1679
1680 <!-- attributes -->
1681 <xsl:call-template name="emitAttributes">
1682 <xsl:with-param name="iface" select="$iface"/>
1683 <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/>
1684 <xsl:with-param name="pmode" select="'code'"/>
1685 </xsl:call-template>
1686
1687 <xsl:for-each select="exsl:node-set($addinterfaces)/token">
1688 <!-- This is super tricky, as the for-each switches to the node set,
1689 which means the normal document isn't available any more. So need
1690 to use the global root node to get back into the documemt to find
1691 corresponding interface data. -->
1692 <xsl:variable name="addifname">
1693 <xsl:value-of select="string(.)"/>
1694 </xsl:variable>
1695 <xsl:call-template name="emitAttributes">
1696 <xsl:with-param name="iface" select="$G_root//interface[@name=$addifname]"/>
1697 <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/>
1698 <xsl:with-param name="pmode" select="'code'"/>
1699 </xsl:call-template>
1700 </xsl:for-each>
1701
1702 <!-- methods -->
1703 <xsl:call-template name="emitMethods">
1704 <xsl:with-param name="iface" select="$iface"/>
1705 <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/>
1706 <xsl:with-param name="pmode" select="'code'"/>
1707 </xsl:call-template>
1708
1709 <xsl:for-each select="exsl:node-set($addinterfaces)/token">
1710 <!-- This is super tricky, as the for-each switches to the node set,
1711 which means the normal document isn't available any more. So need
1712 to use the global root node to get back into the documemt to find
1713 corresponding interface data. -->
1714 <xsl:variable name="addifname">
1715 <xsl:value-of select="string(.)"/>
1716 </xsl:variable>
1717 <xsl:call-template name="emitMethods">
1718 <xsl:with-param name="iface" select="$G_root//interface[@name=$addifname]"/>
1719 <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/>
1720 <xsl:with-param name="pmode" select="'code'"/>
1721 </xsl:call-template>
1722 </xsl:for-each>
1723</xsl:template>
1724
1725<!-- - - - - - - - - - - - - - - - - - - - - - -
1726 emit auxiliary method declarations of an interface
1727 - - - - - - - - - - - - - - - - - - - - - - -->
1728<xsl:template name="emitAuxMethodDefs">
1729 <xsl:param name="iface"/>
1730 <!-- currently nothing, maybe later some generic FinalConstruct/... implementation -->
1731</xsl:template>
1732
1733
1734<!-- - - - - - - - - - - - - - - - - - - - - - -
1735 emit the code file of an interface
1736 - - - - - - - - - - - - - - - - - - - - - - -->
1737<xsl:template name="emitCode">
1738 <xsl:param name="iface"/>
1739 <xsl:param name="addinterfaces"/>
1740
1741 <xsl:variable name="filename" select="concat(substring(@name, 2), 'Wrap.cpp')"/>
1742
1743 <xsl:choose>
1744 <xsl:when test="$filelistonly=''">
1745 <xsl:apply-templates select="$iface" mode="startfile">
1746 <xsl:with-param name="file" select="$filename"/>
1747 </xsl:apply-templates>
1748 <xsl:call-template name="fileheader">
1749 <xsl:with-param name="name" select="$filename"/>
1750 <xsl:with-param name="class" select="substring(@name, 2)"/>
1751 <xsl:with-param name="type" select="'code'"/>
1752 </xsl:call-template>
1753 <xsl:apply-templates select="$iface" mode="codeheader">
1754 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
1755 </xsl:apply-templates>
1756
1757 <!-- interface attributes/methods (public) -->
1758 <xsl:call-template name="emitInterfaceDefs">
1759 <xsl:with-param name="iface" select="$iface"/>
1760 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
1761 </xsl:call-template>
1762
1763 <!-- auxiliary methods (public) -->
1764 <xsl:call-template name="emitAuxMethodDefs">
1765 <xsl:with-param name="iface" select="$iface"/>
1766 </xsl:call-template>
1767
1768 <xsl:apply-templates select="$iface" mode="codefooter">
1769 <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
1770 </xsl:apply-templates>
1771 <xsl:apply-templates select="$iface" mode="endfile">
1772 <xsl:with-param name="file" select="$filename"/>
1773 </xsl:apply-templates>
1774 </xsl:when>
1775 <xsl:otherwise>
1776 <xsl:apply-templates select="$iface" mode="listfile">
1777 <xsl:with-param name="file" select="$filename"/>
1778 </xsl:apply-templates>
1779 </xsl:otherwise>
1780 </xsl:choose>
1781</xsl:template>
1782
1783
1784<!-- - - - - - - - - - - - - - - - - - - - - - -
1785 wildcard match, ignore everything which has no explicit match
1786 - - - - - - - - - - - - - - - - - - - - - - -->
1787
1788<xsl:template match="*"/>
1789
1790<!-- - - - - - - - - - - - - - - - - - - - - - -
1791 ignore all if tags except those for XPIDL or MIDL target
1792 - - - - - - - - - - - - - - - - - - - - - - -->
1793
1794<xsl:template match="if">
1795 <xsl:if test="(@target = 'xpidl') or (@target = 'midl')">
1796 <xsl:apply-templates/>
1797 </xsl:if>
1798</xsl:template>
1799
1800<!-- - - - - - - - - - - - - - - - - - - - - - -
1801 interface match
1802 - - - - - - - - - - - - - - - - - - - - - - -->
1803
1804<xsl:template match="interface">
1805 <xsl:if test="not(@internal='yes') and not(@supportsErrorInfo='no')">
1806 <xsl:call-template name="emitInterface">
1807 <xsl:with-param name="iface" select="."/>
1808 </xsl:call-template>
1809 </xsl:if>
1810</xsl:template>
1811
1812<!-- - - - - - - - - - - - - - - - - - - - - - -
1813 library match
1814 - - - - - - - - - - - - - - - - - - - - - - -->
1815
1816<xsl:template match="library">
1817 <xsl:apply-templates/>
1818</xsl:template>
1819
1820<!-- - - - - - - - - - - - - - - - - - - - - - -
1821 root match
1822 - - - - - - - - - - - - - - - - - - - - - - -->
1823
1824<xsl:template match="/idl">
1825 <xsl:choose>
1826 <xsl:when test="$filelistonly=''">
1827 </xsl:when>
1828 <xsl:otherwise>
1829 <xsl:value-of select="concat($filelistonly, ' := \&#10;')"/>
1830 </xsl:otherwise>
1831 </xsl:choose>
1832 <xsl:apply-templates/>
1833 <xsl:choose>
1834 <xsl:when test="$filelistonly=''">
1835 </xsl:when>
1836 <xsl:otherwise>
1837 <xsl:text>
1838</xsl:text>
1839 </xsl:otherwise>
1840 </xsl:choose>
1841</xsl:template>
1842
1843</xsl:stylesheet>
1844<!-- vi: set tabstop=4 shiftwidth=4 expandtab: -->
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette