VirtualBox

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

Last change on this file since 46825 was 45518, checked in by vboxsync, 12 years ago

Main: Code generator for (xp)com API implementations, including logging and parameter conversion, so far only used by MediumFormat. Next try, needed significant tweaks to work with xpcom (safearray handling fixes in the parameter conversion helpers), different STL implementation (which doesn't support declaring template type parameters as const), missing build dependencies (which didn't show on the dual core system used for writing the code), and finally the duplicate XPCOM classinfo and AddRef/Release/QueryInterface method definitions needed to be removed.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 46.0 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-2013 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:include href="typemap-shared.inc.xsl"/>
36
37<!-- - - - - - - - - - - - - - - - - - - - - - -
38templates for file separation
39 - - - - - - - - - - - - - - - - - - - - - - -->
40
41<xsl:template match="interface" mode="listfile">
42 <xsl:param name="file"/>
43
44 <xsl:value-of select="concat('&#9;', $file, ' \&#10;')"/>
45</xsl:template>
46
47<xsl:template match="interface" mode="startfile">
48 <xsl:param name="file"/>
49
50 <xsl:value-of select="concat('&#10;// ##### BEGINFILE &quot;', $file, '&quot;&#10;')"/>
51</xsl:template>
52
53<xsl:template match="interface" mode="endfile">
54 <xsl:param name="file"/>
55
56 <xsl:value-of select="concat('&#10;// ##### ENDFILE &quot;', $file, '&quot;&#10;')"/>
57</xsl:template>
58
59<!-- - - - - - - - - - - - - - - - - - - - - - -
60templates for file headers/footers
61 - - - - - - - - - - - - - - - - - - - - - - -->
62
63<xsl:template name="fileheader">
64 <xsl:param name="class"/>
65 <xsl:param name="name"/>
66 <xsl:param name="type"/>
67
68 <xsl:text>/** @file
69 *
70</xsl:text>
71 <xsl:value-of select="concat(' * VirtualBox API class wrapper ', $type, ' for I', $class, '.')"/>
72 <xsl:text>
73 *
74 * DO NOT EDIT! This is a generated file.
75 * Generated from: src/VBox/Main/idl/VirtualBox.xidl
76 * Generator: src/VBox/Main/idl/apiwrap-server.xsl
77 */
78
79/**
80 * Copyright (C) 2011-2013 Oracle Corporation
81 *
82 * This file is part of VirtualBox Open Source Edition (OSE), as
83 * available from http://www.virtualbox.org. This file is free software;
84 * you can redistribute it and/or modify it under the terms of the GNU
85 * General Public License (GPL) as published by the Free Software
86 * Foundation, in version 2 as it comes in the "COPYING" file of the
87 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
88 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
89 */
90
91</xsl:text>
92</xsl:template>
93
94<xsl:template name="emitCOMInterfaces">
95 <xsl:param name="iface"/>
96
97 <xsl:value-of select="concat(' COM_INTERFACE_ENTRY(', $iface/@name, ')&#10;')"/>
98 <!-- now recurse to emit all base interfaces -->
99 <xsl:variable name="extends" select="$iface/@extends"/>
100 <xsl:if test="$extends and not($extends='$unknown') and not($extends='$dispatched') and not($extends='$errorinfo')">
101 <xsl:call-template name="emitCOMInterfaces">
102 <xsl:with-param name="iface" select="//interface[@name=$extends]"/>
103 </xsl:call-template>
104 </xsl:if>
105</xsl:template>
106
107<xsl:template match="interface" mode="classheader">
108 <xsl:value-of select="concat('#ifndef ', substring(@name, 2), 'Wrap_H_&#10;')"/>
109 <xsl:value-of select="concat('#define ', substring(@name, 2), 'Wrap_H_')"/>
110 <xsl:text>
111
112#include "VirtualBoxBase.h"
113#include "Wrapper.h"
114
115</xsl:text>
116 <xsl:value-of select="concat('class ATL_NO_VTABLE ', substring(@name, 2), 'Wrap:')"/>
117 <xsl:text>
118 public VirtualBoxBase,
119</xsl:text>
120 <xsl:value-of select="concat(' VBOX_SCRIPTABLE_IMPL(', @name, ')&#10;')"/>
121 <xsl:text>{
122 Q_OBJECT
123
124public:
125</xsl:text>
126 <xsl:value-of select="concat(' VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(', substring(@name, 2), 'Wrap, ', @name, ')&#10;')"/>
127 <xsl:value-of select="concat(' DECLARE_NOT_AGGREGATABLE(', substring(@name, 2), 'Wrap)&#10;')"/>
128 <xsl:text> DECLARE_PROTECT_FINAL_CONSTRUCT()
129
130</xsl:text>
131 <xsl:value-of select="concat(' BEGIN_COM_MAP(', substring(@name, 2), 'Wrap)&#10;')"/>
132 <xsl:text> COM_INTERFACE_ENTRY(ISupportErrorInfo)
133</xsl:text>
134 <xsl:call-template name="emitCOMInterfaces">
135 <xsl:with-param name="iface" select="."/>
136 </xsl:call-template>
137 <xsl:value-of select="concat(' COM_INTERFACE_ENTRY2(IDispatch, ', @name, ')&#10;')"/>
138 <xsl:text> END_COM_MAP()
139
140</xsl:text>
141 <xsl:value-of select="concat(' DECLARE_EMPTY_CTOR_DTOR(', substring(@name, 2), 'Wrap)&#10;')"/>
142</xsl:template>
143
144<xsl:template match="interface" mode="classfooter">
145 <xsl:text>};
146
147</xsl:text>
148 <xsl:value-of select="concat('#endif // !', substring(@name, 2), 'Wrap_H_&#10;')"/>
149</xsl:template>
150
151<xsl:template match="interface" mode="codeheader">
152 <xsl:value-of select="concat('#define LOG_GROUP_MAIN_OVERRIDE LOG_GROUP_MAIN_', translate(substring(@name, 2), $G_lowerCase, $G_upperCase), '&#10;&#10;')"/>
153 <xsl:value-of select="concat('#include &quot;', substring(@name, 2), 'Wrap.h&quot;&#10;')"/>
154 <xsl:text>#include "AutoCaller.h"
155#include "Logging.h"
156
157</xsl:text>
158</xsl:template>
159
160<xsl:template match="interface" mode="codefooter">
161 <xsl:text>#ifdef VBOX_WITH_XPCOM
162</xsl:text>
163 <xsl:value-of select="concat('NS_DECL_CLASSINFO(', substring(@name, 2), 'Wrap)&#10;NS_IMPL_THREADSAFE_ISUPPORTS1_CI(', substring(@name, 2), 'Wrap, ', @name, ')&#10;')"/>
164 <xsl:text>#endif // VBOX_WITH_XPCOM
165</xsl:text>
166</xsl:template>
167
168
169<!-- - - - - - - - - - - - - - - - - - - - - - -
170 templates for dealing with names and parameters
171 - - - - - - - - - - - - - - - - - - - - - - -->
172
173<xsl:template name="tospace">
174 <xsl:param name="str"/>
175 <xsl:value-of select="translate($str, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_', ' ')"/>
176</xsl:template>
177
178<xsl:template name="translatepublictype">
179 <xsl:param name="type"/>
180 <xsl:param name="dir"/>
181
182 <!-- get C++ glue type from IDL type from table in typemap-shared.inc.xsl -->
183 <xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
184 <xsl:choose>
185 <xsl:when test="$type='wstring' or $type='uuid'">
186 <xsl:choose>
187 <xsl:when test="$dir='in'">
188 <xsl:text>IN_BSTR</xsl:text>
189 </xsl:when>
190 <xsl:otherwise>
191 <xsl:text>BSTR</xsl:text>
192 </xsl:otherwise>
193 </xsl:choose>
194 </xsl:when>
195 <xsl:when test="string-length($gluetypefield)">
196 <xsl:value-of select="$gluetypefield"/>
197 </xsl:when>
198 <xsl:when test="//enum[@name=$type]">
199 <xsl:value-of select="concat($type, '_T')"/>
200 </xsl:when>
201 <xsl:when test="$type='$unknown'">
202 <xsl:text>IUnknown *</xsl:text>
203 </xsl:when>
204 <xsl:when test="//interface[@name=$type]">
205 <xsl:variable name="thatif" select="//interface[@name=$type]"/>
206 <xsl:variable name="thatifname" select="$thatif/@name"/>
207 <xsl:value-of select="concat($thatifname, ' *')"/>
208 </xsl:when>
209 <xsl:otherwise>
210 <xsl:call-template name="fatalError">
211 <xsl:with-param name="msg" select="concat('translatepublictype: Type &quot;', $type, '&quot; is not supported.')"/>
212 </xsl:call-template>
213 </xsl:otherwise>
214 </xsl:choose>
215</xsl:template>
216
217<xsl:template name="translatewrappedtype">
218 <xsl:param name="type"/>
219 <xsl:param name="dir"/>
220 <xsl:param name="safearray"/>
221
222 <!-- get C++ wrap type from IDL type from table in typemap-shared.inc.xsl -->
223 <xsl:variable name="wraptypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
224 <xsl:choose>
225 <xsl:when test="$type='wstring'">
226 <xsl:if test="$dir='in' and not($safearray='yes')">
227 <xsl:text>const </xsl:text>
228 </xsl:if>
229 <xsl:text>com::Utf8Str &amp;</xsl:text>
230 </xsl:when>
231 <xsl:when test="$type='uuid'">
232 <xsl:if test="$dir='in'">
233 <xsl:text>const </xsl:text>
234 </xsl:if>
235 <xsl:text>com::Guid &amp;</xsl:text>
236 </xsl:when>
237 <xsl:when test="string-length($wraptypefield)">
238 <xsl:value-of select="$wraptypefield"/>
239 </xsl:when>
240 <xsl:when test="//enum[@name=$type]">
241 <xsl:value-of select="concat($type, '_T')"/>
242 </xsl:when>
243 <xsl:when test="$type='$unknown'">
244 <xsl:if test="$dir='in' and not($safearray='yes')">
245 <xsl:text>const </xsl:text>
246 </xsl:if>
247 <xsl:text>ComPtr&lt;IUnknown&gt; &amp;</xsl:text>
248 </xsl:when>
249 <xsl:when test="//interface[@name=$type]">
250 <xsl:variable name="thatif" select="//interface[@name=$type]"/>
251 <xsl:variable name="thatifname" select="$thatif/@name"/>
252 <xsl:if test="$dir='in' and not($safearray='yes')">
253 <xsl:text>const </xsl:text>
254 </xsl:if>
255 <xsl:value-of select="concat('ComPtr&lt;', $thatifname, '&gt; &amp;')"/>
256 </xsl:when>
257 <xsl:otherwise>
258 <xsl:call-template name="fatalError">
259 <xsl:with-param name="msg" select="concat('translatewrappedtype: Type &quot;', $type, '&quot; is not supported.')"/>
260 </xsl:call-template>
261 </xsl:otherwise>
262 </xsl:choose>
263</xsl:template>
264
265<xsl:template name="translatefmtspectype">
266 <xsl:param name="type"/>
267 <xsl:param name="dir"/>
268 <xsl:param name="safearray"/>
269 <xsl:param name="mod"/>
270
271 <!-- get C format string for IDL type from table in typemap-shared.inc.xsl -->
272 <xsl:variable name="wrapfmt" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluefmt"/>
273 <xsl:choose>
274 <xsl:when test="$mod='ref' and $dir!='in'">
275 <xsl:text>%p</xsl:text>
276 </xsl:when>
277 <xsl:when test="$safearray='yes'">
278 <xsl:text>%zu</xsl:text>
279 </xsl:when>
280 <xsl:when test="string-length($wrapfmt)">
281 <xsl:value-of select="$wrapfmt"/>
282 </xsl:when>
283 <xsl:when test="//enum[@name=$type]">
284 <xsl:text>%RU32</xsl:text>
285 </xsl:when>
286 <xsl:when test="$type='$unknown'">
287 <xsl:text>%p</xsl:text>
288 </xsl:when>
289 <xsl:when test="//interface[@name=$type]">
290 <xsl:text>%p</xsl:text>
291 </xsl:when>
292 <xsl:otherwise>
293 <xsl:call-template name="fatalError">
294 <xsl:with-param name="msg" select="concat('translatefmtcpectype: Type &quot;', $type, '&quot; is not supported.')"/>
295 </xsl:call-template>
296 </xsl:otherwise>
297 </xsl:choose>
298</xsl:template>
299
300<xsl:template match="attribute/@type | param/@type" mode="public">
301 <xsl:param name="dir"/>
302
303 <xsl:variable name="gluetype">
304 <xsl:call-template name="translatepublictype">
305 <xsl:with-param name="type" select="."/>
306 <xsl:with-param name="dir" select="$dir"/>
307 </xsl:call-template>
308 </xsl:variable>
309
310 <xsl:if test="../@safearray='yes'">
311 <xsl:choose>
312 <xsl:when test="$dir='in'">
313 <xsl:text>ComSafeArrayIn(</xsl:text>
314 </xsl:when>
315 <xsl:otherwise>
316 <xsl:text>ComSafeArrayOut(</xsl:text>
317 </xsl:otherwise>
318 </xsl:choose>
319 </xsl:if>
320 <xsl:value-of select="$gluetype"/>
321 <xsl:choose>
322 <xsl:when test="../@safearray='yes'">
323 <xsl:text>, </xsl:text>
324 </xsl:when>
325 <xsl:otherwise>
326 <xsl:if test="substring($gluetype,string-length($gluetype))!='*'">
327 <xsl:text> </xsl:text>
328 </xsl:if>
329 <xsl:choose>
330 <xsl:when test="$dir='in'">
331 </xsl:when>
332 <xsl:otherwise>
333 <xsl:value-of select="'*'"/>
334 </xsl:otherwise>
335 </xsl:choose>
336 </xsl:otherwise>
337 </xsl:choose>
338 <xsl:text>a</xsl:text>
339 <xsl:call-template name="capitalize">
340 <xsl:with-param name="str" select="../@name"/>
341 </xsl:call-template>
342 <xsl:if test="../@safearray='yes'">
343 <xsl:value-of select="')'"/>
344 </xsl:if>
345</xsl:template>
346
347<xsl:template match="attribute/@type | param/@type" mode="wrapped">
348 <xsl:param name="dir"/>
349
350 <xsl:variable name="wraptype">
351 <xsl:call-template name="translatewrappedtype">
352 <xsl:with-param name="type" select="."/>
353 <xsl:with-param name="dir" select="$dir"/>
354 <xsl:with-param name="safearray" select="../@safearray"/>
355 </xsl:call-template>
356 </xsl:variable>
357
358 <xsl:choose>
359 <xsl:when test="../@safearray='yes'">
360 <xsl:if test="$dir='in'">
361 <xsl:text>const </xsl:text>
362 </xsl:if>
363 <xsl:text>std::vector&lt;</xsl:text>
364 <xsl:choose>
365 <xsl:when test="substring($wraptype,string-length($wraptype))='&amp;'">
366 <xsl:variable name="wraptype2">
367 <xsl:value-of select="substring($wraptype,1,string-length($wraptype)-2)"/>
368 </xsl:variable>
369
370 <xsl:choose>
371 <xsl:when test="substring($wraptype2,string-length($wraptype2))='&gt;'">
372 <xsl:value-of select="concat($wraptype2, ' ')"/>
373 </xsl:when>
374 <xsl:otherwise>
375 <xsl:value-of select="$wraptype2"/>
376 </xsl:otherwise>
377 </xsl:choose>
378 </xsl:when>
379 <xsl:when test="substring($wraptype,string-length($wraptype))='&gt;'">
380 <xsl:value-of select="concat($wraptype, ' ')"/>
381 </xsl:when>
382 <xsl:otherwise>
383 <xsl:value-of select="$wraptype"/>
384 </xsl:otherwise>
385 </xsl:choose>
386 <xsl:text>&gt; &amp;</xsl:text>
387 </xsl:when>
388 <xsl:otherwise>
389 <xsl:value-of select="$wraptype"/>
390 <xsl:if test="substring($wraptype,string-length($wraptype))!='&amp;'">
391 <xsl:if test="substring($wraptype,string-length($wraptype))!='*'">
392 <xsl:text> </xsl:text>
393 </xsl:if>
394 <xsl:choose>
395 <xsl:when test="$dir='in'">
396 </xsl:when>
397 <xsl:otherwise>
398 <xsl:value-of select="'*'"/>
399 </xsl:otherwise>
400 </xsl:choose>
401 </xsl:if>
402 </xsl:otherwise>
403 </xsl:choose>
404 <xsl:text>a</xsl:text>
405 <xsl:call-template name="capitalize">
406 <xsl:with-param name="str" select="../@name"/>
407 </xsl:call-template>
408</xsl:template>
409
410<xsl:template match="attribute/@type | param/@type" mode="logparamtext">
411 <xsl:param name="dir"/>
412 <xsl:param name="mod"/>
413
414 <xsl:if test="$mod!='ref' and ($dir='out' or $dir='ret')">
415 <xsl:text>*</xsl:text>
416 </xsl:if>
417 <xsl:text>a</xsl:text>
418 <xsl:call-template name="capitalize">
419 <xsl:with-param name="str" select="../@name"/>
420 </xsl:call-template>
421 <xsl:text>=</xsl:text>
422 <xsl:call-template name="translatefmtspectype">
423 <xsl:with-param name="type" select="."/>
424 <xsl:with-param name="dir" select="$dir"/>
425 <xsl:with-param name="safearray" select="../@safearray"/>
426 <xsl:with-param name="mod" select="$mod"/>
427 </xsl:call-template>
428</xsl:template>
429
430<xsl:template match="attribute/@type | param/@type" mode="logparamval">
431 <xsl:param name="dir"/>
432 <xsl:param name="mod"/>
433
434 <xsl:choose>
435 <xsl:when test="../@safearray='yes' and $mod!='ref'">
436 <xsl:text>ComSafeArraySize(</xsl:text>
437 <xsl:if test="$mod!='ref' and $dir!='in'">
438 <xsl:text>*</xsl:text>
439 </xsl:if>
440 </xsl:when>
441 <xsl:when test="$mod!='ref' and $dir!='in'">
442 <xsl:text>*</xsl:text>
443 </xsl:when>
444 </xsl:choose>
445 <xsl:text>a</xsl:text>
446 <xsl:call-template name="capitalize">
447 <xsl:with-param name="str" select="../@name"/>
448 </xsl:call-template>
449 <xsl:choose>
450 <xsl:when test="../@safearray='yes' and $mod!='ref'">
451 <xsl:text>)</xsl:text>
452 </xsl:when>
453 </xsl:choose>
454</xsl:template>
455
456<xsl:template match="attribute/@type | param/@type" mode="paramvalconversion">
457 <xsl:param name="dir"/>
458
459 <xsl:variable name="gluetype">
460 <xsl:call-template name="translatepublictype">
461 <xsl:with-param name="type" select="."/>
462 <xsl:with-param name="dir" select="$dir"/>
463 </xsl:call-template>
464 </xsl:variable>
465 <xsl:variable name="type" select="."/>
466 <xsl:variable name="thatif" select="../../../..//interface[@name=$type]"/>
467 <xsl:choose>
468 <xsl:when test="$type='$unknown'">
469 <xsl:if test="../@safearray='yes'">
470 <xsl:text>Array</xsl:text>
471 </xsl:if>
472 <xsl:choose>
473 <xsl:when test="$dir='in'">
474 <xsl:text>ComTypeInConverter&lt;IUnknown&gt;(</xsl:text>
475 </xsl:when>
476 <xsl:otherwise>
477 <xsl:text>ComTypeOutConverter&lt;IUnknown&gt;(</xsl:text>
478 </xsl:otherwise>
479 </xsl:choose>
480 <xsl:if test="../@safearray='yes'">
481 <xsl:choose>
482 <xsl:when test="$dir='in'">
483 <xsl:text>ComSafeArrayInArg(</xsl:text>
484 </xsl:when>
485 <xsl:otherwise>
486 <xsl:text>ComSafeArrayOutArg(</xsl:text>
487 </xsl:otherwise>
488 </xsl:choose>
489 </xsl:if>
490 </xsl:when>
491 <xsl:when test="$thatif">
492 <xsl:if test="../@safearray='yes'">
493 <xsl:text>Array</xsl:text>
494 </xsl:if>
495 <xsl:variable name="thatifname" select="$thatif/@name"/>
496 <xsl:choose>
497 <xsl:when test="$dir='in'">
498 <xsl:text>ComTypeInConverter</xsl:text>
499 </xsl:when>
500 <xsl:otherwise>
501 <xsl:text>ComTypeOutConverter</xsl:text>
502 </xsl:otherwise>
503 </xsl:choose>
504 <xsl:value-of select="concat('&lt;', $thatifname, '&gt;(')"/>
505 <xsl:if test="../@safearray='yes'">
506 <xsl:choose>
507 <xsl:when test="$dir='in'">
508 <xsl:text>ComSafeArrayInArg(</xsl:text>
509 </xsl:when>
510 <xsl:otherwise>
511 <xsl:text>ComSafeArrayOutArg(</xsl:text>
512 </xsl:otherwise>
513 </xsl:choose>
514 </xsl:if>
515 </xsl:when>
516 <xsl:when test="$type='wstring'">
517 <xsl:if test="../@safearray='yes'">
518 <xsl:text>Array</xsl:text>
519 </xsl:if>
520 <xsl:choose>
521 <xsl:when test="$dir='in'">
522 <xsl:text>BSTRInConverter(</xsl:text>
523 </xsl:when>
524 <xsl:otherwise>
525 <xsl:text>BSTROutConverter(</xsl:text>
526 </xsl:otherwise>
527 </xsl:choose>
528 <xsl:if test="../@safearray='yes'">
529 <xsl:choose>
530 <xsl:when test="$dir='in'">
531 <xsl:text>ComSafeArrayInArg(</xsl:text>
532 </xsl:when>
533 <xsl:otherwise>
534 <xsl:text>ComSafeArrayOutArg(</xsl:text>
535 </xsl:otherwise>
536 </xsl:choose>
537 </xsl:if>
538 </xsl:when>
539 <xsl:when test="$type='uuid'">
540 <xsl:if test="../@safearray='yes'">
541 <xsl:text>Array</xsl:text>
542 </xsl:if>
543 <xsl:choose>
544 <xsl:when test="$dir='in'">
545 <xsl:text>UuidInConverter(</xsl:text>
546 </xsl:when>
547 <xsl:otherwise>
548 <xsl:text>UuidOutConverter(</xsl:text>
549 </xsl:otherwise>
550 </xsl:choose>
551 <xsl:if test="../@safearray='yes'">
552 <xsl:choose>
553 <xsl:when test="$dir='in'">
554 <xsl:text>ComSafeArrayInArg(</xsl:text>
555 </xsl:when>
556 <xsl:otherwise>
557 <xsl:text>ComSafeArrayOutArg(</xsl:text>
558 </xsl:otherwise>
559 </xsl:choose>
560 </xsl:if>
561 </xsl:when>
562 <xsl:otherwise>
563 <xsl:if test="../@safearray='yes'">
564 <xsl:text>Array</xsl:text>
565 <xsl:choose>
566 <xsl:when test="$dir='in'">
567 <xsl:text>InConverter</xsl:text>
568 </xsl:when>
569 <xsl:otherwise>
570 <xsl:text>OutConverter</xsl:text>
571 </xsl:otherwise>
572 </xsl:choose>
573 <xsl:value-of select="concat('&lt;', $gluetype, '&gt;(')"/>
574 <xsl:choose>
575 <xsl:when test="$dir='in'">
576 <xsl:text>ComSafeArrayInArg(</xsl:text>
577 </xsl:when>
578 <xsl:otherwise>
579 <xsl:text>ComSafeArrayOutArg(</xsl:text>
580 </xsl:otherwise>
581 </xsl:choose>
582 </xsl:if>
583 </xsl:otherwise>
584 </xsl:choose>
585 <xsl:text>a</xsl:text>
586 <xsl:call-template name="capitalize">
587 <xsl:with-param name="str" select="../@name"/>
588 </xsl:call-template>
589 <xsl:choose>
590 <xsl:when test="$type='$unknown' or $thatif">
591 <xsl:choose>
592 <xsl:when test="../@safearray='yes'">
593 <xsl:text>)).array()</xsl:text>
594 </xsl:when>
595 <xsl:otherwise>
596 <xsl:text>).ptr()</xsl:text>
597 </xsl:otherwise>
598 </xsl:choose>
599 </xsl:when>
600 <xsl:when test="$type='wstring'">
601 <xsl:choose>
602 <xsl:when test="../@safearray='yes'">
603 <xsl:text>)).array()</xsl:text>
604 </xsl:when>
605 <xsl:otherwise>
606 <xsl:text>).str()</xsl:text>
607 </xsl:otherwise>
608 </xsl:choose>
609 </xsl:when>
610 <xsl:when test="$type='uuid'">
611 <xsl:choose>
612 <xsl:when test="../@safearray='yes'">
613 <xsl:text>)).array()</xsl:text>
614 </xsl:when>
615 <xsl:otherwise>
616 <xsl:text>).uuid()</xsl:text>
617 </xsl:otherwise>
618 </xsl:choose>
619 </xsl:when>
620 <xsl:otherwise>
621 <xsl:if test="../@safearray='yes'">
622 <xsl:text>)).array()</xsl:text>
623 </xsl:if>
624 </xsl:otherwise>
625 </xsl:choose>
626</xsl:template>
627
628<!-- - - - - - - - - - - - - - - - - - - - - - -
629 emit attribute
630 - - - - - - - - - - - - - - - - - - - - - - -->
631
632<xsl:template match="attribute" mode="public">
633 <xsl:variable name="attrbasename">
634 <xsl:call-template name="capitalize">
635 <xsl:with-param name="str" select="@name"/>
636 </xsl:call-template>
637 </xsl:variable>
638
639 <xsl:value-of select="concat(' STDMETHOD(COMGETTER(', $attrbasename, '))(')"/>
640 <xsl:apply-templates select="@type" mode="public">
641 <xsl:with-param name="dir" select="'out'"/>
642 </xsl:apply-templates>
643 <xsl:text>);
644</xsl:text>
645
646 <xsl:if test="not(@readonly) or @readonly!='yes'">
647 <xsl:value-of select="concat(' STDMETHOD(COMSETTER(', $attrbasename, '))(')"/>
648 <xsl:apply-templates select="@type" mode="public">
649 <xsl:with-param name="dir" select="'in'"/>
650 </xsl:apply-templates>
651 <xsl:text>);
652</xsl:text>
653 </xsl:if>
654</xsl:template>
655
656<xsl:template match="attribute" mode="wrapped">
657 <xsl:variable name="attrbasename">
658 <xsl:call-template name="capitalize">
659 <xsl:with-param name="str" select="@name"/>
660 </xsl:call-template>
661 </xsl:variable>
662
663 <xsl:value-of select="concat(' virtual HRESULT get', $attrbasename, '(')"/>
664 <xsl:apply-templates select="@type" mode="wrapped">
665 <xsl:with-param name="dir" select="'out'"/>
666 </xsl:apply-templates>
667 <xsl:text>) = 0;
668</xsl:text>
669
670 <xsl:if test="not(@readonly) or @readonly!='yes'">
671 <xsl:value-of select="concat(' virtual HRESULT set', $attrbasename, '(')"/>
672 <xsl:apply-templates select="@type" mode="wrapped">
673 <xsl:with-param name="dir" select="'in'"/>
674 </xsl:apply-templates>
675 <xsl:text>) = 0;
676</xsl:text>
677 </xsl:if>
678</xsl:template>
679
680<xsl:template match="attribute" mode="code">
681 <xsl:param name="topclass"/>
682
683 <xsl:variable name="attrbasename">
684 <xsl:call-template name="capitalize">
685 <xsl:with-param name="str" select="@name"/>
686 </xsl:call-template>
687 </xsl:variable>
688
689 <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMGETTER(', $attrbasename, ')(')"/>
690 <xsl:apply-templates select="@type" mode="public">
691 <xsl:with-param name="dir" select="'out'"/>
692 </xsl:apply-templates>
693 <xsl:text>)
694{
695 LogRelFlow(("{%p} %s: enter </xsl:text>
696 <xsl:apply-templates select="@type" mode="logparamtext">
697 <xsl:with-param name="dir" select="'out'"/>
698 <xsl:with-param name="mod" select="'ref'"/>
699 </xsl:apply-templates>
700 <xsl:text>\n", this, </xsl:text>
701 <xsl:value-of select="concat('&quot;', $topclass, '::get', $attrbasename, '&quot;, ')"/>
702 <xsl:apply-templates select="@type" mode="logparamval">
703 <xsl:with-param name="dir" select="'out'"/>
704 <xsl:with-param name="mod" select="'ref'"/>
705 </xsl:apply-templates>
706 <xsl:text>));
707
708 VirtualBoxBase::clearError();
709
710 HRESULT hrc;
711
712 try
713 {
714 CheckComArgOutPointerValidThrow(a</xsl:text>
715 <xsl:value-of select="$attrbasename"/>
716 <xsl:text>);
717
718 AutoCaller autoCaller(this);
719 if (FAILED(autoCaller.rc()))
720 throw autoCaller.rc();
721
722</xsl:text>
723 <xsl:value-of select="concat(' hrc = get', $attrbasename, '(')"/>
724 <xsl:apply-templates select="@type" mode="paramvalconversion">
725 <xsl:with-param name="dir" select="'out'"/>
726 </xsl:apply-templates>
727 <xsl:text>);
728 }
729 catch (HRESULT hrc2)
730 {
731 hrc = hrc2;
732 }
733 catch (...)
734 {
735 hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
736 }
737
738 LogRelFlow(("{%p} %s: leave </xsl:text>
739 <xsl:apply-templates select="@type" mode="logparamtext">
740 <xsl:with-param name="dir" select="'out'"/>
741 </xsl:apply-templates>
742 <xsl:text> hrc=%Rhrc\n", this, </xsl:text>
743 <xsl:value-of select="concat('&quot;', $topclass, '::get', $attrbasename, '&quot;, ')"/>
744 <xsl:apply-templates select="@type" mode="logparamval">
745 <xsl:with-param name="dir" select="'out'"/>
746 </xsl:apply-templates>
747 <xsl:text>, hrc));
748 return hrc;
749}
750
751</xsl:text>
752 <xsl:if test="not(@readonly) or @readonly!='yes'">
753 <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMSETTER(', $attrbasename, ')(')"/>
754 <xsl:apply-templates select="@type" mode="public">
755 <xsl:with-param name="dir" select="'in'"/>
756 </xsl:apply-templates>
757 <!-- @todo check in parameters if possible -->
758 <xsl:text>)
759{
760 LogRelFlow(("{%p} %s: enter </xsl:text>
761 <xsl:apply-templates select="@type" mode="logparamtext">
762 <xsl:with-param name="dir" select="'in'"/>
763 </xsl:apply-templates>
764 <xsl:text>\n", this, </xsl:text>
765 <xsl:value-of select="concat('&quot;', $topclass, '::set', $attrbasename, '&quot;, ')"/>
766 <xsl:apply-templates select="@type" mode="logparamval">
767 <xsl:with-param name="dir" select="'in'"/>
768 </xsl:apply-templates>
769 <xsl:text>));
770
771 VirtualBoxBase::clearError();
772
773 HRESULT hrc;
774
775 try
776 {
777 AutoCaller autoCaller(this);
778 if (FAILED(autoCaller.rc()))
779 throw autoCaller.rc();
780
781</xsl:text>
782 <xsl:value-of select="concat(' hrc = set', $attrbasename, '(')"/>
783 <xsl:apply-templates select="@type" mode="paramvalconversion">
784 <xsl:with-param name="dir" select="'in'"/>
785 </xsl:apply-templates>
786 <xsl:text>);
787 }
788 catch (HRESULT hrc2)
789 {
790 hrc = hrc2;
791 }
792 catch (...)
793 {
794 hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
795 }
796
797 LogRelFlow(("{%p} %s: leave hrc=%Rhrc\n", this, </xsl:text>
798 <xsl:value-of select="concat('&quot;', $topclass, '::set', $attrbasename, '&quot;, ')"/>
799 <xsl:text>hrc));
800 return hrc;
801}
802
803</xsl:text>
804 </xsl:if>
805</xsl:template>
806
807<!-- - - - - - - - - - - - - - - - - - - - - - -
808 emit all attributes of an interface
809 - - - - - - - - - - - - - - - - - - - - - - -->
810<xsl:template name="emitAttributes">
811 <xsl:param name="iface"/>
812 <xsl:param name="topclass"/>
813 <xsl:param name="pmode"/>
814
815 <!-- first recurse to emit all base interfaces -->
816 <xsl:variable name="extends" select="$iface/@extends"/>
817 <xsl:if test="$extends and not($extends='$unknown') and not($extends='$dispatched') and not($extends='$errorinfo')">
818 <xsl:call-template name="emitAttributes">
819 <xsl:with-param name="iface" select="//interface[@name=$extends]"/>
820 <xsl:with-param name="topclass" select="$topclass"/>
821 <xsl:with-param name="pmode" select="$pmode"/>
822 </xsl:call-template>
823 </xsl:if>
824
825 <xsl:choose>
826 <xsl:when test="$pmode='code'">
827 <xsl:text>//
828</xsl:text>
829 <xsl:value-of select="concat('// ', $iface/@name, ' properties')"/>
830 <xsl:text>
831//
832
833</xsl:text>
834 </xsl:when>
835 <xsl:otherwise>
836 <xsl:value-of select="concat('&#10; // ', $pmode, ' ', $iface/@name, ' properties&#10;')"/>
837 </xsl:otherwise>
838 </xsl:choose>
839 <xsl:choose>
840 <xsl:when test="$pmode='public'">
841 <xsl:apply-templates select="$iface/attribute" mode="public"/>
842 </xsl:when>
843 <xsl:when test="$pmode='wrapped'">
844 <xsl:apply-templates select="$iface/attribute" mode="wrapped"/>
845 </xsl:when>
846 <xsl:when test="$pmode='code'">
847 <xsl:apply-templates select="$iface/attribute" mode="code">
848 <xsl:with-param name="topclass" select="$topclass"/>
849 </xsl:apply-templates>
850 </xsl:when>
851 <xsl:otherwise/>
852 </xsl:choose>
853</xsl:template>
854
855<!-- - - - - - - - - - - - - - - - - - - - - - -
856 emit method
857 - - - - - - - - - - - - - - - - - - - - - - -->
858
859<xsl:template match="method" mode="public">
860 <xsl:variable name="methodindent">
861 <xsl:call-template name="tospace">
862 <xsl:with-param name="str" select="@name"/>
863 </xsl:call-template>
864 </xsl:variable>
865
866 <xsl:text> STDMETHOD(</xsl:text>
867 <xsl:call-template name="capitalize">
868 <xsl:with-param name="str" select="@name"/>
869 </xsl:call-template>
870 <xsl:text>)(</xsl:text>
871 <xsl:for-each select="param">
872 <xsl:apply-templates select="@type" mode="public">
873 <xsl:with-param name="dir" select="@dir"/>
874 </xsl:apply-templates>
875 <xsl:if test="not(position()=last())">
876 <xsl:text>,
877 </xsl:text>
878 <xsl:value-of select="$methodindent"/>
879 </xsl:if>
880 </xsl:for-each>
881 <xsl:text>);
882</xsl:text>
883</xsl:template>
884
885<xsl:template match="method" mode="wrapped">
886 <xsl:variable name="methodindent">
887 <xsl:call-template name="tospace">
888 <xsl:with-param name="str" select="@name"/>
889 </xsl:call-template>
890 </xsl:variable>
891
892 <xsl:text> virtual HRESULT </xsl:text>
893 <xsl:call-template name="uncapitalize">
894 <xsl:with-param name="str" select="@name"/>
895 </xsl:call-template>
896 <xsl:text>(</xsl:text>
897 <xsl:for-each select="param">
898 <xsl:apply-templates select="@type" mode="wrapped">
899 <xsl:with-param name="dir" select="@dir"/>
900 </xsl:apply-templates>
901 <xsl:if test="not(position()=last())">
902 <xsl:text>,
903 </xsl:text>
904 <xsl:value-of select="$methodindent"/>
905 </xsl:if>
906 </xsl:for-each>
907 <xsl:text>) = 0;
908</xsl:text>
909</xsl:template>
910
911<xsl:template match="method" mode="code">
912 <xsl:param name="topclass"/>
913
914 <xsl:variable name="methodindent">
915 <xsl:call-template name="tospace">
916 <xsl:with-param name="str" select="@name"/>
917 </xsl:call-template>
918 </xsl:variable>
919 <xsl:variable name="methodclassindent">
920 <xsl:call-template name="tospace">
921 <xsl:with-param name="str" select="concat($topclass, @name)"/>
922 </xsl:call-template>
923 </xsl:variable>
924 <xsl:variable name="methodbasename">
925 <xsl:call-template name="capitalize">
926 <xsl:with-param name="str" select="@name"/>
927 </xsl:call-template>
928 </xsl:variable>
929
930 <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::', $methodbasename, '(')"/>
931 <xsl:for-each select="param">
932 <xsl:apply-templates select="@type" mode="public">
933 <xsl:with-param name="dir" select="@dir"/>
934 </xsl:apply-templates>
935 <xsl:if test="not(position()=last())">
936 <xsl:text>,
937 </xsl:text>
938 <xsl:value-of select="$methodclassindent"/>
939 </xsl:if>
940 </xsl:for-each>
941 <xsl:text>)
942{
943 LogRelFlow(("{%p} %s:enter</xsl:text>
944 <xsl:for-each select="param">
945 <xsl:text> </xsl:text>
946 <xsl:apply-templates select="@type" mode="logparamtext">
947 <xsl:with-param name="dir" select="@dir"/>
948 <xsl:with-param name="mod" select="'ref'"/>
949 </xsl:apply-templates>
950 </xsl:for-each>
951 <xsl:text>\n", this</xsl:text>
952 <xsl:value-of select="concat(', &quot;', $topclass, '::', @name, '&quot;')"/>
953 <xsl:for-each select="param">
954 <xsl:text>, </xsl:text>
955 <xsl:apply-templates select="@type" mode="logparamval">
956 <xsl:with-param name="dir" select="@dir"/>
957 <xsl:with-param name="mod" select="'ref'"/>
958 </xsl:apply-templates>
959 </xsl:for-each>
960 <xsl:text>));
961
962 VirtualBoxBase::clearError();
963
964 HRESULT hrc;
965
966 try
967 {
968</xsl:text>
969 <!-- @todo check in parameters if possible -->
970 <xsl:for-each select="param">
971 <xsl:if test="@dir!='in'">
972 <xsl:text> CheckComArgOutPointerValidThrow(a</xsl:text>
973 <xsl:call-template name="capitalize">
974 <xsl:with-param name="str" select="@name"/>
975 </xsl:call-template>
976 <xsl:text>);
977</xsl:text>
978 </xsl:if>
979 </xsl:for-each>
980 <xsl:text>
981 AutoCaller autoCaller(this);
982 if (FAILED(autoCaller.rc()))
983 throw autoCaller.rc();
984
985</xsl:text>
986 <xsl:value-of select="concat(' hrc = ', @name, '(')"/>
987 <xsl:for-each select="param">
988 <xsl:apply-templates select="@type" mode="paramvalconversion">
989 <xsl:with-param name="dir" select="@dir"/>
990 </xsl:apply-templates>
991 <xsl:if test="not(position()=last())">
992 <xsl:text>,
993 </xsl:text>
994 <xsl:value-of select="$methodindent"/>
995 </xsl:if>
996 </xsl:for-each>
997 <xsl:text>);
998 }
999 catch (HRESULT hrc2)
1000 {
1001 hrc = hrc2;
1002 }
1003 catch (...)
1004 {
1005 hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
1006 }
1007
1008 LogRelFlow(("{%p} %s: leave</xsl:text>
1009 <xsl:for-each select="param">
1010 <xsl:if test="@dir!='in'">
1011 <xsl:text> </xsl:text>
1012 <xsl:apply-templates select="@type" mode="logparamtext">
1013 <xsl:with-param name="dir" select="@dir"/>
1014 </xsl:apply-templates>
1015 </xsl:if>
1016 </xsl:for-each>
1017 <xsl:text> hrc=%Rhrc\n", this</xsl:text>
1018 <xsl:value-of select="concat(', &quot;', $topclass, '::', @name, '&quot;')"/>
1019 <xsl:for-each select="param">
1020 <xsl:if test="@dir!='in'">
1021 <xsl:text>, </xsl:text>
1022 <xsl:apply-templates select="@type" mode="logparamval">
1023 <xsl:with-param name="dir" select="@dir"/>
1024 </xsl:apply-templates>
1025 </xsl:if>
1026 </xsl:for-each>
1027 <xsl:text>, hrc));
1028 return hrc;
1029}
1030
1031</xsl:text>
1032</xsl:template>
1033
1034<!-- - - - - - - - - - - - - - - - - - - - - - -
1035 emit all methods of an interface
1036 - - - - - - - - - - - - - - - - - - - - - - -->
1037<xsl:template name="emitMethods">
1038 <xsl:param name="iface"/>
1039 <xsl:param name="topclass"/>
1040 <xsl:param name="pmode"/>
1041
1042 <!-- first recurse to emit all base interfaces -->
1043 <xsl:variable name="extends" select="$iface/@extends"/>
1044 <xsl:if test="$extends and not($extends='$unknown') and not($extends='$dispatched') and not($extends='$errorinfo')">
1045 <xsl:call-template name="emitMethods">
1046 <xsl:with-param name="iface" select="//interface[@name=$extends]"/>
1047 <xsl:with-param name="topclass" select="$topclass"/>
1048 <xsl:with-param name="pmode" select="$pmode"/>
1049 </xsl:call-template>
1050 </xsl:if>
1051
1052 <xsl:choose>
1053 <xsl:when test="$pmode='code'">
1054 <xsl:text>//
1055</xsl:text>
1056 <xsl:value-of select="concat('// ', $iface/@name, ' methods')"/>
1057 <xsl:text>
1058//
1059
1060</xsl:text>
1061 </xsl:when>
1062 <xsl:otherwise>
1063 <xsl:value-of select="concat('&#10; // ', $pmode, ' ', $iface/@name, ' methods&#10;')"/>
1064 </xsl:otherwise>
1065 </xsl:choose>
1066 <xsl:choose>
1067 <xsl:when test="$pmode='public'">
1068 <xsl:apply-templates select="$iface/method" mode="public"/>
1069 </xsl:when>
1070 <xsl:when test="$pmode='wrapped'">
1071 <xsl:apply-templates select="$iface/method" mode="wrapped"/>
1072 </xsl:when>
1073 <xsl:when test="$pmode='code'">
1074 <xsl:apply-templates select="$iface/method" mode="code">
1075 <xsl:with-param name="topclass" select="$topclass"/>
1076 </xsl:apply-templates>
1077 </xsl:when>
1078 <xsl:otherwise/>
1079 </xsl:choose>
1080</xsl:template>
1081
1082<!-- - - - - - - - - - - - - - - - - - - - - - -
1083 emit all attributes and methods declarations of an interface
1084 - - - - - - - - - - - - - - - - - - - - - - -->
1085<xsl:template name="emitInterfaceDecls">
1086 <xsl:param name="iface"/>
1087 <xsl:param name="pmode"/>
1088
1089 <!-- attributes -->
1090 <xsl:call-template name="emitAttributes">
1091 <xsl:with-param name="iface" select="$iface"/>
1092 <xsl:with-param name="pmode" select="$pmode"/>
1093 </xsl:call-template>
1094
1095 <!-- methods -->
1096 <xsl:call-template name="emitMethods">
1097 <xsl:with-param name="iface" select="$iface"/>
1098 <xsl:with-param name="pmode" select="$pmode"/>
1099 </xsl:call-template>
1100</xsl:template>
1101
1102<!-- - - - - - - - - - - - - - - - - - - - - - -
1103 emit auxiliary method declarations of an interface
1104 - - - - - - - - - - - - - - - - - - - - - - -->
1105<xsl:template name="emitAuxMethodDecls">
1106 <xsl:param name="iface"/>
1107 <!-- currently nothing, maybe later some generic FinalConstruct/... helper declaration for ComObjPtr -->
1108</xsl:template>
1109
1110<!-- - - - - - - - - - - - - - - - - - - - - - -
1111 emit the header file of an interface
1112 - - - - - - - - - - - - - - - - - - - - - - -->
1113<xsl:template name="emitHeader">
1114 <xsl:param name="iface"/>
1115
1116 <xsl:variable name="filename" select="concat(substring(@name, 2), 'Wrap.h')"/>
1117
1118 <xsl:choose>
1119 <xsl:when test="$filelistonly=''">
1120 <xsl:apply-templates select="$iface" mode="startfile">
1121 <xsl:with-param name="file" select="$filename"/>
1122 </xsl:apply-templates>
1123 <xsl:call-template name="fileheader">
1124 <xsl:with-param name="name" select="$filename"/>
1125 <xsl:with-param name="class" select="substring(@name, 2)"/>
1126 <xsl:with-param name="type" select="'header'"/>
1127 </xsl:call-template>
1128 <xsl:apply-templates select="." mode="classheader"/>
1129
1130 <!-- interface attributes/methods (public) -->
1131 <xsl:call-template name="emitInterfaceDecls">
1132 <xsl:with-param name="iface" select="$iface"/>
1133 <xsl:with-param name="pmode" select="'public'"/>
1134 </xsl:call-template>
1135
1136 <!-- auxiliary methods (public) -->
1137 <xsl:call-template name="emitAuxMethodDecls">
1138 <xsl:with-param name="iface" select="$iface"/>
1139 </xsl:call-template>
1140
1141 <!-- switch to private -->
1142 <xsl:text>
1143private:</xsl:text>
1144
1145 <!-- wrapped interface attributes/methods (private) -->
1146 <xsl:call-template name="emitInterfaceDecls">
1147 <xsl:with-param name="iface" select="$iface"/>
1148 <xsl:with-param name="pmode" select="'wrapped'"/>
1149 </xsl:call-template>
1150
1151 <xsl:apply-templates select="." mode="classfooter"/>
1152 <xsl:apply-templates select="$iface" mode="endfile">
1153 <xsl:with-param name="file" select="$filename"/>
1154 </xsl:apply-templates>
1155 </xsl:when>
1156 <xsl:otherwise>
1157 <xsl:apply-templates select="$iface" mode="listfile">
1158 <xsl:with-param name="file" select="$filename"/>
1159 </xsl:apply-templates>
1160 </xsl:otherwise>
1161 </xsl:choose>
1162</xsl:template>
1163
1164<!-- - - - - - - - - - - - - - - - - - - - - - -
1165 emit all attributes and methods definitions of an interface
1166 - - - - - - - - - - - - - - - - - - - - - - -->
1167<xsl:template name="emitInterfaceDefs">
1168 <xsl:param name="iface"/>
1169
1170 <xsl:value-of select="concat('DEFINE_EMPTY_CTOR_DTOR(', substring($iface/@name, 2), 'Wrap)&#10;&#10;')"/>
1171
1172 <!-- attributes -->
1173 <xsl:call-template name="emitAttributes">
1174 <xsl:with-param name="iface" select="$iface"/>
1175 <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/>
1176 <xsl:with-param name="pmode" select="'code'"/>
1177 </xsl:call-template>
1178
1179 <!-- methods -->
1180 <xsl:call-template name="emitMethods">
1181 <xsl:with-param name="iface" select="$iface"/>
1182 <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/>
1183 <xsl:with-param name="pmode" select="'code'"/>
1184 </xsl:call-template>
1185</xsl:template>
1186
1187<!-- - - - - - - - - - - - - - - - - - - - - - -
1188 emit auxiliary method declarations of an interface
1189 - - - - - - - - - - - - - - - - - - - - - - -->
1190<xsl:template name="emitAuxMethodDefs">
1191 <xsl:param name="iface"/>
1192 <!-- currently nothing, maybe later some generic FinalConstruct/... implementation -->
1193</xsl:template>
1194
1195
1196<!-- - - - - - - - - - - - - - - - - - - - - - -
1197 emit the code file of an interface
1198 - - - - - - - - - - - - - - - - - - - - - - -->
1199<xsl:template name="emitCode">
1200 <xsl:param name="iface"/>
1201
1202 <xsl:variable name="filename" select="concat(substring(@name, 2), 'Wrap.cpp')"/>
1203
1204 <xsl:choose>
1205 <xsl:when test="$filelistonly=''">
1206 <xsl:apply-templates select="$iface" mode="startfile">
1207 <xsl:with-param name="file" select="$filename"/>
1208 </xsl:apply-templates>
1209 <xsl:call-template name="fileheader">
1210 <xsl:with-param name="name" select="$filename"/>
1211 <xsl:with-param name="class" select="substring(@name, 2)"/>
1212 <xsl:with-param name="type" select="'code'"/>
1213 </xsl:call-template>
1214 <xsl:apply-templates select="." mode="codeheader"/>
1215
1216 <!-- @todo special thread logging for API methods returning IProgress??? would be very usefulcurrently nothing, maybe later some generic FinalConstruct/... implementation -->
1217
1218 <!-- interface attributes/methods (public) -->
1219 <xsl:call-template name="emitInterfaceDefs">
1220 <xsl:with-param name="iface" select="$iface"/>
1221 </xsl:call-template>
1222
1223 <!-- auxiliary methods (public) -->
1224 <xsl:call-template name="emitAuxMethodDefs">
1225 <xsl:with-param name="iface" select="$iface"/>
1226 </xsl:call-template>
1227
1228 <xsl:apply-templates select="." mode="codefooter"/>
1229 <xsl:apply-templates select="$iface" mode="endfile">
1230 <xsl:with-param name="file" select="$filename"/>
1231 </xsl:apply-templates>
1232 </xsl:when>
1233 <xsl:otherwise>
1234 <xsl:apply-templates select="$iface" mode="listfile">
1235 <xsl:with-param name="file" select="$filename"/>
1236 </xsl:apply-templates>
1237 </xsl:otherwise>
1238 </xsl:choose>
1239</xsl:template>
1240
1241
1242<!-- - - - - - - - - - - - - - - - - - - - - - -
1243 wildcard match, ignore everything which has no explicit match
1244 - - - - - - - - - - - - - - - - - - - - - - -->
1245
1246<xsl:template match="*"/>
1247
1248<!-- - - - - - - - - - - - - - - - - - - - - - -
1249 ignore all if tags except those for XPIDL or MIDL target
1250 - - - - - - - - - - - - - - - - - - - - - - -->
1251
1252<xsl:template match="if">
1253 <xsl:if test="(@target = 'xpidl') or (@target = 'midl')">
1254 <xsl:apply-templates/>
1255 </xsl:if>
1256</xsl:template>
1257
1258<!-- - - - - - - - - - - - - - - - - - - - - - -
1259 library match
1260 - - - - - - - - - - - - - - - - - - - - - - -->
1261
1262<xsl:template match="interface">
1263 <xsl:if test="not(@supportsErrorInfo='no')">
1264 <xsl:call-template name="emitHeader">
1265 <xsl:with-param name="iface" select="."/>
1266 </xsl:call-template>
1267
1268 <xsl:call-template name="emitCode">
1269 <xsl:with-param name="iface" select="."/>
1270 </xsl:call-template>
1271 </xsl:if>
1272</xsl:template>
1273
1274<!-- - - - - - - - - - - - - - - - - - - - - - -
1275 library match
1276 - - - - - - - - - - - - - - - - - - - - - - -->
1277
1278<xsl:template match="library">
1279 <xsl:apply-templates/>
1280</xsl:template>
1281
1282<!-- - - - - - - - - - - - - - - - - - - - - - -
1283 root match
1284 - - - - - - - - - - - - - - - - - - - - - - -->
1285
1286<xsl:template match="/idl">
1287 <xsl:choose>
1288 <xsl:when test="$filelistonly=''">
1289 </xsl:when>
1290 <xsl:otherwise>
1291 <xsl:value-of select="concat($filelistonly, ' := \&#10;')"/>
1292 </xsl:otherwise>
1293 </xsl:choose>
1294 <xsl:apply-templates/>
1295 <xsl:choose>
1296 <xsl:when test="$filelistonly=''">
1297 </xsl:when>
1298 <xsl:otherwise>
1299 <xsl:text>
1300</xsl:text>
1301 </xsl:otherwise>
1302 </xsl:choose>
1303</xsl:template>
1304
1305</xsl:stylesheet>
1306<!-- 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