VirtualBox

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

Last change on this file since 49660 was 49660, checked in by vboxsync, 11 years ago

Main/idl/apiwrap-server.xsl: add forgotten marshaller interface to the COM map of every wrapper class, which is needed to solve threading model trouble

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